mishl-dev / Discord-AI-Chatbot

This Discord chatbot is incredibly versatile. Powered incredibly fast Groq API
GNU Affero General Public License v3.0
1.32k stars 417 forks source link

Responses getting cut off and bot only replying to older messages when using custom instruction file on Claude API #255

Closed joep1000 closed 7 months ago

joep1000 commented 7 months ago

Hi! I have been happily using your Discord bot and have noticed an issue with the bot's responses. The problem occurs when I ask the bot a question with the Claude API (claude-3-opus-20240229, but it happens with every variant of the claude models i've tried) and a custom instruction file. First, it provides a good response. However, when I ask a follow-up question, the bot's response gets cut off, and it seems to reply only to older messages instead of the most recent one and ignores your new request entirely. This does not occur when I use another API like gpt-4-turbo.

An example: I ask the bot: "Is the ACER Nitro N50-650 Gaming PC - Intel® Core™ i5, RTX 4060, 1 TB SSD good for gaming and game development?" Claude provides a good answer to this question. I then ask a different question, but the bot's response is cut off, and it only replies to the older message about the gaming PC, even though the new question was sent successfully. I think it's an issue with how the bot handles the conversation history or processes subsequent questions. The responses are getting truncated, and the bot is getting confused, replying to older messages instead of the most recent one. Might be related to the on_message event in the main.py file, specifically in how the responses are generated and sent back.

I have included some screenshots of what I mean. First screenshot: good reply

Screenshot 2024-03-25 at 21 57 48

Second screenshot: old/bad reply to a different question that is related to the custom instructions file.

Screenshot 2024-03-25 at 21 57 56

Third screenshot: the correct reply that I specified in the custom instruction file after I asked the bot the same question a second time via claude.

Screenshot 2024-03-25 at 21 58 03
joep1000 commented 7 months ago
Screenshot 2024-03-25 at 22 03 09

The reply from Claude is also cut off at the end sometimes, as you can see here the discord emote specified in the custom instructions file is not completed by Claude

mishl-dev commented 7 months ago

discord message character limit i will try make it split the message and not cut of characters