hmgill commited on
Commit
9847e32
·
verified ·
1 Parent(s): ec4bf63

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -955,13 +955,15 @@ async def _run_agent_turn(prompt_text: str, cxr_path: str | None) -> None:
955
  answer.content = (
956
  "I've re-opened the most recent overlay in the panel on the "
957
  "right — it already shows the localized findings on this image.")
958
- answer.elements = [] # stop the live timer
 
959
  await answer.update()
960
  return
961
  except Exception: # noqa: BLE001 — fall through to the error message
962
  pass
963
  answer.content = f"❌ Run failed: {e}"
964
- answer.elements = [] # stop the live timer
 
965
  await answer.update()
966
  return
967
 
@@ -1036,6 +1038,10 @@ async def _run_agent_turn(prompt_text: str, cxr_path: str | None) -> None:
1036
  content += "\n\n---\n" + "\n\n".join(footer_bits)
1037
 
1038
  answer.content = content
 
 
 
 
1039
  answer.elements = files # replaces the live timer element (turn done)
1040
  answer.actions = actions
1041
  await answer.update()
 
955
  answer.content = (
956
  "I've re-opened the most recent overlay in the panel on the "
957
  "right — it already shows the localized findings on this image.")
958
+ answer.elements = [cl.CustomElement(
959
+ name="TimerStop", props={"id": _timer_id}, display="inline")]
960
  await answer.update()
961
  return
962
  except Exception: # noqa: BLE001 — fall through to the error message
963
  pass
964
  answer.content = f"❌ Run failed: {e}"
965
+ answer.elements = [cl.CustomElement(
966
+ name="TimerStop", props={"id": _timer_id}, display="inline")]
967
  await answer.update()
968
  return
969
 
 
1038
  content += "\n\n---\n" + "\n\n".join(footer_bits)
1039
 
1040
  answer.content = content
1041
+ # Mount an invisible stopper so the live timer halts even if this Chainlit
1042
+ # version doesn't unmount the removed TurnTimer element on update.
1043
+ files.append(cl.CustomElement(
1044
+ name="TimerStop", props={"id": _timer_id}, display="inline"))
1045
  answer.elements = files # replaces the live timer element (turn done)
1046
  answer.actions = actions
1047
  await answer.update()