bichnhan2701 commited on
Commit
cc65c05
·
1 Parent(s): 65ea3a1

fix bug create note

Browse files
app/jobs/transcribe_job.py CHANGED
@@ -63,7 +63,17 @@ def transcribe_job(audio_url: str, note_id: str, user_id: str | None = None):
63
  }
64
 
65
  client = NoteServiceClient()
66
- asyncio.run(client.create_audio_note(payload))
 
 
 
 
 
 
 
 
 
 
67
 
68
  finally:
69
  if wav_path and os.path.exists(wav_path):
 
63
  }
64
 
65
  client = NoteServiceClient()
66
+ asyncio.run(
67
+ client.update_note(
68
+ note_id,
69
+ {
70
+ "status": note_status,
71
+ "raw_text": text,
72
+ "metadata": payload["metadata"],
73
+ },
74
+ )
75
+ )
76
+
77
 
78
  finally:
79
  if wav_path and os.path.exists(wav_path):
app/services/note_client.py CHANGED
@@ -35,4 +35,13 @@ class NoteServiceClient:
35
 
36
  async def save_transcript(self, payload: dict):
37
  # alias used elsewhere in the codebase
38
- return await self.create_audio_note(payload)
 
 
 
 
 
 
 
 
 
 
35
 
36
  async def save_transcript(self, payload: dict):
37
  # alias used elsewhere in the codebase
38
+ return await self.create_audio_note(payload)
39
+
40
+ async def update_note(self, note_id: str, payload: dict):
41
+ async with httpx.AsyncClient(timeout=30) as client:
42
+ r = await client.patch(
43
+ f"{NOTE_SERVICE_URL}/internal/notes/{note_id}",
44
+ json=payload,
45
+ )
46
+ r.raise_for_status()
47
+ return r.json()