[feat] better stringlizer

This commit is contained in:
kwaroran
2023-05-24 02:39:56 +09:00
parent 53ca05652d
commit 3f4baac593
3 changed files with 20 additions and 13 deletions

View File

@@ -8,13 +8,10 @@ export function stringlizeChat(formated:OpenAIChat[], char:string = ''){
let resultString:string[] = []
for(const form of formated){
if(form.role === 'system'){
resultString.push("'System Note: " + form.content)
resultString.push("system note: " + form.content)
}
else if(form.role === 'user'){
resultString.push("user: " + form.content)
}
else if(form.role === 'assistant'){
resultString.push("assistant: " + form.content)
else{
resultString.push(form.name + ": " + form.content)
}
}
return resultString.join('\n\n') + `\n\n${char}:`