Files
LocalAI/core/http
Ettore Di Giacinto 7b451058cc fix(api): return 404 for unknown weight-file model names instead of gallery fallthrough
The model-existence guard in SetModelAndConfig skipped the check for any
model name containing "/", to let diffusers-style HuggingFace "org/repo"
IDs download on the fly. But a name like "local/model.gguf" (the
parameters.model weight path, mistakenly passed as the request model)
also contains "/", so it bypassed the guard and silently fell through to
the gallery autoloader, which then attempted a surprising HuggingFace
download (issue #10162).

Tighten the guard so it only treats a "/"-containing name as a remote ID
when it does NOT end in a recognized model-file extension. Names that
point at a concrete weight file are now verified like any other, so a
wrong name returns a clear 404 while a loose weight file addressed by its
relative path (resolved by CheckIfModelExists against the models dir)
still passes.

The extension check reuses pkg/model's known-suffix list via the new
HasKnownModelFileExtension helper, so version-style suffixes like the
".0" in "stabilityai/stable-diffusion-xl-base-1.0" are correctly treated
as remote IDs.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Assisted-by: Claude:claude-opus-4-8 [Claude Code]
2026-06-04 08:24:19 +00:00
..
2026-03-30 00:47:27 +02:00