diff --git a/app/components/@settings/tabs/debug/DebugTab.tsx b/app/components/@settings/tabs/debug/DebugTab.tsx index 75be68c5..e31ae473 100644 --- a/app/components/@settings/tabs/debug/DebugTab.tsx +++ b/app/components/@settings/tabs/debug/DebugTab.tsx @@ -238,7 +238,7 @@ export default function DebugTab() { performance: false, }); - const { isLocalModel, providers } = useSettings(); + const { providers } = useSettings(); // Subscribe to logStore updates const logs = useStore(logStore.logs); @@ -1135,16 +1135,22 @@ export default function DebugTab() { } }, [providers]); - // Monitor isLocalModel changes and check status periodically + // Monitor Ollama provider status and check periodically useEffect(() => { - // Check immediately when isLocalModel changes - checkOllamaStatus(); + const ollamaProvider = providers?.Ollama; - // Set up periodic checks every 10 seconds - const intervalId = setInterval(checkOllamaStatus, 10000); + if (ollamaProvider?.settings?.enabled) { + // Check immediately when provider is enabled + checkOllamaStatus(); - return () => clearInterval(intervalId); - }, [isLocalModel, checkOllamaStatus]); + // Set up periodic checks every 10 seconds + const intervalId = setInterval(checkOllamaStatus, 10000); + + return () => clearInterval(intervalId); + } + + return undefined; + }, [providers, checkOllamaStatus]); // Replace the existing export button with this new component const ExportButton = () => { @@ -1222,15 +1228,6 @@ export default function DebugTab() { const ollamaProvider = providers?.Ollama; const isOllamaEnabled = ollamaProvider?.settings?.enabled; - if (!isLocalModel) { - return { - status: 'Disabled', - color: 'text-red-500', - bgColor: 'bg-red-500', - message: 'Local models are disabled in settings', - }; - } - if (!isOllamaEnabled) { return { status: 'Disabled', diff --git a/app/lib/hooks/useSettings.ts b/app/lib/hooks/useSettings.ts index 12338248..c04384df 100644 --- a/app/lib/hooks/useSettings.ts +++ b/app/lib/hooks/useSettings.ts @@ -2,8 +2,6 @@ import { useStore } from '@nanostores/react'; import { isDebugMode, isEventLogsEnabled, - isLocalModelsEnabled, - LOCAL_PROVIDERS, promptStore, providersStore, latestBranchStore, @@ -17,7 +15,6 @@ import { updateAutoSelectTemplate, updateContextOptimization, updateEventLogs, - updateLocalModels, updatePromptId, } from '~/lib/stores/settings'; import { useCallback, useEffect, useState } from 'react'; @@ -49,8 +46,6 @@ export interface UseSettingsReturn { providers: Record; activeProviders: ProviderInfo[]; updateProviderSettings: (provider: string, config: IProviderSetting) => void; - isLocalModel: boolean; - enableLocalModels: (enabled: boolean) => void; // Debug and development settings debug: boolean; @@ -81,7 +76,6 @@ export function useSettings(): UseSettingsReturn { const debug = useStore(isDebugMode); const eventLogs = useStore(isEventLogsEnabled); const promptId = useStore(promptStore); - const isLocalModel = useStore(isLocalModelsEnabled); const isLatestBranch = useStore(latestBranchStore); const autoSelectTemplate = useStore(autoSelectStarterTemplate); const [activeProviders, setActiveProviders] = useState([]); @@ -100,16 +94,12 @@ export function useSettings(): UseSettingsReturn { }); useEffect(() => { - let active = Object.entries(providers) + const active = Object.entries(providers) .filter(([_key, provider]) => provider.settings.enabled) .map(([_k, p]) => p); - if (!isLocalModel) { - active = active.filter((p) => !LOCAL_PROVIDERS.includes(p.name)); - } - setActiveProviders(active); - }, [providers, isLocalModel]); + }, [providers]); const saveSettings = useCallback((newSettings: Partial) => { setSettings((prev) => { @@ -135,11 +125,6 @@ export function useSettings(): UseSettingsReturn { logStore.logSystem(`Event logs ${enabled ? 'enabled' : 'disabled'}`); }, []); - const enableLocalModels = useCallback((enabled: boolean) => { - updateLocalModels(enabled); - logStore.logSystem(`Local models ${enabled ? 'enabled' : 'disabled'}`); - }, []); - const setPromptId = useCallback((id: string) => { updatePromptId(id); logStore.logSystem(`Prompt template updated to ${id}`); @@ -205,8 +190,6 @@ export function useSettings(): UseSettingsReturn { providers, activeProviders, updateProviderSettings, - isLocalModel, - enableLocalModels, debug, enableDebugMode, eventLogs, diff --git a/app/lib/stores/settings.ts b/app/lib/stores/settings.ts index f989fbcb..ccd3e2b1 100644 --- a/app/lib/stores/settings.ts +++ b/app/lib/stores/settings.ts @@ -129,7 +129,6 @@ const SETTINGS_KEYS = { AUTO_SELECT_TEMPLATE: 'autoSelectTemplate', CONTEXT_OPTIMIZATION: 'contextOptimizationEnabled', EVENT_LOGS: 'isEventLogsEnabled', - LOCAL_MODELS: 'isLocalModelsEnabled', PROMPT_ID: 'promptId', DEVELOPER_MODE: 'isDeveloperMode', } as const; @@ -159,7 +158,6 @@ const getInitialSettings = () => { autoSelectTemplate: getStoredBoolean(SETTINGS_KEYS.AUTO_SELECT_TEMPLATE, true), contextOptimization: getStoredBoolean(SETTINGS_KEYS.CONTEXT_OPTIMIZATION, true), eventLogs: getStoredBoolean(SETTINGS_KEYS.EVENT_LOGS, true), - localModels: getStoredBoolean(SETTINGS_KEYS.LOCAL_MODELS, false), promptId: isBrowser ? localStorage.getItem(SETTINGS_KEYS.PROMPT_ID) || 'default' : 'default', developerMode: getStoredBoolean(SETTINGS_KEYS.DEVELOPER_MODE, false), }; @@ -172,7 +170,6 @@ export const latestBranchStore = atom(initialSettings.latestBranch); export const autoSelectStarterTemplate = atom(initialSettings.autoSelectTemplate); export const enableContextOptimizationStore = atom(initialSettings.contextOptimization); export const isEventLogsEnabled = atom(initialSettings.eventLogs); -export const isLocalModelsEnabled = atom(initialSettings.localModels); export const promptStore = atom(initialSettings.promptId); // Helper functions to update settings with persistence @@ -196,11 +193,6 @@ export const updateEventLogs = (enabled: boolean) => { localStorage.setItem(SETTINGS_KEYS.EVENT_LOGS, JSON.stringify(enabled)); }; -export const updateLocalModels = (enabled: boolean) => { - isLocalModelsEnabled.set(enabled); - localStorage.setItem(SETTINGS_KEYS.LOCAL_MODELS, JSON.stringify(enabled)); -}; - export const updatePromptId = (id: string) => { promptStore.set(id); localStorage.setItem(SETTINGS_KEYS.PROMPT_ID, id);