mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Respect impersonate option
This commit is contained in:
@ -400,7 +400,16 @@ async function prepareOpenAIMessages({
|
|||||||
addMessageToChatCompletion('system', `${name2}'s personality: ${substituteParams(charPersonality)}`, 'charPersonality');
|
addMessageToChatCompletion('system', `${name2}'s personality: ${substituteParams(charPersonality)}`, 'charPersonality');
|
||||||
addMessageToChatCompletion('system', `Circumstances and context of the dialogue: ${substituteParams(Scenario)}`, 'scenario');
|
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
|
const userPrompts = prompts.collection
|
||||||
.filter((prompt) => false === prompt.system_prompt)
|
.filter((prompt) => false === prompt.system_prompt)
|
||||||
.reduce((acc, prompt) => {
|
.reduce((acc, prompt) => {
|
||||||
@ -408,8 +417,7 @@ async function prepareOpenAIMessages({
|
|||||||
return acc;
|
return acc;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Add optional prompts if they exist
|
[...systemPrompts, ...userPrompts].forEach(identifier => {
|
||||||
[...optionalSystemPrompts, ...userPrompts].forEach(identifier => {
|
|
||||||
if (prompts.has(identifier)) {
|
if (prompts.has(identifier)) {
|
||||||
chatCompletion.add(MessageCollection.fromPrompt(prompts.get(identifier)), prompts.index(identifier));
|
chatCompletion.add(MessageCollection.fromPrompt(prompts.get(identifier)), prompts.index(identifier));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user