diff --git a/src/lib/apis/prompts/index.ts b/src/lib/apis/prompts/index.ts index 0d796e5cd..f1c54b109 100644 --- a/src/lib/apis/prompts/index.ts +++ b/src/lib/apis/prompts/index.ts @@ -4,7 +4,7 @@ type PromptItem = { command: string; title: string; content: string; - access_control: null | object; + access_control?: null | object; }; export const createNewPrompt = async (token: string, prompt: PromptItem) => { diff --git a/src/lib/components/workspace/Prompts.svelte b/src/lib/components/workspace/Prompts.svelte index f20f549e1..12494c1e7 100644 --- a/src/lib/components/workspace/Prompts.svelte +++ b/src/lib/components/workspace/Prompts.svelte @@ -239,12 +239,12 @@ console.log(savedPrompts); for (const prompt of savedPrompts) { - await createNewPrompt( - localStorage.token, - prompt.command.charAt(0) === '/' ? prompt.command.slice(1) : prompt.command, - prompt.title, - prompt.content - ).catch((error) => { + await createNewPrompt(localStorage.token, { + command: + prompt.command.charAt(0) === '/' ? prompt.command.slice(1) : prompt.command, + title: prompt.title, + content: prompt.content + }).catch((error) => { toast.error(error); return null; }); @@ -252,6 +252,9 @@ prompts = await getPromptList(localStorage.token); await _prompts.set(await getPrompts(localStorage.token)); + + importFiles = []; + promptsImportInputElement.value = ''; }; reader.readAsText(importFiles[0]);