Tohr AI - VS Code Extension
Tohr AI is an intelligent coding assistant for VS Code that integrates Large Language Models (LLMs) to help with programming tasks. Inspired by tools like Cursor.io, it provides context-aware code assistance, intelligent chat, and powerful code generation capabilities.
Features
🤖 Intelligent Chat with Context
- Multi-file Context: Automatically includes relevant files in your workspace for context-aware responses
- Vector Search: Advanced semantic search through your entire codebase for better understanding
- Session Management: Organize conversations by project with persistent chat history
- Load Older Messages: Efficient pagination to avoid performance issues with long conversations
💡 Smart Code Suggestions
- Real-time Suggestions: Get intelligent code completions as you type
- Diff Visualization: See exactly what changes will be made before applying them
- File Creation: Generate new files with proper structure and content
- Code Refactoring: Intelligent suggestions for improving existing code
⚡ Quick Commands
- Documentation Generation: Generate comprehensive documentation for your code
- Code Refactoring: Automated code improvement suggestions
- Bug Detection: Identify potential issues in your code
- Performance Optimization: Get suggestions for improving code performance
🔧 Flexible Configuration
- Multiple LLM Providers: Support for OpenAI and Anthropic models
- Secure API Key Storage: Safe storage of your API credentials
- Customizable Settings: Tailor the extension to your workflow
- Workspace-specific Settings: Different configurations per project
📁 Project-based Chat History
- Session Management: Each project maintains its own chat sessions
- Persistent History: Chat history is saved per workspace
- Session Switching: Easily switch between different conversation contexts
- History Pagination: Load older messages without performance issues
- Session Export/Import: Backup and restore chat sessions
Installation
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "Tohr AI"
- Click Install
Quick Start
- Open the Chat Panel: Press
Ctrl+Shift+P
and run "Tohr AI: Open Chat"
- Configure Your API: Click the settings icon (⚙️) in the chat panel
- Add Your API Key: Enter your OpenAI or Anthropic API key
- Start Chatting: Type your questions or requests in the chat input
Configuration
API Setup
- Get an API key from OpenAI or Anthropic
- Open the settings panel in the chat
- Select your preferred provider
- Enter your API key
- Save the configuration
Workspace Indexing
- Automatic Indexing: The extension automatically indexes your workspace for better context
- Manual Indexing: Use the "Index Workspace" button to re-index when needed
- File Filtering: Configure which files to include/exclude from indexing
Usage Examples
Chat Commands
"Help me understand this function"
"Generate unit tests for this class"
"Refactor this code to be more efficient"
"Create a new API endpoint for user authentication"
"Debug this error in my React component"
File Operations
"Create a new React component for user profile"
"Generate a TypeScript interface for this data"
"Add error handling to this function"
"Optimize this database query"
Code Analysis
"Review this code for security vulnerabilities"
"Suggest improvements for this algorithm"
"Check for potential memory leaks"
"Analyze the performance of this function"
Session Management
Creating Sessions
- Automatic: New sessions are created automatically when you start chatting
- Manual: Click the "+" button to create a new session
- Named Sessions: Give your sessions descriptive names for better organization
Managing Sessions
- Switch Sessions: Use the dropdown to switch between different conversation contexts
- Delete Sessions: Remove old or unwanted sessions
- Session History: View all your sessions with timestamps and message counts
- Message Limits: Automatic message limiting to prevent performance issues
- Lazy Loading: Older messages are loaded on demand
- Session Cleanup: Automatic cleanup of old sessions to save space
Commands
Command |
Description |
tohr-ai.openChat |
Open the chat panel |
tohr-ai.openSettings |
Open the settings panel |
tohr-ai.indexWorkspace |
Re-index the current workspace |
tohr-ai.testSessions |
Test session management functionality |
tohr-ai.listSessions |
List all chat sessions |
Troubleshooting
Common Issues
API Key Errors
- Ensure your API key is correct and has sufficient credits
- Check if your provider is properly configured
- Verify your internet connection
Performance Issues
- Use the "Load Older Messages" feature for long conversations
- Consider clearing old sessions if you have many
- Check your workspace size and indexing settings
Context Issues
- Re-index your workspace if files aren't being included
- Check file filtering settings
- Ensure files are saved before asking questions
Error Messages
- "No relevant context found": Try re-indexing your workspace
- "API rate limit exceeded": Wait a moment and try again
- "Invalid API key": Check your API key in settings
Development
Building from Source
git clone https://github.com/your-repo/tohr-ai.git
cd tohr-ai
npm install
npm run compile
Testing
npm run test
npm run lint
Contributing
We welcome contributions! Please see our Contributing Guide for details.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
Changelog
v1.2.0 - Session Management
- ✨ Added project-based chat history
- ✨ Implemented session management with persistent storage
- ✨ Added load older messages functionality
- ✨ Improved performance with message pagination
- ✨ Added session export/import capabilities
v1.1.0 - Vector Search
- ✨ Added semantic search through codebase
- ✨ Implemented MongoDB-based vector storage
- ✨ Added workspace indexing functionality
- ✨ Improved context relevance
v1.0.0 - Initial Release
- ✨ Basic chat functionality
- ✨ Code suggestion and generation
- ✨ File context integration
- ✨ Settings panel
- ✨ Multiple LLM provider support
This README was generated with the help of Tohr AI itself.