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

+65 -61
View File
@@ -1,61 +1,65 @@
import type { PartialTheme } from '@nivo/theming';
export const nivoTheme: PartialTheme = {
background: 'transparent',
text: {
fontFamily: "Geist, 'Microsoft YaHei', 'Heiti SC', 'WenQuanYi Micro Hei', sans-serif",
fontSize: 11,
fill: '#b8b8b8',
},
axis: {
domain: {
line: {
stroke: 'rgba(255,255,255,0.1)',
strokeWidth: 1,
},
},
ticks: {
line: {
stroke: 'transparent',
strokeWidth: 0,
},
text: {
fontFamily: "Geist, 'Microsoft YaHei', 'Heiti SC', 'WenQuanYi Micro Hei', sans-serif",
fontSize: 11,
fill: '#b8b8b8',
},
},
legend: {
text: {
fontFamily: "Geist, 'Microsoft YaHei', 'Heiti SC', 'WenQuanYi Micro Hei', sans-serif",
fontSize: 12,
fill: '#b8b8b8',
},
},
},
grid: {
line: {
stroke: 'rgba(255,255,255,0.06)',
strokeWidth: 1,
strokeDasharray: '4 4',
},
},
legends: {
text: {
fontFamily: "Geist, 'Microsoft YaHei', 'Heiti SC', 'WenQuanYi Micro Hei', sans-serif",
fontSize: 12,
fill: '#b8b8b8',
},
},
tooltip: {
container: {
background: '#2e2e2e',
color: '#fff',
fontFamily: "Geist, 'Microsoft YaHei', 'Heiti SC', 'WenQuanYi Micro Hei', sans-serif",
fontSize: 12,
borderRadius: 6,
boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',
padding: '8px 12px',
},
},
};
import type { PartialTheme } from '@nivo/theming';
/**
* Nivo chart theme aligned with Gemini Nexus design system.
* Uses Inter font family and refined dark palette.
*/
export const nivoTheme: PartialTheme = {
background: 'transparent',
text: {
fontFamily: "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
fontSize: 11,
fill: '#6b7280',
},
axis: {
domain: {
line: {
stroke: 'rgba(255,255,255,0.06)',
strokeWidth: 1,
},
},
ticks: {
line: {
stroke: 'transparent',
strokeWidth: 0,
},
text: {
fontFamily: "'JetBrains Mono', monospace",
fontSize: 10,
fill: '#6b7280',
},
},
legend: {
text: {
fontFamily: "Inter, sans-serif",
fontSize: 11,
fill: '#6b7280',
},
},
},
grid: {
line: {
stroke: 'rgba(255,255,255,0.04)',
strokeWidth: 1,
},
},
legends: {
text: {
fontFamily: "Inter, sans-serif",
fontSize: 11,
fill: '#6b7280',
},
},
tooltip: {
container: {
background: '#16161e',
color: '#e8eaed',
fontFamily: "Inter, sans-serif",
fontSize: 12,
borderRadius: 8,
border: '1px solid rgba(255,255,255,0.06)',
boxShadow: '0 8px 24px -4px rgba(0, 0, 0, 0.3)',
padding: '8px 12px',
},
},
};