feat(stt-log): log the WHOLE turn pipeline to the transcript channel
The transcript channel only showed successful transcripts, so dropped utterances (the 47/50 misses) were invisible. Now every captured utterance is mirrored with its outcome and per-stage timing: - too-short blip (<300ms), VAD "음성 아님(VAD 차단)", "인식 실패", "답변 없음", or "ok" - transcript + reply (or "(무응답)") - ⏱️ stt/llm seconds The bridge meta now carries note + stt_sec + think_sec; voice.ts fires onTurn for every turn (not only non-empty transcripts) and for the too-short drop; userbot formats the diagnostic line. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -211,7 +211,7 @@ def transcribe(wav_bytes: bytes) -> dict:
|
||||
log=lambda m: print(f"[bridge] {m}", flush=True),
|
||||
):
|
||||
print("[bridge] no speech detected (VAD) — skipping STT", flush=True)
|
||||
return {"text": "", "language": None}
|
||||
return {"text": "", "language": None, "note": "음성 아님(VAD 차단)"}
|
||||
|
||||
segments, info = _whisper.transcribe(audio, beam_size=1, language=STT_LANGUAGE)
|
||||
# Second line of defence: drop non-speech / hallucinated segments by
|
||||
@@ -231,7 +231,8 @@ def transcribe(wav_bytes: bytes) -> dict:
|
||||
log=lambda m: print(f"[bridge] {m}", flush=True),
|
||||
)
|
||||
text = "".join(seg.text for seg in kept).strip()
|
||||
return {"text": text, "language": getattr(info, "language", None)}
|
||||
note = "ok" if text else "인식 실패(빈 결과/필터)"
|
||||
return {"text": text, "language": getattr(info, "language", None), "note": note}
|
||||
|
||||
|
||||
def think(text: str, language: Optional[str] = None, broadcasting: Optional[bool] = None) -> dict:
|
||||
@@ -458,7 +459,9 @@ def http_converse_stream():
|
||||
transcript = stt.get("text", "")
|
||||
if not transcript:
|
||||
yield json.dumps({"type": "meta", "transcript": "", "language": stt.get("language"),
|
||||
"reply": "", "error": stt.get("error"), "broadcast_action": None}) + "\n"
|
||||
"reply": "", "error": stt.get("error"),
|
||||
"note": stt.get("note", "빈 결과"),
|
||||
"stt_sec": round(t_stt - t0, 1), "broadcast_action": None}) + "\n"
|
||||
yield json.dumps({"type": "end"}) + "\n"
|
||||
return
|
||||
result = think(transcript, stt.get("language"), broadcasting)
|
||||
@@ -470,6 +473,9 @@ def http_converse_stream():
|
||||
"language": stt.get("language"),
|
||||
"reply": reply,
|
||||
"error": result.get("error"),
|
||||
"note": "ok" if reply.strip() else "답변 없음",
|
||||
"stt_sec": round(t_stt - t0, 1),
|
||||
"think_sec": round(t_think - t_stt, 1),
|
||||
"broadcast_action": result.get("broadcast_action"),
|
||||
}) + "\n"
|
||||
tts_total = 0.0
|
||||
|
||||
Reference in New Issue
Block a user