A LocalChat.ai application powered by the DeepSeek API, featuring a modern chat interface with customizable response styles and conversation management.
- 🤖 DeepSeek API Integration - High-performance AI chat with cost-effective pricing
- 🎨 Multiple Response Styles - Balanced, Concise, Explanatory, Formal, and Friendly modes
- 💬 Conversation Management - Persistent chat history with local storage
- 🔄 Real-time Streaming - Smooth, responsive chat experience
- 📱 Responsive Design - Works seamlessly on desktop and mobile
- 🛡️ Robust Error Handling - Graceful fallbacks and retry mechanisms
- 💾 Data Export/Import - Backup and restore your conversations
- ⚡ Context Management - Automatic context window optimization
- Node.js 16+ and npm
- DeepSeek API key (Get yours here)
-
Clone the repository
git clone <your-repo-url> cd LocalChat.ai
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env
Edit
.envand add your DeepSeek API key:DEEPSEEK_API_KEY=your_api_key_here DEEPSEEK_BASE_URL=https://api.deepseek.com PORT=3001 -
Start the application
npm start
This will start both the backend server (port 3001) and frontend (port 3000).
-
Open in browser
http://localhost:3000
- Express.js server with API routes
- DeepSeek API integration with retry logic
- Prompt templates system for style customization
- Error handling with proper HTTP status codes
- React 18 with modern hooks
- Component-based architecture
- Local storage for conversation persistence
- Axios for API communication
- Markdown rendering for AI responses
src/
├── components/
│ ├── ChatSidebar.jsx # Conversation history
│ ├── ChatHeader.jsx # Style selector
│ ├── ChatContainer.jsx # Message display
│ ├── Message.jsx # Individual message
│ └── MessageInput.jsx # Input area
├── services/
│ ├── chatService.js # API communication
│ └── conversationManager.js # Local storage
└── utils/
└── errorHandling.js # Error management
The application supports five different response styles:
- Balanced - Well-rounded responses with appropriate detail
- Concise - Brief, direct answers focused on key points
- Explanatory - Detailed explanations with context and examples
- Formal - Professional tone suitable for business contexts
- Friendly - Warm, conversational tone for casual interactions
| Variable | Description | Default |
|---|---|---|
DEEPSEEK_API_KEY |
Your DeepSeek API key | Required |
DEEPSEEK_BASE_URL |
DeepSeek API endpoint | https://api.deepseek.com |
PORT |
Backend server port | 3001 |
The application is configured with optimal settings for chat:
- Model:
deepseek-chat - Temperature:
0.7(balanced creativity) - Max Tokens:
4000(substantial responses) - Top-p:
0.95(diverse vocabulary)
- Local Storage Only - All conversations stored in browser
- No Cloud Sync - Complete privacy and control
- Export/Import - JSON format for backup
- Automatic Cleanup - Limits storage to prevent bloat
The application includes comprehensive error handling:
- Network Errors - Retry with exponential backoff
- Rate Limiting - Automatic retry with appropriate delays
- API Errors - User-friendly error messages
- Storage Errors - Graceful degradation
- Context Overflow - Automatic message truncation
LocalChat.ai/
├── src/ # React frontend
│ ├── components/ # UI components
│ ├── services/ # Business logic
│ └── utils/ # Utilities
├── server/ # Express backend
│ ├── routes/ # API endpoints
│ └── services/ # Backend services
├── package.json # Dependencies
└── vite.config.js # Build configuration
npm run dev # Start frontend development server
npm run server # Start backend server only
npm start # Start both frontend and backend
npm run build # Build for production
npm run preview # Preview production buildPOST /api/chat/message- Send chat messageGET /api/chat/styles- Get available response stylesGET /api/health- Health check
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details.
- 📖 Check the DeepSeek API Documentation
- 🐛 Report issues on GitHub
- 💡 Feature requests welcome
Built with ❤️ using DeepSeek AI and modern web technologies.