diff --git a/echo/server/dembrane/api/conversation.py b/echo/server/dembrane/api/conversation.py index 4342fa87..305804cf 100644 --- a/echo/server/dembrane/api/conversation.py +++ b/echo/server/dembrane/api/conversation.py @@ -674,6 +674,12 @@ async def summarize_conversation( language = conversation_data["project_id"]["language"] if transcript_str == "": + # Update conversation in DB so has_empty_transcript is True, preventing infinite retries by the catch-up scheduler + await run_in_thread_pool( + conversation_service.update, + conversation_id=conversation_id, + has_empty_transcript=True, + ) return { "status": "success", "message": "Transcript is empty, so no summary was generated", diff --git a/echo/server/dembrane/conversation_utils.py b/echo/server/dembrane/conversation_utils.py index fb5efa59..836f95e5 100644 --- a/echo/server/dembrane/conversation_utils.py +++ b/echo/server/dembrane/conversation_utils.py @@ -134,7 +134,7 @@ def collect_unsummarized_conversations(limit: int = 50) -> List[str]: """ Collect conversations that are fully transcribed but missing a summary. - Simple check: is_all_chunks_transcribed = True AND summary = null. + Simple check: is_all_chunks_transcribed = True AND summary = null AND has_empty_transcript != True. The transcribed flag is the source of truth for "ready for summarization". Args: @@ -150,6 +150,7 @@ def collect_unsummarized_conversations(limit: int = 50) -> List[str]: "filter": { "is_all_chunks_transcribed": True, "summary": {"_null": True}, + "has_empty_transcript": {"_neq": True}, "deleted_at": {"_null": True}, "created_at": { "_lte": (get_utc_timestamp() - timedelta(minutes=5)).isoformat() diff --git a/echo/server/dembrane/service/conversation.py b/echo/server/dembrane/service/conversation.py index 0d53c4e9..a786eca2 100644 --- a/echo/server/dembrane/service/conversation.py +++ b/echo/server/dembrane/service/conversation.py @@ -330,6 +330,7 @@ def update( is_finished: Any = _UNSET, is_all_chunks_transcribed: Any = _UNSET, is_over_cap: Any = _UNSET, + has_empty_transcript: Any = _UNSET, ) -> dict: update_data: dict[str, Any] = {} if participant_name is not _UNSET: @@ -348,6 +349,8 @@ def update( update_data["is_all_chunks_transcribed"] = is_all_chunks_transcribed if is_over_cap is not _UNSET: update_data["is_over_cap"] = is_over_cap + if has_empty_transcript is not _UNSET: + update_data["has_empty_transcript"] = has_empty_transcript try: with self._client_context() as client: