Issue Fix

Upload 404 warning	doc_set(merge=True) in upload.py — creates doc if missing
MQTT call_end 404 error	doc_set(merge=True) in mqtt_handler.py — same root cause
Transcription 404 (saving transcript to nonexistent doc)	doc_set(merge=True) in transcription.py
Transcription ADC credentials error	Explicit service_account.Credentials from gcp-key.json in _sync_transcribe — same pattern as storage.py
This commit is contained in:
Logan
2026-04-12 22:04:11 -04:00
parent 66316efa53
commit 357553f1ea
3 changed files with 13 additions and 4 deletions
+1 -1
View File
@@ -193,7 +193,7 @@ class MQTTHandler:
if payload.get("audio_url"):
updates["audio_url"] = payload["audio_url"]
await fstore.doc_update("calls", call_id, updates)
await fstore.doc_set("calls", call_id, updates)
logger.info(f"Call end: {call_id}")
# ------------------------------------------------------------------
+11 -2
View File
@@ -35,7 +35,7 @@ async def transcribe_call(call_id: str, gcs_uri: str) -> Optional[str]:
if transcript:
try:
await fstore.doc_update("calls", call_id, {"transcript": transcript})
await fstore.doc_set("calls", call_id, {"transcript": transcript})
logger.info(f"Transcript saved for call {call_id} ({len(transcript)} chars)")
except Exception as e:
logger.warning(f"Could not save transcript for {call_id}: {e}")
@@ -46,8 +46,17 @@ async def transcribe_call(call_id: str, gcs_uri: str) -> Optional[str]:
def _sync_transcribe(gcs_uri: str) -> Optional[str]:
"""Synchronous STT call — run in a thread via asyncio.to_thread."""
from google.cloud import speech
from app.config import settings
client = speech.SpeechClient()
if settings.gcp_credentials_path:
from google.oauth2 import service_account
creds = service_account.Credentials.from_service_account_file(
settings.gcp_credentials_path,
scopes=["https://www.googleapis.com/auth/cloud-platform"],
)
client = speech.SpeechClient(credentials=creds)
else:
client = speech.SpeechClient()
audio = speech.RecognitionAudio(uri=gcs_uri)
config = speech.RecognitionConfig(