From 1d2f5a3eedfd8b6d29b1c38e8e86a4a5bdfae223 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 2 Sep 2023 21:12:13 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(ChatProcess.py):=20add=20'fl?= =?UTF-8?q?ags=3Dre.UNICODE'=20to=20the=20re.sub()=20function=20to=20corre?= =?UTF-8?q?ctly=20handle=20non-ASCII=20characters=20in=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ChatProcess.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ChatProcess.py b/src/ChatProcess.py index e3ac3d8..65e4736 100644 --- a/src/ChatProcess.py +++ b/src/ChatProcess.py @@ -118,7 +118,7 @@ class Chat: 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) + name = re.sub(r"[^a-zA-Z0-9_-]", "", name, flags=re.UNICODE) if not await moderate(self.openai_api_key, msg.content): self.context.append( {