mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-05-28 03:33:05 +08:00
### What problem does this PR solve? Fixes #14884 The ZhipuAI Go driver in `internal/entity/models/zhipu-ai.go` had a stub `ListModels` method that always returned `"zhipu-ai, no such method"`. The DeepSeek, Gitee, NVIDIA, OpenAI, SiliconFlow, and OpenRouter drivers in the same package already implement `ListModels` against the OpenAI-compatible `/models` endpoint, and the model picker UI relies on it. This PR brings ZhipuAI in line with that pattern. ### Changes - `internal/entity/models/zhipu-ai.go`: implement `ZhipuAIModel.ListModels`. - Resolve region with default fallback. - GET `${BaseURL[region]}/${URLSuffix.Models}` (resolves to `https://open.bigmodel.cn/api/paas/v4/models` with the default region). - Send `Authorization: Bearer <api_key>` when an API key is configured. Omit the header when the key is empty, so an unauthenticated caller gets a clear `401` from upstream. - Surface non-200 responses with the upstream status line and body, matching the other Go drivers. - Parse the response via the package-level `DSModelList` / `DSModel` types already used by DeepSeek, Gitee, and SiliconFlow. - When the response includes `owned_by`, render the entry as `id@owned_by`, matching the convention of Gitee and SiliconFlow. - `conf/models/zhipu-ai.json`: add `"models": "models"` to `url_suffix`. ### Type of change - [x] New Feature (non-breaking change which adds functionality)