mirror of
https://github.com/open-webui/open-webui
synced 2024-12-28 14:52:23 +00:00
fix: prompt import
This commit is contained in:
parent
364d6eb9c4
commit
e1a198f0a3
@ -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) => {
|
||||
|
@ -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]);
|
||||
|
Loading…
Reference in New Issue
Block a user