Move quick edit ui identifiers into configuration

This commit is contained in:
maver 2023-08-14 18:28:03 +02:00
parent 6caa8a4765
commit 033dc45ab9
3 changed files with 14 additions and 4 deletions

View File

@ -1357,7 +1357,7 @@
</div>
</div>
<div class="range-block m-t-1">
<div class="justifyLeft" data-i18n="NSFW">Main</div>
<div class="justifyLeft" data-i18n="NSFW">NSFW</div>
<div class="wide100p">
<textarea id="nsfw_prompt_quick_edit_textarea" class="text_pole textarea_compact" name="nsfw_prompt" rows="6" placeholder=""></textarea>
</div>

View File

@ -159,6 +159,11 @@ function PromptManagerModule() {
jailbreak: '',
enhanceDefinitions: ''
},
quickEdit: {
main: '',
nsfw: '',
jailbreak: ''
}
};
// Chatcompletion configuration object
@ -327,15 +332,15 @@ PromptManagerModule.prototype.init = function (moduleConfiguration, serviceSetti
}
const mainPrompt = this.getPromptById('main');
const mainPromptTextarea = document.getElementById('main_prompt_quick_edit_textarea');
const mainPromptTextarea = document.getElementById(this.configuration.quickEdit.main);
const mainQuickEdit = createQuickEdit().from(mainPromptTextarea, mainPrompt);
const nsfwPrompt = this.getPromptById('nsfw');
const nsfwPromptTextarea = document.getElementById('nsfw_prompt_quick_edit_textarea');
const nsfwPromptTextarea = document.getElementById(this.configuration.quickEdit.nsfw);
const nsfwQuickEdit = createQuickEdit().from(nsfwPromptTextarea, nsfwPrompt);
const jailbreakPrompt = this.getPromptById('jailbreak');
const jailbreakPromptTextarea = document.getElementById('jailbreak_prompt_quick_edit_textarea');
const jailbreakPromptTextarea = document.getElementById(this.configuration.quickEdit.jailbreak);
const jailbreakQuickEdit = createQuickEdit().from(jailbreakPromptTextarea, jailbreakPrompt);
// Save prompt edit form to settings and close form.

View File

@ -348,6 +348,11 @@ function setupChatCompletionPromptManager(openAiSettings) {
jailbreak: default_jailbreak_prompt,
enhanceDefinitions: default_enhance_definitions_prompt
},
quickEdit: {
main: 'main_prompt_quick_edit_textarea',
nsfw: 'nsfw_prompt_quick_edit_textarea',
jailbreak: 'jailbreak_prompt_quick_edit_textarea'
}
};
promptManager.saveServiceSettings = () => {