mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-30 12:39:27 +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:
@@ -244,16 +244,18 @@ type cometapiModelCatalogItem struct {
|
||||
ID string `json:"id"`
|
||||
}
|
||||
|
||||
func parseCometAPIModelCatalog(body []byte) ([]string, error) {
|
||||
func parseCometAPIModelCatalog(body []byte) ([]ListModelResponse, error) {
|
||||
var parsed cometapiModelCatalogResponse
|
||||
if err := json.Unmarshal(body, &parsed); err != nil {
|
||||
return nil, fmt.Errorf("failed to parse response: %w", err)
|
||||
}
|
||||
|
||||
models := make([]string, 0, len(parsed.Data))
|
||||
models := make([]ListModelResponse, 0, len(parsed.Data))
|
||||
for _, model := range parsed.Data {
|
||||
if model.ID != "" {
|
||||
models = append(models, model.ID)
|
||||
models = append(models, ListModelResponse{
|
||||
Name: model.ID,
|
||||
})
|
||||
}
|
||||
}
|
||||
return models, nil
|
||||
@@ -498,7 +500,7 @@ func (c *CometAPIModel) Embed(modelName *string, texts []string, apiConfig *APIC
|
||||
}
|
||||
|
||||
// ListModels returns the public CometAPI model catalog.
|
||||
func (c *CometAPIModel) ListModels(apiConfig *APIConfig) ([]string, error) {
|
||||
func (c *CometAPIModel) ListModels(apiConfig *APIConfig) ([]ListModelResponse, error) {
|
||||
url, err := c.endpointURL(cometapiRegion(apiConfig), c.baseModel.URLSuffix.Models)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user