mirror of
https://github.com/open-webui/open-webui
synced 2024-11-21 23:57:51 +00:00
refac: prompts frontend
This commit is contained in:
parent
b81cd15ced
commit
e78657f07e
@ -1,9 +1,11 @@
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import { toast } from 'svelte-sonner';
|
||||
import { goto } from '$app/navigation';
|
||||
import { prompts } from '$lib/stores';
|
||||
import { onMount, tick, getContext } from 'svelte';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
import { createNewPrompt, getPrompts } from '$lib/apis/prompts';
|
||||
import PromptEditor from '$lib/components/workspace/Prompts/PromptEditor.svelte';
|
||||
|
||||
@ -15,6 +17,8 @@
|
||||
});
|
||||
|
||||
if (prompt) {
|
||||
toast.success($i18n.t('Prompt created successfully'));
|
||||
|
||||
await prompts.set(await getPrompts(localStorage.token));
|
||||
await goto('/workspace/prompts');
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import { toast } from 'svelte-sonner';
|
||||
import { goto } from '$app/navigation';
|
||||
import { prompts } from '$lib/stores';
|
||||
import { onMount, tick, getContext } from 'svelte';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
import { getPromptByCommand, getPrompts, updatePromptByCommand } from '$lib/apis/prompts';
|
||||
import { page } from '$app/stores';
|
||||
|
||||
@ -18,6 +20,7 @@
|
||||
});
|
||||
|
||||
if (prompt) {
|
||||
toast.success($i18n.t('Prompt updated successfully'));
|
||||
await prompts.set(await getPrompts(localStorage.token));
|
||||
await goto('/workspace/prompts');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user