From c42d8985046cbd74274db8a4250d9ce932127c96 Mon Sep 17 00:00:00 2001 From: Aaron Nelson Date: Wed, 29 Apr 2026 17:58:01 +0000 Subject: [PATCH] emit capture_saved SSE event when async transcription completes --- scripts/api.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/api.py b/scripts/api.py index 5c8d3a1..024ec7e 100644 --- a/scripts/api.py +++ b/scripts/api.py @@ -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)