[feat] added ooba

This commit is contained in:
kwaroran
2023-07-09 21:13:47 +09:00
parent 5f8be5a06c
commit 3564190235
4 changed files with 165 additions and 18 deletions

View File

@@ -24,7 +24,26 @@ export function stringlizeChat(formated:OpenAIChat[], char:string = ''){
}
export function stringlizeChatOba(formated:OpenAIChat[], char:string = ''){
const db = get(DataBase)
let resultString:string[] = []
if(db.ooba.formating.custom){
for(const form of formated){
if(form.role === 'system'){
resultString.push(form.content)
}
else if(form.name){
resultString.push(db.ooba.formating.userPrefix + form.content + db.ooba.formating.seperator)
}
else if(form.role === 'assistant' && char){
resultString.push(db.ooba.formating.assistantPrefix + form.content + db.ooba.formating.seperator)
}
else{
resultString.push(form.content)
}
}
return resultString.join('\n\n') + `\n\n${db.ooba.formating.assistantPrefix}:`
}
for(const form of formated){
if(form.role === 'system'){
resultString.push(form.content)