Add web frontend

This commit is contained in:
2026-02-13 23:15:12 -08:00
parent 5faa57a741
commit 16a668b6ee
37 changed files with 4149 additions and 69 deletions

View File

@@ -13,12 +13,20 @@ Backend API for:
```bash
cp .env.example .env
npm run db:migrate
npm run dev
```
Migrations are applied automatically on server startup (`prisma migrate deploy`).
Open docs: `http://localhost:8787/docs`
## Run Modes
- `npm run dev`: runs `src/index.ts` with `tsx` in watch mode (auto-restart on file changes). Use for local development.
- `npm run start`: runs compiled `dist/index.js` with Node.js (no watch mode). Use for production-like runs.
Both modes run startup checks (`predev` / `prestart`) and apply migrations at app boot.
## Auth
Set `ADMIN_TOKEN` and send:
@@ -34,6 +42,7 @@ If `ADMIN_TOKEN` is not set, the server runs in open mode (dev).
## API
- `GET /health`
- `GET /v1/auth/session`
- `GET /v1/chats`
- `POST /v1/chats`
- `GET /v1/chats/:chatId`
@@ -41,6 +50,8 @@ If `ADMIN_TOKEN` is not set, the server runs in open mode (dev).
- `POST /v1/chat-completions`
- `POST /v1/chat-completions/stream` (SSE)
When `chatId` is provided to completion endpoints, you can send full conversation context. The server now stores only new non-assistant messages to avoid duplicate history rows.
`POST /v1/chat-completions` body example:
```json