Add reset for main,nsfw and jailbreak prompts
This commit is contained in:
parent
9cf41a6a52
commit
221ecbf8d6
|
@ -89,7 +89,12 @@
|
|||
margin-top:1em;
|
||||
}
|
||||
|
||||
#completion_prompt_manager_popup #completion_prompt_manager_popup_entry_form_footer #completion_prompt_manager_popup_entry_form_reset {
|
||||
color: rgb(220 173 16);
|
||||
}
|
||||
|
||||
#completion_prompt_manager_popup #completion_prompt_manager_popup_entry_form_footer #completion_prompt_manager_popup_entry_form_close,
|
||||
#completion_prompt_manager_popup #completion_prompt_manager_popup_entry_form_footer #completion_prompt_manager_popup_entry_form_reset,
|
||||
#completion_prompt_manager_popup #completion_prompt_manager_popup_entry_form_footer #completion_prompt_manager_popup_entry_form_save {
|
||||
font-size: 1.25em;
|
||||
padding: 0.5em;
|
||||
|
|
|
@ -1286,7 +1286,7 @@
|
|||
<input id="names_in_completion" type="checkbox" /><span data-i18n="Add names to chat history">Add character names to chat history</span>
|
||||
</label>
|
||||
<div class="toggle-description justifyLeft">
|
||||
<span data-i18n="Adds character and user names to each message. May help the AI to understand the context. Only character and usernames with up to 64 letters or numbers are supported. No whitespaces or special characters.">May help the AI to understand the context. Only character and usernames with up to 64 letters or numbers are supported. No whitespaces or special characters.</span>
|
||||
<span data-i18n="Helps the AI to understand the context better during group chats. Names may only contain letters or numbers.">Helps the AI to understand the context better during group chats. Names may only contain letters or numbers.</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block">
|
||||
|
@ -3614,8 +3614,9 @@
|
|||
</textarea>
|
||||
</div>
|
||||
<div id="completion_prompt_manager_popup_entry_form_footer" >
|
||||
<a id="completion_prompt_manager_popup_entry_form_close" class="fa-solid fa-close menu_button"></a>
|
||||
<a id="completion_prompt_manager_popup_entry_form_save" class="fa-solid fa-save menu_button" data-pm-prompt=""></a>
|
||||
<a id="completion_prompt_manager_popup_entry_form_close" title="close" class="fa-solid fa-close menu_button"></a>
|
||||
<a id="completion_prompt_manager_popup_entry_form_reset" title="reset" class="fa-solid fa-undo menu_button"></a>
|
||||
<a id="completion_prompt_manager_popup_entry_form_save" title="save" class="fa-solid fa-save menu_button" data-pm-prompt=""></a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -65,7 +65,12 @@ function PromptManagerModule() {
|
|||
listIdentifier: '',
|
||||
listItemTemplateIdentifier: '',
|
||||
toggleDisabled: [],
|
||||
draggable: true
|
||||
draggable: true,
|
||||
defaultPrompts: {
|
||||
main: '',
|
||||
nsfw: '',
|
||||
jailbreak: ''
|
||||
}
|
||||
};
|
||||
|
||||
this.serviceSettings = null;
|
||||
|
@ -83,6 +88,7 @@ function PromptManagerModule() {
|
|||
this.handleEdit = () => { };
|
||||
this.handleDetach = () => { };
|
||||
this.handleSavePrompt = () => { };
|
||||
this.handleResetPrompt = () => { };
|
||||
this.handleNewPrompt = () => { };
|
||||
this.handleDeletePrompt = () => { };
|
||||
this.handleAppendPrompt = () => { };
|
||||
|
@ -151,6 +157,26 @@ PromptManagerModule.prototype.init = function (moduleConfiguration, serviceSetti
|
|||
this.saveServiceSettings().then(() => this.render());
|
||||
}
|
||||
|
||||
// Reset prompt should it be a system prompt
|
||||
this.handleResetPrompt = (event) => {
|
||||
const promptId = event.target.dataset.pmPrompt;
|
||||
const prompt = this.getPromptById(promptId);
|
||||
|
||||
switch (promptId) {
|
||||
case 'main':
|
||||
prompt.content = this.configuration.defaultPrompts.main;
|
||||
break;
|
||||
case 'nsfw':
|
||||
prompt.content = this.configuration.defaultPrompts.nsfw;
|
||||
break;
|
||||
case 'jailbreak':
|
||||
prompt.content = this.configuration.defaultPrompts.jailbreak;
|
||||
break;
|
||||
}
|
||||
|
||||
document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_prompt').value = prompt.content;
|
||||
}
|
||||
|
||||
this.handleAppendPrompt = (event) => {
|
||||
const promptID = document.getElementById(this.configuration.prefix + 'prompt_manager_footer_append_prompt').value;
|
||||
const prompt = this.getPromptById(promptID);
|
||||
|
@ -232,8 +258,9 @@ PromptManagerModule.prototype.init = function (moduleConfiguration, serviceSetti
|
|||
if (this.activeCharacter) this.render();
|
||||
});
|
||||
|
||||
// Prepare prompt edit form save and close button.
|
||||
// Prepare prompt edit form buttons
|
||||
document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_save').addEventListener('click', this.handleSavePrompt);
|
||||
document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_reset').addEventListener('click', this.handleResetPrompt);
|
||||
document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_close').addEventListener('click', () => {
|
||||
this.hideEditForm();
|
||||
this.clearEditForm();
|
||||
|
|
|
@ -287,7 +287,12 @@ function setupOpenAIPromptManager(openAiSettings) {
|
|||
containerIdentifier: 'completion_prompt_manager',
|
||||
listIdentifier: 'completion_prompt_manager_list',
|
||||
toggleDisabled: ['main'],
|
||||
draggable: true
|
||||
draggable: true,
|
||||
defaultPrompts: {
|
||||
main: default_main_prompt,
|
||||
nsfw: default_nsfw_prompt,
|
||||
jailbreak: default_jailbreak_prompt
|
||||
}
|
||||
};
|
||||
|
||||
promptManager.saveServiceSettings = () => {
|
||||
|
|
Loading…
Reference in New Issue