diff --git a/web/src/lib/const.ts b/web/src/lib/const.ts index 55515f2ae..5000d7a0b 100644 --- a/web/src/lib/const.ts +++ b/web/src/lib/const.ts @@ -1,3 +1,6 @@ +/** ONNX embedding models that require local model downloads. GenAI providers are not in this list. */ +export const JINA_EMBEDDING_MODELS = ["jinav1", "jinav2"] as const; + export const supportedLanguageKeys = [ "en", "es", diff --git a/web/src/pages/Explore.tsx b/web/src/pages/Explore.tsx index 8f50e982e..35860ed35 100644 --- a/web/src/pages/Explore.tsx +++ b/web/src/pages/Explore.tsx @@ -23,6 +23,7 @@ import { toast } from "sonner"; import useSWR from "swr"; import useSWRInfinite from "swr/infinite"; import { useDocDomain } from "@/hooks/use-doc-domain"; +import { JINA_EMBEDDING_MODELS } from "@/lib/const"; const API_LIMIT = 25; @@ -293,7 +294,12 @@ export default function Explore() { const modelVersion = config?.semantic_search.model || "jinav1"; const modelSize = config?.semantic_search.model_size || "small"; - // Text model state + // GenAI providers have no local models to download + const isGenaiEmbeddings = + typeof modelVersion === "string" && + !(JINA_EMBEDDING_MODELS as readonly string[]).includes(modelVersion); + + // Text model state (skipped for GenAI - no local models) const { payload: textModelState } = useModelState( modelVersion === "jinav1" ? "jinaai/jina-clip-v1-text_model_fp16.onnx" @@ -328,6 +334,10 @@ export default function Explore() { ); const allModelsLoaded = useMemo(() => { + if (isGenaiEmbeddings) { + return true; + } + return ( textModelState === "downloaded" && textTokenizerState === "downloaded" && @@ -335,6 +345,7 @@ export default function Explore() { visionFeatureExtractorState === "downloaded" ); }, [ + isGenaiEmbeddings, textModelState, textTokenizerState, visionModelState, @@ -358,10 +369,11 @@ export default function Explore() { !defaultViewLoaded || (config?.semantic_search.enabled && (!reindexState || - !textModelState || - !textTokenizerState || - !visionModelState || - !visionFeatureExtractorState)) + (!isGenaiEmbeddings && + (!textModelState || + !textTokenizerState || + !visionModelState || + !visionFeatureExtractorState)))) ) { return (