Changeset 0.17.1 (#76)
This commit is contained in:
27
README.md
27
README.md
@@ -44,16 +44,18 @@ docker compose up -d
|
||||
│ Go Backend │
|
||||
│ ├─ handlers/ │
|
||||
│ ├─ store/postgres/ │
|
||||
│ ├─ store/sqlite/ │
|
||||
│ ├─ providers/ │
|
||||
│ └─ capabilities/ │
|
||||
└─────────┬─────────┘
|
||||
│
|
||||
┌─────────▼─────────┐
|
||||
│ PostgreSQL 16 │
|
||||
│ PostgreSQL 16 or │
|
||||
│ SQLite (embedded) │
|
||||
└───────────────────┘
|
||||
```
|
||||
|
||||
**Go backend** (vanilla, no framework beyond Gin) with a store layer abstracting all database access. Providers package handles LLM API calls. Capabilities package resolves model features from catalog data, known model tables, and heuristic inference. Server tools (calculator, datetime) auto-register via `init()`. EventBus + WebSocket hub routes tool calls between backend and browser extensions.
|
||||
**Go backend** (vanilla, no framework beyond Gin) with a store layer abstracting all database access. Dual-driver architecture: `store/postgres` for production deployments, `store/sqlite` for single-user, edge, and development scenarios — selected at startup via `DB_DRIVER`. Providers package handles LLM API calls. Capabilities package resolves model features from catalog data, known model tables, and heuristic inference. Server tools (calculator, datetime) auto-register via `init()`. EventBus + WebSocket hub routes tool calls between backend and browser extensions.
|
||||
|
||||
**Frontend** is vanilla JavaScript — no build step, no bundler. 15 files organized by domain: `api.js` (HTTP client), `app.js` (state + init), `chat.js` (send, regen, edit, branch), `events.js` (event bus + WebSocket), `extensions.js` (loader, registry, renderer pipeline, tool bridge), `ui-core.js` (DOM rendering + streaming), `ui-format.js` (markdown, code blocks), `ui-primitives.js` (shared components), `ui-settings.js` / `ui-admin.js` (settings and admin panels), `notes.js`, `tokens.js`, `debug.js`, `settings-handlers.js`, `admin-handlers.js`.
|
||||
|
||||
@@ -65,8 +67,10 @@ All configuration via environment variables. See `server/.env.example` for the f
|
||||
|----------|---------|-------------|
|
||||
| `PORT` | `8080` | Backend listen port |
|
||||
| `BASE_PATH` | ` ` | URL prefix (e.g. `/chat`) |
|
||||
| `DB_HOST` | `localhost` | PostgreSQL host |
|
||||
| `DB_NAME` | `chat_switchboard` | Database name |
|
||||
| `DB_DRIVER` | `postgres` | Database backend: `postgres` or `sqlite` |
|
||||
| `DATABASE_URL` | ` ` | SQLite: path to database file (e.g. `/data/switchboard.db`) |
|
||||
| `DB_HOST` | `localhost` | PostgreSQL host (ignored when `DB_DRIVER=sqlite`) |
|
||||
| `DB_NAME` | `chat_switchboard` | Database name (ignored when `DB_DRIVER=sqlite`) |
|
||||
| `JWT_SECRET` | (required) | Token signing key |
|
||||
| `SWITCHBOARD_ADMIN_USERNAME` | ` ` | Bootstrap admin username |
|
||||
| `SWITCHBOARD_ADMIN_PASSWORD` | ` ` | Bootstrap admin password |
|
||||
@@ -158,7 +162,20 @@ The Docker build bakes in `marked.js`, `DOMPurify`, and `KaTeX` (JS + CSS + font
|
||||
|
||||
## Database
|
||||
|
||||
PostgreSQL 16+ required. The `pgcrypto` extension is used for `gen_random_uuid()`.
|
||||
### PostgreSQL (default)
|
||||
|
||||
PostgreSQL 16+ recommended. The `pgcrypto` and `vector` (pgvector) extensions are used for UUID generation and vector similarity search respectively.
|
||||
|
||||
### SQLite (single-user / edge / dev)
|
||||
|
||||
Set `DB_DRIVER=sqlite` and `DATABASE_URL=/path/to/switchboard.db` to run with an embedded SQLite database. No external dependencies — the binary is self-contained (pure Go, no CGO). The SQLite backend has full feature parity with Postgres including knowledge base vector search, which uses app-level cosine similarity computed in Go rather than pgvector.
|
||||
|
||||
```bash
|
||||
# Minimal single-binary startup
|
||||
DB_DRIVER=sqlite DATABASE_URL=./data/switchboard.db JWT_SECRET=changeme ./switchboard
|
||||
```
|
||||
|
||||
SQLite is best suited for single-user workstations, edge deployments, air-gapped laptops, and local development. For multi-user production with concurrent writes, use PostgreSQL.
|
||||
|
||||
### Schema Management
|
||||
|
||||
|
||||
Reference in New Issue
Block a user