Skip to content

Your lightweight open-source personal agent.

feat(cli): make stream renderer use bot_name and bot_icon (#3650)

Alfredo Arenas86693f5422d8
diff --git a/nanobot/cli/stream.py b/nanobot/cli/stream.py
index b0095f153..c6b5a87ad 100644
--- a/nanobot/cli/stream.py
+++ b/nanobot/cli/stream.py
@@ -14,8 +14,6 @@ from rich.live import Live
from rich.markdown import Markdown
from rich.text import Text
-from nanobot import __logo__
-
def _make_console() -> Console:
"""Create a Console that emits plain text when stdout is not a TTY.
@@ -32,11 +30,11 @@ def _make_console() -> Console:
class ThinkingSpinner:
- """Spinner that shows 'nanobot is thinking...' with pause support."""
+ """Spinner that shows '<bot_name> is thinking...' with pause support."""
- def __init__(self, console: Console | None = None):
+ def __init__(self, console: Console | None = None, bot_name: str = "nanobot"):
c = console or _make_console()
- self._spinner = c.status("[dim]nanobot is thinking...[/dim]", spinner="dots")
+ self._spinner = c.status(f"[dim]{bot_name} is thinking...[/dim]", spinner="dots")
self._active = False
def __enter__(self):
@@ -76,9 +74,17 @@ class StreamRenderer:
on_end -> Live stops (content stays on screen)
"""
- def __init__(self, render_markdown: bool = True, show_spinner: bool = True):
+ def __init__(
+ self,
+ render_markdown: bool = True,
+ show_spinner: bool = True,
+ bot_name: str = "nanobot",
+ bot_icon: str = "🐈",
+ ):
self._md = render_markdown
self._show_spinner = show_spinner
+ self._bot_name = bot_name
+ self._bot_icon = bot_icon
self._buf = ""
self._live: Live | None = None
self._t = 0.0
@@ -91,7 +97,7 @@ class StreamRenderer:
def _start_spinner(self) -> None:
if self._show_spinner:
- self._spinner = ThinkingSpinner()
+ self._spinner = ThinkingSpinner(bot_name=self._bot_name)
self._spinner.__enter__()
def _stop_spinner(self) -> None:
@@ -108,7 +114,8 @@ class StreamRenderer:
self._stop_spinner()
c = _make_console()
c.print()
- c.print(f"[cyan]{__logo__} nanobot[/cyan]")
+ header = f"{self._bot_icon} {self._bot_name}" if self._bot_icon else self._bot_name
+ c.print(f"[cyan]{header}[/cyan]")
self._live = Live(self._render(), console=c, auto_refresh=False)
self._live.start()
now = time.monotonic()