Add geminiThinking flag and enhance thoughts handling in chat processing

This commit is contained in:
Kwaroran
2024-12-20 02:53:58 +09:00
parent bd14dcd038
commit 4afe32a2c2
3 changed files with 43 additions and 30 deletions

View File

@@ -39,6 +39,7 @@ export interface OpenAIChat{
removable?:boolean
attr?:string[]
multimodals?: MultiModal[]
thoughts?: string[]
}
export interface MultiModal{
@@ -752,14 +753,19 @@ export async function sendChat(chatProcessIndex = -1,arg:{
break
}
}
formatedChat = formatedChat.replace(/<Thoughts>(.+?)<\/Thoughts>/gm, '')
let thoughts:string[] = []
formatedChat = formatedChat.replace(/<Thoughts>(.+?)<\/Thoughts>/gm, (match, p1) => {
thoughts.push(p1)
return ''
})
const chat:OpenAIChat = {
role: role,
content: formatedChat,
memo: msg.chatId,
attr: attr,
multimodals: multimodal
multimodals: multimodal,
thoughts: thoughts
}
if(chat.multimodals.length === 0){
delete chat.multimodals