Generate: Fix prompt bias addition

If the bias is empty, don't add it.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri 2023-08-21 16:52:58 -04:00
parent 60faaf1831
commit ecfe8a722f
1 changed files with 6 additions and 4 deletions

View File

@ -2922,13 +2922,15 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
// Add prompt bias after everything else
// Always run with continue
if (!isInstruct && !isImpersonate && (tokens_already_generated === 0 || isContinue)) {
const trimmedBias = promptBias.trimStart();
finalMesSend[finalMesSend.length - 1] +=
if (promptBias.trim().length !== 0) {
finalMesSend[finalMesSend.length - 1] +=
/\s/.test(finalMesSend[finalMesSend.length - 1].slice(-1))
? trimmedBias
: ` ${trimmedBias}`;
? promptBias.trimStart()
: ` ${promptBias.trimStart()}`;
}
}
// Prune from prompt cache if it exists
if (generatedPromtCache.length !== 0) {
generatedPromtCache = cleanupPromptCache(generatedPromtCache);