Fix being unable to save instruct templates

88c47fccdfa9c56f97135932701039d2f33e90ca

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

1 files changed, +4 -1Showing whitespace changes
public/scripts/sysprompt.js+4 -1
@@ -62,7 +62,10 @@ export async function loadSystemPrompts(data) {
62 * @param {object} template Instruct template object62 * @param {object} template Instruct template object
63 */63 */
64export async function checkForSystemPromptInInstructTemplate(name, template) {64export 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) {