mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-03 22:30:31 +08:00
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:
@@ -328,7 +328,7 @@ func (a *AstraflowModel) ChatStreamlyWithSender(modelName string, messages []Mes
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *AstraflowModel) ListModels(apiConfig *APIConfig) ([]string, error) {
|
||||
func (a *AstraflowModel) ListModels(apiConfig *APIConfig) ([]ListModelResponse, error) {
|
||||
if err := a.baseModel.APIConfigCheck(apiConfig); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -373,17 +373,21 @@ func (a *AstraflowModel) ListModels(apiConfig *APIConfig) ([]string, error) {
|
||||
return nil, fmt.Errorf("invalid models list format")
|
||||
}
|
||||
|
||||
models := make([]string, 0, len(data))
|
||||
models := make([]ListModelResponse, 0, len(data))
|
||||
var modelMap map[string]interface{}
|
||||
for _, m := range data {
|
||||
modelMap, ok := m.(map[string]interface{})
|
||||
modelMap, ok = m.(map[string]interface{})
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
id, ok := modelMap["id"].(string)
|
||||
var id string
|
||||
id, ok = modelMap["id"].(string)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
models = append(models, id)
|
||||
models = append(models, ListModelResponse{
|
||||
Name: id,
|
||||
})
|
||||
}
|
||||
return models, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user