From 1092f624fb90d3e3644f8a380990b4c5ed48fb6c Mon Sep 17 00:00:00 2001 From: Hz_ Date: Tue, 2 Jun 2026 13:39:07 +0800 Subject: [PATCH] fix: post /api/v1/system/tokens (#15410) ### What problem does this PR solve? This PR aligns `POST /api/v1/system/tokens` in Go with the Python implementation. ### Type of change - Keep the token creation flow under the system API route. - Preserve the owner-tenant authorization check. - Generate and persist API tokens consistently with the current Go service flow. - Return the created token payload in the standard API response format. Co-authored-by: Jin Hai --- internal/service/api_token.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/api_token.go b/internal/service/api_token.go index 8f90d7d5f0..30cf29f4aa 100644 --- a/internal/service/api_token.go +++ b/internal/service/api_token.go @@ -84,7 +84,7 @@ func (s *SystemService) CreateAPIToken(tenantID string, req *CreateAPITokenReque // token: "ragflow-" + secrets.token_urlsafe(32) APIToken := utility.GenerateAPIToken() // beta: generate_confirmation_token().replace("ragflow-", "")[:32] - betaAPIKey := utility.GenerateBetaAPIToken(APIToken) + betaAPIKey := utility.GenerateBetaAPIToken(utility.GenerateAPIToken()) APITokenData := &entity.APIToken{ TenantID: tenantID,