| 62 | * @param {object} template Instruct template object | 62 | * @param {object} template Instruct template object |
| 63 | */ | 63 | */ |
| 64 | export async function checkForSystemPromptInInstructTemplate(name, template) { | 64 | export async function checkForSystemPromptInInstructTemplate(name, template) { |
| 65 | if ('system_prompt' in template && name && template.system_prompt && !system_prompts.some(x => x.name === name)) { | 65 | if (!template || !name || typeof name !== 'string' || typeof template !== 'object') { |
| | 66 | return; |
| | 67 | } |
| | 68 | if ('system_prompt' in template && template.system_prompt && !system_prompts.some(x => x.name === name)) { |
| 66 | const html = await renderTemplateAsync('migrateInstructPrompt', { prompt: template.system_prompt }); | 69 | const html = await renderTemplateAsync('migrateInstructPrompt', { prompt: template.system_prompt }); |
| 67 | const confirm = await callGenericPopup(html, POPUP_TYPE.CONFIRM); | 70 | const confirm = await callGenericPopup(html, POPUP_TYPE.CONFIRM); |
| 68 | if (confirm) { | 71 | if (confirm) { |