116 lines
2.9 KiB
Markdown
116 lines
2.9 KiB
Markdown
# 🔀 Chat Switchboard
|
|
|
|
A sleek, OpenAI-compatible chat interface with per-conversation model switching, collapsible thinking blocks, and full chat history management.
|
|
|
|
## Features
|
|
|
|
- **Multi-Model Support**: Switch models per-chat via quick selector
|
|
- **Thinking Blocks**: Collapsible `<thinking>` tags with distinct styling
|
|
- **Streaming Responses**: Real-time token streaming with stop button
|
|
- **Chat History**: Persistent storage with export (Markdown/JSON/Text)
|
|
- **Keyboard Shortcuts**: `Enter` send, `Shift+Enter` newline, `Esc` stop, `Ctrl+B` sidebar, `Ctrl+,` settings
|
|
- **Code Highlighting**: Syntax-aware code blocks with copy buttons
|
|
- **Regenerate**: Re-run last response with one click
|
|
- **Dark Theme**: Easy on the eyes
|
|
|
|
## Quick Start
|
|
|
|
### Standalone (No Build Required)
|
|
|
|
```bash
|
|
# Build the single-file version
|
|
./build.sh
|
|
|
|
# Open in browser
|
|
xdg-open standalone/index.html
|
|
# or
|
|
python3 -m http.server 8080 --directory standalone
|
|
```
|
|
|
|
### Development
|
|
|
|
```bash
|
|
# Serve src/ directory for development
|
|
python3 -m http.server 8080 --directory src
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
chat-switchboard/
|
|
├── build.sh # Builds standalone HTML
|
|
├── standalone/ # Built single-file output
|
|
│ └── index.html
|
|
├── src/ # Source files
|
|
│ ├── index.html
|
|
│ ├── css/
|
|
│ │ └── styles.css
|
|
│ └── js/
|
|
│ ├── storage.js # LocalStorage utilities
|
|
│ ├── state.js # State management
|
|
│ ├── api.js # API calls
|
|
│ ├── ui.js # UI rendering
|
|
│ └── app.js # Main application
|
|
├── server/ # Backend (future)
|
|
│ ├── main.go
|
|
│ ├── handlers/
|
|
│ ├── models/
|
|
│ └── middleware/
|
|
├── migrations/ # PostgreSQL schemas
|
|
│ └── 001_initial.sql
|
|
├── docker-compose.yml # Local dev environment
|
|
└── docs/ # Documentation
|
|
```
|
|
|
|
## Backend (Planned)
|
|
|
|
The project is structured to support a full backend with:
|
|
|
|
- **Go server** with Gin/Echo
|
|
- **PostgreSQL** for persistent storage
|
|
- **User authentication** (optional)
|
|
- **API key management** per user
|
|
- **Chat syncing** across devices
|
|
|
|
### Database Schema
|
|
|
|
See `migrations/001_initial.sql` for the initial PostgreSQL schema.
|
|
|
|
### Running with Docker
|
|
|
|
```bash
|
|
docker-compose up -d
|
|
```
|
|
|
|
## Configuration
|
|
|
|
Settings are stored in `localStorage`:
|
|
|
|
| Key | Description |
|
|
|-----|-------------|
|
|
| `chatSwitchboard_settings` | API endpoint, model, parameters |
|
|
| `chatSwitchboard_models` | Cached model list |
|
|
| `chatSwitchboard_chats` | Chat history |
|
|
|
|
## API Compatibility
|
|
|
|
Works with any OpenAI-compatible API:
|
|
|
|
- OpenAI
|
|
- Anthropic (via proxy)
|
|
- Ollama (`http://localhost:11434/v1`)
|
|
- LM Studio
|
|
- LocalAI
|
|
- vLLM
|
|
- Together AI
|
|
- OpenRouter
|
|
- And more...
|
|
|
|
## License
|
|
|
|
MIT
|
|
|
|
## Credits
|
|
|
|
Originally inspired by various chat interfaces, enhanced with multi-model switching and thinking block support.
|