Merge branch 'kwaroran:main' into main

This commit is contained in:
HyperBlaze
2024-12-20 23:36:41 -08:00
committed by GitHub
39 changed files with 1655 additions and 315 deletions

View File

@@ -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