Add group nudge to prompts array

This commit is contained in:
maver 2023-08-20 15:35:15 +02:00
parent 58a018deae
commit 5fee1f6f96
1 changed files with 4 additions and 8 deletions

View File

@ -710,7 +710,8 @@ function populateChatCompletion(prompts, chatCompletion, { bias, quietPrompt, ty
*/ */
function preparePromptsForChatCompletion(Scenario, charPersonality, name2, worldInfoBefore, worldInfoAfter, charDescription, quietPrompt, bias, extensionPrompts, systemPromptOverride, jailbreakPromptOverride) { function preparePromptsForChatCompletion(Scenario, charPersonality, name2, worldInfoBefore, worldInfoAfter, charDescription, quietPrompt, bias, extensionPrompts, systemPromptOverride, jailbreakPromptOverride) {
const scenarioText = Scenario ? `[Circumstances and context of the dialogue: ${Scenario}]` : ''; const scenarioText = Scenario ? `[Circumstances and context of the dialogue: ${Scenario}]` : '';
const charPersonalityText = charPersonality ? `[${name2}'s personality: ${charPersonality}]` : ''; const charPersonalityText = charPersonality ? `[${name2}'s personality: ${charPersonality}]` : ''
const groupNudge = `[Write the next reply only as ${name2}]`;
// Create entries for system prompts // Create entries for system prompts
const systemPrompts = [ const systemPrompts = [
@ -724,7 +725,8 @@ function preparePromptsForChatCompletion(Scenario, charPersonality, name2, world
{ role: 'system', content: oai_settings.nsfw_avoidance_prompt, identifier: 'nsfwAvoidance' }, { role: 'system', content: oai_settings.nsfw_avoidance_prompt, identifier: 'nsfwAvoidance' },
{ role: 'system', content: oai_settings.impersonation_prompt, identifier: 'impersonate' }, { role: 'system', content: oai_settings.impersonation_prompt, identifier: 'impersonate' },
{ role: 'system', content: quietPrompt, identifier: 'quietPrompt' }, { role: 'system', content: quietPrompt, identifier: 'quietPrompt' },
{ role: 'system', content: bias, identifier: 'bias' } { role: 'system', content: bias, identifier: 'bias' },
{ role: 'system', content: groupNudge, identifier: 'groupNudge' }
]; ];
// Tavern Extras - Summary // Tavern Extras - Summary
@ -778,12 +780,6 @@ function preparePromptsForChatCompletion(Scenario, charPersonality, name2, world
prompts.set(jbReplacement, prompts.index('jailbreak')); prompts.set(jbReplacement, prompts.index('jailbreak'));
} }
// TODO: Integrate Group nudge into the prompt manager properly
if(selected_group) {
let group_nudge = {"role": "system", "content": `[Write the next reply only as ${name2}]`};
openai_msgs.push(group_nudge);
}
// Allow subscribers to manipulate the prompts object // Allow subscribers to manipulate the prompts object
eventSource.emit(event_types.OAI_BEFORE_CHATCOMPLETION, prompts); eventSource.emit(event_types.OAI_BEFORE_CHATCOMPLETION, prompts);