Skip to content

Conversation

@Mirrowel
Copy link
Owner

@Mirrowel Mirrowel commented Dec 9, 2025

Yes, i have committed a great sin.

This commit introduces a comprehensive AI assistant system for the Model Filter GUI, providing contextual help and automated configuration capabilities.

Core Components:

  • AIAssistantCore: Orchestrates conversation sessions, tool execution, and checkpoint management
  • LLMBridge: Bridges async RotatingClient with synchronous GUI thread using threading coordination
  • CheckpointManager: Hybrid snapshot/delta system for undo capability with crash recovery
  • ToolExecutor: Validates and executes window-specific tools with automatic retry logic
  • WindowContextAdapter: Abstract interface for window integration with context extraction

UI Features:

  • Pop-out chat window with streaming responses and collapsible thinking sections
  • Model selector with provider grouping and reasoning effort configuration
  • Checkpoint dropdown for rollback to previous states
  • Virtual message list with user/AI messages, tool execution results, and error handling
  • Multi-line input with keyboard shortcuts (Ctrl+Enter to send, Escape to cancel)

Model Filter Integration:

  • 15 specialized tools for rule management (add/remove ignore/whitelist patterns)
  • Query tools for pattern preview and model status explanation
  • State management tools (save/discard changes, provider switching)
  • Full context extraction with change tracking and diff detection
  • Window locking during AI execution to prevent race conditions

Technical Implementation:

  • Async/sync coordination using threading.Thread + asyncio.run()
  • Streaming chunk processing with thinking/content separation
  • Automatic checkpoint creation before write operations
  • Silent retry logic (up to 4 attempts) for invalid tool calls
  • Temp file persistence for checkpoint crash recovery
  • Grid-based responsive layout with dynamic resizing

The assistant has complete visibility into window state, can execute multiple tools in sequence, maintains conversation history, and provides verbose feedback on all operations. Changes are non-destructive with full rollback capability.


Important

Introduces a comprehensive AI assistant system for the Model Filter GUI, enhancing user interaction with contextual help and automated configuration capabilities.

  • AI Assistant System:
    • Introduces AIAssistantCore, LLMBridge, CheckpointManager, ToolExecutor, and WindowContextAdapter for managing AI interactions and tool executions.
    • Implements ai_assistant directory with core logic, UI components, and adapters.
  • UI Features:
    • Adds AIChatWindow for pop-out chat with streaming responses and tool execution results.
    • Includes model selector, checkpoint dropdown, and multi-line input with shortcuts.
  • Model Filter Integration:
    • Integrates 15 specialized tools for rule management and state handling in model_filter.py.
    • Provides full context extraction and change tracking.
  • Technical Implementation:
    • Utilizes threading and asyncio for async/sync coordination.
    • Implements checkpoint system with crash recovery and rollback capabilities.
  • Miscellaneous:
    • Adds AI assistant button to model_filter_gui.py and binds it to open the assistant window.
    • Updates README.md with relevant information.

This description was created by Ellipsis for 1371a73. You can customize this summary. It will automatically update as commits are pushed.

… and tool execution

This commit introduces a comprehensive AI assistant system for the Model Filter GUI, providing contextual help and automated configuration capabilities.

Core Components:
- AIAssistantCore: Orchestrates conversation sessions, tool execution, and checkpoint management
- LLMBridge: Bridges async RotatingClient with synchronous GUI thread using threading coordination
- CheckpointManager: Hybrid snapshot/delta system for undo capability with crash recovery
- ToolExecutor: Validates and executes window-specific tools with automatic retry logic
- WindowContextAdapter: Abstract interface for window integration with context extraction

UI Features:
- Pop-out chat window with streaming responses and collapsible thinking sections
- Model selector with provider grouping and reasoning effort configuration
- Checkpoint dropdown for rollback to previous states
- Virtual message list with user/AI messages, tool execution results, and error handling
- Multi-line input with keyboard shortcuts (Ctrl+Enter to send, Escape to cancel)

Model Filter Integration:
- 15 specialized tools for rule management (add/remove ignore/whitelist patterns)
- Query tools for pattern preview and model status explanation
- State management tools (save/discard changes, provider switching)
- Full context extraction with change tracking and diff detection
- Window locking during AI execution to prevent race conditions

Technical Implementation:
- Async/sync coordination using threading.Thread + asyncio.run()
- Streaming chunk processing with thinking/content separation
- Automatic checkpoint creation before write operations
- Silent retry logic (up to 4 attempts) for invalid tool calls
- Temp file persistence for checkpoint crash recovery
- Grid-based responsive layout with dynamic resizing

The assistant has complete visibility into window state, can execute multiple tools in sequence, maintains conversation history, and provides verbose feedback on all operations. Changes are non-destructive with full rollback capability.
This commit restructures the AI chat window layout to create a more space-efficient interface:

- Moved Send and New Session buttons from bottom status bar to right side of input area, stacked vertically
- Reduced button sizes (90x26px) and input area min-height (80→55px) for compactness
- Changed checkpoint dropdown button to icon-only (↩️) to save horizontal space (120→40px width)
- Refactored thinking section from CTkTextbox to CTkLabel to eliminate unnecessary scrollbar
- Added mousewheel event capture to thinking section to prevent scroll propagation when expanded
- Updated layout to use grid for input/button positioning with proper weight distribution

The changes maintain all functionality while significantly reducing vertical space usage and improving visual density of the interface.
Adjust top and bottom padding of status frame from (4, 8) to (0, 4) to achieve a more compact visual appearance, consistent with recent layout optimization efforts.
…interactions

Implement a detailed logging infrastructure to track and debug AI assistant requests, responses, and tool execution flow.

- Add `AssistantLogger` class to capture complete conversation turns including request parameters, streaming chunks, tool calls, tool execution results, and final responses
- Create structured log directories per session with timestamped turn folders containing JSON and JSONL files for analysis
- Integrate logging into `LLMBridge` to automatically track all streaming events and tool call validation
- Add tool call validation in bridge to skip empty tool names and auto-generate missing IDs
- Enhance `AIAssistantCore` with debug logging for message flow, tool execution, and agentic loop continuation
- Fix assistant message formatting to include null content when tool_calls are present for provider compatibility
- Export `AssistantLogger` through package `__all__` for external access

The logging system writes comprehensive diagnostics to `logs/assistant_logs/{session_id}/{timestamp}_{turn_id}/` including request.json, streaming_chunks.jsonl, tool_calls.json, tool_results.jsonl, final_response.json, and metadata.json files.
Base automatically changed from feature/filtering-tool to dev December 14, 2025 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants