- Reorganize project structure and file locations - Add ReasoningController to manage model selection and reasoning mode - Update design and requirements for reasoning mode toggle - Implement model switching between Qwen3-4B-Instruct and Qwen3-4B-Thinking models - Remove deprecated files and consolidate project layout - Add new steering and specification documentation - Clean up and remove unnecessary files and directories - Prepare for enhanced AI sidebar functionality with more flexible model handling
74 lines
2.3 KiB
Python
74 lines
2.3 KiB
Python
from ignis import widgets
|
|
from ignis.window_manager import WindowManager
|
|
from ignis.services.niri import NiriService
|
|
from .chat_widget import ChatWidget
|
|
|
|
window_manager = WindowManager.get_default()
|
|
|
|
|
|
class AISidebar(widgets.RevealerWindow):
|
|
"""AI Chat Sidebar that slides in from the left side"""
|
|
|
|
def __init__(self):
|
|
# Create chat interface
|
|
self.chat_widget = ChatWidget()
|
|
|
|
# Content box - 400px wide to match QuickCenter
|
|
self.content_box = widgets.Box(
|
|
vertical=True,
|
|
spacing=0,
|
|
hexpand=False,
|
|
css_classes=["ai-sidebar"],
|
|
child=[self.chat_widget],
|
|
)
|
|
self.content_box.width_request = 400
|
|
self.content_box.set_halign("start") # Align to left side
|
|
|
|
# Revealer for slide animation
|
|
revealer = widgets.Revealer(
|
|
child=self.content_box,
|
|
transition_duration=300,
|
|
transition_type="slide_right", # Slide in from left
|
|
halign="start", # Align revealer to left
|
|
)
|
|
|
|
# Close button overlay (click outside to close)
|
|
close_button = widgets.Button(
|
|
vexpand=True,
|
|
hexpand=True,
|
|
can_focus=False,
|
|
on_click=lambda x: window_manager.close_window("AISidebar"),
|
|
)
|
|
|
|
main_overlay = widgets.Overlay(
|
|
css_classes=["popup-close"],
|
|
child=close_button,
|
|
overlays=[revealer],
|
|
)
|
|
|
|
super().__init__(
|
|
revealer=revealer,
|
|
child=main_overlay,
|
|
css_classes=["popup-close"],
|
|
hide_on_close=True,
|
|
visible=False,
|
|
namespace="AISidebar",
|
|
popup=True,
|
|
layer="overlay", # Same as QuickCenter
|
|
kb_mode="exclusive", # Same as QuickCenter
|
|
anchor=["left", "right", "top", "bottom"], # Anchor to ALL edges like QuickCenter
|
|
)
|
|
|
|
self.window_manager = window_manager
|
|
self.revealer = revealer
|
|
self.niri = NiriService.get_default()
|
|
|
|
self.connect("notify::visible", self._toggle_revealer)
|
|
|
|
def _toggle_revealer(self, *_):
|
|
"""Toggle revealer when window visibility changes"""
|
|
self.revealer.reveal_child = self.visible
|
|
if self.visible:
|
|
# Focus on input when opened
|
|
self.chat_widget.focus_input()
|