Go: add cli command, list dataset documents (#14948)

### What problem does this PR solve?
```
+---------------------+----------------------------------+-------------+-----------------+---------+--------+------+
| created_at          | id                               | meta_fields | name            | size    | status | type |
+---------------------+----------------------------------+-------------+-----------------+---------+--------+------+
| 2026-05-08 19:35:08 | f6aa38bb4ad111f1ba6338a74640adcc | map[]       |  abc.pdf        | 3387987 | 1      | pdf  |
+---------------------+----------------------------------+-------------+-----------------+---------+--------+------+
```

### 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-05-15 14:00:45 +08:00
committed by GitHub
parent 1a25191b13
commit 335dd5a263
12 changed files with 225 additions and 67 deletions

View File

@@ -136,6 +136,8 @@ func (p *Parser) parseListCommand() (*Command, error) {
return NewCommand("list_environments"), nil
case TokenDatasets:
return p.parseListDatasets()
case TokenDocuments:
return p.parseListDatasetDocuments()
case TokenAgents:
return p.parseListAgents()
case TokenTokens:
@@ -181,6 +183,31 @@ func (p *Parser) parseListDatasets() (*Command, error) {
return cmd, nil
}
func (p *Parser) parseListDatasetDocuments() (*Command, error) {
p.nextToken() // consume DOCUMENTS
if p.curToken.Type != TokenFrom {
return nil, fmt.Errorf("expected FROM")
}
p.nextToken()
datasetID, err := p.parseQuotedString()
if err != nil {
return nil, err
}
p.nextToken()
cmd := NewCommand("list_dataset_documents")
cmd.Params["dataset_id"] = datasetID
// Semicolon is optional for UNSET TOKEN
if p.curToken.Type == TokenSemicolon {
p.nextToken()
}
return cmd, nil
}
func (p *Parser) parseListAgents() (*Command, error) {
p.nextToken() // consume AGENTS