Spaces:
Sleeping
Sleeping
Commit ·
22ae8d0
1
Parent(s): 08bb076
Add system
Browse filesFiles changed (3)
- app.py+4-4
- system/pledge_tracking.py+5-13
- test.html+14-7
174 unmodified lines175176177178179180181178179180181182183184174 unmodified lines "events": events } default_log_path = f"{FEEDBACK_DIR}/feedback_{timestamp}_{user_id}.jsonl" step_id = outputs["step_id"] if update_status: update_status(step_id, "All done!") step_id += 1 # step_id = outputs["step_id"] # if update_status: # update_status(step_id, "All done!") # step_id += 1 with open(default_log_path, "w") as f: f.write(json.dumps(log_entry, indent=1))
26 unmodified lines27282930303233343536373839403132333435143 unmodified lines17918018119019119218218318418518618726 unmodified lines with open(output_path, "r", encoding="utf-8") as f: results = json.load(f)
print(results) total_events = 0 for item in results: try: events = item["output"] if isinstance(events, list): total_events += len(events) else: print(f"invalid: {events}") except KeyError: print(f"lack item: {item}") for result in results: total_events+= len(result["output"]["events"])
print(f"{total_events} events in total") return total_events143 unmodified lines df.to_excel(sorted_event_path, index=False) print(sorted_event_path)
# if update_fn: # update_fn(step_id, "All done!") # step_id += 1 if update_fn: update_fn(step_id, "All done!") step_id += 1
return { "claim_json": claim_json_path,244 unmodified lines245246247248249250251252253254248249250251252253254255256257258259260261262263264244 unmodified lines const finalText = values.join(" ").toLowerCase();
if (finalText.includes("done") || finalText.includes("finished")) { clearInterval(window.pollIntervalId); window.pollIntervalId = null; statusElement.innerHTML += `<div class="mt-2 text-green-600 font-semibold">✅ All done.</div>`; checkBtn.disabled = false; checkBtn.classList.remove("opacity-50", "cursor-not-allowed"); if (lastUsedFile) loadEvents(lastUsedFile); } else if (finalText.includes("error") || finalText.includes("fail")) { clearInterval(window.pollIntervalId); window.pollIntervalId = null; statusElement.innerHTML += `<div class="mt-2 text-green-600 font-semibold">✅ All done.</div>`; checkBtn.disabled = false; checkBtn.classList.remove("opacity-50", "cursor-not-allowed");
// 🕐 等待 lastUsedFile 准备好 const waitForFile = setInterval(() => { if (lastUsedFile) { clearInterval(waitForFile); loadEvents(lastUsedFile); } }, 200); } else if (finalText.includes("error") || finalText.includes("fail")) { clearInterval(window.pollIntervalId); window.pollIntervalId = null; statusElement.innerHTML += `<div class="mt-2 text-red-600 font-semibold">❌ The process failed.</div>`;app.py+4-4
system/pledge_tracking.py+5-13
test.html+14-7