Merge branch 'feat/checkpoint-fields'

fix: снимок сессии сохраняет раскрытые факты и поля завершённых карточек ДДС
This commit is contained in:
GGlamer 2026-09-26 23:01:11 +03:00 • committed by GitHub
commit 69de83f232
2 changed files with 84 additions and 2 deletions

View file

@ -151,11 +151,20 @@ def dump_state(state: SessionState) -> dict:
"findings": [finding.model_dump(mode="json") for finding in item.findings],
"actions": item.actions,
"duration_ms": item.duration_ms,
"title": item.title,
"address": item.address,
"description": item.description,
"incident_type": item.incident_type,
"victims_count": item.victims_count,
"received_at": item.received_at.isoformat() if item.received_at else None,
"managed_service": item.managed_service,
"recipient_services": item.recipient_services,
}
for item in state.dds_completed
],
"reply_text": state.reply_text,
"reply_log": [[at.isoformat(), text] for at, text in state.reply_log],
"text_revealed_facts": state.text_revealed_facts,
"resolved_outcome": state.resolved_outcome,
"resolve_comment": state.resolve_comment,
"processed_station_commands": state.processed_station_commands[-512:],
@ -312,12 +321,21 @@ def load_state(payload: dict, saved_at: datetime) -> SessionState:
for finding in item.get("findings", [])],
actions=list(item.get("actions") or []),
duration_ms=int(item.get("duration_ms", 0)),
title=item.get("title"),
address=item.get("address"),
description=item.get("description"),
incident_type=item.get("incident_type"),
victims_count=item.get("victims_count"),
received_at=_dt(item.get("received_at")),
managed_service=item.get("managed_service"),
recipient_services=list(item.get("recipient_services") or []),
)
for item in payload.get("dds_completed", [])
],
reply_text=payload.get("reply_text", ""),
reply_log=[(datetime.fromisoformat(at), text)
for at, text in payload.get("reply_log", [])],
text_revealed_facts=dict(payload.get("text_revealed_facts") or {}),
resolved_outcome=payload.get("resolved_outcome"),
resolve_comment=payload.get("resolve_comment", ""),
processed_station_commands=list(payload.get("processed_station_commands") or [])[-512:],