mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-03 04:37:40 +01:00
Let oai prompt manager handle enhanced definitions
This commit is contained in:
parent
5996697fce
commit
a041230a99
@ -1284,17 +1284,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="range-block">
|
<div class="range-block">
|
||||||
<label title="Use OAI knowledge base to enhance definitions for public figures and known fictional characters" data-i18n="[title]Use OAI knowledge base to enhance definitions for public figures and known fictional characters" class="checkbox_label widthFreeExpand">
|
<label for="wrap_in_quotes" title="Wrap user messages in quotes before sending" class="checkbox_label widthFreeExpand">
|
||||||
<input id="enhance_definitions" type="checkbox" /><span data-i18n="Enhance Definitions">
|
|
||||||
Enhance Definitions</span>
|
|
||||||
</label>
|
|
||||||
<div class="toggle-description justifyLeft" data-i18n="Use OAI knowledge base to enhance definitions for public figures and known fictional characters">
|
|
||||||
Use OAI knowledge base to enhance definitions for public figures and known
|
|
||||||
fictional characters
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="range-block">
|
|
||||||
<label for="wrap_in_quotes" title="Wrap user messages in quotes before sending" data-i18n="[title]Wrap user messages in quotes before sending" class="checkbox_label widthFreeExpand">
|
|
||||||
<input id="wrap_in_quotes" type="checkbox" /><span data-i18n="Wrap in Quotes">
|
<input id="wrap_in_quotes" type="checkbox" /><span data-i18n="Wrap in Quotes">
|
||||||
Wrap in Quotes</span>
|
Wrap in Quotes</span>
|
||||||
</label>
|
</label>
|
||||||
|
@ -726,6 +726,15 @@ const openAiDefaultPrompts = {
|
|||||||
"system_prompt": true,
|
"system_prompt": true,
|
||||||
"marker": true,
|
"marker": true,
|
||||||
"calculated_tokens": 0
|
"calculated_tokens": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identifier": "enhanceDefinitions",
|
||||||
|
"role": "system",
|
||||||
|
"name": "Enhance Definitions",
|
||||||
|
"content": "If you have more knowledge of {{char}}, add to the character\'s lore and personality to enhance them but keep the Character Sheet\'s definitions absolute.",
|
||||||
|
"system_prompt": true,
|
||||||
|
"marker": false,
|
||||||
|
"calculated_tokens": 0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
@ -751,6 +760,10 @@ const openAiDefaultPromptLists = {
|
|||||||
"identifier": "main",
|
"identifier": "main",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"identifier": "enhanceDefinitions",
|
||||||
|
"enabled": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"identifier": "worldInfoAfter",
|
"identifier": "worldInfoAfter",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
|
@ -125,7 +125,6 @@ const default_settings = {
|
|||||||
stream_openai: false,
|
stream_openai: false,
|
||||||
openai_max_context: max_4k,
|
openai_max_context: max_4k,
|
||||||
openai_max_tokens: 300,
|
openai_max_tokens: 300,
|
||||||
enhance_definitions: false,
|
|
||||||
wrap_in_quotes: false,
|
wrap_in_quotes: false,
|
||||||
...openAiDefaultPrompts,
|
...openAiDefaultPrompts,
|
||||||
...openAiDefaultPromptLists,
|
...openAiDefaultPromptLists,
|
||||||
@ -160,7 +159,6 @@ const oai_settings = {
|
|||||||
stream_openai: false,
|
stream_openai: false,
|
||||||
openai_max_context: max_4k,
|
openai_max_context: max_4k,
|
||||||
openai_max_tokens: 300,
|
openai_max_tokens: 300,
|
||||||
enhance_definitions: false,
|
|
||||||
wrap_in_quotes: false,
|
wrap_in_quotes: false,
|
||||||
...openAiDefaultPrompts,
|
...openAiDefaultPrompts,
|
||||||
...openAiDefaultPromptLists,
|
...openAiDefaultPromptLists,
|
||||||
@ -364,7 +362,6 @@ async function prepareOpenAIMessages({ systemPrompt, name2, storyString, worldIn
|
|||||||
const chatCompletion = promptManager.getChatCompletion();
|
const chatCompletion = promptManager.getChatCompletion();
|
||||||
|
|
||||||
// Prepare messages
|
// Prepare messages
|
||||||
const enhanceDefinitionMessage = chatCompletion.makeSystemMessage(substituteParams('If you have more knowledge of {{char}}, add to the character\'s lore and personality to enhance them but keep the Character Sheet\'s definitions absolute.'));
|
|
||||||
const worldInfoBeforeMessage = chatCompletion.makeSystemMessage(formatWorldInfo(worldInfoBefore));
|
const worldInfoBeforeMessage = chatCompletion.makeSystemMessage(formatWorldInfo(worldInfoBefore));
|
||||||
const worldInfoAfterMessage = chatCompletion.makeSystemMessage(formatWorldInfo(worldInfoAfter));
|
const worldInfoAfterMessage = chatCompletion.makeSystemMessage(formatWorldInfo(worldInfoAfter));
|
||||||
const characterInfoMessages = chatCompletion.makeSystemMessage(substituteParams(storyString));
|
const characterInfoMessages = chatCompletion.makeSystemMessage(substituteParams(storyString));
|
||||||
@ -390,9 +387,6 @@ 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);
|
|
||||||
|
|
||||||
// Handle extension prompt
|
// Handle extension prompt
|
||||||
if (extensionPrompt) chatCompletion.insertAfter('worldInfoAfter', 'extensionPrompt', extensionPrompt);
|
if (extensionPrompt) chatCompletion.insertAfter('worldInfoAfter', 'extensionPrompt', extensionPrompt);
|
||||||
|
|
||||||
@ -1143,7 +1137,6 @@ function loadOpenAISettings(data, settings) {
|
|||||||
|
|
||||||
if (settings.nsfw_toggle !== undefined) oai_settings.nsfw_toggle = !!settings.nsfw_toggle;
|
if (settings.nsfw_toggle !== undefined) oai_settings.nsfw_toggle = !!settings.nsfw_toggle;
|
||||||
if (settings.keep_example_dialogue !== undefined) oai_settings.keep_example_dialogue = !!settings.keep_example_dialogue;
|
if (settings.keep_example_dialogue !== undefined) oai_settings.keep_example_dialogue = !!settings.keep_example_dialogue;
|
||||||
if (settings.enhance_definitions !== undefined) oai_settings.enhance_definitions = !!settings.enhance_definitions;
|
|
||||||
if (settings.wrap_in_quotes !== undefined) oai_settings.wrap_in_quotes = !!settings.wrap_in_quotes;
|
if (settings.wrap_in_quotes !== undefined) oai_settings.wrap_in_quotes = !!settings.wrap_in_quotes;
|
||||||
if (settings.nsfw_first !== undefined) oai_settings.nsfw_first = !!settings.nsfw_first;
|
if (settings.nsfw_first !== undefined) oai_settings.nsfw_first = !!settings.nsfw_first;
|
||||||
if (settings.openai_model !== undefined) oai_settings.openai_model = settings.openai_model;
|
if (settings.openai_model !== undefined) oai_settings.openai_model = settings.openai_model;
|
||||||
@ -1168,7 +1161,6 @@ function loadOpenAISettings(data, settings) {
|
|||||||
|
|
||||||
$('#nsfw_toggle').prop('checked', oai_settings.nsfw_toggle);
|
$('#nsfw_toggle').prop('checked', oai_settings.nsfw_toggle);
|
||||||
$('#keep_example_dialogue').prop('checked', oai_settings.keep_example_dialogue);
|
$('#keep_example_dialogue').prop('checked', oai_settings.keep_example_dialogue);
|
||||||
$('#enhance_definitions').prop('checked', oai_settings.enhance_definitions);
|
|
||||||
$('#wrap_in_quotes').prop('checked', oai_settings.wrap_in_quotes);
|
$('#wrap_in_quotes').prop('checked', oai_settings.wrap_in_quotes);
|
||||||
$('#nsfw_first').prop('checked', oai_settings.nsfw_first);
|
$('#nsfw_first').prop('checked', oai_settings.nsfw_first);
|
||||||
$('#jailbreak_system').prop('checked', oai_settings.jailbreak_system);
|
$('#jailbreak_system').prop('checked', oai_settings.jailbreak_system);
|
||||||
@ -1336,7 +1328,6 @@ async function saveOpenAIPreset(name, settings) {
|
|||||||
openai_max_context: settings.openai_max_context,
|
openai_max_context: settings.openai_max_context,
|
||||||
openai_max_tokens: settings.openai_max_tokens,
|
openai_max_tokens: settings.openai_max_tokens,
|
||||||
nsfw_toggle: settings.nsfw_toggle,
|
nsfw_toggle: settings.nsfw_toggle,
|
||||||
enhance_definitions: settings.enhance_definitions,
|
|
||||||
wrap_in_quotes: settings.wrap_in_quotes,
|
wrap_in_quotes: settings.wrap_in_quotes,
|
||||||
send_if_empty: settings.send_if_empty,
|
send_if_empty: settings.send_if_empty,
|
||||||
nsfw_first: settings.nsfw_first,
|
nsfw_first: settings.nsfw_first,
|
||||||
@ -1671,7 +1662,6 @@ function onSettingsPresetChange() {
|
|||||||
openai_max_context: ['#openai_max_context', 'openai_max_context', false],
|
openai_max_context: ['#openai_max_context', 'openai_max_context', false],
|
||||||
openai_max_tokens: ['#openai_max_tokens', 'openai_max_tokens', false],
|
openai_max_tokens: ['#openai_max_tokens', 'openai_max_tokens', false],
|
||||||
nsfw_toggle: ['#nsfw_toggle', 'nsfw_toggle', true],
|
nsfw_toggle: ['#nsfw_toggle', 'nsfw_toggle', true],
|
||||||
enhance_definitions: ['#enhance_definitions', 'enhance_definitions', true],
|
|
||||||
wrap_in_quotes: ['#wrap_in_quotes', 'wrap_in_quotes', true],
|
wrap_in_quotes: ['#wrap_in_quotes', 'wrap_in_quotes', true],
|
||||||
send_if_empty: ['#send_if_empty_textarea', 'send_if_empty', false],
|
send_if_empty: ['#send_if_empty_textarea', 'send_if_empty', false],
|
||||||
jailbreak_system: ['#jailbreak_system', 'jailbreak_system', true],
|
jailbreak_system: ['#jailbreak_system', 'jailbreak_system', true],
|
||||||
@ -2083,11 +2073,6 @@ $(document).ready(function () {
|
|||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#enhance_definitions').on('change', function () {
|
|
||||||
oai_settings.enhance_definitions = !!$('#enhance_definitions').prop('checked');
|
|
||||||
saveSettingsDebounced();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#wrap_in_quotes').on('change', function () {
|
$('#wrap_in_quotes').on('change', function () {
|
||||||
oai_settings.wrap_in_quotes = !!$('#wrap_in_quotes').prop('checked');
|
oai_settings.wrap_in_quotes = !!$('#wrap_in_quotes').prop('checked');
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user