From 9586c1b6deefcfdd4aa4065a2dc414603477b168 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 <80892890+shaohuzhang1@users.noreply.github.com> Date: Tue, 30 Dec 2025 10:43:47 +0800 Subject: [PATCH] feat: Modify the dialogue apikey generation rules (#4582) --- apps/application/serializers/application_api_key.py | 2 +- apps/common/auth/handle/impl/application_key.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/application/serializers/application_api_key.py b/apps/application/serializers/application_api_key.py index 510d1291d..e4fd787c4 100644 --- a/apps/application/serializers/application_api_key.py +++ b/apps/application/serializers/application_api_key.py @@ -47,7 +47,7 @@ class ApplicationKeySerializer(serializers.Serializer): self.is_valid(raise_exception=True) application_id = self.data.get("application_id") application = QuerySet(Application).filter(id=application_id).first() - secret_key = 'application-' + hashlib.md5(str(uuid.uuid7()).encode()).hexdigest() + secret_key = 'agent-' + hashlib.md5(str(uuid.uuid7()).encode()).hexdigest() application_api_key = ApplicationApiKey(id=uuid.uuid7(), secret_key=secret_key, user_id=application.user_id, diff --git a/apps/common/auth/handle/impl/application_key.py b/apps/common/auth/handle/impl/application_key.py index d4fa8933e..a13b8f336 100644 --- a/apps/common/auth/handle/impl/application_key.py +++ b/apps/common/auth/handle/impl/application_key.py @@ -39,4 +39,4 @@ class ApplicationKey(AuthBaseHandle): chat_user_type=ChatUserType.ANONYMOUS_USER.value) def support(self, request, token: str, get_token_details): - return str(token).startswith("application-") + return str(token).startswith("application-") or str(token).startswith('agent-')