From 1e919abda30e500c07d60f9a893f9a1184745c63 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 20 Apr 2024 20:49:16 -0500 Subject: [PATCH] fix: settings getModels issue --- backend/apps/openai/main.py | 1 + src/lib/components/chat/SettingsModal.svelte | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/apps/openai/main.py b/backend/apps/openai/main.py index 4647d7489..0fbbd365e 100644 --- a/backend/apps/openai/main.py +++ b/backend/apps/openai/main.py @@ -80,6 +80,7 @@ async def get_openai_urls(user=Depends(get_admin_user)): @app.post("/urls/update") async def update_openai_urls(form_data: UrlsUpdateForm, user=Depends(get_admin_user)): + await get_all_models() app.state.OPENAI_API_BASE_URLS = form_data.urls return {"OPENAI_API_BASE_URLS": app.state.OPENAI_API_BASE_URLS} diff --git a/src/lib/components/chat/SettingsModal.svelte b/src/lib/components/chat/SettingsModal.svelte index fd3910e90..95becea12 100644 --- a/src/lib/components/chat/SettingsModal.svelte +++ b/src/lib/components/chat/SettingsModal.svelte @@ -3,7 +3,7 @@ import { toast } from 'svelte-sonner'; import { models, settings, user } from '$lib/stores'; - import { getModels } from '$lib/utils'; + import { getModels as _getModels } from '$lib/utils'; import Modal from '../common/Modal.svelte'; import Account from './Settings/Account.svelte'; @@ -23,10 +23,14 @@ const saveSettings = async (updated) => { console.log(updated); await settings.set({ ...$settings, ...updated }); - await models.set(await getModels(localStorage.token)); + await models.set(await getModels()); localStorage.setItem('settings', JSON.stringify($settings)); }; + const getModels = async () => { + return await _getModels(localStorage.token); + }; + let selectedTab = 'general';