Go: add command, show tasks summary (#16187)

### What problem does this PR solve?

RAGFlow(admin)> show tasks summary;

+---------+-----------------------------------------------------------------+
| field | value |

+---------+-----------------------------------------------------------------+
| command | show_users_quota_summary |
| error | 'Show users quota summary' is implemented in enterprise
edition |

+---------+-----------------------------------------------------------------+

### 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-06-18 17:09:20 +08:00
committed by GitHub
parent 3762f1e573
commit 5eedd13d49
6 changed files with 82 additions and 0 deletions

View File

@@ -2172,6 +2172,36 @@ func (c *CLI) AdminShowQuotaSummaryCommand(cmd *Command) (ResponseIf, error) {
return &result, nil
}
func (c *CLI) AdminShowTasksSummaryCommand(cmd *Command) (ResponseIf, error) {
if c.Config.CLIMode != AdminMode || c.AdminServerClient.LoginToken == nil {
return nil, fmt.Errorf("this command is only allowed in ADMIN mode or already login")
}
apiURL := "/admin/ingestion/tasks/summary"
resp, err := c.AdminServerClient.Request("GET", apiURL, "admin", nil, nil)
if err != nil {
return nil, fmt.Errorf("failed to get users quota summary: %w", err)
}
if resp.StatusCode != 200 {
return nil, fmt.Errorf("failed to get users quota summary: HTTP %d, body: %s", resp.StatusCode, string(resp.Body))
}
var result CommonDataResponse
if err = json.Unmarshal(resp.Body, &result); err != nil {
return nil, fmt.Errorf("get users quota summary failed: invalid JSON (%w)", err)
}
if result.Code != 0 {
return nil, fmt.Errorf("%s", result.Message)
}
result.Duration = resp.Duration
return &result, nil
}
func (c *CLI) AdminPurgeOrphanCommand(cmd *Command) (ResponseIf, error) {
if c.Config.CLIMode != AdminMode || c.AdminServerClient.LoginToken == nil {