60 lines
2 KiB
Markdown
60 lines
2 KiB
Markdown
# Dashboard
|
|
|
|
Admin dashboard for the didiAI platform. Tracks search provider usage, costs, request history, and exposes runtime configuration.
|
|
|
|
## What it does
|
|
|
|
- **Live quota & billing** — pulls real-time data from SerpAPI, Tavily, Brave, OpenRouter
|
|
- **Health monitoring** — SearXNG, web-api, vLLM, llama.cpp servers
|
|
- **Request history** — 30-day rolling log of every gather/search/fetch request with drill-down
|
|
- **Cost tracking** — per-provider spend, projections, cost per tier
|
|
- **Future:** runtime config (toggle providers, change strategies, manage tier caps)
|
|
|
|
## Prerequisites
|
|
|
|
- Docker 24+ with Compose V2
|
|
- PostgreSQL 16 (provided by compose)
|
|
- Internal network access to web-api, SearXNG, LLM servers
|
|
|
|
## Quick start
|
|
|
|
```bash
|
|
cd deploy
|
|
cp ../.env.example .env # edit with your secrets
|
|
./deploy.sh up
|
|
```
|
|
|
|
Dashboard is now running at http://localhost:51300
|
|
|
|
## Endpoints
|
|
|
|
### Web UI
|
|
- `/` — overview with KPIs and provider grid
|
|
- `/providers` — detailed provider cards + raw table
|
|
- `/history` — filterable request history
|
|
- `/history/{request_id}` — full request detail with stages
|
|
|
|
### JSON API
|
|
- `GET /health` — liveness
|
|
- `GET /api/stats/providers` — live provider stats
|
|
- `GET /api/stats/summary?hours=24` — aggregated counters
|
|
- `GET /api/stats/timeline?hours=24` — hourly buckets for charts
|
|
- `GET /api/history?limit=50&tier=premium` — filtered history
|
|
- `GET /api/history/{request_id}` — single request with full payload
|
|
- `POST /api/ingest/event` — receives events from web-api middleware
|
|
|
|
## Architecture
|
|
|
|
```
|
|
web-api ────► POST /api/ingest/event ────► dashboard-api ────► PostgreSQL
|
|
│
|
|
├─ reads provider APIs live
|
|
└─ serves UI via Jinja2+HTMX
|
|
```
|
|
|
|
## Tech stack
|
|
|
|
- FastAPI + Pydantic
|
|
- SQLAlchemy 2.0 async + asyncpg
|
|
- Jinja2 + HTMX + Alpine.js + Tailwind (zero build step)
|
|
- PostgreSQL 16
|