mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-09 13:21:42 +00:00
fix: gate interrupt STT transcript echoes
This commit is contained in:
parent
bfc5262725
commit
406eb719c3
2 changed files with 23 additions and 6 deletions
|
|
@ -18613,7 +18613,7 @@ class GatewayRunner(GatewayAuthorizationMixin, GatewayKanbanWatchersMixin, Gatew
|
|||
# real transcript instead of an empty string
|
||||
# (or file-path placeholder). Matches the UX
|
||||
# of fresh voice messages including the
|
||||
# 🎙️ echo back to the user.
|
||||
# optional 🎙️ echo back to the user.
|
||||
_media_urls = getattr(_peek_event, "media_urls", None) or []
|
||||
_media_types = getattr(_peek_event, "media_types", None) or []
|
||||
_audio_paths = []
|
||||
|
|
@ -18631,7 +18631,7 @@ class GatewayRunner(GatewayAuthorizationMixin, GatewayKanbanWatchersMixin, Gatew
|
|||
pending_text, _audio_paths,
|
||||
)
|
||||
pending_text = _enriched
|
||||
if _transcripts:
|
||||
if _transcripts and self._should_echo_stt_transcripts():
|
||||
_echo_meta = {"thread_id": source.thread_id} if source.thread_id else None
|
||||
for _tx in _transcripts:
|
||||
try:
|
||||
|
|
@ -19030,9 +19030,9 @@ class GatewayRunner(GatewayAuthorizationMixin, GatewayKanbanWatchersMixin, Gatew
|
|||
# Transcribe audio media on the dequeued event BEFORE it is
|
||||
# handed back as the next user turn, so queued/interrupting
|
||||
# voice messages drain with the real transcript instead of
|
||||
# a file-path placeholder. Echo each transcript back to the
|
||||
# user (same 🎙️ format as fresh voice messages) so voice
|
||||
# interrupts feel identical to text interrupts.
|
||||
# a file-path placeholder. When configured, echo each
|
||||
# transcript back to the user in the same 🎙️ format as
|
||||
# fresh voice messages.
|
||||
_pending_text = pending_event.text or ""
|
||||
_media_urls = getattr(pending_event, "media_urls", None) or []
|
||||
_media_types = getattr(pending_event, "media_types", None) or []
|
||||
|
|
@ -19051,7 +19051,7 @@ class GatewayRunner(GatewayAuthorizationMixin, GatewayKanbanWatchersMixin, Gatew
|
|||
_pending_text, _audio_paths,
|
||||
)
|
||||
pending = _enriched or None
|
||||
if _transcripts:
|
||||
if _transcripts and self._should_echo_stt_transcripts():
|
||||
_echo_meta = {"thread_id": source.thread_id} if source.thread_id else None
|
||||
for _tx in _transcripts:
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
|
||||
from gateway.config import GatewayConfig
|
||||
|
|
@ -39,3 +40,19 @@ def test_gateway_runner_uses_stt_echo_transcripts_flag():
|
|||
|
||||
runner.config = SimpleNamespace()
|
||||
assert runner._should_echo_stt_transcripts() is True
|
||||
|
||||
|
||||
def test_all_gateway_transcript_echo_sends_are_gated():
|
||||
source = Path(__file__).resolve().parents[2] / "gateway" / "run.py"
|
||||
lines = source.read_text().splitlines()
|
||||
|
||||
echo_send_lines = [
|
||||
index
|
||||
for index, line in enumerate(lines)
|
||||
if "f'🎙️" in line or 'f"🎙️' in line
|
||||
]
|
||||
|
||||
assert echo_send_lines
|
||||
for index in echo_send_lines:
|
||||
context = "\n".join(lines[max(0, index - 12): index + 1])
|
||||
assert "_should_echo_stt_transcripts()" in context
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue