feat(aisidebar): implement Ollama availability handling and graceful startup
- Add comprehensive Ollama connection error handling strategy - Implement OllamaClient with non-blocking initialization and connection checks - Create OllamaAvailabilityMonitor for periodic Ollama connection tracking - Update design and requirements to support graceful Ollama unavailability - Add new project structure for AI sidebar module with initial implementation - Enhance error handling to prevent application crashes when Ollama is not running - Prepare for future improvements in AI sidebar interaction and resilience
This commit is contained in:
124
aisidebar/README.md
Normal file
124
aisidebar/README.md
Normal file
@@ -0,0 +1,124 @@
|
||||
## AI Sidebar for Ignis
|
||||
|
||||
A sleek AI chat sidebar that integrates with your Ignis desktop, sliding in from the left side with Ollama AI integration.
|
||||
|
||||
### Features
|
||||
|
||||
- **Slide-in Animation**: Smoothly slides in from the left side (opposite of QuickCenter)
|
||||
- **Ollama Integration**: Chat with local AI models via Ollama
|
||||
- **Conversation Persistence**: Your conversations are automatically saved and restored
|
||||
- **Material Design 3**: Matches your existing Ignis theme perfectly
|
||||
- **Keyboard Toggle**: Bind a key to toggle the sidebar visibility
|
||||
|
||||
### How to Use
|
||||
|
||||
#### Open/Close the Sidebar
|
||||
|
||||
You can toggle the sidebar using:
|
||||
1. **Python/Script**: Call `window_manager.toggle_window("AISidebar")`
|
||||
2. **Keyboard Shortcut**: Add a binding in your window manager config
|
||||
|
||||
#### Setting up a Keyboard Shortcut
|
||||
|
||||
For **Niri**, add this to your `~/.config/niri/config.kdl`:
|
||||
|
||||
```kdl
|
||||
binds {
|
||||
// ... your other bindings
|
||||
|
||||
// Toggle AI Sidebar with Super+A (or any key you prefer)
|
||||
Mod+A { spawn "ignis" "run" "ignis.window_manager.WindowManager.get_default().toggle_window('AISidebar')"; }
|
||||
}
|
||||
```
|
||||
|
||||
For **Hyprland**, add this to your `~/.config/hypr/hyprland.conf`:
|
||||
|
||||
```conf
|
||||
# Toggle AI Sidebar with Super+A
|
||||
bind = SUPER, A, exec, ignis run "ignis.window_manager.WindowManager.get_default().toggle_window('AISidebar')"
|
||||
```
|
||||
|
||||
For **Sway**, add this to your `~/.config/sway/config`:
|
||||
|
||||
```
|
||||
# Toggle AI Sidebar with Super+A
|
||||
bindsym $mod+A exec ignis run "ignis.window_manager.WindowManager.get_default().toggle_window('AISidebar')"
|
||||
```
|
||||
|
||||
### Requirements
|
||||
|
||||
- **Ignis** desktop environment
|
||||
- **Python 3.10+**
|
||||
- **Ollama** with at least one model installed
|
||||
- **ollama Python package**: `pip install ollama`
|
||||
|
||||
### Configuration
|
||||
|
||||
The sidebar will automatically:
|
||||
- Detect your default Ollama model
|
||||
- Store conversations in `~/.config/ignis/modules/aisidebar/data/conversations/`
|
||||
- Apply your current Ignis theme colors
|
||||
|
||||
### Customization
|
||||
|
||||
#### Change Width
|
||||
|
||||
Edit `aisidebar.py` line 19:
|
||||
```python
|
||||
self.content_box.width_request = 400 # Change to desired width
|
||||
```
|
||||
|
||||
#### Change Animation Speed
|
||||
|
||||
Edit `aisidebar.py` line 24:
|
||||
```python
|
||||
transition_duration=300, # Change to desired milliseconds
|
||||
```
|
||||
|
||||
#### Custom CSS Styling
|
||||
|
||||
Edit `~/.config/ignis/styles/aisidebar.scss` to customize:
|
||||
- Colors (uses Material Design 3 color tokens)
|
||||
- Border radius
|
||||
- Padding/margins
|
||||
- Message bubble styling
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
**Sidebar doesn't appear:**
|
||||
- Restart Ignis: `ignis reload`
|
||||
- Check Ollama is running: `curl http://127.0.0.1:11434/api/tags`
|
||||
- Check console for errors: `ignis`
|
||||
|
||||
**No AI responses:**
|
||||
- Ensure Ollama is running
|
||||
- Ensure `ollama` Python package is installed in Ignis's Python environment
|
||||
- Check that you have at least one model: `ollama list`
|
||||
|
||||
**CSS not applying:**
|
||||
- Restart Ignis: `ignis reload`
|
||||
- Check SCSS compilation: Look for errors in Ignis console output
|
||||
|
||||
### Architecture
|
||||
|
||||
```
|
||||
~/.config/ignis/modules/aisidebar/
|
||||
├── __init__.py # Module exports
|
||||
├── aisidebar.py # Main RevealerWindow class
|
||||
├── chat_widget.py # Chat UI widget
|
||||
├── ollama_client.py # Ollama API wrapper
|
||||
├── conversation_manager.py # Conversation persistence
|
||||
└── data/
|
||||
└── conversations/ # Saved conversations (auto-created)
|
||||
```
|
||||
|
||||
### Visual Design
|
||||
|
||||
The AI Sidebar follows the same visual language as QuickCenter:
|
||||
- Material Design 3 color system
|
||||
- 20px border radius on container
|
||||
- Surface elevation with shadows
|
||||
- Smooth slide-in transitions
|
||||
- Translucent overlay backdrop
|
||||
|
||||
Clicking outside the sidebar will close it (same as QuickCenter behavior).
|
||||
Reference in New Issue
Block a user