MCPcopy
hub / github.com/usestrix/strix / build_tui_stats_text

Function build_tui_stats_text

strix/interface/utils.py:371–397  ·  view source on GitHub ↗
(report_state: Any)

Source from the content-addressed store, hash-verified

369
370
371def 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
400def _slugify_for_run_name(text: str, max_length: int = 32) -> str:

Callers 1

_update_stats_displayMethod · 0.90

Calls 5

load_settingsFunction · 0.90
_llm_usageFunction · 0.85
_int_statFunction · 0.85
format_token_countFunction · 0.85
_float_statFunction · 0.85

Tested by

no test coverage detected