Skip to content

Commit

Permalink
fix(memory): add reply information to chat context
Browse files Browse the repository at this point in the history
  • Loading branch information
The0mikkel committed May 28, 2024
1 parent 633e279 commit 0e9fd93
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
6 changes: 5 additions & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ async def on_ready(self):
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:
Expand Down

0 comments on commit 0e9fd93

Please sign in to comment.