Files

92 lines
2.9 KiB
Markdown

Modern, responsive chat interface inspired by Open WebUI. Supports OpenAI-compatible API with streaming responses, token analysis, and RAG knowledge bases.
## 🚀 Quick Start (Docker)
```bash
cp .env.example .env
# Edit .env — set your API URL and key
docker compose up --build -d
# Open http://localhost
```
## 🏗️ Development
### Backend
```bash
cd backend
npm install
npm run dev # port 3001
```
### Frontend
```bash
cd frontend
npm install
npm run dev # port 5173 (with HMR)
```
## ✨ Features
| Feature | Description |
|---------|-------------|
| 💬 Chat | Streaming messages with markdown & LaTeX |
| ⚙️ Settings | Model, system prompt, temperature, tokens |
| 📊 Token Analysis | Usage stats panel (tokens/sec, context, cost) |
| 📁 Attachments | Image upload + analysis |
| 📚 Knowledge Bases | RAG with multiple bases, file/folder upload |
| 🎨 Theme | Dark mode, accent colors |
| 📱 Responsive | Works on mobile and desktop |
## 🏛️ Architecture
```
┌──────────────────┐ ┌──────────────┐ ┌─────────────────┐
│ Nginx (80) │────────▶│ Backend │────────▶│ OpenAI API │
│ SPA + /api/* │ │ (Node.js) │ │ (or compatible)│
└──────────────────┘ └──────────────┘ └─────────────────┘
┌──────────────┐
│ sqlite db │
│ (chats) │
└──────────────┘
```
## 🔧 Environment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `OPENAI_API_URL` | `https://api.openai.com/v1` | API endpoint |
| `OPENAI_API_KEY` | - | Your API key |
| `DEFAULT_MODEL` | `gpt-4o-mini` | Default model ID |
| `JWT_SECRET` | random | JWT secret |
| `NODE_ENV` | `development` | Environment |
## 🐳 Production
```bash
docker compose -f docker-compose.yml up -d --build
```
Nginx serves static frontend + proxies `/api` to backend.
## 📂 Project Structure
```
├── frontend/ # Vite + React + TypeScript + Tailwind
│ ├── src/components/ # Chat, UI, Layout components
│ ├── src/stores/ # Zustand store
│ ├── src/services/ # API client
│ └── Dockerfile
├── backend/ # Express + proxy + chat storage
│ ├── src/index.js # Main server
│ └── Dockerfile
├── nginx/ # Reverse proxy config
└── docker-compose.yml # Full stack
```
## 📜 License
MIT