Harden WeCom pull streaming and add compatible Dify snapshot refresh configuration#2053
Open
bjhx2003 wants to merge 34 commits intolangbot-app:masterfrom
Open
Harden WeCom pull streaming and add compatible Dify snapshot refresh configuration#2053bjhx2003 wants to merge 34 commits intolangbot-app:masterfrom
bjhx2003 wants to merge 34 commits intolangbot-app:masterfrom
Conversation
- Reduce stream_poll_timeout from 0.15s to 0.05s for faster response - Change yield condition from % 8 to % 2 for higher push frequency - Skip plugin events for intermediate streaming chunks to reduce latency - Fix yield condition to ensure is_final is always sent - Add msg_id_map cleanup to prevent memory bloat - Update version to 4.9.0-wecom.1 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move dependency installation before source code copy to leverage Docker layer caching. Code changes no longer trigger dependency reinstallation, reducing build time from 2-3 minutes to 10-20 seconds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use `uv sync --no-dev` to exclude dev dependencies - Remove gcc after build with apt-get purge - Clean apt cache with rm -rf /var/lib/apt/lists/* - Expand .dockerignore to exclude docs, tests, and other non-runtime files Image size reduced from 2.07GB to 1.67GB (19% reduction). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- 对齐版本号到 4.9.0.post2,并同步 pyproject、包版本与 uv.lock\n- 将企微通道层配置保留在机器人适配器中,新增占位文案延迟配置\n- 将 chunk 批大小与时间窗口下沉到流水线输出配置,补齐默认值与 UI 元数据\n- 将 Dify 流式输出改为 chunk 阈值或时间窗口双触发,并保证 final 立即收口\n- 优化 pull 模式占位文案逻辑,仅在首字超时后返回占位文案\n- 补充企微与 Dify 定向单元测试,覆盖双阈值 flush、占位延迟与最终收口场景
- Add workflow_finished event handling to set is_final=True - Add yielded_final flag to prevent duplicate final chunk yield - Fix WeCom continuous polling issue when Dify workflow ends Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add PullPendingPlaceholderEnabled config option (default: true) - Show delay and content fields only when enabled via visibleOn - Pass effective values to WecomBotClient based on switch state Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add _summarize_stream_text helper for content logging - Add publish/consume action logs with seq, content stats - Track cleared queue items and publish sequence - Help troubleshoot WeCom pull mode polling issues Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add FULL_TEXT and HYBRID search types - Implement RRF (Reciprocal Rank Fusion) for hybrid search - Change add to upsert for idempotent document insertion - Upgrade chromadb dependency to >=1.0.0,<2.0.0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace hide-exception and block-failed-request-output with exception-handling - Add three strategies: hide, show-hint, show-error - Add failure-hint field for customizable error message - Add database migration dbm021 for config conversion - Remove wecom-stream stage (moved to adapter config) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tibility - Move filters out of retrieval_settings to avoid empty results - Pass sender_id and session_name in retrieval settings - Some plugins (e.g. LangRAG) pass filters directly to vector_search Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Update tests to use adapter config instead of pipeline wecom-stream - Add test for workflow_finished event handling - Add test for ignoring empty message chunks Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Member
|
感谢 PR!可否提供一下修改前后的截图,例如 配置页面截图、运行效果截图?我们将更快开始 review |
…sessions.publish` call.
Author
|
# Conflicts: # src/langbot/pkg/platform/sources/wecombot.py
fdc310
reviewed
Mar 27, 2026
| inputs.update(query.variables) | ||
| messsage_idx = 0 | ||
| is_final = False | ||
| stream_completed = False |
Member
There was a problem hiding this comment.
这个参数每一处都是和is_final对应的,为什么不直接用is_final呢
| if rendered_text: | ||
| content_parts.append(rendered_text) | ||
|
|
||
| return ''.join(content_parts) |
|
|
||
| # 如果未开启首字等待占位,则将延迟设为0且占位文案设为空 | ||
| effective_placeholder_delay = pending_placeholder_delay_ms / 1000 if pending_placeholder_enabled else 0 | ||
| effective_placeholder = pending_placeholder if pending_placeholder_enabled else '' |
Member
There was a problem hiding this comment.
这里首字占位,其实我觉着放在creat_message_card这里(主要当时我写钉钉和飞书的时候以为只有卡片流式来着所以函数名就这样了)这样创建首字在进入模型前就能开始,个人感觉比较合理。
| is_stream_mode = await query.adapter.is_stream_output_supported() and has_chunks | ||
|
|
||
| random_delay = random.uniform(*random_range) | ||
| # 流式模式下跳过强制延迟,确保首字快速响应 |
Member
There was a problem hiding this comment.
就像wecom那边我说的,如果是在creat_message_card中创建首字消息,这里就不用这么处理了
|
|
||
| def __init__(self, config: dict, logger: EventLogger): | ||
| enable_webhook = config.get('enable-webhook', True) | ||
| if not enable_webhook: |
Member
|
你好,请问改pr中dify相关的修改的能不能单独提一个pr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述 / Overview
本次 PR 主要增强了企业微信智能机器人 Pull 模式下的流式消息处理能力,并补齐 Dify 流式快照刷新配置,同时保持默认行为尽量兼容 master。
This PR mainly improves pull-mode streaming for the WeCom AI bot, adds Dify snapshot refresh configuration, and keeps default behavior as compatible with master as possible.
主要改动 / Key changes
增强企微 Pull 流式生命周期处理
Harden WeCom pull streaming lifecycle
改进企微回复与流水线流式处理
respback在流式模式下跳过强制延迟,提升首字响应速度is_final标记,避免 finish 状态错误Improve streaming response handling in pipeline stages
优化企微消息转换
WecomBotMessageConverter在转文本时保留引用内容Improve WeCom message conversion
补齐 Dify 流式快照刷新策略
output.dify-stream.chunk-batch-sizeoutput.dify-stream.flush-window-enabledoutput.dify-stream.flush-window-msworkflow_finished场景,保证流式输出能正确 finishAdd Dify snapshot refresh strategy
output.dify-stream.chunk-batch-sizeoutput.dify-stream.flush-window-enabledoutput.dify-stream.flush-window-msworkflow_finishedcorrectly to ensure stream completion配置迁移与兼容默认值
dify-service-api作为 runner 时显示dify-stream配置项500ms8Config migration and compatibility defaults
dify-streamsection only when the selected runner isdify-service-api500ms8Docker 构建优化
.dockerignoreDockerfile复制顺序与依赖安装顺序,尽量利用 Docker 层缓存Docker build optimization
.dockerignoreDockerfilelayer usage for better build caching测试
Tests
更改前后对比截图 / Screenshots
检查清单 / Checklist
已通过以下测试: