mirror of
https://github.com/open-webui/open-webui
synced 2025-05-17 12:03:41 +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 { toast } from 'svelte-sonner';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { prompts } from '$lib/stores';
|
import { prompts } from '$lib/stores';
|
||||||
import { onMount, tick, getContext } from 'svelte';
|
import { onMount, tick, getContext } from 'svelte';
|
||||||
|
|
||||||
|
const i18n = getContext('i18n');
|
||||||
|
|
||||||
import { createNewPrompt, getPrompts } from '$lib/apis/prompts';
|
import { createNewPrompt, getPrompts } from '$lib/apis/prompts';
|
||||||
import PromptEditor from '$lib/components/workspace/Prompts/PromptEditor.svelte';
|
import PromptEditor from '$lib/components/workspace/Prompts/PromptEditor.svelte';
|
||||||
|
|
||||||
@ -15,6 +17,8 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (prompt) {
|
if (prompt) {
|
||||||
|
toast.success($i18n.t('Prompt created successfully'));
|
||||||
|
|
||||||
await prompts.set(await getPrompts(localStorage.token));
|
await prompts.set(await getPrompts(localStorage.token));
|
||||||
await goto('/workspace/prompts');
|
await goto('/workspace/prompts');
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
<script>
|
<script lang="ts">
|
||||||
import { toast } from 'svelte-sonner';
|
import { toast } from 'svelte-sonner';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { prompts } from '$lib/stores';
|
import { prompts } from '$lib/stores';
|
||||||
import { onMount, tick, getContext } from 'svelte';
|
import { onMount, tick, getContext } from 'svelte';
|
||||||
|
|
||||||
|
const i18n = getContext('i18n');
|
||||||
|
|
||||||
import { getPromptByCommand, getPrompts, updatePromptByCommand } from '$lib/apis/prompts';
|
import { getPromptByCommand, getPrompts, updatePromptByCommand } from '$lib/apis/prompts';
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
|
|
||||||
@ -18,6 +20,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (prompt) {
|
if (prompt) {
|
||||||
|
toast.success($i18n.t('Prompt updated successfully'));
|
||||||
await prompts.set(await getPrompts(localStorage.token));
|
await prompts.set(await getPrompts(localStorage.token));
|
||||||
await goto('/workspace/prompts');
|
await goto('/workspace/prompts');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user