LocalAI/core/http
LocalAI [bot] f0cb02afb8
feat(usage): attribute Sources rows to user accounts in admin view (#9935)
The merged feature (#9920) let admins see per-API-key and per-source
totals but did not surface which user owned each key, and lumped
every user's Web UI traffic into a single global Web UI row. This
makes the admin Sources tab properly per-user attributable:

- KeyTotal gains UserID + UserName, populated from the snapshot the
  usage middleware already records. The by_key roll-up now groups by
  (api_key_id, api_key_name, user_id, user_name).
- New SourceTotals.ByUserSource roll-up groups (source, user_id,
  user_name) for sources without a key identity (web, legacy). Only
  populated on the admin path (includeLegacy=true); the non-admin
  endpoint stays unchanged for backwards compatibility.
- SourcesTable accepts showUserColumn={isAdmin}; admin view renders
  a User column, makes the search match user name/id, and expands
  Web UI / legacy pseudo-rows from the global aggregate to one row
  per user using by_user_source.

Refs: #9862

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
2026-05-21 23:23:06 +02:00
..
auth feat(usage): attribute Sources rows to user accounts in admin view (#9935) 2026-05-21 23:23:06 +02:00
endpoints fix(nodes): make per-node backend install async via gallery job queue (#9928) 2026-05-21 22:25:53 +02:00
middleware feat(usage): track and visualise usage per API key (#9920) 2026-05-21 16:34:02 +02:00
react-ui feat(usage): attribute Sources rows to user accounts in admin view (#9935) 2026-05-21 23:23:06 +02:00
routes fix(nodes): make per-node backend install async via gallery job queue (#9928) 2026-05-21 22:25:53 +02:00
static fix(streaming): comply with OpenAI usage / stream_options spec (#9815) 2026-05-14 08:53:46 +02:00
views feat(realtime): WebRTC support (#8790) 2026-03-13 21:37:15 +01:00
app.go fix(nodes): make per-node backend install async via gallery job queue (#9928) 2026-05-21 22:25:53 +02:00
app_test.go fix(http): honor X-Forwarded-Prefix when proxy strips the prefix (#9614) 2026-05-13 21:59:33 +02:00
csrf_multipart_test.go chore: Security hardening (#9719) 2026-05-08 16:25:45 +02:00
explorer.go chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
http_suite_test.go refactor(tests): split app_test.go, move real-backend coverage to e2e-backends 2026-04-27 23:09:20 +00:00
openresponses_test.go feat: add distributed mode (#9124) 2026-03-30 00:47:27 +02:00
render.go feat: add distributed mode (#9124) 2026-03-30 00:47:27 +02:00
route_coverage_test.go chore: Security hardening (#9719) 2026-05-08 16:25:45 +02:00