refactor(tui): hug marker clear/model-switch calls
This commit is contained in:
@@ -162,11 +162,9 @@ def _apply_pending_model_switch(sid: str, session: dict) -> None:
|
||||
if not pending or session.get("agent") is None:
|
||||
return
|
||||
try:
|
||||
result = _apply_model_switch(
|
||||
sid, session, pending["raw"], confirm_expensive_model=bool(pending.get("confirm_expensive_model"))
|
||||
)
|
||||
# Honour the expensive-model confirm: surface the warning and drop the switch rather than
|
||||
# spend on a model the user never confirmed.
|
||||
result = _apply_model_switch(sid, session, pending["raw"], confirm_expensive_model=bool(pending.get("confirm_expensive_model")))
|
||||
# Honour the expensive-model confirm: surface the warning and drop the switch rather than spend
|
||||
# on a model the user never confirmed.
|
||||
if result.get("confirm_required"):
|
||||
_emit("error", sid, {"message": result.get("confirm_message") or result.get("warning") or ""})
|
||||
except Exception as e:
|
||||
|
||||
@@ -96,10 +96,7 @@ def record_turn_start(home: Path | str, session_key: str, prompt: str, *, attemp
|
||||
def clear_turn_marker(home: Path | str, session_key: str) -> None:
|
||||
"""Remove the marker once its turn concluded (any outcome the client saw)."""
|
||||
if session_key:
|
||||
_update(
|
||||
home, session_key,
|
||||
lambda e: {k: v for k, v in e.items() if k != session_key} if session_key in e else None, "clear",
|
||||
)
|
||||
_update(home, session_key, lambda e: {k: v for k, v in e.items() if k != session_key} if session_key in e else None, "clear")
|
||||
|
||||
|
||||
def read_turn_marker(home: Path | str, session_key: str) -> dict[str, Any] | None:
|
||||
|
||||
Reference in New Issue
Block a user