159 lines
4.5 KiB
Markdown
159 lines
4.5 KiB
Markdown
# oAI
|
|
|
|
A native macOS AI chat application with support for multiple providers and advanced features.
|
|
|
|
## Features
|
|
|
|
### Multi-Provider Support
|
|
- **OpenAI** - GPT models with native API support
|
|
- **Anthropic** - Claude models with OAuth integration
|
|
- **OpenRouter** - Access to 100+ AI models
|
|
- **Ollama** - Local model inference
|
|
|
|
### Core Capabilities
|
|
- **Streaming Responses** - Real-time token streaming for faster interactions
|
|
- **Conversation Management** - Save, load, and delete chat conversations
|
|
- **File Attachments** - Support for text files, images, and PDFs
|
|
- **Image Generation** - Create images with supported models
|
|
- **Online Mode** - Web search integration for up-to-date information
|
|
- **Session Statistics** - Track token usage and costs
|
|
- **Model Context Protocol (MCP)** - Filesystem access for AI models with configurable permissions
|
|
|
|
### UI/UX
|
|
- Native macOS interface with dark mode support
|
|
- Markdown rendering with syntax highlighting
|
|
- Command history navigation
|
|
- Model selector with detailed information
|
|
- Footer stats display (tokens, cost, response time)
|
|
|
|
## Installation
|
|
|
|
1. Clone this repository
|
|
2. Open `oAI.xcodeproj` in Xcode
|
|
3. Build and run (⌘R)
|
|
|
|
## Configuration
|
|
|
|
### API Keys
|
|
Add your API keys in Settings (⌘,):
|
|
- OpenAI API key
|
|
- Anthropic API key (or use OAuth)
|
|
- OpenRouter API key
|
|
- Ollama base URL (default: http://localhost:11434)
|
|
|
|
### Settings
|
|
- **Provider** - Select default AI provider
|
|
- **Streaming** - Enable/disable response streaming
|
|
- **Memory** - Control conversation context (on/off)
|
|
- **Online Mode** - Enable web search integration
|
|
- **Max Tokens** - Set maximum response length
|
|
- **Temperature** - Control response randomness
|
|
|
|
## Slash Commands
|
|
|
|
### Model & Chat
|
|
- `/help` - Show help and available commands
|
|
- `/model` - Open model selector (⌘M)
|
|
- `/clear` - Clear current conversation
|
|
- `/retry` - Regenerate last response
|
|
- `/info [model]` - Display model information
|
|
|
|
### Conversation Management
|
|
- `/save <name>` - Save current conversation
|
|
- `/load` or `/list` - List and load saved conversations
|
|
- `/delete <name>` - Delete a saved conversation
|
|
- `/export <md|json> [filename]` - Export conversation
|
|
|
|
### Provider & Settings
|
|
- `/provider [name]` - Switch or display current provider
|
|
- `/config` or `/settings` - Open settings (⌘,)
|
|
- `/stats` - View session statistics
|
|
- `/credits` - Check API credits/balance
|
|
|
|
### Features
|
|
- `/memory <on|off>` - Toggle conversation memory
|
|
- `/online <on|off>` - Toggle online/web search mode
|
|
- `/mcp <on|off|status|add|remove|list>` - Manage MCP filesystem access
|
|
|
|
### MCP (Model Context Protocol)
|
|
- `/mcp add <path>` - Grant AI access to a folder
|
|
- `/mcp remove <index|path>` - Revoke folder access
|
|
- `/mcp list` - Show allowed folders
|
|
- `/mcp write <on|off>` - Enable/disable file write permissions
|
|
- `/mcp status` - Display MCP configuration
|
|
|
|
## File Attachments
|
|
|
|
Attach files to your messages using the syntax: `@/path/to/file`
|
|
|
|
Example:
|
|
```
|
|
Can you review this code? @~/project/main.swift
|
|
```
|
|
|
|
Supported formats:
|
|
- **Text files** - Any UTF-8 text file (.txt, .md, .swift, .py, etc.)
|
|
- **Images** - PNG, JPG, WebP (for vision-capable models)
|
|
- **PDFs** - Document analysis with vision models
|
|
|
|
Limits:
|
|
- Maximum file size: 10 MB
|
|
- Text files truncated after 50 KB (head + tail shown)
|
|
|
|
## Keyboard Shortcuts
|
|
|
|
- `⌘M` - Open model selector
|
|
- `⌘,` - Open settings
|
|
- `⌘N` - New conversation
|
|
- `↑/↓` - Navigate command history
|
|
|
|
## Development
|
|
|
|
### Project Structure
|
|
```
|
|
oAI/
|
|
├── Models/ # Data models (Message, Conversation, Settings)
|
|
├── Views/ # SwiftUI views
|
|
│ ├── Main/ # Chat, header, footer, input
|
|
│ └── Screens/ # Settings, stats, model selector
|
|
├── ViewModels/ # ChatViewModel
|
|
├── Providers/ # AI provider implementations
|
|
├── Services/ # Database, MCP, web search, settings
|
|
└── Utilities/ # Extensions, logging, syntax highlighting
|
|
```
|
|
|
|
### Key Components
|
|
|
|
- **ChatViewModel** - Main state management and message handling
|
|
- **ProviderRegistry** - Provider selection and initialization
|
|
- **AIProvider Protocol** - Common interface for all AI providers
|
|
- **MCPService** - Filesystem tool integration
|
|
- **DatabaseService** - Conversation persistence
|
|
- **WebSearchService** - Online search integration
|
|
|
|
## Requirements
|
|
|
|
- macOS 14.0+
|
|
- Xcode 15.0+
|
|
- Swift 5.9+
|
|
|
|
## License
|
|
|
|
MIT License - See [LICENSE](LICENSE) for details.
|
|
|
|
## Author
|
|
|
|
**Rune Olsen**
|
|
|
|
https://blog.rune.pm
|
|
|
|
## Contributing
|
|
|
|
1. Fork the repository
|
|
2. Create a feature branch
|
|
3. Submit a pull request
|
|
|
|
---
|
|
|
|
**⭐ Star this project if you find it useful!**
|