bardd commited on
Commit
edc838a
·
verified ·
1 Parent(s): 5cf54c1

Update src/proxy_app/static/dashboard.html

Browse files
Files changed (1) hide show
  1. src/proxy_app/static/dashboard.html +30 -10
src/proxy_app/static/dashboard.html CHANGED
@@ -373,7 +373,8 @@
373
  btn.innerHTML = '⏳ Loading...';
374
 
375
  try {
376
- const response = await fetch('/v1/quota-stats?provider=antigravity', {
 
377
  headers: {
378
  'Authorization': `Bearer ${API_KEY}`
379
  }
@@ -400,19 +401,34 @@
400
  }
401
 
402
  function renderDashboard(data) {
403
- const provider = data.providers?.antigravity;
404
- if (!provider) {
405
- document.getElementById('content').innerHTML = '<div class="loading">No Antigravity data available</div>';
 
406
  return;
407
  }
408
 
409
- const summary = data.summary || {};
 
 
 
 
 
 
 
 
410
  const tokens = provider.tokens || {};
411
  const totalTokens = (tokens.input_uncached || 0) + (tokens.input_cached || 0) + (tokens.output || 0);
412
 
 
 
 
413
  let html = `
 
 
 
414
  <div class="summary-card">
415
- <div class="summary-title">📊 TOTAL USAGE</div>
416
  <div class="summary-grid">
417
  <div class="stat-box">
418
  <div class="stat-value">${provider.total_requests || 0}</div>
@@ -460,9 +476,14 @@
460
  ];
461
 
462
  const credentials = provider.credentials || [];
 
 
 
 
463
  credentials.forEach((cred, index) => {
464
  const credTokens = cred.tokens || {};
465
  const credTotalTokens = (credTokens.input_uncached || 0) + (credTokens.input_cached || 0) + (credTokens.output || 0);
 
466
  const maskedEmail = maskedEmails[index] || `Account #${index + 1}`;
467
 
468
  html += `
@@ -507,13 +528,12 @@
507
  });
508
 
509
  modelEntries.forEach(([modelName, modelStats]) => {
510
- const shortName = modelName.replace('antigravity/', '');
 
511
  const used = modelStats.request_count || 0;
512
  const max = modelStats.quota_max_requests || 0;
513
  const pct = max > 0 ? (used / max) * 100 : 0;
514
  const resetTime = modelStats.quota_reset_ts;
515
- const promptTokens = modelStats.prompt_tokens || 0;
516
- const completionTokens = modelStats.completion_tokens || 0;
517
 
518
  html += `
519
  <div class="model-row">
@@ -540,7 +560,7 @@
540
  });
541
 
542
  html += '</div>';
543
- document.getElementById('content').innerHTML = html;
544
  }
545
 
546
  function startCountdown() {
 
373
  btn.innerHTML = '⏳ Loading...';
374
 
375
  try {
376
+ // Fetch stats for ALL providers (removed ?provider=antigravity)
377
+ const response = await fetch('/v1/quota-stats', {
378
  headers: {
379
  'Authorization': `Bearer ${API_KEY}`
380
  }
 
401
  }
402
 
403
  function renderDashboard(data) {
404
+ const providers = data.providers || {};
405
+
406
+ if (Object.keys(providers).length === 0) {
407
+ document.getElementById('content').innerHTML = '<div class="loading">No provider data available</div>';
408
  return;
409
  }
410
 
411
+ let html = '';
412
+ // Render each provider in its own section
413
+ for (const [name, stats] of Object.entries(providers)) {
414
+ html += renderProviderSection(name, stats);
415
+ }
416
+ document.getElementById('content').innerHTML = html;
417
+ }
418
+
419
+ function renderProviderSection(providerName, provider) {
420
  const tokens = provider.tokens || {};
421
  const totalTokens = (tokens.input_uncached || 0) + (tokens.input_cached || 0) + (tokens.output || 0);
422
 
423
+ // Format provider name nicely (e.g., "gemini_cli" -> "Gemini CLI")
424
+ const displayName = providerName.split('_').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
425
+
426
  let html = `
427
+ <h2 style="margin-top: 30px; margin-bottom: 15px; border-bottom: 2px solid var(--border-color); padding-bottom: 10px;">
428
+ 🤖 ${displayName}
429
+ </h2>
430
  <div class="summary-card">
431
+ <div class="summary-title">📊 TOTAL USAGE - ${displayName.toUpperCase()}</div>
432
  <div class="summary-grid">
433
  <div class="stat-box">
434
  <div class="stat-value">${provider.total_requests || 0}</div>
 
476
  ];
477
 
478
  const credentials = provider.credentials || [];
479
+ if (credentials.length === 0) {
480
+ html += '<div style="color: var(--text-secondary); padding: 20px; text-align: center;">No credentials configured</div>';
481
+ }
482
+
483
  credentials.forEach((cred, index) => {
484
  const credTokens = cred.tokens || {};
485
  const credTotalTokens = (credTokens.input_uncached || 0) + (credTokens.input_cached || 0) + (credTokens.output || 0);
486
+ // Use built-in masked email if available, else fallback
487
  const maskedEmail = maskedEmails[index] || `Account #${index + 1}`;
488
 
489
  html += `
 
528
  });
529
 
530
  modelEntries.forEach(([modelName, modelStats]) => {
531
+ // Remove provider prefix for cleaner display
532
+ const shortName = modelName.replace(`${providerName}/`, '');
533
  const used = modelStats.request_count || 0;
534
  const max = modelStats.quota_max_requests || 0;
535
  const pct = max > 0 ? (used / max) * 100 : 0;
536
  const resetTime = modelStats.quota_reset_ts;
 
 
537
 
538
  html += `
539
  <div class="model-row">
 
560
  });
561
 
562
  html += '</div>';
563
+ return html;
564
  }
565
 
566
  function startCountdown() {