mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-05-28 11:43:06 +08:00
Closes #15040. ModelScope was listed unchecked in the Go-rewrite tracker #14736 and already had an llm_factories.json entry (tags: LLM) but no Go driver, so the new Go API server could not route ModelScope instances. The Python side has supported it through the OpenAI-compatible base at rag/llm/chat_model.py:618 (ModelScopeChat), which requires a user-supplied base URL and appends /v1. This adds: - internal/entity/models/modelscope.go: self-hosted OpenAI-compatible driver with chat (sync + SSE stream with idle-timeout cancellation), list_models, and check_connection. Auth header is optional, matching the xinference pattern, so deployments without auth and auth-enabled deployments both work. Base URL is normalized so users can configure either the root endpoint or the /v1 endpoint. - internal/entity/models/modelscope_test.go: 12 tests covering name, URL normalization, factory routing, chat happy path / auth header / reasoning_content extraction, stream happy path / stream=false rejection / idle cancellation, list_models + check_connection, missing-base-URL clear error, and the no-such-method sentinels. - conf/models/modelscope.json: shipped config (class: "local", url_suffix v1/chat/completions and v1/models). - internal/entity/models/factory.go: case "modelscope" → ModelScopeModel. - internal/service/llm.go: ModelScope added to the selfDeployed map alongside Ollama, Xinference, LocalAI, LM-Studio, GPUStack — the Python side requires user-supplied URL with no default, so the Go side classifies it the same way. Follow-on issues will add Embed and Rerank, in line with how Novita, NVIDIA, TogetherAI, and other providers landed method-by-method. --------- Co-authored-by: Jin Hai <haijin.chn@gmail.com>
9 lines
131 B
JSON
9 lines
131 B
JSON
{
|
|
"name": "modelscope",
|
|
"url_suffix": {
|
|
"chat": "v1/chat/completions",
|
|
"models": "v1/models"
|
|
},
|
|
"class": "local"
|
|
}
|