mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-30 06:41:51 +00:00
fix(gateway): scope audio_file_paths outside media_urls guard
The audio-file-paths handling block at line 7334 references the variable unconditionally, but #24879 initialized it inside the 'if event.media_urls' block — so events without media_urls hit UnboundLocalError. Found via test_run_agent_queued_message_does_not_treat_commentary_as_final after PR #28478 landed.
This commit is contained in:
parent
f55c67ac1f
commit
256c4c1b4a
1 changed files with 4 additions and 1 deletions
|
|
@ -7254,10 +7254,13 @@ class GatewayRunner:
|
|||
if getattr(event, "channel_context", None):
|
||||
message_text = f"{event.channel_context}\n\n[New message]\n{message_text}"
|
||||
|
||||
# Declare at outer scope so the audio-file-paths handling block below
|
||||
# remains safe when ``event.media_urls`` is empty (no inner block runs).
|
||||
audio_file_paths: list[str] = []
|
||||
|
||||
if event.media_urls:
|
||||
image_paths = []
|
||||
audio_paths = []
|
||||
audio_file_paths: list[str] = [] # audio file attachments — not for STT
|
||||
for i, path in enumerate(event.media_urls):
|
||||
mtype = event.media_types[i] if i < len(event.media_types) else ""
|
||||
if mtype.startswith("image/") or event.message_type == MessageType.PHOTO:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue