From 7aed3be5cb7253c05045daeff15dc4c53e20c25f Mon Sep 17 00:00:00 2001 From: RockChinQ Date: Sat, 7 Nov 2026 01:22:01 +0800 Subject: [PATCH] docs(plugin): document send_message timeout parameter (#2923) send_message now waits 60s by default and accepts a keyword-only `timeout` (langbot-app/langbot-plugin-sdk#219). Document the parameter, its validation, the fact that a timeout does not cancel the host send, and the SDK/Runtime version requirement in zh/en/ja. Co-authored-by: Claude Opus 5.5 Co-authored-by: multica-agent --- docs/en/plugin/dev/apis/common.mdx | 17 +++++++++++++++++ docs/ja/plugin/dev/apis/common.mdx | 17 +++++++++++++++++ docs/zh/plugin/dev/apis/common.mdx | 17 +++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/docs/en/plugin/dev/apis/common.mdx b/docs/en/plugin/dev/apis/common.mdx index bbd5ca38a..0e78dd4a1 100644 --- a/docs/en/plugin/dev/apis/common.mdx +++ b/docs/en/plugin/dev/apis/common.mdx @@ -94,6 +94,8 @@ async def send_message( target_type: str, target_id: str, message_chain: platform_message.MessageChain, + *, + timeout: float | None = None, ) -> None: """Send a message to a session""" @@ -104,8 +106,23 @@ await self.plugin.send_message( target_id="1010553892", message_chain=platform_message.MessageChain([platform_message.Plain(text="Hello, world!")]), ) + +# Allow more time for media messages such as images +await self.plugin.send_message( + bot_uuid="de639861-be05-4018-859b-c2e2d3e0d603", + target_type="person", + target_id="1010553892", + message_chain=platform_message.MessageChain([platform_message.Image(url="https://example.com/a.png")]), + timeout=180, +) ``` +`timeout` is how many seconds the plugin waits for LangBot to finish sending. It defaults to 60 seconds, must be passed as a keyword argument, and must be a positive number; otherwise `ValueError` is raised. Images, files and voice messages are uploaded to the platform before they are sent and can take longer, so raise it when needed. A timeout only means the plugin stops waiting: it does not cancel a send already in progress in LangBot, so do not resend right away after a timeout, or the message may be delivered twice. + + +Requires a `langbot-plugin` release after 0.7.22: plugins need that SDK version to pass `timeout`, and the Plugin Runtime needs it to apply the 60-second default and the plugin's timeout. Version 0.7.22 and earlier wait a fixed 15 seconds. + + ### Get Configured LLM Model List Returns a list of UUIDs for all configured LLM models. diff --git a/docs/ja/plugin/dev/apis/common.mdx b/docs/ja/plugin/dev/apis/common.mdx index ec45becba..fdcc0aa47 100644 --- a/docs/ja/plugin/dev/apis/common.mdx +++ b/docs/ja/plugin/dev/apis/common.mdx @@ -94,6 +94,8 @@ async def send_message( target_type: str, target_id: str, message_chain: platform_message.MessageChain, + *, + timeout: float | None = None, ) -> None: """セッションにメッセージを送信する""" @@ -104,8 +106,23 @@ await self.plugin.send_message( target_id="1010553892", message_chain=platform_message.MessageChain([platform_message.Plain(text="Hello, world!")]), ) + +# 画像などのメディアメッセージでは待ち時間を明示的に延ばせます +await self.plugin.send_message( + bot_uuid="de639861-be05-4018-859b-c2e2d3e0d603", + target_type="person", + target_id="1010553892", + message_chain=platform_message.MessageChain([platform_message.Image(url="https://example.com/a.png")]), + timeout=180, +) ``` +`timeout` はプラグインが LangBot の送信完了を待つ秒数です。デフォルトは 60 秒で、キーワード引数としてのみ指定でき、正の数である必要があります。そうでない場合は `ValueError` が発生します。画像・ファイル・音声などのメディアメッセージは送信前にメッセージプラットフォームへアップロードされるため時間がかかることがあり、必要に応じて大きくしてください。タイムアウトはプラグインが待つのをやめるだけで、LangBot で進行中の送信は取り消されません。重複送信を避けるため、タイムアウト後にすぐ再送しないでください。 + + +0.7.22 より後にリリースされる `langbot-plugin` が必要です。`timeout` を渡すにはプラグインがその SDK を使う必要があり、60 秒のデフォルトとプラグイン指定のタイムアウトを適用するには Plugin Runtime もそのバージョンである必要があります。0.7.22 以前は 15 秒固定で待機します。 + + ### 設定済みLLMモデルリストの取得 設定されたすべてのLLMモデルのUUIDのリストを返します。 diff --git a/docs/zh/plugin/dev/apis/common.mdx b/docs/zh/plugin/dev/apis/common.mdx index 40b7cc0be..4314fcbfe 100644 --- a/docs/zh/plugin/dev/apis/common.mdx +++ b/docs/zh/plugin/dev/apis/common.mdx @@ -94,6 +94,8 @@ async def send_message( target_type: str, target_id: str, message_chain: platform_message.MessageChain, + *, + timeout: float | None = None, ) -> None: """Send a message to a session""" @@ -104,8 +106,23 @@ await self.plugin.send_message( target_id="1010553892", message_chain=platform_message.MessageChain([platform_message.Plain(text="Hello, world!")]), ) + +# 发送图片等媒体消息时可显式延长等待时间 +await self.plugin.send_message( + bot_uuid="de639861-be05-4018-859b-c2e2d3e0d603", + target_type="person", + target_id="1010553892", + message_chain=platform_message.MessageChain([platform_message.Image(url="https://example.com/a.png")]), + timeout=180, +) ``` +`timeout` 是插件等待 LangBot 完成发送的秒数,默认 60 秒,只能以关键字参数传入,必须为正数,否则抛出 `ValueError`。图片、文件、语音等媒体消息需要先上传到消息平台再发送,耗时可能更长,可按需调大。超时只表示插件不再等待,不会取消 LangBot 中正在进行的发送,因此超时后不要直接重发,以免重复发送。 + + +需要 0.7.22 之后发布的 `langbot-plugin`:插件使用该版本 SDK 才能传入 `timeout`,Plugin Runtime 升级到该版本后才会采用 60 秒默认值和插件指定的超时。0.7.22 及更早版本固定等待 15 秒。 + + ### 获取已配置的 LLM 模型列表 返回由所有已配置的 LLM 模型 UUID 组成的列表。