流媒体応答
Streaming + chunking behavior (block replies, draft streaming, limits)
OpenClaw's "streaming" involves three layers of mechanisms that are easy to confuse:
1. LLM token streaming:模型但令牌每个文本返执行(内部实现的详情)。
2. Block streaming: delivers completed text blocks to the channel early (users may see multiple updates).
3. Chunking: splits one reply into multiple messages based on channel character limits (independent of streaming).
Block streaming(块每个配信)
块流的目标:在模型完全完成之前向用户显示"部分完成的段落",尽可能保持段落边界自然。
交换机:
- 全局默认:''agents.defaults.blockStreamingDefault: "on"''
- Channel override: most channels require explicit ''channels.<channel>.blockStreaming: true''
- Telegram is the exception: it also has draft streaming (see below).
調整参数:
- ''agents.defaults.blockStreamingBreak'': when to flush (e.g., ''text_end'').
- ''agents.defaults.blockStreamingChunk'':''minChars''、''maxChars''、''breakPreference''。
- ''agents.defaults.blockStreamingCoalesce'': merges overly dense small blocks to reduce screen flooding.
- ''agents.defaults.humanDelay'': makes delivery look more "human".
Chunking(渠道限制由分钟割)
Chunking is a "hard split" before delivery:
- Telegram / WhatsApp默认約4000文字
- Discord是2000文字 + 行数限制
- Slack是4000文字
设置:
- ''channels.<channel>.textChunkLimit''
- ''channels.<channel>.chunkMode''(''length'' 或 ''newline'')
分块尝试避免分割围栏代码块,但在极端情况下可能仍需要分割。
Telegram draft streaming (draft bubbles)
Telegram supports "updating the same message" using draft mode in private chat topics/threads. OpenClaw controls this via ''channels.telegram.streamMode'':
- ''"off"'': disables draft streaming, allows block streaming (multiple messages)
- ''"partial"'' (default): uses draft updates in private chat topics (users see one message continuously growing)
- ''"block"'': writes block streaming blocks to draft (reduces multiple messages)
注意:
- Only supported in Telegram private chats + topics/threads.
- Draft streaming and block streaming are mutually exclusive (when enabled, block streaming is disabled).
为什么您可能看不到流式传输
一般的那理由:
- ''agents.defaults.blockStreamingDefault'' is still ''off''
- You set ''blockStreamingDefault'' but didn't enable ''channels.<channel>.blockStreaming: true'' on the channel
- ''blockStreamingCoalesce'' merged blocks, so they appeared sent at once
- 模型但大机那块一度在输出已执行(flush积分钟没有)
- Telegram draft streaming is enabled (looks like "same message update", not multiple)
実用的那推荐事项
- Be careful enabling block streaming in public group chats (screen flooding); prefer larger ''minChars'' or stronger coalesce.
- Block streaming works best in private chats.
- If the channel supports reply threading, block streaming's multiple messages will look more "scattered". Use ''replyToMode'' and channel policy to optimize threading.