Disable-able main prompt

This commit is contained in:
Cohee
2024-03-24 00:28:54 +02:00
parent 7b9c0e303f
commit c1ac34e001
2 changed files with 9 additions and 3 deletions

View File

@ -884,7 +884,7 @@ class PromptManager {
* @returns {boolean} True if the prompt can be deleted, false otherwise.
*/
isPromptToggleAllowed(prompt) {
const forceTogglePrompts = ['charDescription', 'charPersonality', 'scenario', 'personaDescription', 'worldInfoBefore', 'worldInfoAfter'];
const forceTogglePrompts = ['charDescription', 'charPersonality', 'scenario', 'personaDescription', 'worldInfoBefore', 'worldInfoAfter', 'main'];
return prompt.marker && !forceTogglePrompts.includes(prompt.identifier) ? false : !this.configuration.toggleDisabled.includes(prompt.identifier);
}
@ -1255,6 +1255,12 @@ class PromptManager {
if (true === entry.enabled) {
const prompt = this.getPromptById(entry.identifier);
if (prompt) promptCollection.add(this.preparePrompt(prompt));
} else if (!entry.enabled && entry.identifier === 'main') {
// Some extensions require main prompt to be present for relative inserts.
// So we make a GMO-free vegan replacement.
const prompt = this.getPromptById(entry.identifier);
prompt.content = '';
if (prompt) promptCollection.add(this.preparePrompt(prompt));
}
});