Add model reference and update vision model check

This commit is contained in:
2026-04-17 10:50:12 +02:00
parent 473ea4ac85
commit 8459ab1837

View File

@@ -396,6 +396,7 @@ export default function App() {
const [isChatDragActive, setIsChatDragActive] = useState(false)
const chatRef = useRef(null)
const textareaRef = useRef(null); // Ref for the textarea
const modelRef = useRef(model)
const dbPickerRef = useRef(null)
const chatModelPickerRef = useRef(null)
const imageInputRef = useRef(null)
@@ -574,7 +575,7 @@ export default function App() {
try {
const data = await fetchModelCapabilities(nextModel)
if (!data?.supports_vision) {
if (!data?.supports_vision || modelRef.current !== nextModel) {
return false
}
setVisionModel(nextModel)
@@ -1381,6 +1382,10 @@ async function regenerateFromIndex(index, overrideUserText = null) {
};
}, []);
useEffect(() => {
modelRef.current = model
}, [model])
useEffect(() => {
let cancelled = false
const controller = new AbortController()