Go CLI: update list supported models (#15845)

### What problem does this PR solve?

Now list supported models will show more info.

```
RAGFlow(api/default)> list supported models from 'gitee' 'test';
+-----------+------------+-------------+----------------------------------------------------------+---------------------------------------------+
| dimension | max_tokens | model_types | name                                                     | thinking                                    |
+-----------+------------+-------------+----------------------------------------------------------+---------------------------------------------+
|           |            |             | Wan2.7                                                   |                                             |
|           |            |             | HappyHorse-1.0                                           |                                             |
|           |            |             | Qwen3.6-27B@Qwen                                         |                                             |
|           |            |             | Qwen3.6-35B-A3B@Qwen                                     |                                             |
|           | 1048576    | [chat]      | DeepSeek-V4-Flash@deepseek-ai                            | map[clear_thinking:true default_value:true] |
|           | 1048576    | [chat]      | DeepSeek-V4-Pro@deepseek-ai                              | map[clear_thinking:true default_value:true] |
+-----------+------------+-------------+----------------------------------------------------------+---------------------------------------------+
```

### Type of change

- [x] New Feature (non-breaking change which adds functionality)

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-06-09 19:01:00 +08:00
committed by GitHub
parent f0efa63bf2
commit 719ce15c95
68 changed files with 357 additions and 258 deletions

View File

@@ -311,7 +311,7 @@ type perplexityModelListResponse struct {
Data []perplexityModelInfo `json:"data"`
}
func (p *PerplexityModel) ListModels(apiConfig *APIConfig) ([]string, error) {
func (p *PerplexityModel) ListModels(apiConfig *APIConfig) ([]ListModelResponse, error) {
if err := p.baseModel.APIConfigCheck(apiConfig); err != nil {
return nil, err
}
@@ -350,10 +350,10 @@ func (p *PerplexityModel) ListModels(apiConfig *APIConfig) ([]string, error) {
// or alternate payloads may return a bare array; accept both.
var wrapped perplexityModelListResponse
if err = json.Unmarshal(body, &wrapped); err == nil && len(wrapped.Data) > 0 {
models := make([]string, 0, len(wrapped.Data))
models := make([]ListModelResponse, 0, len(wrapped.Data))
for _, model := range wrapped.Data {
if model.ID != "" {
models = append(models, model.ID)
models = append(models, ListModelResponse{Name: model.ID})
}
}
return models, nil
@@ -363,10 +363,10 @@ func (p *PerplexityModel) ListModels(apiConfig *APIConfig) ([]string, error) {
if err = json.Unmarshal(body, &bare); err != nil {
return nil, fmt.Errorf("failed to parse response: %w", err)
}
models := make([]string, 0, len(bare))
models := make([]ListModelResponse, 0, len(bare))
for _, model := range bare {
if model.ID != "" {
models = append(models, model.ID)
models = append(models, ListModelResponse{Name: model.ID})
}
}
return models, nil