mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-11 14:15:40 +08:00
Go: add show users plan quota (#16818)
### Summary ``` RAGFlow(admin)> show users plan quota 100; +---------+------------------------------------------+ | field | value | +---------+------------------------------------------+ | quota | 100 | | command | show_users_plan_quota | | error | 'Show users plan quota' is not supported | +---------+------------------------------------------+ ``` Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -1678,7 +1678,7 @@ func (c *CLI) AdminShowUsersActivityCommand(cmd *Command) (ResponseIf, error) {
|
||||
return HandleCommonDataResponse(resp, "get users activity")
|
||||
}
|
||||
|
||||
func (c *CLI) AdminShowUsersPlanCommand(cmd *Command) (ResponseIf, error) {
|
||||
func (c *CLI) AdminShowUsersPlanSummaryCommand(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")
|
||||
@@ -1694,6 +1694,27 @@ func (c *CLI) AdminShowUsersPlanCommand(cmd *Command) (ResponseIf, error) {
|
||||
return HandleCommonDataResponse(resp, "get users plan")
|
||||
}
|
||||
|
||||
func (c *CLI) AdminShowUsersPlanQuotaCommand(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")
|
||||
}
|
||||
|
||||
quota, ok := cmd.Params["quota"].(int)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("quota not provided")
|
||||
}
|
||||
|
||||
apiURL := fmt.Sprintf("/admin/users/plan?quota=%d", quota)
|
||||
|
||||
resp, err := c.AdminServerClient.Request("GET", apiURL, "admin", nil, nil)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get users plan quota: %w", err)
|
||||
}
|
||||
|
||||
return HandleCommonDataResponse(resp, "get users plan quota")
|
||||
}
|
||||
|
||||
// ListUsers lists all users (admin mode only)
|
||||
// Returns (result_map, error) - result_map is non-nil for benchmark mode
|
||||
func (c *CLI) AdminListUsersCommand(cmd *Command) (ResponseIf, error) {
|
||||
|
||||
Reference in New Issue
Block a user