Commit 484ae9a
feat(frontend): color-code first-token & total latency in usage views (#43)
Map latency magnitude to color across the usage surfaces, on two scales:
- 首字延迟 (first-token / TTFT): tight 3-step scale (<3s green / <10s amber
/ >=10s red) — the pre-first-byte window stays small even when upstreams
are slow.
- 整体延迟 (total request latency): wider 5-step scale that keeps the original
1:3:6:12 spacing (<8s emerald / <24s lime / <48s amber / <96s orange /
>=96s red), since a streaming reasoning request can legitimately run well
over a minute.
Changes:
- llm_access_shared.rs: add shared LatencyBadgeColor alias, format_latency_ms,
first_token_latency_color and total_latency_color helpers + unit tests.
- admin_llm_gateway.rs: the Usage tab and Usage-journal-preview tab now use
the shared helpers; first-token latency is rendered as a color-coded badge
instead of plain muted text. The private format_latency_ms is dropped in
favor of the shared one.
- llm_access_usage.rs (public /llm-access/usage): the latency cell reuses the
colored-badge style and now shows first-token latency; the 账号 (account)
column is removed.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 7ce48b8 commit 484ae9a
3 files changed
Lines changed: 117 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
297 | 298 | | |
298 | 299 | | |
299 | 300 | | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | 301 | | |
305 | 302 | | |
306 | 303 | | |
| |||
6540 | 6537 | | |
6541 | 6538 | | |
6542 | 6539 | | |
6543 | | - | |
6544 | | - | |
6545 | | - | |
6546 | | - | |
6547 | | - | |
6548 | | - | |
6549 | | - | |
| 6540 | + | |
| 6541 | + | |
| 6542 | + | |
| 6543 | + | |
| 6544 | + | |
6550 | 6545 | | |
6551 | 6546 | | |
6552 | 6547 | | |
| |||
6594 | 6589 | | |
6595 | 6590 | | |
6596 | 6591 | | |
6597 | | - | |
6598 | | - | |
6599 | | - | |
| 6592 | + | |
| 6593 | + | |
| 6594 | + | |
| 6595 | + | |
| 6596 | + | |
6600 | 6597 | | |
6601 | | - | |
6602 | | - | |
| 6598 | + | |
| 6599 | + | |
6603 | 6600 | | |
6604 | 6601 | | |
6605 | 6602 | | |
| |||
9174 | 9171 | | |
9175 | 9172 | | |
9176 | 9173 | | |
9177 | | - | |
9178 | | - | |
9179 | | - | |
9180 | | - | |
9181 | | - | |
9182 | | - | |
9183 | | - | |
9184 | | - | |
| 9174 | + | |
| 9175 | + | |
| 9176 | + | |
| 9177 | + | |
| 9178 | + | |
9185 | 9179 | | |
9186 | 9180 | | |
9187 | 9181 | | |
| |||
9228 | 9222 | | |
9229 | 9223 | | |
9230 | 9224 | | |
9231 | | - | |
9232 | | - | |
9233 | | - | |
| 9225 | + | |
| 9226 | + | |
| 9227 | + | |
| 9228 | + | |
| 9229 | + | |
9234 | 9230 | | |
9235 | | - | |
9236 | | - | |
| 9231 | + | |
| 9232 | + | |
9237 | 9233 | | |
9238 | 9234 | | |
9239 | 9235 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
208 | 251 | | |
209 | 252 | | |
210 | 253 | | |
| |||
407 | 450 | | |
408 | 451 | | |
409 | 452 | | |
410 | | - | |
411 | | - | |
| 453 | + | |
| 454 | + | |
412 | 455 | | |
413 | 456 | | |
414 | 457 | | |
| |||
479 | 522 | | |
480 | 523 | | |
481 | 524 | | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
482 | 550 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
397 | 398 | | |
398 | 399 | | |
399 | 400 | | |
400 | | - | |
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
410 | 415 | | |
411 | 416 | | |
412 | 417 | | |
| |||
415 | 420 | | |
416 | 421 | | |
417 | 422 | | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | 423 | | |
424 | 424 | | |
425 | 425 | | |
| |||
444 | 444 | | |
445 | 445 | | |
446 | 446 | | |
447 | | - | |
448 | | - | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
449 | 460 | | |
450 | 461 | | |
451 | 462 | | |
| |||
0 commit comments