mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-11 01:20:12 +01:00
Add migrated prefix to imported legacy instructs
This commit is contained in:
parent
45e92fdf20
commit
ece2684001
@ -72,14 +72,15 @@ export async function checkForSystemPromptInInstructTemplate(name, template) {
|
|||||||
if (!template || !name || typeof name !== 'string' || typeof template !== 'object') {
|
if (!template || !name || typeof name !== 'string' || typeof template !== 'object') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ('system_prompt' in template && template.system_prompt && !system_prompts.some(x => x.name === name)) {
|
if ('system_prompt' in template && template.system_prompt) {
|
||||||
const html = await renderTemplateAsync('migrateInstructPrompt', { prompt: template.system_prompt });
|
const html = await renderTemplateAsync('migrateInstructPrompt', { prompt: template.system_prompt });
|
||||||
const confirm = await callGenericPopup(html, POPUP_TYPE.CONFIRM);
|
const confirm = await callGenericPopup(html, POPUP_TYPE.CONFIRM);
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
const prompt = { name: name, content: template.system_prompt };
|
const migratedName = `[Migrated] ${name}`;
|
||||||
|
const prompt = { name: migratedName, content: template.system_prompt };
|
||||||
const presetManager = getPresetManager('sysprompt');
|
const presetManager = getPresetManager('sysprompt');
|
||||||
await presetManager.savePreset(prompt.name, prompt);
|
await presetManager.savePreset(migratedName, prompt);
|
||||||
toastr.success(`System prompt "${prompt.name}" has been saved.`);
|
toastr.success(`System prompt "${migratedName}" has been saved.`);
|
||||||
} else {
|
} else {
|
||||||
toastr.info('System prompt has been discarded.');
|
toastr.info('System prompt has been discarded.');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user