Building Aidian: An Obsidian Plugin Powered by Gemini AI
How we built a powerful Obsidian plugin that brings AI-powered chat assistance to your note-taking workflow
The Vision Behind Aidian
As note-takers and knowledge workers, we've all wished for an AI assistant that could help us with our note-taking process, provide insights, and help organize our thoughts. That's exactly what we set out to build with Aidian - an Obsidian plugin that leverages Google's Gemini AI to provide intelligent chat assistance right in your notes.
"The goal was to create an AI assistant that feels like a natural part of your note-taking workflow, providing context-aware assistance without disrupting your writing experience."
Core Architecture
Aidian is built on a modular architecture that seamlessly integrates with Obsidian while providing powerful AI capabilities:
graph TD
A[Obsidian Plugin] --> B[Main Plugin Class]
B --> C[Chat View]
B --> D[Settings Tab]
C --> E[Chat Interface]
C --> F[Message History]
C --> G[Model Selection]
E --> H[Send Message]
E --> I[Clear Chat]
H --> J[Gemini API Client]
J --> K[API Request]
K --> L[Response Handler]
L --> M[Message Display]
D --> N[API Key Management]
D --> O[API Version Selection]
D --> P[Model Configuration]
Main Plugin Class
- Manages plugin lifecycle
- Handles settings persistence
- Creates and manages views
- Coordinates between components
Chat View
- Manages the chat interface
- Handles message history
- Controls model selection
- Manages chat state
Gemini API Client
- Interfaces with Gemini AI API
- Supports multiple API versions
- Manages request/response flow
- Handles error cases
AI Integration and Features
The heart of Aidian lies in its AI integration, which provides powerful capabilities while maintaining a simple and intuitive interface:
- Support for both v1 and v1beta Gemini API versions
- Multiple model selection (Pro and Ultra)
- Context-aware chat responses
- Secure API key management
API Version Support
One of Aidian's standout features is its support for multiple Gemini API versions:
- v1 (stable) for reliable, production-ready features
- v1beta for access to the latest Gemini capabilities
- Seamless version switching through settings
- Version-specific model support
Model Selection
Users can choose between different Gemini models based on their needs:
- Gemini Pro for general note-taking assistance
- Gemini Ultra for more complex tasks
- Dynamic model loading based on context
- Version-specific model availability
Security and Data Management
Security is a top priority in Aidian's design, especially when dealing with API keys and user data:
graph TD
A[API Key Input] -->|Encrypt| B[Secure Storage]
B -->|Decrypt| C[API Requests]
C -->|Success| D[Process Response]
C -->|Error| E[Handle Error]
B -->|Never Exposed| F[UI/Logs]
- Encrypted API key storage
- No key exposure in logs or UI
- Secure API communication
- Local message storage
Future Enhancements
We're constantly working on improving Aidian with new features and capabilities:
Planned Features
- Context-aware chat based on note content
- Advanced model features integration
- Custom prompt templates
- Enhanced note organization
Technical Improvements
- Modular architecture expansion
- Performance optimizations
- Enhanced error handling
- Better offline support