RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Go: update EE interface (#21056)
Jin Hai5124117e5419
diff --git a/internal/admin/handler_ee.go b/internal/admin/handler_ee.goindex 163738ab40..b15fdbc0d3 100644--- a/internal/admin/handler_ee.go+++ b/internal/admin/handler_ee.go@@ -791,12 +791,12 @@ func (h *Handler) SetSystemLicense(c *gin.Context) {}ctx := c.Request.Context()- err := h.service.SetSystemLicense(ctx, req.License)+ result, err := h.service.SetSystemLicense(ctx, req.License)if err != nil {common.ErrorWithCode(c, common.CodeServerError, err.Error())return}- common.SuccessWithData(c, nil, "System license set successfully")+ common.SuccessWithData(c, result, "System license set successfully")}// ShowSystemLicense to get system license@@ -812,13 +812,32 @@ func (h *Handler) ShowSystemLicense(c *gin.Context) {}ctx := c.Request.Context()- systemLicense, err := h.service.ShowSystemLicense(ctx, checkFlag)- if err != nil {- common.ErrorWithCode(c, common.CodeServerError, err.Error())- return+ var result map[string]interface{}+ if checkFlag {+ result, err = h.service.CheckSystemLicense(ctx)+ if err != nil {+ common.ErrorWithCode(c, common.CodeServerError, err.Error())+ return+ }+ } else {+ var license string+ license, ok = c.GetQuery("license")+ if !ok {+ // Show license+ result, err = h.service.ShowSystemLicense(ctx)+ if err != nil {+ common.ErrorWithCode(c, common.CodeServerError, err.Error())+ return+ }+ }+ // Verify license+ result, err = h.service.VerifyLicense(ctx, license)+ if err != nil {+ common.ErrorWithCode(c, common.CodeServerError, err.Error())+ return+ }}-- common.SuccessWithData(c, systemLicense, "")+ common.SuccessNoMessage(c, result)}type SetSystemLicenseConfigRequest struct {diff --git a/internal/admin/service_ee.go b/internal/admin/service_ee.goindex 95830ce22d..5aa2485e9e 100644--- a/internal/admin/service_ee.go+++ b/internal/admin/service_ee.go@@ -378,23 +378,35 @@ func (s *Service) GetSystemFingerprint(ctx context.Context) (map[string]interfacreturn result, nil}-func (s *Service) SetSystemLicense(ctx context.Context, license string) error {- return errors.New("'set system license' is not supported")+func (s *Service) SetSystemLicense(ctx context.Context, licenseStr string) (map[string]interface{}, error) {+ return nil, errors.New("'set system license' is not supported")}-func (s *Service) ShowSystemLicense(ctx context.Context, check bool) (map[string]interface{}, error) {+func (s *Service) ShowSystemLicense(ctx context.Context) (map[string]interface{}, error) {var result map[string]interface{}- if check {- result = map[string]interface{}{- "command": "check_system_license",- "error": "'check system license' is not supported",- }+ result = map[string]interface{}{+ "command": "show_system_license",+ "error": "'show system license' is not supported",+ }- } else {- result = map[string]interface{}{- "command": "show_system_license",- "error": "'show system license' is not supported",- }+ return result, nil+}++func (s *Service) VerifyLicense(ctx context.Context, licenseStr string) (map[string]interface{}, error) {+ var result map[string]interface{}+ result = map[string]interface{}{+ "command": "verify_license",+ "error": "'verify license' is not supported",+ }++ return result, nil+}++func (s *Service) CheckSystemLicense(ctx context.Context) (map[string]interface{}, error) {+ var result map[string]interface{}+ result = map[string]interface{}{+ "command": "check_system_license",+ "error": "'check system license' is not supported",}return result, nildiff --git a/internal/cli/admin_command.go b/internal/cli/admin_command.goindex 551df0fc76..aaa4beb350 100644--- a/internal/cli/admin_command.go+++ b/internal/cli/admin_command.go@@ -1320,6 +1320,26 @@ func (c *CLI) AdminCheckLicenseCommand(commandCount int, cmd *Command) (Responsereturn HandleCommonDataResponse(resp, "check license")}+func (c *CLI) AdminVerifyLicenseCommand(commandCount int, 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")+ }++ licenseStr, ok := cmd.Params["license"].(string)+ if !ok {+ return nil, fmt.Errorf("license not provided")+ }++ apiURL := fmt.Sprintf("/admin/system/license?license=%s", licenseStr)++ resp, err := c.AdminServerClient.Request(commandCount, "GET", apiURL, "admin", nil, nil)+ if err != nil {+ return nil, fmt.Errorf("failed to verify license: %w", err)+ }++ return HandleCommonDataResponse(resp, "verify license")+}+// AdminShowFingerprintCommand show fingerprint command (admin mode only)func (c *CLI) AdminShowFingerprintCommand(commandCount int, cmd *Command) (ResponseIf, error) {if c.Config.CLIMode != AdminMode || c.AdminServerClient.LoginToken == nil {diff --git a/internal/cli/admin_parser.go b/internal/cli/admin_parser.goindex 3ea4f462b3..79055cfe46 100644--- a/internal/cli/admin_parser.go+++ b/internal/cli/admin_parser.go@@ -1133,13 +1133,29 @@ func (p *Parser) parseAdminCheck() (*Command, error) {// CHECK LICENSE;func (p *Parser) parseAdminCheckLicense() (*Command, error) {p.nextToken() // consume LICENSE- cmd := NewCommand("admin_check_license")- // Semicolon is optional- if p.curToken.Type == TokenSemicolon {+ switch p.curToken.Type {+ case TokenSemicolon:+ p.nextToken()+ return NewCommand("admin_check_license"), nil+ case TokenEOF:+ return NewCommand("admin_check_license"), nil+ case TokenQuotedString:+ licenseStr, err := p.parseQuotedString()+ if err != nil {+ return nil, err+ }+ cmd := NewCommand("admin_verify_license")+ cmd.Params["license"] = licenseStrp.nextToken()+ // Semicolon is optional+ if p.curToken.Type == TokenSemicolon {+ p.nextToken()+ }+ return cmd, nil+ default:+ return nil, fmt.Errorf("error check license command")}- return cmd, nil}// CHECK PROVIDER 'provider_name' REGION 'region_name' KEY 'api_key' [URL 'base_url'];diff --git a/internal/cli/cli_http.go b/internal/cli/cli_http.goindex 4d3c1a0e4a..e6ea79c889 100644--- a/internal/cli/cli_http.go+++ b/internal/cli/cli_http.go@@ -173,6 +173,8 @@ func (c *CLI) ExecuteAdminCommand(commandCount int, cmd *Command) (ResponseIf, ereturn c.UserShowMessageQueueCommand(commandCount, cmd)case "admin_check_license":return c.AdminCheckLicenseCommand(commandCount, cmd)+ case "admin_verify_license":+ return c.AdminVerifyLicenseCommand(commandCount, cmd)case "admin_check_provider_with_key":return c.CommonCheckProviderWithKeyCommand(commandCount, cmd)case "admin_check_provider_instance":