mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-23 10:42:00 +00:00
fix(slack): report ext-matched audio mimetype for rerouted voice clips
Some checks are pending
Deploy Site / deploy-vercel (push) Waiting to run
Deploy Site / deploy-docs (push) Waiting to run
Docker Build and Publish / build-amd64 (push) Waiting to run
Docker Build and Publish / build-arm64 (push) Waiting to run
Docker Build and Publish / merge (push) Blocked by required conditions
Lint (ruff + ty) / ruff + ty diff (push) Waiting to run
Lint (ruff + ty) / ruff enforcement (blocking) (push) Waiting to run
Lint (ruff + ty) / Windows footguns (blocking) (push) Waiting to run
Tests / test (1) (push) Waiting to run
Tests / test (2) (push) Waiting to run
Tests / test (3) (push) Waiting to run
Tests / test (4) (push) Waiting to run
Tests / test (5) (push) Waiting to run
Tests / test (6) (push) Waiting to run
Tests / save-durations (push) Blocked by required conditions
Tests / e2e (push) Waiting to run
Typecheck / typecheck (apps/bootstrap-installer) (push) Waiting to run
Typecheck / typecheck (apps/desktop) (push) Waiting to run
Typecheck / typecheck (apps/shared) (push) Waiting to run
Typecheck / typecheck (ui-tui) (push) Waiting to run
Typecheck / typecheck (web) (push) Waiting to run
Typecheck / desktop-build (push) Waiting to run
Some checks are pending
Deploy Site / deploy-vercel (push) Waiting to run
Deploy Site / deploy-docs (push) Waiting to run
Docker Build and Publish / build-amd64 (push) Waiting to run
Docker Build and Publish / build-arm64 (push) Waiting to run
Docker Build and Publish / merge (push) Blocked by required conditions
Lint (ruff + ty) / ruff + ty diff (push) Waiting to run
Lint (ruff + ty) / ruff enforcement (blocking) (push) Waiting to run
Lint (ruff + ty) / Windows footguns (blocking) (push) Waiting to run
Tests / test (1) (push) Waiting to run
Tests / test (2) (push) Waiting to run
Tests / test (3) (push) Waiting to run
Tests / test (4) (push) Waiting to run
Tests / test (5) (push) Waiting to run
Tests / test (6) (push) Waiting to run
Tests / save-durations (push) Blocked by required conditions
Tests / e2e (push) Waiting to run
Typecheck / typecheck (apps/bootstrap-installer) (push) Waiting to run
Typecheck / typecheck (apps/desktop) (push) Waiting to run
Typecheck / typecheck (apps/shared) (push) Waiting to run
Typecheck / typecheck (ui-tui) (push) Waiting to run
Typecheck / typecheck (web) (push) Waiting to run
Typecheck / desktop-build (push) Waiting to run
Follow-up to the salvaged voice-clip fix: the rerouted video/mp4 branch
used {".m4a": "audio/mp4"}.get(ext, "audio/mp4"), whose sole key's value
equals the default, so it always returned "audio/mp4" regardless of the
cached extension (dead lookup + a throwaway dict per inbound voice clip).
Replace it with a module-level _SLACK_EXT_TO_AUDIO_MIME map so the reported
media_type matches the bytes we cached (e.g. a clip cached as .wav now
reports audio/wav instead of audio/mp4). STT routing already keys on the
audio/ prefix + cached filename extension, so behavior is unchanged; this
just removes the dead construct and keeps the reported mimetype coherent.
This commit is contained in:
parent
2196584161
commit
5ecf3bf0e0
1 changed files with 20 additions and 1 deletions
|
|
@ -333,6 +333,25 @@ _SLACK_STT_SUPPORTED_EXTS = frozenset(
|
|||
{".mp3", ".mp4", ".mpeg", ".mpga", ".m4a", ".wav", ".webm", ".ogg", ".aac", ".flac"}
|
||||
)
|
||||
|
||||
# Cached-extension → reported ``audio/*`` mimetype. Used when re-routing a
|
||||
# ``video/mp4``-mislabeled voice clip onto the audio path so the reported
|
||||
# media_type stays coherent with the bytes we actually cached (the gateway's
|
||||
# STT gate keys on the ``audio/`` prefix + the cached filename extension, but a
|
||||
# matching mimetype avoids surprising any consumer that inspects it). Anything
|
||||
# unmapped falls back to ``audio/mp4`` — Slack voice clips are MP4/AAC.
|
||||
_SLACK_EXT_TO_AUDIO_MIME = {
|
||||
".mp4": "audio/mp4",
|
||||
".m4a": "audio/mp4",
|
||||
".mp3": "audio/mpeg",
|
||||
".mpeg": "audio/mpeg",
|
||||
".mpga": "audio/mpeg",
|
||||
".wav": "audio/wav",
|
||||
".webm": "audio/webm",
|
||||
".ogg": "audio/ogg",
|
||||
".aac": "audio/aac",
|
||||
".flac": "audio/flac",
|
||||
}
|
||||
|
||||
|
||||
def _resolve_slack_audio_ext(file_obj: Dict[str, Any], mimetype: str) -> str:
|
||||
"""Pick the cache extension that matches an inbound Slack audio file's bytes.
|
||||
|
|
@ -2746,7 +2765,7 @@ class SlackAdapter(BasePlatformAdapter):
|
|||
# Report a coherent audio mimetype matching the cached
|
||||
# extension so downstream STT routing recognizes it.
|
||||
media_types.append(
|
||||
{".m4a": "audio/mp4"}.get(ext, "audio/mp4")
|
||||
_SLACK_EXT_TO_AUDIO_MIME.get(ext, "audio/mp4")
|
||||
)
|
||||
logger.debug(
|
||||
"[Slack] Cached voice clip (mislabeled %s) as audio: %s",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue