-
Notifications
You must be signed in to change notification settings - Fork 30
feat(ui): ✨ implement AI assistant system with full context awareness and tool execution #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Mirrowel
wants to merge
12
commits into
dev
Choose a base branch
from
feature/Assitant
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Introduces a comprehensive CustomTkinter-based GUI application for managing model ignore/whitelist rules per provider, accessible from the settings tool. - Created model_filter_gui.py with full-featured visual editor (2600+ lines) - Implemented dual synchronized model lists showing unfiltered and filtered states - Added color-coded rule chips with visual association to affected models - Real-time pattern preview as users type filter rules - Interactive click/right-click functionality for model-rule relationships - Context menus for quick actions (add to ignore/whitelist, copy names) - Comprehensive help documentation with keyboard shortcuts - Unsaved changes detection with save/discard/cancel workflow - Background prefetching of models for all providers to improve responsiveness - Integration with settings tool as menu option #6 The GUI provides pattern matching with exact match, prefix wildcard (*), and match-all support. Whitelist rules take priority over ignore rules. All changes are persisted to .env file using IGNORE_MODELS_* and WHITELIST_MODELS_* variables.
Replace widget-based model lists with canvas-based virtual rendering to drastically improve performance with large model lists (1000+ models). - Add caching layer in FilterEngine with automatic invalidation on rule changes - Implement VirtualModelList component that only renders visible rows - Replace SyncModelListPanel with VirtualSyncModelLists using canvas drawing - Batch status computation in _rebuild_cache() instead of per-model calls - Reduce widget count from O(n) to O(visible_rows) for better memory usage - Maintain synchronized scrolling between left and right model lists - Preserve all existing functionality (search, highlighting, tooltips) The previous implementation created individual CTkFrame widgets for each model, causing severe lag with large provider model lists. The new virtual scrolling approach draws only visible items directly on a canvas, providing smooth scrolling even with thousands of models.
…anvas coordinates Removed manual scroll position tracking in favor of using Tkinter's built-in canvas.yview() and canvas.canvasy() methods for more reliable coordinate transformations. - Removed `_scroll_position` instance variable that was redundantly tracking scroll state - Updated `_get_index_at_y()` to use `canvas.canvasy()` for window-to-canvas coordinate conversion - Modified `_render()` to retrieve scroll position from `canvas.yview()[0]` instead of cached value - Simplified item rendering by using absolute positions in the scroll region, letting canvas handle viewport clipping - Updated `get_scroll_position()` and `set_scroll_position()` to work directly with canvas methods - Added explicit `_render()` call in `scroll_to_model()` to ensure UI updates after programmatic scrolling - Fixed scroll synchronization by reconfiguring scrollbar commands after method override and consolidating render calls into `set_scroll_position()` - Removed redundant manual `_render()` calls throughout sync handlers, as they now occur automatically This change eliminates state synchronization issues between manual tracking and actual canvas state, making the scrolling behavior more predictable and maintainable.
…ring Refactored the rule panel to use a high-performance virtual list implementation instead of creating individual CTkFrame widgets for each filter rule. - Implemented `VirtualRuleList` class using raw tkinter Canvas for direct rendering - Only renders visible rules based on scroll position, dramatically reducing memory usage - Maintains all interactive features: hover states, tooltips, click handling, and rule highlighting - Integrated seamless scrolling with auto-scroll to highlighted rules - Removed `RuleChip` widget dependency from `RulePanel`, replacing with virtual list delegation - Added model deduplication in `_on_models_loaded` to prevent duplicate entries - Optimized tooltip management to prevent memory leaks and duplicate tooltip instances This change significantly improves UI responsiveness when displaying large numbers of filter rules by eliminating the overhead of creating and managing hundreds of individual widget instances.
…ayout Systematically reduced padding, margins, font sizes, and component dimensions throughout the ModelFilterGUI to create a more compact, space-efficient interface. - Reduced title font from FONT_SIZE_NORMAL to FONT_SIZE_SMALL in RulePanel - Decreased padding values (12→10, 8→6, etc.) across all UI components - Reduced input entry and button heights from 36px to 28px, and button from 26px to smaller sizes - Set minimum height constraint (70px) on rule list to prevent collapse - Implemented grid-based responsive layout with proportional row weights (3:1 ratio for models vs rules) - Prevented input frame height changes using pack_propagate(False) - Refactored UI creation into _create_main_layout() with grid system replacing individual pack() calls - Updated all components to use content_frame.grid() instead of self.pack() for better layout control The changes maintain all functionality while significantly improving vertical space utilization, allowing more content to be visible without scrolling.
…ts and grid ratios This commit restructures the model filter GUI layout to use a grid-based system with proper weight ratios and minimum height constraints, ensuring stable proportions during window resizing. - Reduce minimum window dimensions from 850x600 to 600x400 for better flexibility - Implement 3:1 grid weight ratio between model lists (weight=3) and rule panels (weight=1) - Add grid_propagate(False) to key containers to prevent content from dictating frame sizes - Reorganize RulePanel layout: title at top, input frame at bottom (packed first to reserve space), rule list in middle - Set minimum row sizes: 200px for model lists, 55px for rule panels - Remove obsolete RuleChip class (141 lines) - functionality now handled by VirtualRuleList - Adjust padding and spacing values for more compact layout The new grid-based approach ensures consistent proportional sizing and prevents UI elements from being squished or expanding unpredictably during window resizing.
Add complete documentation for the Model Filter GUI feature including overview, features, keyboard shortcuts, context menu operations, and proxy integration details. - Documents GUI launch methods and provider selection - Explains ignore/whitelist rule system with wildcard support - Details dual-pane model view with color-coded status indicators - Lists all keyboard shortcuts (Ctrl+S, Ctrl+R, Ctrl+F, F1, Escape) - Describes right-click context menu functionality - Clarifies integration flow with RotatingClient and .env persistence - Adds cross-reference to Section 6 in project overview
… filter rules This commit introduces comprehensive pattern management features to the Model Filter GUI, significantly improving the user experience for managing filter rules. Core features added: - Smart pattern merge logic that prevents redundant rules by detecting when patterns are covered by existing broader patterns (e.g., "gpt-4" is covered by "gpt-4*") - Pattern coverage detection system with three new methods in FilterEngine: `pattern_is_covered_by`, `is_pattern_covered`, and `get_covered_patterns` - Import/Export functionality for filter rules with dedicated dialogs (ImportRulesDialog, ImportResultDialog) - Copy-to-clipboard buttons for all model lists and rule panels, enabling easy pattern transfer - Replace mode for imports that clears all existing rules vs. merge mode for incremental additions UI improvements: - Refactored HelpWindow to use CTkTextbox instead of CTkScrollableFrame, fixing scrolling issues with dark theme - Proper text formatting with configurable tags for titles, sections, and content - Enhanced rule panel headers showing rule counts and action buttons (Import/Copy) - Model list headers with copy buttons for filtered and all models - Improved tooltip positioning calculation for virtual rule list The smart merge system eliminates duplicate or redundant patterns automatically: - When adding "gpt-4*", existing "gpt-4" and "gpt-4-turbo" rules are removed as they're now covered - When adding "gpt-4", it's skipped if "gpt-4*" already exists - Wildcard "*" covers everything and prevents addition of any other patterns This creates a more intuitive workflow where users can paste comma-separated model lists, import them in bulk, and the system intelligently consolidates them into minimal effective rulesets.
… 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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
UI Features:
Model Filter Integration:
Technical Implementation:
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.
AIAssistantCore,LLMBridge,CheckpointManager,ToolExecutor, andWindowContextAdapterfor managing AI interactions and tool executions.ai_assistantdirectory with core logic, UI components, and adapters.AIChatWindowfor pop-out chat with streaming responses and tool execution results.model_filter.py.model_filter_gui.pyand binds it to open the assistant window.README.mdwith relevant information.This description was created by
for 1371a73. You can customize this summary. It will automatically update as commits are pushed.