7 Commits

Author SHA1 Message Date
LovroG05
8bb62a1c20 feat: serve a backup model when the requested model fails
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Any model can name another model as its backup. The gateway tries the
backup when the model is offline, rate limited, or its upstream fails
before the client has received anything. The response reports the
requested model, so the client sees no switch. The request log records
each failed attempt and the address that served the request, and the
cost uses the backup's prices.
2026-10-15 09:56:01 +02:00
LovroG05
00800d3a3f fix: read the running llama.cpp context and allow a context override
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
The sync took meta.n_ctx_train from the model listing, which is the
training context, not the -c the server runs with. The llama.cpp provider
now asks the server for the live value: /props on a single server, the
router's /models status and /props?model=, and /upstream/<model>/props for
models llama-swap has loaded. Stopped models are never probed, because
that would start them.

Admins can also pin the context window per model from the Models page.
The override wins over the discovered value and survives syncs.
2026-10-04 18:14:09 +02:00
LovroG05
58d9c0a9c0 perf: lazy-load log content, populate user_id, keyset-paginate admin logs
Admin logs list no longer joins prompt/completion content for every row —
content is fetched per-row only when a log is expanded in the dashboard,
since a table of chat-length blobs was slow to serialize even at low row
counts.

request_logs.user_id (previously unpopulated despite an index existing on
it) is now set from the owning key on every insert, including synthetic
dashboard keys, and log queries filter on it directly instead of a
virtual_keys subquery. Pagination switches from OFFSET to a (created_at, id)
keyset cursor so paging deep into the log stays cheap. Adds indexes on
provider_name/key_prefix used by the admin filters.
2026-07-01 16:16:49 +02:00
LovroG05
d7bd1cced0 feat: content logging and per-key analytics
- Migration 000003: request_log_content table (messages jsonb, completion text)
- InsertRequestLog now returns the new row's ID so content can be linked
- Chat handler captures prompt messages and completion text (streaming accumulates deltas)
- ListRequestLogs left-joins content; logs API passes key filter through
- KeyStats query aggregates requests/tokens/cost/errors per key prefix
- GET /api/admin/stats/keys endpoint
- Logs page: expandable rows show prompt + completion inline
- Analytics page: per-key usage table below the chart
2026-06-29 00:01:25 +02:00
LovroG05
1d3a419777 feat: revise core DB schema for provider catalog, settings, and rate limits 2026-06-28 23:14:44 +02:00
LovroG05
2fa715d108 setup 2026-06-27 22:47:37 +02:00
LovroG05
7e7ab5a7e2 init 2026-06-27 16:46:12 +02:00