Files
oai/oai/tui/widgets/chat_display.py
2026-02-04 11:22:53 +01:00

22 lines
627 B
Python

"""Chat display widget for oAI TUI."""
from textual.containers import ScrollableContainer
from textual.widgets import Static
class ChatDisplay(ScrollableContainer):
"""Scrollable container for chat messages."""
def __init__(self):
super().__init__(id="chat-display")
async def add_message(self, widget: Static) -> None:
"""Add a message widget to the display."""
await self.mount(widget)
self.scroll_end(animate=False)
def clear_messages(self) -> None:
"""Clear all messages from the display."""
for child in list(self.children):
child.remove()