From a976a25094b4a683178168660dc2e631716848ca Mon Sep 17 00:00:00 2001 From: Dustin Loring Date: Sat, 14 Dec 2024 20:11:20 -0500 Subject: [PATCH] Update DebugTab.tsx fixed the Local LLM Status not showing BaseURL's --- app/components/settings/debug/DebugTab.tsx | 38 ++++++++++++---------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/app/components/settings/debug/DebugTab.tsx b/app/components/settings/debug/DebugTab.tsx index 3f19a4880..9b2a1b30a 100644 --- a/app/components/settings/debug/DebugTab.tsx +++ b/app/components/settings/debug/DebugTab.tsx @@ -27,6 +27,7 @@ interface IProviderConfig { name: string; settings: { enabled: boolean; + baseUrl?: string; }; } @@ -213,29 +214,30 @@ export default function DebugTab() { try { const entries = Object.entries(providers) as [string, IProviderConfig][]; - const statuses = entries - .filter(([, provider]) => LOCAL_PROVIDERS.includes(provider.name)) - .map(async ([, provider]) => { - const envVarName = - provider.name.toLowerCase() === 'ollama' - ? 'OLLAMA_API_BASE_URL' - : provider.name.toLowerCase() === 'lmstudio' + const statuses = await Promise.all( + entries + .filter(([, provider]) => LOCAL_PROVIDERS.includes(provider.name)) + .map(async ([, provider]) => { + const envVarName = + provider.name.toLowerCase() === 'ollama' + ? 'OLLAMA_API_BASE_URL' + : provider.name.toLowerCase() === 'lmstudio' ? 'LMSTUDIO_API_BASE_URL' : `REACT_APP_${provider.name.toUpperCase()}_URL`; - // Access environment variables through import.meta.env - const url = import.meta.env[envVarName] || null; - console.log(`[Debug] Using URL for ${provider.name}:`, url, `(from ${envVarName})`); + // Access environment variables through import.meta.env + const url = import.meta.env[envVarName] || provider.settings.baseUrl || null; // Ensure baseUrl is used + console.log(`[Debug] Using URL for ${provider.name}:`, url, `(from ${envVarName})`); - const status = await checkProviderStatus(url, provider.name); + const status = await checkProviderStatus(url, provider.name); + return { + ...status, + enabled: provider.settings.enabled ?? false, + }; + }) + ); - return { - ...status, - enabled: provider.settings.enabled ?? false, - }; - }); - - Promise.all(statuses).then(setActiveProviders); + setActiveProviders(statuses); } catch (error) { console.error('[Debug] Failed to update provider statuses:', error); }