mirror of
https://github.com/open-webui/open-webui
synced 2025-04-25 16:49:46 +00:00
refac
This commit is contained in:
parent
59fa2f8f26
commit
9ebd308d28
@ -3,7 +3,7 @@
|
|||||||
import fileSaver from 'file-saver';
|
import fileSaver from 'file-saver';
|
||||||
const { saveAs } = fileSaver;
|
const { saveAs } = fileSaver;
|
||||||
|
|
||||||
import { WEBUI_NAME, functions } from '$lib/stores';
|
import { WEBUI_NAME, functions, models } from '$lib/stores';
|
||||||
import { onMount, getContext } from 'svelte';
|
import { onMount, getContext } from 'svelte';
|
||||||
import { createNewPrompt, deletePromptByCommand, getPrompts } from '$lib/apis/prompts';
|
import { createNewPrompt, deletePromptByCommand, getPrompts } from '$lib/apis/prompts';
|
||||||
|
|
||||||
@ -19,6 +19,7 @@
|
|||||||
import ArrowDownTray from '../icons/ArrowDownTray.svelte';
|
import ArrowDownTray from '../icons/ArrowDownTray.svelte';
|
||||||
import Tooltip from '../common/Tooltip.svelte';
|
import Tooltip from '../common/Tooltip.svelte';
|
||||||
import ConfirmDialog from '../common/ConfirmDialog.svelte';
|
import ConfirmDialog from '../common/ConfirmDialog.svelte';
|
||||||
|
import { getModels } from '$lib/apis';
|
||||||
|
|
||||||
const i18n = getContext('i18n');
|
const i18n = getContext('i18n');
|
||||||
|
|
||||||
@ -226,7 +227,9 @@
|
|||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
toast.success('Function deleted successfully');
|
toast.success('Function deleted successfully');
|
||||||
|
|
||||||
functions.set(await getFunctions(localStorage.token));
|
functions.set(await getFunctions(localStorage.token));
|
||||||
|
models.set(await getModels(localStorage.token));
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -349,6 +352,7 @@
|
|||||||
|
|
||||||
toast.success('Functions imported successfully');
|
toast.success('Functions imported successfully');
|
||||||
functions.set(await getFunctions(localStorage.token));
|
functions.set(await getFunctions(localStorage.token));
|
||||||
|
models.set(await getModels(localStorage.token));
|
||||||
};
|
};
|
||||||
|
|
||||||
reader.readAsText(importFiles[0]);
|
reader.readAsText(importFiles[0]);
|
||||||
|
@ -3,9 +3,10 @@
|
|||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
import { functions } from '$lib/stores';
|
import { functions, models } from '$lib/stores';
|
||||||
import { createNewFunction, getFunctions } from '$lib/apis/functions';
|
import { createNewFunction, getFunctions } from '$lib/apis/functions';
|
||||||
import FunctionEditor from '$lib/components/workspace/Functions/FunctionEditor.svelte';
|
import FunctionEditor from '$lib/components/workspace/Functions/FunctionEditor.svelte';
|
||||||
|
import { getModels } from '$lib/apis';
|
||||||
|
|
||||||
let mounted = false;
|
let mounted = false;
|
||||||
let clone = false;
|
let clone = false;
|
||||||
@ -26,6 +27,8 @@
|
|||||||
if (res) {
|
if (res) {
|
||||||
toast.success('Function created successfully');
|
toast.success('Function created successfully');
|
||||||
functions.set(await getFunctions(localStorage.token));
|
functions.set(await getFunctions(localStorage.token));
|
||||||
|
models.set(await getModels(localStorage.token));
|
||||||
|
|
||||||
await goto('/workspace/functions');
|
await goto('/workspace/functions');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -4,11 +4,12 @@
|
|||||||
|
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import { functions } from '$lib/stores';
|
import { functions, models } from '$lib/stores';
|
||||||
import { updateFunctionById, getFunctions, getFunctionById } from '$lib/apis/functions';
|
import { updateFunctionById, getFunctions, getFunctionById } from '$lib/apis/functions';
|
||||||
|
|
||||||
import FunctionEditor from '$lib/components/workspace/Functions/FunctionEditor.svelte';
|
import FunctionEditor from '$lib/components/workspace/Functions/FunctionEditor.svelte';
|
||||||
import Spinner from '$lib/components/common/Spinner.svelte';
|
import Spinner from '$lib/components/common/Spinner.svelte';
|
||||||
|
import { getModels } from '$lib/apis';
|
||||||
|
|
||||||
let func = null;
|
let func = null;
|
||||||
|
|
||||||
@ -27,6 +28,7 @@
|
|||||||
if (res) {
|
if (res) {
|
||||||
toast.success('Function updated successfully');
|
toast.success('Function updated successfully');
|
||||||
functions.set(await getFunctions(localStorage.token));
|
functions.set(await getFunctions(localStorage.token));
|
||||||
|
models.set(await getModels(localStorage.token));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user