🔧 fix(ChatProcess.py): remove debug print statements

🔧 fix(claude.py): update system message prompt to include explanation about the name in brackets
The debug print statements in ChatProcess.py have been removed to clean up the code and improve readability. In claude.py, the system message prompt has been updated to include an explanation about the name in brackets after "Human ", providing more context to the users.
This commit is contained in:
2023-11-02 17:26:15 +01:00
parent cd28e90226
commit 50c847d974
2 changed files with 6 additions and 1 deletions

View File

@@ -119,10 +119,15 @@ class Chat:
else: else:
role = "user" role = "user"
name = msg.author.display_name or msg.author.global_name or msg.author.name name = msg.author.display_name or msg.author.global_name or msg.author.name
print(f"""Global name: {msg.author.global_name}
Display name: {msg.author.display_name}
Name: {msg.author.name}""")
# use re not make name match ^[a-zA-Z0-9_-]{1,64}$ by removing all non-alphanumeric characters # 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, flags=re.UNICODE) name = re.sub(r"[^a-zA-Z0-9_-]", "", name, flags=re.UNICODE)
print(f"Name after regex: {name}")
if name == "": if name == "":
name = msg.author.name name = msg.author.name
print(f"Name after regex: {name}")
if not await moderate(self.openai_api_key, msg.content): if not await moderate(self.openai_api_key, msg.content):
self.context.append( self.context.append(
{ {

View File

@@ -13,7 +13,7 @@ async def claude(messages):
prompt = "" prompt = ""
for message in messages: for message in messages:
if message["role"] == "system": if message["role"] == "system":
prompt += f"{HUMAN_PROMPT} {message['content']}" prompt += f"{HUMAN_PROMPT} The name in brackets after \"Human \" is the username of the person sending the message\n{message['content']}"
elif message["role"] == "assistant": elif message["role"] == "assistant":
prompt += f"{AI_PROMPT} {message['content']}" prompt += f"{AI_PROMPT} {message['content']}"
elif message["role"] == "user": elif message["role"] == "user":