fix: align once output with dashboard snapshot

This commit is contained in:
2026-06-30 08:23:07 +08:00
parent 88361206ee
commit 99194a8f7d
+7 -4
View File
@@ -1173,13 +1173,16 @@ def normalize_log_rows(payload: dict[str, Any]) -> list[dict[str, Any]]:
return rows
def print_once(payload: dict[str, Any], filter_text: str = "", status_payload: dict[str, Any] | None = None, status_error: str = "") -> None:
def print_once(snapshot: dict[str, Any], filter_text: str = "") -> None:
payload = snapshot.get("payload") if isinstance(snapshot, dict) and isinstance(snapshot.get("payload"), dict) else {}
status_payload = snapshot.get("status_payload") if isinstance(snapshot, dict) and isinstance(snapshot.get("status_payload"), dict) else {}
status_error = str(snapshot.get("status_error") or "") if isinstance(snapshot, dict) else ""
print(summary_line(payload))
print(state_summary(payload))
if status_payload or status_error:
print(status_summary(status_payload or {}, status_error))
print(status_summary(status_payload, status_error))
print("requests")
for row in normalize_request_rows(payload, filter_text):
for row in snapshot.get("requests") or []:
print(
f"{row['seq']:>6} {short_text(row['request_id'], 16):<16} {status_symbol(row)} {row.get('status_code') or '-':<4} "
f"{short_text(row['path'], 20):<20} {short_text(row['model'] or row['requested_model'] or row['forwarded_model'], 16):<16} "
@@ -1212,7 +1215,7 @@ def main(argv: list[str] | None = None) -> int:
filter_text=args.filter,
current_view="overview",
)
print_once(snapshot["payload"], args.filter, snapshot["status_payload"], snapshot["status_error"])
print_once(snapshot, args.filter)
return 0
return run_textual(args.api_url, status_url, max(1, args.refresh_seconds), max(1, args.timeout), version_message)