Add model capabilities check and update UI based on support for vision
This commit is contained in:
36
src/App.jsx
36
src/App.jsx
@@ -923,6 +923,42 @@ async function regenerateFromIndex(index, overrideUserText = null) {
|
|||||||
};
|
};
|
||||||
}, [activeSidebarMode]);
|
}, [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(() => {
|
useEffect(() => {
|
||||||
if (!settingsLoaded || loading || !backendApiUrl || startupOllamaCheckRanRef.current) return
|
if (!settingsLoaded || loading || !backendApiUrl || startupOllamaCheckRanRef.current) return
|
||||||
startupOllamaCheckRanRef.current = true
|
startupOllamaCheckRanRef.current = true
|
||||||
|
|||||||
Reference in New Issue
Block a user