Change detailed model stats to use a new shared Table class to resolve robustness issues. (#15208)

This commit is contained in:
Jacob Richman
2025-12-17 18:01:37 -08:00
committed by GitHub
parent 124a6da743
commit bc168bbae4
6 changed files with 415 additions and 184 deletions

View File

@@ -11,7 +11,6 @@ exports[`<ModelStatsDisplay /> > should display a single model correctly 1`] = `
│ Requests 1 │
│ Errors 0 (0.0%) │
│ Avg Latency 100ms │
│ │
│ Tokens │
│ Total 30 │
│ ↳ Input 5 │
@@ -28,20 +27,19 @@ exports[`<ModelStatsDisplay /> > should display conditional rows if at least one
│ │
│ Model Stats For Nerds │
│ │
│ Metric gemini-2.5-pro gemini-2.5-flash
│ Metric gemini-2.5-pro gemini-2.5-flash │
│ ────────────────────────────────────────────────────────────────────────────────────────────── │
│ API │
│ Requests 1 1
│ Errors 0 (0.0%) 0 (0.0%)
│ Avg Latency 100ms 50ms
│ │
│ Requests 1 1
│ Errors 0 (0.0%) 0 (0.0%)
│ Avg Latency 100ms 50ms
│ Tokens │
│ Total 30 15
│ ↳ Input 5 5
│ ↳ Cache Reads 5 (50.0%) 0 (0.0%)
│ ↳ Thoughts 2 0
│ ↳ Tool 0 3
│ ↳ Output 20 10
│ Total 30 15
│ ↳ Input 5 5
│ ↳ Cache Reads 5 (50.0%) 0 (0.0%)
│ ↳ Thoughts 2 0
│ ↳ Tool 0 3
│ ↳ Output 20 10
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯"
`;
@@ -51,20 +49,19 @@ exports[`<ModelStatsDisplay /> > should display stats for multiple models correc
│ │
│ Model Stats For Nerds │
│ │
│ Metric gemini-2.5-pro gemini-2.5-flash
│ Metric gemini-2.5-pro gemini-2.5-flash │
│ ────────────────────────────────────────────────────────────────────────────────────────────── │
│ API │
│ Requests 10 20
│ Errors 1 (10.0%) 2 (10.0%)
│ Avg Latency 100ms 25ms
│ │
│ Requests 10 20
│ Errors 1 (10.0%) 2 (10.0%)
│ Avg Latency 100ms 25ms
│ Tokens │
│ Total 300 600
│ ↳ Input 50 100
│ ↳ Cache Reads 50 (50.0%) 100 (50.0%)
│ ↳ Thoughts 10 20
│ ↳ Tool 5 10
│ ↳ Output 200 400
│ Total 300 600
│ ↳ Input 50 100
│ ↳ Cache Reads 50 (50.0%) 100 (50.0%)
│ ↳ Thoughts 10 20
│ ↳ Tool 5 10
│ ↳ Output 200 400
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯"
`;
@@ -80,7 +77,6 @@ exports[`<ModelStatsDisplay /> > should handle large values without wrapping or
│ Requests 999,999,999 │
│ Errors 123,456,789 (12.3%) │
│ Avg Latency 0ms │
│ │
│ Tokens │
│ Total 999,999,999 │
│ ↳ Input 864,197,532 │
@@ -92,6 +88,28 @@ exports[`<ModelStatsDisplay /> > should handle large values without wrapping or
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯"
`;
exports[`<ModelStatsDisplay /> > should handle models with long names (gemini-3-*-preview) without layout breaking 1`] = `
"╭──────────────────────────────────────────────────────────────────────────────╮
│ │
│ Model Stats For Nerds │
│ │
│ Metric gemini-3-pro-preview gemini-3-flash-preview │
│ ────────────────────────────────────────────────────────────────────────── │
│ API │
│ Requests 10 20 │
│ Errors 0 (0.0%) 0 (0.0%) │
│ Avg Latency 200ms 50ms │
│ Tokens │
│ Total 6,000 12,000 │
│ ↳ Input 1,000 2,000 │
│ ↳ Cache Reads 500 (25.0%) 1,000 (25.0%) │
│ ↳ Thoughts 100 200 │
│ ↳ Tool 50 100 │
│ ↳ Output 4,000 8,000 │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯"
`;
exports[`<ModelStatsDisplay /> > should not display conditional rows if no model has data for them 1`] = `
"╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
@@ -103,7 +121,6 @@ exports[`<ModelStatsDisplay /> > should not display conditional rows if no model
│ Requests 1 │
│ Errors 0 (0.0%) │
│ Avg Latency 100ms │
│ │
│ Tokens │
│ Total 30 │
│ ↳ Input 10 │

View File

@@ -0,0 +1,14 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`Table > should render headers and data correctly 1`] = `
"ID Name
────────────────────────────────────────────────────────────────────────────────────────────────────
1 Alice
2 Bob"
`;
exports[`Table > should support custom cell rendering 1`] = `
"Value
────────────────────────────────────────────────────────────────────────────────────────────────────
20"
`;