feat(frontend): auto-detect vision models via backend, separate search filter from model classification

This commit is contained in:
Roland Tannous 2026-02-16 18:18:28 +00:00
commit 09f3b6bce5
7 changed files with 68 additions and 7 deletions

View file

@ -0,0 +1,21 @@
import { authFetch } from "@/features/auth";
interface VisionCheckResponse {
model_name: string;
is_vision: boolean;
}
/**
* Check whether a model is a vision model by asking the backend.
* Calls GET /api/models/check-vision/{model_name}.
*/
export async function checkVisionModel(modelName: string): Promise<boolean> {
const encoded = encodeURIComponent(modelName);
const response = await authFetch(`/api/models/check-vision/${encoded}`);
if (!response.ok) {
// If the check fails (e.g. network error), default to non-vision
return false;
}
const data = (await response.json()) as VisionCheckResponse;
return data.is_vision;
}