Add DeveloperRole flag and update role handling in OpenAIChatExtra
This commit is contained in:
@@ -15,7 +15,8 @@ export enum LLMFlags{
|
||||
mustStartWithUserInput,
|
||||
poolSupported,
|
||||
hasVideoInput,
|
||||
OAICompletionTokens
|
||||
OAICompletionTokens,
|
||||
DeveloperRole
|
||||
}
|
||||
|
||||
export enum LLMProvider{
|
||||
@@ -451,7 +452,8 @@ export const LLMModels: LLMModel[] = [
|
||||
LLMFlags.hasStreaming,
|
||||
LLMFlags.OAICompletionTokens,
|
||||
LLMFlags.hasFullSystemPrompt,
|
||||
LLMFlags.hasImageInput
|
||||
LLMFlags.hasImageInput,
|
||||
LLMFlags.DeveloperRole
|
||||
],
|
||||
parameters: OpenAIParameters,
|
||||
tokenizer: LLMTokenizer.tiktokenO200Base
|
||||
|
||||
@@ -237,7 +237,7 @@ interface OpenAIImageContents {
|
||||
type OpenAIContents = OpenAITextContents|OpenAIImageContents
|
||||
|
||||
export interface OpenAIChatExtra {
|
||||
role: 'system'|'user'|'assistant'|'function'
|
||||
role: 'system'|'user'|'assistant'|'function'|'developer'
|
||||
content: string|OpenAIContents[]
|
||||
memo?:string
|
||||
name?:string
|
||||
@@ -555,6 +555,17 @@ async function requestOpenAI(arg:RequestDataArgumentExtended):Promise<requestDat
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(arg.modelInfo.flags.includes(LLMFlags.DeveloperRole)){
|
||||
reformatedChat = reformatedChat.map((v) => {
|
||||
if(v.role === 'system'){
|
||||
return {
|
||||
...v,
|
||||
role: 'developer'
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const res = await globalFetch(arg.customURL ?? "https://api.mistral.ai/v1/chat/completions", {
|
||||
body: applyParameters({
|
||||
|
||||
Reference in New Issue
Block a user