Newer
Older
navi-1 / clients / terminal / tui / renderers / thinking.py
"""Renderer for thinking/reasoning blocks."""

from __future__ import annotations

from rich.console import RenderableType
from rich.box import ROUNDED
from rich.panel import Panel
from rich.text import Text

from .base import ContentRenderer


class ThinkingRenderer(ContentRenderer):
    """Render a complete thinking block."""

    def accepts(self, msg: dict) -> bool:
        return msg.get("type") == "thinking_block"

    def render(self, msg: dict) -> RenderableType:
        text = msg.get("content", "")
        return Panel(
            Text(text, style="dim"),
            title="thinking",
            title_align="left",
            border_style="bright_black",
            box=ROUNDED,
        )