(report_state: Any)
| 369 | |
| 370 | |
| 371 | def build_tui_stats_text(report_state: Any) -> Text: |
| 372 | stats_text = Text() |
| 373 | if not report_state: |
| 374 | return stats_text |
| 375 | |
| 376 | model = load_settings().llm.model or "unknown" |
| 377 | stats_text.append(str(model), style="white") |
| 378 | |
| 379 | usage = _llm_usage(report_state) |
| 380 | if usage and _int_stat(usage, "total_tokens") > 0: |
| 381 | stats_text.append("\n") |
| 382 | stats_text.append( |
| 383 | f"{format_token_count(_int_stat(usage, 'total_tokens'))} tokens", |
| 384 | style="white", |
| 385 | ) |
| 386 | cost = _float_stat(usage, "cost") |
| 387 | if cost > 0: |
| 388 | stats_text.append(" · ", style="white") |
| 389 | stats_text.append(f"${cost:.2f}", style="white") |
| 390 | |
| 391 | caido_url = getattr(report_state, "caido_url", None) |
| 392 | if caido_url: |
| 393 | stats_text.append("\n") |
| 394 | stats_text.append("Caido: ", style="bold white") |
| 395 | stats_text.append(caido_url, style="white") |
| 396 | |
| 397 | return stats_text |
| 398 | |
| 399 | |
| 400 | def _slugify_for_run_name(text: str, max_length: int = 32) -> str: |
no test coverage detected