🔧 chore(ChatProcess.py): use regular expression to remove non-alphanumeric characters from name to ensure it matches the required pattern

This commit is contained in:
2023-08-23 15:22:15 +02:00
parent 591b918c9f
commit 119d791820

View File

@@ -117,6 +117,8 @@ class Chat:
else:
role = "user"
name = msg.author.global_name
# use re not make name match ^[a-zA-Z0-9_-]{1,64}$ by removing all non-alphanumeric characters
name = re.sub(r"[^a-zA-Z0-9_-]", "", name)
if not await moderate(self.openai_api_key, msg.content):
self.context.append(
{