fix: token tracking pipeline + premium usage dashboard redesign

Backend fixes:
- Fix totalTokens defaulting to 0 when API omits totalTokenCount (now computes prompt+completion)
- Fix streaming metadata extraction: unwrap response wrapper in Anthropic/Gemini handlers
- Fix Zod schemas: handle SQL SUM(null) with nullable().transform()
- Add is_estimated column migration to token_usage table

Frontend redesign:
- Rewrite Usage page with area charts (nivo/line), horizontal bar model ranking
- StatCard: add trend indicators (% vs previous period) and inline SVG sparklines
- Premium color palette, prompt/completion ratio bar, top models mini-list
- Live indicator with 15s auto-refresh

Design system migration:
- Standardize all components on Gemini Nexus tokens (rounded-xl, border-white/[0.06])
- Refine UI components, proxy tabs, cloud account list, provider groups
This commit is contained in:
Gemini Nexus Bot committed 2026-04-29 01:43:48 -03:00
1 parent b1c76f3b69
commit a648f2a281
44 files changed
+8920 -14566

No files matched your search

+69
View File
@@ -46,6 +46,9 @@ importers:
'@nivo/core':
specifier: ^0.99.0
version: 0.99.0([email protected]([email protected]))([email protected])
'@nivo/line':
specifier: ^0.99.0
version: 0.99.0([email protected]([email protected]))([email protected])
'@nivo/pie':
specifier: ^0.99.0
version: 0.99.0([email protected]([email protected]))([email protected])
@@ -1641,6 +1644,11 @@ packages:
peerDependencies:
react: ^16.14 || ^17.0 || ^18.0 || ^19.0
'@nivo/[email protected]':
resolution: {integrity: sha512-bAqTXSjpnpcGMs341qWFUi7hJTqQiNoSeJHsYPuPS3icuXPcp3WETQH+zRZACeEF79ZigeOWCW+dzODgne1y9w==}
peerDependencies:
react: ^16.14 || ^17.0 || ^18.0 || ^19.0
'@nivo/[email protected]':
resolution: {integrity: sha512-zUbo8UdLndp2RMljrOqitAKKEnl7YypkJrOzjKLk8jQGU7qqUKtgFoJIPhiBsvNPs3xtX2KwgtS1+JKNTNns7A==}
peerDependencies:
@@ -1664,6 +1672,11 @@ packages:
peerDependencies:
react: ^16.14 || ^17.0 || ^18.0 || ^19.0
'@nivo/[email protected]':
resolution: {integrity: sha512-KfmMdidbYzhiUCki1FG4X4nHEFT4loK8G5bMBnmCl9U+S78W+gvkfrgD2Aoqp/Q9yKQvr3Y8UcZKSFZnn3HgjQ==}
peerDependencies:
react: ^16.14 || ^17.0 || ^18.0 || ^19.0
'@nodelib/[email protected]':
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
engines: {node: '>= 8'}
@@ -3505,6 +3518,9 @@ packages:
'@types/[email protected]':
resolution: {integrity: sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==}
'@types/[email protected]':
resolution: {integrity: sha512-ZMaSKu4THYCU6sV64Lhg6qjf1orxBthaC161plr5KuPHo3CNm8DTHiLw/5Eq2b6TsNP0W0iJrUOFscY6Q450Hw==}
'@types/[email protected]':
resolution: {integrity: sha512-mLxrC1MSWupOSncXN/HOlWUAAIffAEBaI4+PKy2uMPsKe4FNZlk7qrbTjmzJXITQQqBHivaks4Td18azgqnotA==}
@@ -4593,6 +4609,10 @@ packages:
resolution: {integrity: sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==}
engines: {node: '>=12'}
[email protected]:
resolution: {integrity: sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A==}
engines: {node: '>=12'}
[email protected]:
resolution: {integrity: sha512-J0piedu6Z8iB6TbIGfZgDzfXxUFN3qQRMofy2oPdXzQibYGqPB/9iMcxr/TGalU+2RsyDO+U4f33id8tbnSRMQ==}
@@ -4702,6 +4722,9 @@ packages:
resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==}
engines: {node: '>= 0.4'}
[email protected]:
resolution: {integrity: sha512-AGrQ4QSgssa1NGmWmLPqN5NY2KajF5MqxetNEO+o0n3ZwZZeTmt7bBnvzHWrmkZFxGgr4HdyFgelzgi06otLuQ==}
[email protected]:
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
engines: {node: '>=0.4.0'}
@@ -7618,6 +7641,9 @@ packages:
resolution: {integrity: sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==}
engines: {node: '>=8.0'}
[email protected]:
resolution: {integrity: sha512-NS3levdsRIUOmiJ8FZWCP7LG3QpJyrs/TE0Zpf1yvZu8cAJJ6QMW92H1c7kWpdIHo8RvmLxN/o2JXTKHp74lUA==}
[email protected]:
resolution: {integrity: sha512-ZrT53oAKrtA4+YtBWPQbtPOxIbVDbxT0orcYERKd63VJTF13zPcgXTvD4843L8pcsI7M6MErt8QtON6lrB9tyA==}
engines: {node: ^20.19.0 || >=22.12.0}
@@ -10389,6 +10415,24 @@ snapshots:
transitivePeerDependencies:
- react-dom
'@nivo/[email protected]([email protected]([email protected]))([email protected])':
dependencies:
'@nivo/annotations': 0.99.0([email protected]([email protected]))([email protected])
'@nivo/axes': 0.99.0([email protected]([email protected]))([email protected])
'@nivo/colors': 0.99.0([email protected]([email protected]))([email protected])
'@nivo/core': 0.99.0([email protected]([email protected]))([email protected])
'@nivo/legends': 0.99.0([email protected]([email protected]))([email protected])
'@nivo/scales': 0.99.0
'@nivo/theming': 0.99.0([email protected])
'@nivo/tooltip': 0.99.0([email protected]([email protected]))([email protected])
'@nivo/voronoi': 0.99.0([email protected]([email protected]))([email protected])
'@react-spring/web': 10.0.3([email protected]([email protected]))([email protected])
'@types/d3-shape': 3.1.8
d3-shape: 3.2.0
react: 19.2.5
transitivePeerDependencies:
- react-dom
'@nivo/[email protected]([email protected]([email protected]))([email protected])':
dependencies:
'@nivo/arcs': 0.99.0([email protected]([email protected]))([email protected])
@@ -10438,6 +10482,19 @@ snapshots:
transitivePeerDependencies:
- react-dom
'@nivo/[email protected]([email protected]([email protected]))([email protected])':
dependencies:
'@nivo/core': 0.99.0([email protected]([email protected]))([email protected])
'@nivo/theming': 0.99.0([email protected])
'@nivo/tooltip': 0.99.0([email protected]([email protected]))([email protected])
'@types/d3-delaunay': 6.0.4
'@types/d3-scale': 4.0.9
d3-delaunay: 6.0.4
d3-scale: 4.0.2
react: 19.2.5
transitivePeerDependencies:
- react-dom
'@nodelib/[email protected]':
dependencies:
'@nodelib/fs.stat': 2.0.5
@@ -12378,6 +12435,8 @@ snapshots:
'@types/[email protected]': {}
'@types/[email protected]': {}
'@types/[email protected]': {}
'@types/[email protected]':
@@ -13684,6 +13743,10 @@ snapshots:
[email protected]: {}
[email protected]:
dependencies:
delaunator: 5.1.0
[email protected]: {}
[email protected]: {}
@@ -13790,6 +13853,10 @@ snapshots:
has-property-descriptors: 1.0.2
object-keys: 1.1.1
[email protected]:
dependencies:
robust-predicates: 3.0.3
[email protected]: {}
[email protected]: {}
@@ -16781,6 +16848,8 @@ snapshots:
sprintf-js: 1.1.3
optional: true
[email protected]: {}
[email protected]:
dependencies:
'@oxc-project/types': 0.127.0