Spaces:
Sleeping
Sleeping
File size: 1,080 Bytes
463f868 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | import json
report_path = "reports/report_20260112_042512.json"
try:
with open(report_path, "r", encoding="utf-8") as f:
data = json.load(f)
print(f"Data Type: {type(data)}")
steps = [] # Default
if isinstance(data, dict):
print(f"Keys: {list(data.keys())}")
steps = data.get("steps", [])
print(f"Steps count: {len(steps)}")
elif isinstance(data, list):
print(f"List length: {len(data)}")
if len(data) > 0:
print(f"First item keys: {data[0].keys()}")
# steps = data.get("steps", []) # Old logic
if steps:
last_step = steps[-1]
print("Last Step Details:")
print(f" Phase: {last_step.get('phase')}")
print(f" Action: {last_step.get('action')}")
print(f" Legal Actions: {last_step.get('legal_actions')}")
# Check for logs
logs = data.get("logs", [])
if logs:
print("Last 5 Logs:")
for log in logs[-5:]:
print(f" {log}")
except Exception as e:
print(f"Error: {e}")
|