From 972263d5236b392fc1a67b35227854ad1e257fd2 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Thu, 16 Apr 2026 21:30:33 +0200 Subject: [PATCH] Add model capabilities check and update UI based on support for vision --- src/App.jsx | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/App.jsx b/src/App.jsx index 926aee8..6ae427c 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -923,6 +923,42 @@ async function regenerateFromIndex(index, overrideUserText = null) { }; }, [activeSidebarMode]); + useEffect(() => { + let cancelled = false + const controller = new AbortController() + + if (!backendApiUrl || !model) { + setSelectedModelSupportsVision(false) + return () => { + controller.abort() + } + } + + ;(async () => { + try { + const data = await fetchModelCapabilities(model, controller.signal) + if (!cancelled) { + setSelectedModelSupportsVision(Boolean(data?.supports_vision)) + } + } catch (error) { + if (!cancelled && !isAbortError(error)) { + console.warn('Failed to load model capabilities', error) + setSelectedModelSupportsVision(false) + } + } + })() + + return () => { + cancelled = true + controller.abort() + } + }, [backendApiUrl, model]) + + useEffect(() => { + imageDragDepthRef.current = 0 + setIsChatDragActive(false) + }, [selectedModelSupportsVision, activeSidebarMode]) + useEffect(() => { if (!settingsLoaded || loading || !backendApiUrl || startupOllamaCheckRanRef.current) return startupOllamaCheckRanRef.current = true