Harden Windows Ollama probing

This commit is contained in:
mmckeen-nv
2026-05-19 19:08:25 -07:00
parent 635cdae9a0
commit e0a0588659
2 changed files with 75 additions and 16 deletions
+6 -1
View File
@@ -88,6 +88,10 @@ function ollamaSourceSummary(models: OllamaModel[]) {
return Array.from(new Set(models.map((item) => item.hostLabel).filter(Boolean))).join(" + ")
}
function ollamaProbeSummary(labels: unknown) {
return Array.isArray(labels) ? labels.filter((item): item is string => typeof item === "string" && Boolean(item)).join(" + ") : ""
}
function VllmAdvancedConfiguration({
model,
port,
@@ -478,8 +482,9 @@ export default function InferenceEndpointPanel() {
}
const models = Array.isArray(data.models) ? data.models : []
const sources = ollamaSourceSummary(models)
const checked = ollamaProbeSummary(data.checkedHostLabels)
setOllamaModels(models)
setOllamaMessage(models.length > 0 ? `${models.length} Ollama model${models.length === 1 ? "" : "s"} available${sources ? ` from ${sources}` : ""}. Click one to load the Ollama endpoint preset.` : "Ollama is reachable but has no models installed.")
setOllamaMessage(models.length > 0 ? `${models.length} Ollama model${models.length === 1 ? "" : "s"} available${sources ? ` from ${sources}` : ""}${checked && checked !== sources ? `. Checked ${checked}.` : ""} Click one to load the Ollama endpoint preset.` : (checked ? `Checked ${checked}; no Ollama models reported.` : "Ollama is reachable but has no models installed."))
if (models[0]?.name) setModel((current) => current || models[0].name)
} catch (error) {
setOllamaModels([])