mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix: slack file upload fallback loses thread context
Fallback paths in send_image_file, send_video, and send_document called super() without metadata, causing replies to appear outside the thread when file upload fails. Use self.send() with metadata instead to preserve thread_ts context.
This commit is contained in:
parent
3bc933586a
commit
064c66df8c
2 changed files with 111 additions and 3 deletions
|
|
@ -442,7 +442,10 @@ class SlackAdapter(BasePlatformAdapter):
|
|||
e,
|
||||
exc_info=True,
|
||||
)
|
||||
return await super().send_image_file(chat_id, image_path, caption, reply_to)
|
||||
text = f"🖼️ Image: {image_path}"
|
||||
if caption:
|
||||
text = f"{caption}\n{text}"
|
||||
return await self.send(chat_id, text, reply_to=reply_to, metadata=metadata)
|
||||
|
||||
async def send_image(
|
||||
self,
|
||||
|
|
@ -549,7 +552,10 @@ class SlackAdapter(BasePlatformAdapter):
|
|||
e,
|
||||
exc_info=True,
|
||||
)
|
||||
return await super().send_video(chat_id, video_path, caption, reply_to)
|
||||
text = f"🎬 Video: {video_path}"
|
||||
if caption:
|
||||
text = f"{caption}\n{text}"
|
||||
return await self.send(chat_id, text, reply_to=reply_to, metadata=metadata)
|
||||
|
||||
async def send_document(
|
||||
self,
|
||||
|
|
@ -587,7 +593,10 @@ class SlackAdapter(BasePlatformAdapter):
|
|||
e,
|
||||
exc_info=True,
|
||||
)
|
||||
return await super().send_document(chat_id, file_path, caption, file_name, reply_to)
|
||||
text = f"📎 File: {file_path}"
|
||||
if caption:
|
||||
text = f"{caption}\n{text}"
|
||||
return await self.send(chat_id, text, reply_to=reply_to, metadata=metadata)
|
||||
|
||||
async def get_chat_info(self, chat_id: str) -> Dict[str, Any]:
|
||||
"""Get information about a Slack channel."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue