Skip to content

CompactionView

Base classes

Name Children Inherits
Static
textual.widgets._static
A widget to display simple static content, or use as a base class for more complex widgets.

⋔ Inheritance diagram

graph TD
  107846721666432["blocks.CompactionView"]
  107846719030608["_static.Static"]
  107846718477920["widget.Widget"]
  107846718489888["dom.DOMNode"]
  107846718374032["message_pump.MessagePump"]
  137699722799616["builtins.object"]
  107846719030608 --> 107846721666432
  107846718477920 --> 107846719030608
  107846718489888 --> 107846718477920
  107846718374032 --> 107846718489888
  137699722799616 --> 107846718374032

🛈 DocStrings

Bases: Static

A context compaction.

Source code in src/acptui/ui/widgets/blocks.py
class CompactionView(Static):
    """A context compaction."""

    DEFAULT_CSS = """
    CompactionView { height: auto; color: $text-muted; padding: 0 1; margin: 0 0 1 0; }
    """

    def __init__(self, entry: CompactionEntry) -> None:
        super().__init__()
        self.entry = entry
        self.refresh_entry()

    def refresh_entry(self) -> None:
        """Re-render."""
        entry = self.entry
        text = f"⟲ Context compaction: {entry.status}"
        if entry.error:
            text += f" ({entry.error})"
        summary = blocks_text(entry.summary)
        self.update(Content(text + (f"\n{summary}" if summary else "")))

refresh_entry

refresh_entry() -> None

Re-render.

Source code in src/acptui/ui/widgets/blocks.py
def refresh_entry(self) -> None:
    """Re-render."""
    entry = self.entry
    text = f"⟲ Context compaction: {entry.status}"
    if entry.error:
        text += f" ({entry.error})"
    summary = blocks_text(entry.summary)
    self.update(Content(text + (f"\n{summary}" if summary else "")))

:fa-brands-github: Show source on GitHub