Files
strix/strix/interface/tool_components/thinking_renderer.py
T

33 lines
970 B
Python
Raw Normal View History

2025-08-08 20:36:44 -07:00
from typing import Any, ClassVar
from rich.text import Text
2025-08-08 20:36:44 -07:00
from textual.widgets import Static
from .base_renderer import BaseToolRenderer
from .registry import register_tool_renderer
@register_tool_renderer
class ThinkRenderer(BaseToolRenderer):
tool_name: ClassVar[str] = "think"
css_classes: ClassVar[list[str]] = ["tool-call", "thinking-tool"]
@classmethod
def render(cls, tool_data: dict[str, Any]) -> Static:
args = tool_data.get("args", {})
thought = args.get("thought", "")
text = Text()
text.append("🧠 ")
text.append("Thinking", style="bold #a855f7")
text.append("\n ")
2025-08-08 20:36:44 -07:00
if thought:
thought_display = cls.truncate(thought, 600)
text.append(thought_display, style="italic dim")
2025-08-08 20:36:44 -07:00
else:
text.append("Thinking...", style="italic dim")
2025-08-08 20:36:44 -07:00
css_classes = cls.get_css_classes("completed")
return Static(text, classes=css_classes)