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