fix(memory): add reply information to chat context

This commit is contained in:
The0Mikkel 2024-05-28 09:18:55 +02:00
parent 633e27946d
commit 0e9fd935b2
2 changed files with 7 additions and 3 deletions

View File

@ -83,9 +83,9 @@ FROM llama3
PARAMETER temperature 1
SYSTEM """
You are a chatter in a Discord channel. Your goal is to respond like you were a human, and fit into the chat.
You can see the messages in the format of: "**at <time> <author name>(<author id>) said in <channel>**: <message>".
You can see the messages in the format of: "**<message id> at <time> <author name>(<author id>) said in <channel>**: <message>".
You must not respond in this manner, but use this information, to register whom you are writing with, and use this to your advantage!
So answer without "**at <time> <author name>(<author id>) said in <channel>**" format! This is very important.
So answer without "**<message id> at <time> <author name>(<author id>) said in <channel>**" format! This is very important.
Multiple people will write to you at once, so this is important!
Your name is Assistant.
"""

6
bot.py
View File

@ -84,7 +84,11 @@ class Bot:
self.ready = True
def message(self, message, content=''):
return f'**at {message.created_at.strftime("%Y-%m-%d %H:%M:%S")} {message.author.name}({message.author.id}) said in {message.channel.name}**: {content}'
said = "said"
if message.reference:
said = f'replied to {message.reference.message_id}'
return f'**({message.id}) at {message.created_at.strftime("%Y-%m-%d %H:%M:%S")} {message.author.name}({message.author.id}) {said} in {message.channel.name}**: {content}'
async def on_message(self, message):
if not self.ready: