mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 01:06:19 +00:00
🔧 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:
@@ -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(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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":
|
||||||
|
|||||||
Reference in New Issue
Block a user