emit capture_saved SSE event when async transcription completes

This commit is contained in:
2026-04-29 17:58:01 +00:00
parent a05fcec882
commit c42d898504
+10
View File
@@ -716,6 +716,16 @@ def transcribe_and_save(tmp_path, timestamp, nextcloud_url, nextcloud_user, next
url = f"{captures_dir}/{filename}"
req_lib.put(url, data=content_md.encode("utf-8"), auth=nc_auth, timeout=30)
print(f"Async transcription saved: {filename}")
# Notify SSE clients that transcription is complete
try:
import requests as _req
_req.post("http://localhost:8000/api/events/notify", json={
"type": "capture_saved",
"filename": filename,
"timestamp": timestamp,
}, timeout=3)
except Exception:
pass
except Exception as e:
if os.path.exists(tmp_path):
os.unlink(tmp_path)