[fix] ooba autosuggest

This commit is contained in:
aegkmq
2023-08-03 14:17:51 +09:00
parent 61fb8a0b15
commit d6f4dc48fb
2 changed files with 7 additions and 7 deletions

View File

@@ -77,14 +77,14 @@
if($DataBase.subModel === "textgen_webui"){ if($DataBase.subModel === "textgen_webui"){
promptbody = [ promptbody = [
...lastMessages.map(({ role, data }) => ({
role: role === "user" ? "user" as const : "assistant" as const,
content: data,
})),
{ {
role: 'system', role: 'system',
content: replacePlaceholders($DataBase.autoSuggestPrompt, currentChar.name) content: replacePlaceholders($DataBase.autoSuggestPrompt, currentChar.name)
}, },
...lastMessages.map(({ role, data }) => ({
role: role === "user" ? "user" as const : "assistant" as const,
content: data,
})),
] ]
} }

View File

@@ -47,11 +47,11 @@ export function stringlizeChatOba(formated:OpenAIChat[], characterName:string=''
let prefix = "" let prefix = ""
let name = "" let name = ""
if(form.role === 'user'){ if(form.role === 'user'){
prefix = appendWhitespace(userPrefix, seperator) prefix = appendWhitespace(suggesting ? assistantPrefix : userPrefix, seperator)
name = `${db.username}: ` name = `${db.username}: `
} }
else if(form.role === 'assistant'){ else if(form.role === 'assistant'){
prefix = appendWhitespace(assistantPrefix, seperator) prefix = appendWhitespace(suggesting ? userPrefix : assistantPrefix, seperator)
name = `${characterName}: ` name = `${characterName}: `
} }
else if(form.role === 'system'){ else if(form.role === 'system'){
@@ -60,7 +60,7 @@ export function stringlizeChatOba(formated:OpenAIChat[], characterName:string=''
resultString.push(prefix + name + form.content) resultString.push(prefix + name + form.content)
} }
if (suggesting){ if (suggesting){
resultString.push(appendWhitespace(assistantPrefix, seperator) + "\n" + db.autoSuggestPrefix) resultString.push(appendWhitespace(assistantPrefix, seperator) + `${db.username}:\n` + db.autoSuggestPrefix)
} else { } else {
resultString.push(assistantPrefix + `${characterName}:`) resultString.push(assistantPrefix + `${characterName}:`)
} }