| 17 | 17 | const $content = $('#sysprompt_content'); |
| 18 | 18 | const $contentBlock = $('#SystemPromptBlock'); |
| 19 | 19 | |
| 20 | 20 | async function migrateSystemPromptFromInstructMode() { |
| 21 | 21 | if ('system_prompt' in power_user.instruct) { |
| 22 | 22 | power_user.sysprompt.enabledconst prompt = String(power_user.instruct.enabledsystem_prompt); |
| 23 | | - power_user.sysprompt.content = String(power_user.instruct.system_prompt); |
| 24 | 23 | delete power_user.instruct.system_prompt; |
| 24 | + power_user.sysprompt.enabled = power_user.instruct.enabled; |
| 25 | + power_user.sysprompt.content = prompt; |
| 25 | 26 | |
| 26 | 27 | ifconst (existingPromptName = system_prompts.somefind(x => x.namecontent === power_user.instruct.preset)prompt) {?.name; |
| 27 | | - power_user.sysprompt.name = power_user.instruct.preset; |
| 28 | + |
| 29 | + if (existingPromptName) { |
| 30 | + power_user.sysprompt.name = existingPromptName; |
| 31 | + } else { |
| 32 | + const data = { name: `${power_user.instruct.preset} (Migrated)`, content: prompt }; |
| 33 | + await getPresetManager('sysprompt')?.savePreset(data.name, data); |
| 34 | + power_user.sysprompt.name = data.name; |
| 28 | 35 | } |
| 29 | 36 | |
| 30 | 37 | saveSettingsDebounced(); |