mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
refac
This commit is contained in:
@@ -93,7 +93,12 @@
|
||||
settings.set(localStorageSettings);
|
||||
}
|
||||
|
||||
models.set(await getModels(localStorage.token, $settings?.directConnections ?? null));
|
||||
models.set(
|
||||
await getModels(
|
||||
localStorage.token,
|
||||
$config?.features?.enable_direct_connetions && ($settings?.directConnections ?? null)
|
||||
)
|
||||
);
|
||||
banners.set(await getBanners(localStorage.token));
|
||||
tools.set(await getTools(localStorage.token));
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { onMount, getContext } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
import { functions, models, settings } from '$lib/stores';
|
||||
import { config, functions, models, settings } from '$lib/stores';
|
||||
import { createNewFunction, getFunctions } from '$lib/apis/functions';
|
||||
import FunctionEditor from '$lib/components/admin/Functions/FunctionEditor.svelte';
|
||||
import { getModels } from '$lib/apis';
|
||||
@@ -47,7 +47,12 @@
|
||||
if (res) {
|
||||
toast.success($i18n.t('Function created successfully'));
|
||||
functions.set(await getFunctions(localStorage.token));
|
||||
models.set(await getModels(localStorage.token, $settings?.directConnections ?? null));
|
||||
models.set(
|
||||
await getModels(
|
||||
localStorage.token,
|
||||
$config?.features?.enable_direct_connetions && ($settings?.directConnections ?? null)
|
||||
)
|
||||
);
|
||||
|
||||
await goto('/admin/functions');
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import { goto } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { functions, models, settings } from '$lib/stores';
|
||||
import { config, functions, models, settings } from '$lib/stores';
|
||||
import { updateFunctionById, getFunctions, getFunctionById } from '$lib/apis/functions';
|
||||
|
||||
import FunctionEditor from '$lib/components/admin/Functions/FunctionEditor.svelte';
|
||||
@@ -48,7 +48,12 @@
|
||||
if (res) {
|
||||
toast.success($i18n.t('Function updated successfully'));
|
||||
functions.set(await getFunctions(localStorage.token));
|
||||
models.set(await getModels(localStorage.token, $settings?.directConnections ?? null));
|
||||
models.set(
|
||||
await getModels(
|
||||
localStorage.token,
|
||||
$config?.features?.enable_direct_connetions && ($settings?.directConnections ?? null)
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { models, settings } from '$lib/stores';
|
||||
import { config, models, settings } from '$lib/stores';
|
||||
import { getModels } from '$lib/apis';
|
||||
import Models from '$lib/components/workspace/Models.svelte';
|
||||
|
||||
onMount(async () => {
|
||||
await Promise.all([
|
||||
(async () => {
|
||||
models.set(await getModels(localStorage.token, $settings?.directConnections ?? null));
|
||||
models.set(
|
||||
await getModels(
|
||||
localStorage.token,
|
||||
$config?.features?.enable_direct_connetions && ($settings?.directConnections ?? null)
|
||||
)
|
||||
);
|
||||
})()
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -42,7 +42,12 @@
|
||||
});
|
||||
|
||||
if (res) {
|
||||
await models.set(await getModels(localStorage.token, $settings?.directConnections ?? null));
|
||||
await models.set(
|
||||
await getModels(
|
||||
localStorage.token,
|
||||
$config?.features?.enable_direct_connetions && ($settings?.directConnections ?? null)
|
||||
)
|
||||
);
|
||||
toast.success($i18n.t('Model created successfully!'));
|
||||
await goto('/workspace/models');
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
import { page } from '$app/stores';
|
||||
import { models } from '$lib/stores';
|
||||
import { config, models } from '$lib/stores';
|
||||
|
||||
import { getModelById, updateModelById } from '$lib/apis/models';
|
||||
|
||||
@@ -34,7 +34,12 @@
|
||||
const res = await updateModelById(localStorage.token, modelInfo.id, modelInfo);
|
||||
|
||||
if (res) {
|
||||
await models.set(await getModels(localStorage.token, $settings?.directConnections ?? null));
|
||||
await models.set(
|
||||
await getModels(
|
||||
localStorage.token,
|
||||
$config?.features?.enable_direct_connetions && ($settings?.directConnections ?? null)
|
||||
)
|
||||
);
|
||||
toast.success($i18n.t('Model updated successfully'));
|
||||
await goto('/workspace/models');
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { settings, chatId, WEBUI_NAME, models } from '$lib/stores';
|
||||
import { settings, chatId, WEBUI_NAME, models, config } from '$lib/stores';
|
||||
import { convertMessagesToHistory, createMessagesList } from '$lib/utils';
|
||||
|
||||
import { getChatByShareId, cloneSharedChatById } from '$lib/apis/chats';
|
||||
@@ -61,7 +61,12 @@
|
||||
//////////////////////////
|
||||
|
||||
const loadSharedChat = async () => {
|
||||
await models.set(await getModels(localStorage.token, $settings?.directConnections ?? null));
|
||||
await models.set(
|
||||
await getModels(
|
||||
localStorage.token,
|
||||
$config?.features?.enable_direct_connetions && ($settings?.directConnections ?? null)
|
||||
)
|
||||
);
|
||||
await chatId.set($page.params.id);
|
||||
chat = await getChatByShareId(localStorage.token, $chatId).catch(async (error) => {
|
||||
await goto('/');
|
||||
|
||||
Reference in New Issue
Block a user