Chat interfaceο
Present messages, tool calls, execution outcomes, and Plan/Run controls.
mtc_gui.chat_panel Β· Source
Operator GUI Β· Guide Β· Symbol index
How it is usedο
MTCMainWindow connects ChatPanel to AgentBridge. The panel emits message_submitted and mode_change_requested; bridge signals feed its message and status methods. The panel itself neither opens an agent connection nor submits robot goals.
Update this widget on the GUI thread. Messages are rendered as plain text, tool details expand on demand, and set_thinking() controls both the animation and input availability. Mode radios remain disabled until the bridge acknowledges a change through the main window.
Start hereο
Callable |
Purpose |
|---|---|
Create the conversation view, input controls, status, and Plan/Run selector. |
|
Append an assistant bubble stamped with current local HH:MM time. |
|
Append an expandable tool-call bubble. |
|
Show or hide the thinking indicator and disable or enable chat input. |
|
Render the result of an agent-initiated execution as an assistant or error bubble. |
ChatPanelο
Own conversation widgets, input, and mode controls. It communicates through signals so the main window can coordinate agent and execution state.
Inherits from: QWidget.
ChatPanel.__init__()ο
Create the conversation view, input controls, status, and Plan/Run selector.
Lifecycle Β· Source
__init__(self, parent=None)
Parameter |
Meaning |
|---|---|
|
Optional parent widget. |
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Defaults to Plan and Connecting, connects radio/send/clear handlers, and installs an input-key event filter. Starts no agent connection.
Referenced in source (1)
MTCMainWindow._build_right_tabsβ mtc_gui.main_window
ChatPanel.append_assistant()ο
Append an assistant bubble stamped with current local HH:MM time.
Callback Β· Source
append_assistant(self, text: str) -> None
Parameter |
Meaning |
|---|---|
|
Plain-text assistant response to show. |
Returns: None.
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Creates a MessageBubble and schedules bottom scrolling.
ChatPanel.append_tool_call()ο
Append an expandable tool-call bubble.
Callback Β· Source
append_tool_call(self, name: str, args_json: str, result: str) -> None
Parameter |
Meaning |
|---|---|
|
Tool name. |
|
Already serialized argument display text. |
|
Tool-result display text. |
Returns: None.
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Creates ToolCallBubble and schedules bottom scrolling; performs no tool invocation.
ChatPanel.set_thinking()ο
Show or hide the thinking indicator and disable or enable chat input.
Callback Β· Source
set_thinking(self, is_thinking: bool) -> None
Parameter |
Meaning |
|---|---|
|
True starts animation and disables send/input; False stops animation and reenables them. |
Returns: None.
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Updates animation and enabled states; finishing restores input focus. Mode radios and Clear remain independently controlled.
ChatPanel.append_execution_outcome()ο
Render the result of an agent-initiated execution as an assistant or error bubble.
Callback Β· Source
append_execution_outcome(
self,
success: bool,
error: str,
completed: int,
total: int,
) -> None
Parameter |
Meaning |
|---|---|
|
True selects the succeeded assistant message; False selects an error bubble. |
|
Optional failure detail appended only on unsuccessful outcomes. |
|
Completed step count shown in the summary. |
|
Total step count shown in the summary. |
Returns: None.
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Formats completed/total outcome text, creates the appropriate bubble, and schedules scrolling.
ChatPanel.set_status()ο
Replace the connection/status label text.
Method Β· Source
set_status(self, text: str) -> None
Parameter |
Meaning |
|---|---|
|
Complete display string; no suffix or formatting is added. |
Returns: None.
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Sets _status_label text.
ChatPanel.append_user()ο
Append a user bubble stamped with current local HH:MM time.
Method Β· Source
append_user(self, text: str) -> None
Parameter |
Meaning |
|---|---|
|
Plain-text user message to show. |
Returns: None.
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Creates a MessageBubble and schedules scrolling to the bottom; does not send the message.
ChatPanel.set_mode_label()ο
Reenable both mode radios and synchronize their checked state after bridge acknowledgment.
Method Β· Source
set_mode_label(self, mode: str) -> None
Parameter |
Meaning |
|---|---|
|
βplanβ or βrunβ selects the matching radio; other strings only reenable the controls. |
Returns: None.
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Temporarily blocks the radio being set to prevent another selected-state request. Despite the method docstring, it does not alter status-label text.
Internal callbacks and helpersο
ChatPanel.eventFilter()ο
Submit on Return/Enter unless Shift is held; allow Shift+Enter to insert a newline.
Callback Β· Source
eventFilter(self, obj, event)
Parameter |
Meaning |
|---|---|
|
Watched QObject; custom handling applies only to input_field. |
|
Qt keyboard/event object; key and modifier fields are inspected only for KeyPress. |
Returns: True when an Enter key was handled, False for Shift+Enter, otherwise the base event-filter result.
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: May clear input and emit message_submitted through _on_send.
ChatPanel.append_error()ο
Append a styled error bubble to the conversation.
Callback Β· Source
append_error(self, text: str) -> None
Parameter |
Meaning |
|---|---|
|
Plain-text error message. |
Returns: None.
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Creates ErrorBubble and schedules bottom scrolling.
ChatPanel.clear_chat()ο
Remove all conversation widgets while retaining the layoutβs trailing stretch.
Callback Β· Source
clear_chat(self) -> None
Returns: None.
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Takes message items from the layout and schedules their widgets for deletion. It does not emit a clear-history signal or call AgentBridge.clear_history.
Referenced in source (1)
ChatPanel.__init__β mtc_gui.chat_panel
ChatPanel._on_mode_radio_toggled()ο
Request the newly selected mode and disable the radios until acknowledgment.
Callback Β· Source
_on_mode_radio_toggled(self, checked: bool) -> None
Parameter |
Meaning |
|---|---|
|
Qt toggled payload; False returns immediately. |
Returns: None.
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Determines mode from Planβs checked state, disables both radios, and emits mode_change_requested(βplanβ or βrunβ).
Referenced in source (1)
ChatPanel.__init__β mtc_gui.chat_panel
ChatPanel._on_send()ο
Trim nonempty input, clear the editor, and emit the user message.
Callback Β· Source
_on_send(self) -> None
Returns: None.
Errors: Blank/whitespace-only text is ignored; Qt errors otherwise propagate.
Side effects: Clears input and emits message_submitted; bubble insertion is left to the connected main-window handler.
Referenced in source (2)
ChatPanel.__init__β mtc_gui.chat_panelChatPanel.eventFilterβ mtc_gui.chat_panel
ChatPanel._add_message_widget()ο
Insert a conversation widget immediately before the trailing stretch.
Internal helper Β· Source
_add_message_widget(self, widget: QWidget) -> None
Parameter |
Meaning |
|---|---|
|
Message/error/tool QWidget to append to the scrollable conversation. |
Returns: None.
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Adds widget to the layout and schedules _scroll_bottom after 10 ms to allow layout sizing.
Referenced in source (5)
ChatPanel.append_assistantβ mtc_gui.chat_panelChatPanel.append_errorβ mtc_gui.chat_panelChatPanel.append_execution_outcomeβ mtc_gui.chat_panelChatPanel.append_tool_callβ mtc_gui.chat_panelChatPanel.append_userβ mtc_gui.chat_panel
ChatPanel._scroll_bottom()ο
Scroll the conversation to its current vertical maximum.
Callback Β· Source
_scroll_bottom(self) -> None
Returns: None.
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Sets the vertical scrollbar value to maximum.
Referenced in source (1)
ChatPanel._add_message_widgetβ mtc_gui.chat_panel
MessageBubbleο
Display one selectable plain-text user or assistant message with role styling and an optional timestamp.
Inherits from: QFrame.
MessageBubble.__init__()ο
Create a selectable plain-text message bubble with role styling and an optional timestamp.
Lifecycle Β· Source
__init__(self, text: str, role: str, timestamp: str='', parent=None)
Parameter |
Meaning |
|---|---|
|
Message text displayed as PlainText, not interpreted as HTML or Markdown. |
|
βuserβ uses right-aligned You styling; every other value uses Assistant styling. |
|
Optional already-formatted timestamp string; empty suppresses its label. |
|
Optional parent widget. |
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Builds labels/frame; user and assistant variants use opposite margins and alignments.
Referenced in source (3)
ChatPanel.append_assistantβ mtc_gui.chat_panelChatPanel.append_execution_outcomeβ mtc_gui.chat_panelChatPanel.append_userβ mtc_gui.chat_panel
ToolCallBubbleο
Display a tool name with expandable plain-text arguments and result.
Inherits from: QFrame.
ToolCallBubble.__init__()ο
Create a collapsed tool-name button and hidden plain-text argument/result details.
Lifecycle Β· Source
__init__(self, name: str, args_json: str, result: str, parent=None)
Parameter |
Meaning |
|---|---|
|
Tool name shown as name(). |
|
Argument display text retained unchanged; the bridge may already have truncated it. |
|
Result display text retained unchanged. |
|
Optional parent widget. |
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Stores arguments/result, builds widgets, and connects the header to expansion toggling.
Referenced in source (1)
ChatPanel.append_tool_callβ mtc_gui.chat_panel
Internal callbacks and helpersο
ToolCallBubble._toggle()ο
Expand or collapse the saved tool-call arguments and result.
Callback Β· Source
_toggle(self)
Returns: None.
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Flips _expanded; expansion writes βArgs: β¦ Result: β¦β, shows detail, and reapplies header styling; collapse hides detail.
Referenced in source (1)
ToolCallBubble.__init__β mtc_gui.chat_panel
ErrorBubbleο
Display a selectable plain-text error message in the conversation.
Inherits from: QFrame.
ErrorBubble.__init__()ο
Build an amber error bubble with a selectable plain-text message and optional alert icon.
Lifecycle Β· Source
__init__(self, text: str, parent=None)
Parameter |
Meaning |
|---|---|
|
Error text displayed without HTML interpretation. |
|
Optional parent widget. |
Errors: Optional qtawesome icon failures are suppressed; other Qt errors propagate.
Side effects: Creates Error heading, colored frame, and message label.
Referenced in source (2)
ChatPanel.append_errorβ mtc_gui.chat_panelChatPanel.append_execution_outcomeβ mtc_gui.chat_panel
ThinkingIndicatorο
Animate the waiting indicator with a Qt timer. ChatPanel starts and stops it around agent turns.
Inherits from: QFrame.
ThinkingIndicator.__init__()ο
Create three dot labels and an inactive animation timer.
Lifecycle Β· Source
__init__(self, parent=None)
Parameter |
Meaning |
|---|---|
|
Optional parent widget. |
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Initializes _tick=0 and connects the timer to _animate; does not start it.
Referenced in source (1)
ChatPanel.__init__β mtc_gui.chat_panel
ThinkingIndicator.start()ο
Restart the dot animation from tick zero at a 400 ms interval.
Method Β· Source
start(self)
Returns: None.
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Resets tick, starts the QTimer, and shows the indicator; existing dot styles update on the next timeout.
ThinkingIndicator.stop()ο
Stop thinking animation and hide its frame.
Method Β· Source
stop(self)
Returns: None.
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Stops the timer and hides the indicator.
Internal callbacks and helpersο
ThinkingIndicator._animate()ο
Advance the waiting animation by one step.
Callback Β· Source
_animate(self)
Returns: None.
Errors: Qt/widget errors propagate; no local exception handler.
Side effects: Changes dot colors/font sizes and increments _tick.
Referenced in source (1)
ThinkingIndicator.__init__β mtc_gui.chat_panel