mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-21 15:11:08 +08:00
Go CLI: fix list dataset files by dataset name (#16341)
### What problem does this PR solve? ``` RAGFlow(api/default)> list dataset 'ccc' files; Total: 1 ``` ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -1583,3 +1583,17 @@ func (c *CLI) UseAdminServer(cmd *Command) (ResponseIf, error) {
|
||||
result.Duration = 0
|
||||
return &result, nil
|
||||
}
|
||||
|
||||
func (c *CLI) getDatasetIDByName(datasetName string) (string, error) {
|
||||
response, err := c.APIListDatasetsCommand(nil)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
commonResponse := response.(*CommonResponse)
|
||||
for _, dataset := range commonResponse.Data {
|
||||
if dataset["name"] == datasetName {
|
||||
return dataset["id"].(string), nil
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("dataset %s not found", datasetName)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user