Respect impersonate option

This commit is contained in:
maver 2023-06-15 18:09:55 +02:00
parent edba17c96e
commit 37c7a82aba
1 changed files with 11 additions and 3 deletions

View File

@ -400,7 +400,16 @@ async function prepareOpenAIMessages({
addMessageToChatCompletion('system', `${name2}'s personality: ${substituteParams(charPersonality)}`, 'charPersonality');
addMessageToChatCompletion('system', `Circumstances and context of the dialogue: ${substituteParams(Scenario)}`, 'scenario');
const optionalSystemPrompts = ['nsfw', 'jailbreak'];
// Add main prompt
if (type === "impersonate") {
const impersonate = substituteParams(oai_settings.impersonation_prompt);
addMessageToChatCompletion('system', impersonate, 'main');
} else {
addMessageToChatCompletion('system', prompts.get('main').content, 'main');
}
// Add managed system and user prompts
const systemPrompts = ['nsfw', 'jailbreak'];
const userPrompts = prompts.collection
.filter((prompt) => false === prompt.system_prompt)
.reduce((acc, prompt) => {
@ -408,8 +417,7 @@ async function prepareOpenAIMessages({
return acc;
}, []);
// Add optional prompts if they exist
[...optionalSystemPrompts, ...userPrompts].forEach(identifier => {
[...systemPrompts, ...userPrompts].forEach(identifier => {
if (prompts.has(identifier)) {
chatCompletion.add(MessageCollection.fromPrompt(prompts.get(identifier)), prompts.index(identifier));
}