wip: direct models

This commit is contained in:
Timothy Jaeryang Baek
2025-02-12 01:17:30 -08:00
parent 982b1fb7e2
commit 431e97b03a
20 changed files with 194 additions and 61 deletions
+1 -1
View File
@@ -93,7 +93,7 @@
settings.set(localStorageSettings);
}
models.set(await getModels(localStorage.token));
models.set(await getModels(localStorage.token, $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 } from '$lib/stores';
import { 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,7 @@
if (res) {
toast.success($i18n.t('Function created successfully'));
functions.set(await getFunctions(localStorage.token));
models.set(await getModels(localStorage.token));
models.set(await getModels(localStorage.token, $settings?.directConnections ?? null));
await goto('/admin/functions');
}
@@ -4,7 +4,7 @@
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import { functions, models } from '$lib/stores';
import { 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,7 @@
if (res) {
toast.success($i18n.t('Function updated successfully'));
functions.set(await getFunctions(localStorage.token));
models.set(await getModels(localStorage.token));
models.set(await getModels(localStorage.token, $settings?.directConnections ?? null));
}
};
@@ -1,13 +1,13 @@
<script>
import { onMount } from 'svelte';
import { models } from '$lib/stores';
import { 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));
models.set(await getModels(localStorage.token, $settings?.directConnections ?? null));
})()
]);
});
@@ -42,7 +42,7 @@
});
if (res) {
await models.set(await getModels(localStorage.token));
await models.set(await getModels(localStorage.token, $settings?.directConnections ?? null));
toast.success($i18n.t('Model created successfully!'));
await goto('/workspace/models');
}
@@ -34,7 +34,7 @@
const res = await updateModelById(localStorage.token, modelInfo.id, modelInfo);
if (res) {
await models.set(await getModels(localStorage.token));
await models.set(await getModels(localStorage.token, $settings?.directConnections ?? null));
toast.success($i18n.t('Model updated successfully'));
await goto('/workspace/models');
}
+1 -1
View File
@@ -61,7 +61,7 @@
//////////////////////////
const loadSharedChat = async () => {
await models.set(await getModels(localStorage.token));
await models.set(await getModels(localStorage.token, $settings?.directConnections ?? null));
await chatId.set($page.params.id);
chat = await getChatByShareId(localStorage.token, $chatId).catch(async (error) => {
await goto('/');