Better chat completion continue

This commit is contained in:
Cohee
2023-07-03 18:22:12 +03:00
parent 9ab7265053
commit 9e3c55805f
2 changed files with 3 additions and 2 deletions

View File

@@ -2484,6 +2484,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
type: type, type: type,
quietPrompt: quiet_prompt, quietPrompt: quiet_prompt,
jailbreakPrompt: jailbreakPrompt, jailbreakPrompt: jailbreakPrompt,
cyclePrompt: cyclePrompt,
}); });
generate_data = { prompt: prompt }; generate_data = { prompt: prompt };

View File

@@ -324,7 +324,7 @@ function formatWorldInfo(value) {
return stringFormat(oai_settings.wi_format, value); return stringFormat(oai_settings.wi_format, value);
} }
async function prepareOpenAIMessages({ systemPrompt, name2, storyString, worldInfoBefore, worldInfoAfter, extensionPrompt, bias, type, quietPrompt, jailbreakPrompt } = {}) { async function prepareOpenAIMessages({ systemPrompt, name2, storyString, worldInfoBefore, worldInfoAfter, extensionPrompt, bias, type, quietPrompt, jailbreakPrompt, cyclePrompt } = {}) {
const isImpersonate = type == "impersonate"; const isImpersonate = type == "impersonate";
let this_max_context = oai_settings.openai_max_context; let this_max_context = oai_settings.openai_max_context;
let enhance_definitions_prompt = ""; let enhance_definitions_prompt = "";
@@ -412,7 +412,7 @@ async function prepareOpenAIMessages({ systemPrompt, name2, storyString, worldIn
} }
if (type == 'continue') { if (type == 'continue') {
const continueNudge = { "role": "system", "content": '[Continue the last assistant message]' }; const continueNudge = { "role": "system", "content": stringFormat('[Continue the following message. Do not include ANY parts of the original message. Use capitalization and punctuation as if your reply is a part of the original message:\n\n{0}]', cyclePrompt || '') };
openai_msgs.push(continueNudge); openai_msgs.push(continueNudge);
total_count += handler_instance.count([continueNudge], true, 'continue'); total_count += handler_instance.count([continueNudge], true, 'continue');