fwerkor commited on
Commit
8e1fbe1
·
1 Parent(s): 42adf6c

Show complete Display evolution

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -404,17 +404,21 @@ def _trace_rows(events: tuple[dict[str, Any], ...]) -> list[list[Any]]:
404
  def _display_evolution(events: tuple[dict[str, Any], ...]) -> str:
405
  changes: list[str] = []
406
  previous: str | None = None
 
407
  for event in events:
408
  if event.get("kind") != "model_step_finished":
409
  continue
410
  payload = event.get("payload", {})
411
  current = str(payload.get("display_materialized_text", "")).strip()
412
- if current and current != previous:
413
- changes.append(f"**Step {event.get('step', 0)}** — {current}")
414
- previous = current
 
 
 
415
  if not changes:
416
- return "No materialized Display text was produced before the run ended."
417
- return "\n\n".join(changes[-12:])
418
 
419
 
420
  def _summary_html(summary: dict[str, Any]) -> str:
 
404
  def _display_evolution(events: tuple[dict[str, Any], ...]) -> str:
405
  changes: list[str] = []
406
  previous: str | None = None
407
+ seen_step = False
408
  for event in events:
409
  if event.get("kind") != "model_step_finished":
410
  continue
411
  payload = event.get("payload", {})
412
  current = str(payload.get("display_materialized_text", "")).strip()
413
+ if seen_step and current == previous:
414
+ continue
415
+ visible = current or "(empty Display)"
416
+ changes.append(f"**Step {event.get('step', 0)}** — {visible}")
417
+ previous = current
418
+ seen_step = True
419
  if not changes:
420
+ return "No Display states were recorded before the run ended."
421
+ return "\n\n".join(changes)
422
 
423
 
424
  def _summary_html(summary: dict[str, Any]) -> str: