Merge branch 'kwaroran:main' into main
This commit is contained in:
@@ -30,6 +30,7 @@ import { hypaMemoryV2 } from "./memory/hypav2";
|
||||
import { runLuaEditTrigger } from "./lua";
|
||||
import { parseChatML } from "../parser.svelte";
|
||||
import { getModelInfo, LLMFlags } from "../model/modellist";
|
||||
import { pluginV2 } from "../plugins/plugins";
|
||||
|
||||
export interface OpenAIChat{
|
||||
role: 'system'|'user'|'assistant'|'function'
|
||||
@@ -39,6 +40,7 @@ export interface OpenAIChat{
|
||||
removable?:boolean
|
||||
attr?:string[]
|
||||
multimodals?: MultiModal[]
|
||||
thoughts?: string[]
|
||||
}
|
||||
|
||||
export interface MultiModal{
|
||||
@@ -752,19 +754,19 @@ export async function sendChat(chatProcessIndex = -1,arg:{
|
||||
break
|
||||
}
|
||||
}
|
||||
if(usingPromptTemplate && DBState.db.promptSettings.maxThoughtTagDepth !== -1){
|
||||
const depth = ms.length - index
|
||||
if(depth >= DBState.db.promptSettings.maxThoughtTagDepth){
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user