bichnhan2701 commited on
Commit
87908ee
·
1 Parent(s): c846dab

Update enrich job

Browse files
Files changed (1) hide show
  1. app/jobs/async_enrichment_job.py +12 -4
app/jobs/async_enrichment_job.py CHANGED
@@ -23,6 +23,13 @@ async def enrich_note(note_id: str, tasks: list[str]):
23
  try:
24
  # ---------- TEXT SOURCE ----------
25
  raw_text = note.get("raw_text", "").strip()
 
 
 
 
 
 
 
26
  text = raw_text
27
 
28
  # ---------- 1️⃣ Normalize ----------
@@ -89,10 +96,11 @@ async def enrich_note(note_id: str, tasks: list[str]):
89
  pass
90
 
91
  # ---------- DONE ----------
92
- update_note(note_id, {
93
- "status": NoteStatus.ready,
94
- "updated_at": now_ts(),
95
- })
 
96
 
97
  except Exception:
98
  logger.exception("Enrichment failed note_id=%s", note_id)
 
23
  try:
24
  # ---------- TEXT SOURCE ----------
25
  raw_text = note.get("raw_text", "").strip()
26
+ if not raw_text:
27
+ logger.info(
28
+ "[enrich_note] skip enrich, raw_text empty note_id=%s",
29
+ note_id,
30
+ )
31
+ return
32
+
33
  text = raw_text
34
 
35
  # ---------- 1️⃣ Normalize ----------
 
96
  pass
97
 
98
  # ---------- DONE ----------
99
+ if raw_text:
100
+ update_note(note_id, {
101
+ "status": NoteStatus.ready,
102
+ "updated_at": now_ts(),
103
+ })
104
 
105
  except Exception:
106
  logger.exception("Enrichment failed note_id=%s", note_id)