fix structuredclone

This commit is contained in:
kwaroran
2024-10-25 18:11:00 +09:00
parent b3fddb814e
commit 0f6246bef6
28 changed files with 114 additions and 104 deletions

View File

@@ -34,7 +34,7 @@ export const applyChatTemplate = (messages:OpenAIChat[], arg:{
if(!type){
throw new Error('Template type is not set')
}
let clonedMessages = structuredClone(messages)
let clonedMessages = safeStructuredClone(messages)
const template = type === 'jinja' ? (new Template(arg.custom ?? db.JinjaTemplate)) :(new Template(chatTemplates[type]))
let formatedMessages:{
"role": 'user'|'assistant'|'system',