mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-31 02:02:48 +00:00
feat: Modify the dialogue apikey generation rules (#4582)
This commit is contained in:
parent
83a328df8e
commit
9586c1b6de
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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-')
|
||||
|
|
|
|||
Loading…
Reference in New Issue