mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-15 17:30:13 +08:00
* fix(agent): improve send_message_to_user tool description to prevent misuse Fixes #6402 The AI was inappropriately using send_message_to_user tool in normal conversations for text replies, causing duplicate messages (once via tool, once via normal response). Root cause: Tool description was not clear enough about when to use it. Changes: - Restructure description with clear sections using markdown - Emphasize two valid use cases: 1. Sending media files (image, record, video, file) in any conversation 2. Proactive messaging scenarios (cron jobs, background tasks) - Add explicit warning: Do NOT use for normal text replies - Explain consequence: Using for text causes duplicate messages This approach (better documentation) is safer than restricting tool registration, which would break media file sending in normal conversations. Alternative to PR #6413 which was closed due to breaking media delivery. * fix: correct syntax error and use triple-quoted string for description Address review feedback: - P0: Add missing closing parenthesis (was causing SyntaxError on import) - Use triple-quoted string for better readability (suggested by gemini-code-assist) - Remove explicit newline characters, let Python handle line breaks --------- Co-authored-by: ccsang <ccsang@users.noreply.github.com>