Skip to content

The agent that grows with you

fix(telegram): apply media read_timeout to all upload send paths, not just video

Teknium524ab539947a
diff --git a/plugins/platforms/telegram/adapter.py b/plugins/platforms/telegram/adapter.py
index 6639ba3d2e8..d3f48a90481 100644
--- a/plugins/platforms/telegram/adapter.py
+++ b/plugins/platforms/telegram/adapter.py
@@ -6821,6 +6821,7 @@ class TelegramAdapter(BasePlatformAdapter):
"parse_mode": _cap_parse_mode,
"reply_to_message_id": reply_to_id,
"duration": _duration_secs,
+ "read_timeout": _MEDIA_SEND_READ_TIMEOUT,
**voice_thread_kwargs,
**self._notification_kwargs(metadata),
},
@@ -6870,6 +6871,7 @@ class TelegramAdapter(BasePlatformAdapter):
"caption": caption[:1024] if caption else None,
"reply_to_message_id": reply_to_id,
"duration": _duration_secs,
+ "read_timeout": _MEDIA_SEND_READ_TIMEOUT,
**audio_thread_kwargs,
**self._notification_kwargs(metadata),
},
@@ -7008,6 +7010,7 @@ class TelegramAdapter(BasePlatformAdapter):
"chat_id": normalize_telegram_chat_id(chat_id),
"media": media,
"reply_to_message_id": reply_to_id,
+ "read_timeout": _MEDIA_SEND_READ_TIMEOUT,
**thread_kwargs,
**self._notification_kwargs(metadata),
},
@@ -7067,6 +7070,7 @@ class TelegramAdapter(BasePlatformAdapter):
"photo": image_file,
"caption": caption[:1024] if caption else None,
"reply_to_message_id": reply_to_id,
+ "read_timeout": _MEDIA_SEND_READ_TIMEOUT,
**thread_kwargs,
**self._notification_kwargs(metadata),
},
@@ -7164,6 +7168,7 @@ class TelegramAdapter(BasePlatformAdapter):
"filename": display_name,
"caption": caption[:1024] if caption else None,
"reply_to_message_id": reply_to_id,
+ "read_timeout": _MEDIA_SEND_READ_TIMEOUT,
**thread_kwargs,
**self._notification_kwargs(metadata),
},
@@ -7359,6 +7364,7 @@ class TelegramAdapter(BasePlatformAdapter):
"animation": animation_url,
"caption": caption[:1024] if caption else None,
"reply_to_message_id": reply_to_id,
+ "read_timeout": _MEDIA_SEND_READ_TIMEOUT,
**animation_thread_kwargs,
**self._notification_kwargs(metadata),
},
diff --git a/tests/tools/test_managed_tool_gateway.py b/tests/tools/test_managed_tool_gateway.py
index 5a02ddff471..1c90bcb90f3 100644
--- a/tests/tools/test_managed_tool_gateway.py
+++ b/tests/tools/test_managed_tool_gateway.py
@@ -192,10 +192,6 @@ class TestManagedMediaUploader:
BASE_URL = f"{GATEWAY}/api/bfl"
UPLOAD_PATH = "/api/uploads/bfl"
- @staticmethod
- def _builder(vendor):
- return f"https://{vendor}-gateway.example.com"
-
def _uploader(self, **kwargs):
return managed_tool_gateway.build_managed_media_uploader(
kwargs.pop("server_url", self.BASE_URL),