From d6f74a8493597fb31f4412a76d6b9abca226b5cf Mon Sep 17 00:00:00 2001 From: LIghtJUNction Date: Mon, 23 Mar 2026 02:58:09 +0800 Subject: [PATCH] feat(tui): add support for tool and reasoning message types - Add additionalProperties to message schema for flexibility - Add TOOL_MSG and REASONING_MSG color pairs for visual distinction --- astrbot/core/tools/send_message.py | 1 + astrbot/tui/screen.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/astrbot/core/tools/send_message.py b/astrbot/core/tools/send_message.py index 54538168f..586cd9101 100644 --- a/astrbot/core/tools/send_message.py +++ b/astrbot/core/tools/send_message.py @@ -49,6 +49,7 @@ class SendMessageToUserTool(FunctionTool[AstrAgentContext]): "description": "An ordered list of message components to send. `mention_user` type can be used to mention the user.", "items": { "type": "object", + "additionalProperties": {}, "properties": { "type": { "type": "string", diff --git a/astrbot/tui/screen.py b/astrbot/tui/screen.py index 1d8791791..3e298bc1b 100644 --- a/astrbot/tui/screen.py +++ b/astrbot/tui/screen.py @@ -24,6 +24,8 @@ class ColorPair(Enum): INPUT_BG = 14 STATUS_BG = 15 BORDER = 16 + TOOL_MSG = 17 + REASONING_MSG = 18 _COLOR_MAP = { @@ -42,6 +44,8 @@ _COLOR_MAP = { ColorPair.INPUT_BG: curses.COLOR_BLACK, ColorPair.STATUS_BG: curses.COLOR_BLUE, ColorPair.BORDER: curses.COLOR_CYAN, + ColorPair.TOOL_MSG: curses.COLOR_MAGENTA, + ColorPair.REASONING_MSG: curses.COLOR_BLUE, } # Box drawing characters @@ -203,6 +207,12 @@ class Screen: elif sender == "bot": indicator = "✦" color = self.get_color(ColorPair.BOT_MSG) + elif sender == "tool": + indicator = "⚙" + color = self.get_color(ColorPair.TOOL_MSG) + elif sender == "reasoning": + indicator = "◎" + color = self.get_color(ColorPair.REASONING_MSG) else: indicator = "●" color = self.get_color(ColorPair.SYSTEM_MSG)