mirror of
https://github.com/open-webui/open-webui
synced 2025-01-01 08:42:14 +00:00
fix: prompt import
This commit is contained in:
parent
364d6eb9c4
commit
e1a198f0a3
@ -4,7 +4,7 @@ type PromptItem = {
|
|||||||
command: string;
|
command: string;
|
||||||
title: string;
|
title: string;
|
||||||
content: string;
|
content: string;
|
||||||
access_control: null | object;
|
access_control?: null | object;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createNewPrompt = async (token: string, prompt: PromptItem) => {
|
export const createNewPrompt = async (token: string, prompt: PromptItem) => {
|
||||||
|
@ -239,12 +239,12 @@
|
|||||||
console.log(savedPrompts);
|
console.log(savedPrompts);
|
||||||
|
|
||||||
for (const prompt of savedPrompts) {
|
for (const prompt of savedPrompts) {
|
||||||
await createNewPrompt(
|
await createNewPrompt(localStorage.token, {
|
||||||
localStorage.token,
|
command:
|
||||||
prompt.command.charAt(0) === '/' ? prompt.command.slice(1) : prompt.command,
|
prompt.command.charAt(0) === '/' ? prompt.command.slice(1) : prompt.command,
|
||||||
prompt.title,
|
title: prompt.title,
|
||||||
prompt.content
|
content: prompt.content
|
||||||
).catch((error) => {
|
}).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(error);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
@ -252,6 +252,9 @@
|
|||||||
|
|
||||||
prompts = await getPromptList(localStorage.token);
|
prompts = await getPromptList(localStorage.token);
|
||||||
await _prompts.set(await getPrompts(localStorage.token));
|
await _prompts.set(await getPrompts(localStorage.token));
|
||||||
|
|
||||||
|
importFiles = [];
|
||||||
|
promptsImportInputElement.value = '';
|
||||||
};
|
};
|
||||||
|
|
||||||
reader.readAsText(importFiles[0]);
|
reader.readAsText(importFiles[0]);
|
||||||
|
Loading…
Reference in New Issue
Block a user