From 5c1b3693cf24f941e2fb32cb76197ef693b9979d Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 11 Nov 2024 23:04:02 -0800 Subject: [PATCH] refac --- .../admin/Settings/Connections.svelte | 18 +++++++++++------- src/lib/components/chat/MessageInput.svelte | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/lib/components/admin/Settings/Connections.svelte b/src/lib/components/admin/Settings/Connections.svelte index 6031b591c..407810c9f 100644 --- a/src/lib/components/admin/Settings/Connections.svelte +++ b/src/lib/components/admin/Settings/Connections.svelte @@ -148,18 +148,22 @@ OLLAMA_API_CONFIGS = ollamaConfig.OLLAMA_API_CONFIGS; if (ENABLE_OPENAI_API) { - OPENAI_API_BASE_URLS.forEach(async (url, idx) => { - const res = await getOpenAIModels(localStorage.token, idx); - if (res.pipelines) { - pipelineUrls[url] = true; - } - }); - for (const url of OPENAI_API_BASE_URLS) { if (!OPENAI_API_CONFIGS[url]) { OPENAI_API_CONFIGS[url] = {}; } } + + OPENAI_API_BASE_URLS.forEach(async (url, idx) => { + OPENAI_API_CONFIGS[url] = OPENAI_API_CONFIGS[url] || {}; + if (!(OPENAI_API_CONFIGS[url]?.enable ?? true)) { + return; + } + const res = await getOpenAIModels(localStorage.token, idx); + if (res.pipelines) { + pipelineUrls[url] = true; + } + }); } if (ENABLE_OLLAMA_API) { diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index 2767b296e..4d8ea5d70 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -291,7 +291,7 @@
{#if atSelectedModel !== undefined || webSearchEnabled}
{#if atSelectedModel !== undefined}