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:
Jin Hai
2026-06-25 13:41:58 +08:00
committed by GitHub
parent a6cc3023c5
commit 17b066e6ae
4 changed files with 62 additions and 12 deletions

View File

@@ -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)
}