[fix] oobabooga prompt template and autosuggest (#226)

# PR Checklist
- [x] Did you check if it works normally in all models? *ignore this
when it dosen't uses models*
- [x] Did you check if it works normally in all of web, local and node
hosted versions? if it dosen't, did you blocked it in those versions?
- [x] Did you added a type def?

# Description
The changes in #225 didn't seem to be enough, so I made an additional
fix.
This commit is contained in:
kwaroran
2023-08-04 11:42:43 +09:00
committed by GitHub
8 changed files with 39 additions and 28 deletions

View File

@@ -400,7 +400,11 @@
{/if}
{#if $DataBase.useAutoSuggestions}
<Suggestion messageInput={(msg)=>messageInput=msg} {send}/>
<Suggestion messageInput={(msg)=>messageInput=(
$DataBase.subModel === "textgen_webui" && $DataBase.autoSuggestClean
? msg.replace(/ +\(.+?\) *$| - [^"'*]*?$/, '')
: msg
)} {send}/>
{/if}
{#each messageForm($DataBase.characters[$selectedCharID].chats[$DataBase.characters[$selectedCharID].chatPage].message, loadPages) as chat, i}

View File

@@ -81,12 +81,10 @@
role: 'system',
content: replacePlaceholders($DataBase.autoSuggestPrompt, currentChar.name)
},
{
role: 'user',
content: lastMessages.map(({ role, data }) => `${
role === 'char' ? currentChar.name : $DataBase.username
}: ${data}`).join("\n\n") + `\n\n${$DataBase.username}:`
},
...lastMessages.map(({ role, data }) => ({
role: role === "user" ? "user" as const : "assistant" as const,
content: data,
})),
]
}

View File

@@ -306,6 +306,8 @@
<span class="text-textcolor">{language.autoSuggest} Prefix</span>
<TextInput marginBottom={true} bind:value={$DataBase.autoSuggestPrefix} />
<Check bind:check={$DataBase.autoSuggestClean} name={`${language.autoSuggest} suffix removal`}/>
{:else if $DataBase.aiModel.startsWith('novelai')}
<span class="text-textcolor">Top P</span>
<SliderInput min={0} max={1} step={0.01} bind:value={$DataBase.NAIsettings.topP}/>