| 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 | } |