Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

CLI: add show quota (#21243)

Jin Hai3f3f588abe79
diff --git a/internal/cli/cli_http.go b/internal/cli/cli_http.go
index e6ea79c889..91deb0f7a9 100644
--- a/internal/cli/cli_http.go
+++ b/internal/cli/cli_http.go
@@ -514,6 +514,8 @@ func (c *CLI) ExecuteUserCommand(commandCount int, cmd *Command) (ResponseIf, er
return c.APIShowMemoryCommand(commandCount, cmd)
case "api_show_concurrency":
return c.APIShowConcurrencyCommand(commandCount, cmd)
+ case "api_show_quota":
+ return c.APIShowQuotaCommand(commandCount, cmd)
case "api_list_api_servers":
return c.CommonListAPIServersCommand(commandCount, cmd)
case "api_list_environments":
diff --git a/internal/cli/user_command.go b/internal/cli/user_command.go
index 7b5e0e40d7..4830a94772 100644
--- a/internal/cli/user_command.go
+++ b/internal/cli/user_command.go
@@ -3921,3 +3921,17 @@ func (c *CLI) APIShowConcurrencyCommand(commandCount int, cmd *Command) (Respons
return HandleCommonDataResponse(resp, "get concurrency")
}
+
+func (c *CLI) APIShowQuotaCommand(commandCount int, cmd *Command) (ResponseIf, error) {
+ httpClient, err := c.apiModeClient()
+ if err != nil {
+ return nil, err
+ }
+
+ resp, err := httpClient.Request(commandCount, "GET", "/system/quota", httpClient.AuthKind(), nil, nil)
+ if err != nil {
+ return nil, fmt.Errorf("failed to get quota: %w", err)
+ }
+
+ return HandleCommonDataResponse(resp, "get quota")
+}
diff --git a/internal/cli/user_parser.go b/internal/cli/user_parser.go
index fd9dc8b7b1..d1a8633817 100644
--- a/internal/cli/user_parser.go
+++ b/internal/cli/user_parser.go
@@ -639,6 +639,8 @@ func (p *Parser) parseAPIShowCommands() (*Command, error) {
return p.parseAPIShowMemory()
case TokenConcurrency:
return p.parseAPIShowConcurrency()
+ case TokenQuota:
+ return p.parseAPIShowQuota()
default:
return nil, fmt.Errorf("unknown SHOW target: %s", p.curToken.Value)
}
@@ -952,6 +954,19 @@ func (p *Parser) parseAPIShowConcurrency() (*Command, error) {
return cmd, nil
}
+// SHOW QUOTA
+func (p *Parser) parseAPIShowQuota() (*Command, error) {
+ p.nextToken() // consume QUOTA
+ cmd := NewCommand("api_show_quota")
+
+ // Semicolon is optional
+ if p.curToken.Type == TokenSemicolon {
+ p.nextToken()
+ }
+
+ return cmd, nil
+}
+
// endregion SHOW commands
// region CREATE commands
diff --git a/internal/handler/system_ee.go b/internal/handler/system_ee.go
index 520a27e4b7..e253bd6c90 100644
--- a/internal/handler/system_ee.go
+++ b/internal/handler/system_ee.go
@@ -60,3 +60,8 @@ func (h *SystemHandler) GetConcurrency(c *gin.Context) {
func (h *SystemHandler) SetConcurrency(c *gin.Context) {
common.ErrorWithCode(c, common.CodeNotImplemented, "Set concurrency not implemented")
}
+
+// GetQuota /api/v1/system/quota [GET]
+func (h *SystemHandler) GetQuota(c *gin.Context) {
+ common.ErrorWithCode(c, common.CodeNotImplemented, "Get quota not implemented")
+}
diff --git a/internal/router/router.go b/internal/router/router.go
index 288f061aec..ffe5e77b50 100644
--- a/internal/router/router.go
+++ b/internal/router/router.go
@@ -687,6 +687,7 @@ func (r *Router) Setup(engine *gin.Engine) {
system.PUT("/memory", r.systemHandler.SetMemory)
system.GET("/concurrency", r.systemHandler.GetConcurrency)
system.PUT("/concurrency", r.systemHandler.SetConcurrency)
+ system.GET("/quota", r.systemHandler.GetQuota)
}
// Chat Channel