Add continue nudge to editable utility prompts
This commit is contained in:
parent
0e4ce734ad
commit
82a11316bc
|
@ -1395,6 +1395,22 @@
|
|||
<textarea id="newexamplechat_prompt_textarea" class="text_pole textarea_compact" name="new_example_chat" rows="1" placeholder=""></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block m-t-1">
|
||||
<div class="range-block-title openai_restorable">
|
||||
<span>Continue nudge</span>
|
||||
<div id="continue_nudge_prompt_restore" title="Restore new chat prompt" class="right_menu_button">
|
||||
<div class="fa-solid fa-clock-rotate-left"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="toggle-description justifyLeft">
|
||||
<span data-i18n="Set at the beginning of the chat history to indicate that a new chat is about to start.">
|
||||
Set at the end of the chat history when the continue button is pressed.
|
||||
</span>
|
||||
</div>
|
||||
<div class="wide100p">
|
||||
<textarea id="continue_nudge_prompt_textarea" class="text_pole textarea_compact" name="continue_nudge" rows="1" placeholder=""></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block m-t-1">
|
||||
<div class="range-block-title justifyLeft">
|
||||
Replace empty message
|
||||
|
|
|
@ -93,6 +93,7 @@ const default_wi_format = '[Details of the fictional world the RP is set in:\n{0
|
|||
const default_new_chat_prompt = '[Start a new Chat]';
|
||||
const default_new_group_chat_prompt = '[Start a new group chat. Group members: {{group}}]';
|
||||
const default_new_example_chat_prompt = '[Start a new Chat]';
|
||||
const default_continue_nudge_prompt = '[Continue the following message. Do not include ANY parts of the original message. Use capitalization and punctuation as if your reply is a part of the original message: {{lastChatMessage}}]';
|
||||
const default_bias = 'Default (none)';
|
||||
const default_bias_presets = {
|
||||
[default_bias]: [],
|
||||
|
@ -150,6 +151,7 @@ const default_settings = {
|
|||
new_chat_prompt: default_new_chat_prompt,
|
||||
new_group_chat_prompt: default_new_group_chat_prompt,
|
||||
new_example_chat_prompt: default_new_example_chat_prompt,
|
||||
continue_nudge_prompt: default_continue_nudge_prompt,
|
||||
bias_preset_selected: default_bias,
|
||||
bias_presets: default_bias_presets,
|
||||
wi_format: default_wi_format,
|
||||
|
@ -188,6 +190,7 @@ const oai_settings = {
|
|||
new_chat_prompt: default_new_chat_prompt,
|
||||
new_group_chat_prompt: default_new_group_chat_prompt,
|
||||
new_example_chat_prompt: default_new_example_chat_prompt,
|
||||
continue_nudge_prompt: default_continue_nudge_prompt,
|
||||
bias_preset_selected: default_bias,
|
||||
bias_presets: default_bias_presets,
|
||||
wi_format: default_wi_format,
|
||||
|
@ -406,6 +409,7 @@ function formatWorldInfo(value) {
|
|||
* @param {PromptCollection} prompts - Map object containing all prompts where the key is the prompt identifier and the value is the prompt object.
|
||||
* @param {ChatCompletion} chatCompletion - An instance of ChatCompletion class that will be populated with the prompts.
|
||||
* @param type
|
||||
* @param cyclePrompt
|
||||
*/
|
||||
function populateChatHistory(prompts, chatCompletion, type = null, cyclePrompt = null) {
|
||||
// Chat History
|
||||
|
@ -422,7 +426,7 @@ function populateChatHistory(prompts, chatCompletion, type = null, cyclePrompt =
|
|||
const continuePrompt = new Prompt({
|
||||
identifier: 'continueNudge',
|
||||
role: 'system',
|
||||
content: '[Continue the following message. Do not include ANY parts of the original message. Use capitalization and punctuation as if your reply is a part of the original message:\n\n + ' + cyclePrompt + ']',
|
||||
content: oai_settings.continue_nudge_prompt.replace('{{lastChatMessage}}', cyclePrompt),
|
||||
system_prompt: true
|
||||
});
|
||||
const preparedPrompt = promptManager.preparePrompt(continuePrompt);
|
||||
|
@ -1792,6 +1796,7 @@ function loadOpenAISettings(data, settings) {
|
|||
oai_settings.new_chat_prompt = settings.new_chat_prompt ?? default_settings.new_chat_prompt;
|
||||
oai_settings.new_group_chat_prompt = settings.new_group_chat_prompt ?? default_settings.new_group_chat_prompt;
|
||||
oai_settings.new_example_chat_prompt = settings.new_example_chat_prompt ?? default_settings.new_example_chat_prompt;
|
||||
oai_settings.continue_nudge_prompt = settings.continue_nudge_prompt ?? default_settings.continue_nudge_prompt;
|
||||
|
||||
if (settings.keep_example_dialogue !== undefined) oai_settings.keep_example_dialogue = !!settings.keep_example_dialogue;
|
||||
if (settings.wrap_in_quotes !== undefined) oai_settings.wrap_in_quotes = !!settings.wrap_in_quotes;
|
||||
|
@ -1835,6 +1840,7 @@ function loadOpenAISettings(data, settings) {
|
|||
$('#newchat_prompt_textarea').val(oai_settings.new_chat_prompt);
|
||||
$('#newgroupchat_prompt_textarea').val(oai_settings.new_group_chat_prompt);
|
||||
$('#newexamplechat_prompt_textarea').val(oai_settings.new_example_chat_prompt);
|
||||
$('#continue_nudge_prompt_textarea').val(oai_settings.continue_nudge_prompt);
|
||||
|
||||
$('#wi_format_textarea').val(oai_settings.wi_format);
|
||||
$('#send_if_empty_textarea').val(oai_settings.send_if_empty);
|
||||
|
@ -1995,6 +2001,7 @@ async function saveOpenAIPreset(name, settings) {
|
|||
new_chat_prompt: settings.new_chat_prompt,
|
||||
new_group_chat_prompt: settings.new_group_chat_prompt,
|
||||
new_example_chat_prompt: settings.new_example_chat_prompt,
|
||||
continue_nudge_prompt: settings.continue_nudge_prompt,
|
||||
bias_preset_selected: settings.bias_preset_selected,
|
||||
reverse_proxy: settings.reverse_proxy,
|
||||
proxy_password: settings.proxy_password,
|
||||
|
@ -2330,6 +2337,7 @@ function onSettingsPresetChange() {
|
|||
new_chat_prompt: ['#newchat_prompt_textarea', 'new_chat_prompt', false],
|
||||
new_group_chat_prompt: ['#newgroupchat_prompt_textarea', 'new_group_chat_prompt', false],
|
||||
new_example_chat_prompt: ['#newexamplechat_prompt_textarea', 'new_example_chat_prompt', false],
|
||||
continue_nudge_prompt: ['#continue_nudge_prompt_textarea', 'continue_nudge_prompt', false],
|
||||
bias_preset_selected: ['#openai_logit_bias_preset', 'bias_preset_selected', false],
|
||||
reverse_proxy: ['#openai_reverse_proxy', 'reverse_proxy', false],
|
||||
legacy_streaming: ['#legacy_streaming', 'legacy_streaming', true],
|
||||
|
@ -2774,6 +2782,11 @@ $(document).ready(function () {
|
|||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$("#continue_nudge_prompt_textarea").on('input', function () {
|
||||
oai_settings.continue_nudge_prompt = $('#continue_nudge_prompt_textarea').val();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$("#nsfw_avoidance_prompt_textarea").on('input', function () {
|
||||
oai_settings.nsfw_avoidance_prompt = $('#nsfw_avoidance_prompt_textarea').val();
|
||||
saveSettingsDebounced();
|
||||
|
@ -2843,6 +2856,12 @@ $(document).ready(function () {
|
|||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$("#continue_nudge_prompt_restore").on('click', function () {
|
||||
oai_settings.continue_nudge_prompt = default_continue_nudge_prompt;
|
||||
$('#continue_nudge_prompt_textarea').val(oai_settings.continue_nudge_prompt);
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$("#wi_format_restore").on('click', function () {
|
||||
oai_settings.wi_format = default_wi_format;
|
||||
$('#wi_format_textarea').val(oai_settings.wi_format);
|
||||
|
|
Loading…
Reference in New Issue