Add migrated prefix to imported legacy instructs

ece268400143bccfe88ddae5958f49b9dadcf946

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +5 -4Showing whitespace changes
public/scripts/sysprompt.js+5 -4
@@ -72,14 +72,15 @@ export async function checkForSystemPromptInInstructTemplate(name, template) {
72 if (!template || !name || typeof name !== 'string' || typeof template !== 'object') {72 if (!template || !name || typeof name !== 'string' || typeof template !== 'object') {
73 return;73 return;
74 }74 }
75 if ('system_prompt' in template && template.system_prompt && !system_prompts.some(x => x.name === name)) {75 if ('system_prompt' in template && template.system_prompt) {
76 const html = await renderTemplateAsync('migrateInstructPrompt', { prompt: template.system_prompt });76 const html = await renderTemplateAsync('migrateInstructPrompt', { prompt: template.system_prompt });
77 const confirm = await callGenericPopup(html, POPUP_TYPE.CONFIRM);77 const confirm = await callGenericPopup(html, POPUP_TYPE.CONFIRM);
78 if (confirm) {78 if (confirm) {
79 const prompt = { name: name, content: template.system_prompt };79 const migratedName = `[Migrated] ${name}`;
80 const prompt = { name: migratedName, content: template.system_prompt };
80 const presetManager = getPresetManager('sysprompt');81 const presetManager = getPresetManager('sysprompt');
81 await presetManager.savePreset(prompt.name, prompt);82 await presetManager.savePreset(migratedName, prompt);
82 toastr.success(`System prompt "${prompt.name}" has been saved.`);83 toastr.success(`System prompt "${migratedName}" has been saved.`);
83 } else {84 } else {
84 toastr.info('System prompt has been discarded.');85 toastr.info('System prompt has been discarded.');
85 }86 }