Fix quiet prompt functionality after rebasing

This commit is contained in:
maver 2023-06-01 19:10:18 +02:00
parent 6e1bb65437
commit 42544e9d26
1 changed files with 14 additions and 0 deletions

View File

@ -390,13 +390,25 @@ async function prepareOpenAIMessages({ systemPrompt, name2, storyString, worldIn
chatCompletion.insertAfter('newMainChat', 'groupNudgeMessage', groupNudgeMessage); chatCompletion.insertAfter('newMainChat', 'groupNudgeMessage', groupNudgeMessage);
} }
// Handle enhanced definitions
if (oai_settings.enhance_definitions) chatCompletion.insertAfter('characterInfo', 'enhancedDefinitions', enhanceDefinitionMessage); if (oai_settings.enhance_definitions) chatCompletion.insertAfter('characterInfo', 'enhancedDefinitions', enhanceDefinitionMessage);
// Handle extension prompt
if (extensionPrompt) chatCompletion.insertAfter('worldInfoAfter', 'extensionPrompt', extensionPrompt); if (extensionPrompt) chatCompletion.insertAfter('worldInfoAfter', 'extensionPrompt', extensionPrompt);
// Handle bias settings
if (bias && bias.trim().length) chatCompletion.add(biasMessage); if (bias && bias.trim().length) chatCompletion.add(biasMessage);
// Handle chat examples
const exampleMessages = prepareExampleMessages(openai_msgs ,openai_msgs_example, power_user.pin_examples); const exampleMessages = prepareExampleMessages(openai_msgs ,openai_msgs_example, power_user.pin_examples);
if (exampleMessages.length) chatCompletion.replace('dialogueExamples', exampleMessages); if (exampleMessages.length) chatCompletion.replace('dialogueExamples', exampleMessages);
// Handle quiet prompt
if (quietPrompt) {
const quietPromptMessage = chatCompletion.makeSystemMessage(quietPrompt);
chatCompletion.insertAfter('main', quietPromptMessage)
}
// Handle impersonation // Handle impersonation
if (type === "impersonate") { if (type === "impersonate") {
chatCompletion.insertBefore('chatHistory', 'impersonate', substituteParams(oai_settings.impersonation_prompt)); chatCompletion.insertBefore('chatHistory', 'impersonate', substituteParams(oai_settings.impersonation_prompt));
@ -415,6 +427,8 @@ async function prepareOpenAIMessages({ systemPrompt, name2, storyString, worldIn
console.log("We're sending this:") console.log("We're sending this:")
console.log(openai_msgs_tosend); console.log(openai_msgs_tosend);
// Integrate const handler_instance = new TokenHandler(countTokens);
return openai_msgs_tosend; return openai_msgs_tosend;
}); });
} }