mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-06-29 15:31:05 +08:00
fix: strip Ollama-style tag suffix from LocalAI model names (#15908)
## Summary
LocalAI exposes two API surfaces with conflicting naming conventions:
- `GET /api/tags` returns model names with `:latest` suffix (Ollama
format)
- `POST /v1/chat/completions` expects names without `:latest` (OpenAI
format)
RAGFlow discovered models via `/api/tags` and stored the tagged name,
then used it with `/v1/chat/completions`, causing a 404 error because
LocalAI didn't recognize `model:latest`.
## Fix
In `LocalAI.get_model_list()`, strip the tag suffix from model names
using `model["name"].rsplit(":", 1)[0]`, so stored names match what the
OpenAI-compatible endpoints expect.
This commit is contained in:
@@ -259,7 +259,7 @@ class LocalAI(Base):
|
||||
context_length = model_info.get("model_info", {}).get("general.context_length", 8192)
|
||||
res.append(
|
||||
{
|
||||
"name": model["name"],
|
||||
"name": model["name"].rsplit(":", 1)[0],
|
||||
"model_types": [capability_to_model_type_mapping[c] for c in model_info.get("capabilities", []) if c in capability_to_model_type_mapping],
|
||||
"features": [capability_to_feature_mapping[c] for c in model_info.get("capabilities", []) if c in capability_to_feature_mapping],
|
||||
"max_tokens": context_length or 8192,
|
||||
|
||||
Reference in New Issue
Block a user