A modern, responsive React application featuring real-time AI streaming, persistent chat history, and a sophisticated "thinking" UI.
- Wait-for-it Streaming: Responses stream to the browser in real-time, character by character.
- Thinking UI: Visualizes the internal reasoning process of advanced models (e.g., DeepSeek-R1) with a collapsible "Thinking Process" bubble.
- Persistent History: Chat sessions are saved locally to
localStorage, allowing you to resume conversations anytime. - Markdown Support: Renders clean Markdown with syntax highlighting for code blocks.
- Secure Backend: Uses a Vercel Edge Function proxy (
api/ai.js) to keep API keys secure on the server side.
-
Install Dependencies
npm install
-
Run Development Server
npm run dev
Open http://localhost:5173 to view it in the browser.
-
Local API (Optional) To run the serverless function locally:
npm install -g vercel vercel dev
To connect a real AI model (instead of the mock mode), create a .env file or configure your Vercel project with:
| Variable | Description | Required? |
|---|---|---|
HF_TOKEN |
Hugging Face Access Token | Yes (for real AI) |
HF_MODEL |
Model ID (e.g., meta-llama/Llama-3.1-8B-Instruct) |
No |
VITE_AI_API_URL |
Path to backend (default: /api/ai) |
No |
This project is optimized for Vercel.
- Push to GitHub.
- Import project in Vercel.
- Add
HF_TOKENto Environment Variables. - Deploy!
See DEPLOYMENT.md for a detailed guide.