mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Disable-able main prompt
This commit is contained in:
@ -884,7 +884,7 @@ class PromptManager {
|
|||||||
* @returns {boolean} True if the prompt can be deleted, false otherwise.
|
* @returns {boolean} True if the prompt can be deleted, false otherwise.
|
||||||
*/
|
*/
|
||||||
isPromptToggleAllowed(prompt) {
|
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);
|
return prompt.marker && !forceTogglePrompts.includes(prompt.identifier) ? false : !this.configuration.toggleDisabled.includes(prompt.identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1255,6 +1255,12 @@ class PromptManager {
|
|||||||
if (true === entry.enabled) {
|
if (true === entry.enabled) {
|
||||||
const prompt = this.getPromptById(entry.identifier);
|
const prompt = this.getPromptById(entry.identifier);
|
||||||
if (prompt) promptCollection.add(this.preparePrompt(prompt));
|
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));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -549,7 +549,7 @@ function setupChatCompletionPromptManager(openAiSettings) {
|
|||||||
prefix: 'completion_',
|
prefix: 'completion_',
|
||||||
containerIdentifier: 'completion_prompt_manager',
|
containerIdentifier: 'completion_prompt_manager',
|
||||||
listIdentifier: 'completion_prompt_manager_list',
|
listIdentifier: 'completion_prompt_manager_list',
|
||||||
toggleDisabled: ['main'],
|
toggleDisabled: [],
|
||||||
sortableDelay: getSortableDelay(),
|
sortableDelay: getSortableDelay(),
|
||||||
defaultPrompts: {
|
defaultPrompts: {
|
||||||
main: default_main_prompt,
|
main: default_main_prompt,
|
||||||
@ -881,7 +881,7 @@ async function populateChatCompletion(prompts, chatCompletion, { bias, quietProm
|
|||||||
// We need the prompts array to determine a position for the source.
|
// We need the prompts array to determine a position for the source.
|
||||||
if (false === prompts.has(source)) return;
|
if (false === prompts.has(source)) return;
|
||||||
|
|
||||||
if (promptManager.isPromptDisabledForActiveCharacter(source)) {
|
if (promptManager.isPromptDisabledForActiveCharacter(source) && source !== 'main') {
|
||||||
promptManager.log(`Skipping prompt ${source} because it is disabled`);
|
promptManager.log(`Skipping prompt ${source} because it is disabled`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user