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: QFrame

A 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: QFrame

Chat 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

set_enabled(*, enabled)[source]

Enable or disable the input.

Parameters:

enabled (bool) – Whether input should be enabled.

Return type:

None

clear()[source]

Clear the input text.

Return type:

None

set_focus()[source]

Set focus to the text input.

Return type:

None

set_text(text)[source]

Set the input text content.

Parameters:

text (str) – Text to set in the input field.

Return type:

None

class ChatPanel[source]

Bases: QFrame

Main 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 Message is tracked as the panel’s active streaming message until finalize_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, so message.content is 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_message was never invoked for the current turn) falls back to add_message() so the completed message is still rendered.

Parameters:

message (Message) – The orchestrator’s completed message for this turn.

Return type:

None

clear_messages()[source]

Clear all messages from the chat.

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:

str

set_input_enabled(*, enabled)[source]

Enable or disable the input widget.

Parameters:

enabled (bool) – Whether input should be enabled.

Return type:

None

get_messages()[source]

Get all messages in the chat.

Returns:

List of messages.

Return type:

list[Message]

set_focus_input()[source]

Set focus to the input widget.

Return type:

None

insert_context_text(text)[source]

Insert context text into the chat input field.

Replaces the current input content with the provided text and sets focus to the input widget for immediate editing or submission.

Parameters:

text (str) – Context text to insert.

Return type:

None