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
This commit is contained in:
LIghtJUNction
2026-03-23 02:58:09 +08:00
parent fcab00332d
commit d6f74a8493
2 changed files with 11 additions and 0 deletions

View File

@@ -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",

View File

@@ -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)