intellicrack.ui.chat
Chat panel widget for the Intellicrack UI.
This module provides the chat interface for interacting with the AI orchestrator, displaying conversation history and tool call information.
- class MessageBubble[source]
Bases:
QFrameA single message bubble in the chat.
Displays a message from the user, assistant, or tool with appropriate styling and formatting.
- Variables:
content_label (intellicrack.ui.chat._MarkdownView) – Markdown-rendering view displaying the message content; updated directly by streaming consumers to append incremental chunks.
- __init__(message, parent=None)[source]
Initialize the MessageBubble with the given message.
- Parameters:
message (Message) – The message to display.
parent (QWidget | None) – Parent widget.
- Return type:
None
- content_label: _MarkdownView
- class ChatInput[source]
Bases:
QFrameChat input widget with send button.
Provides a text input area and send button for composing messages to send to the AI.
- Variables:
message_submitted – Qt signal for message submitted.
- __init__(parent=None)[source]
Initialize the ChatInput widget.
- Parameters:
parent (QWidget | None) – Parent widget.
- Return type:
None
- class ChatPanel[source]
Bases:
QFrameMain chat panel widget.
Contains the message history scroll area and input widget. Manages displaying conversation messages and collecting user input.
- Variables:
message_submitted – Qt signal for message submitted.
context_requested – Qt signal asking to browse the MCP servers’ resources and prompts.
tool_activity (ToolActivityPanel) – The tool calls running now, with their progress and a way to cancel each one.
- tool_activity: ToolActivityPanel
- __init__(parent=None)[source]
Initialize the ChatPanel widget.
- Parameters:
parent (QWidget | None) – Parent widget.
- Return type:
None
- add_message(message)[source]
Add a message to the chat.
- Parameters:
message (Message) – Message to add.
- Return type:
None
- restore_messages(messages)[source]
Replace the visible conversation with a previously saved history.
Renders through the same bubble construction live turns use, so a restored session is indistinguishable from one built up interactively, and scrolls once at the end rather than once per message.
- Parameters:
messages (Sequence[Message]) – Ordered conversation history to display.
- Return type:
None
- add_streaming_message()[source]
Create a streaming message and return the append function.
The created
Messageis tracked as the panel’s active streaming message untilfinalize_streaming_message()folds the orchestrator’s completed response into it, so a turn that streams its text never gets a second, duplicate bubble for the same content (S16 duplicate-assistant-bubble fix).- Returns:
Function to call with each text chunk.
- Return type:
Callable[[str], None]
- finalize_streaming_message(message)[source]
Fold a completed assistant message into the active streaming bubble.
A turn’s streamed text already reached the panel chunk-by-chunk via the append function
add_streaming_message()returned, somessage.contentis not applied here – the tracked message’s content, built incrementally, is already authoritative. This only merges the metadata the streaming path could not carry: tool calls, tool results, and any thinking content the provider reported.Calling this with no active streaming message (
add_streaming_messagewas never invoked for the current turn) falls back toadd_message()so the completed message is still rendered.- Parameters:
message (Message) – The orchestrator’s completed message for this turn.
- Return type:
None
- show_notice(text)[source]
Add a short notice above the message input, such as a server’s resource changing.
The most recent few are shown, newest last, so one notice is not hidden by others that arrive with it.
- Parameters:
text (str) – The notice, already cleaned.
- Return type:
None
- property notice: str
The notices shown now.
- Returns:
The notices, one per line, or an empty string.
- Return type:
- set_input_enabled(*, enabled)[source]
Enable or disable the input widget.
- Parameters:
enabled (bool) – Whether input should be enabled.
- Return type:
None