mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-20 10:11:58 +00:00
fix: detect correct message type from file mime instead of blanket DOCUMENT
Images need PHOTO for vision, audio needs VOICE for STT, and other files get DOCUMENT for text inlining.
This commit is contained in:
parent
3282b7066c
commit
f3ae2491a3
1 changed files with 9 additions and 2 deletions
|
|
@ -661,8 +661,6 @@ class MattermostAdapter(BasePlatformAdapter):
|
|||
msg_type = MessageType.TEXT
|
||||
if message_text.startswith("/"):
|
||||
msg_type = MessageType.COMMAND
|
||||
elif file_ids:
|
||||
msg_type = MessageType.DOCUMENT
|
||||
|
||||
# Download file attachments immediately (URLs require auth headers
|
||||
# that downstream tools won't have).
|
||||
|
|
@ -703,6 +701,15 @@ class MattermostAdapter(BasePlatformAdapter):
|
|||
except Exception as exc:
|
||||
logger.warning("Mattermost: error downloading file %s: %s", fid, exc)
|
||||
|
||||
# Set message type based on downloaded media types.
|
||||
if media_types and msg_type == MessageType.TEXT:
|
||||
if any(m.startswith("image/") for m in media_types):
|
||||
msg_type = MessageType.PHOTO
|
||||
elif any(m.startswith("audio/") for m in media_types):
|
||||
msg_type = MessageType.VOICE
|
||||
elif media_types:
|
||||
msg_type = MessageType.DOCUMENT
|
||||
|
||||
source = self.build_source(
|
||||
chat_id=channel_id,
|
||||
chat_type=chat_type,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue