feat: add supports for dify hitl#2226
Open
fdc310 wants to merge 5 commits into
Open
Conversation
- Added module-level storage for pending forms to manage state across sessions. - Introduced functions to set, get, and clear pending forms with expiration handling. - Enhanced DifyServiceAPIRunner to support resuming paused workflows via form actions. - Implemented logic to yield human input requests and display appropriate messages. - Updated workflow submission methods to handle paused states and resume actions. - Ensured proper merging of pending form actions with user inputs for seamless interaction.
…nagement and draft message support
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Member
|
#2216 |
Member
Author
还是不一样,这个更偏向于人使用时候的一个人工的决策,你发这这个还是一个转人工的需求 |
Member
Author
Member
Member
Author
|
接近这个
…---原始邮件---
发件人: "Haoxuan ***@***.***>
发送时间: 2026年6月7日(周日) 中午12:51
收件人: ***@***.***>;
抄送: "Dongchuan ***@***.******@***.***>;
主题: Re: [langbot-app/LangBot] feat: 支持多个人工介入节点的连续暂停工作流 (PR #2226)
TyperBody left a comment (langbot-app/LangBot#2226)
#2216 想到了这个
还是不一样,这个更偏向于人使用时候的一个人工的决策,你发这这个还是一个转人工的需求
#1086
那这个iss
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Member
|
recheck |
Contributor
|
All contributors have signed the CLA. ✅ 所有贡献者均已签署 CLA。 |
Member
Author
|
I have read the CLA Document and I hereby sign the CLA |
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.



概述
实现 Dify 工作流中多个连续
human_input节点的支持。此前每个会话只能同时挂起一个人工介入表单,后续的会覆盖前一个,导致按钮点击触发 412 错误(form already submitted)。本 PR 将挂起表单的存储改为按form_token索引的有序字典,支持同一会话中多个工作流表单并存。改动内容
1. 多挂起表单存储(difysvapi.py)
_PENDING_FORMS从dict[session_key, 单个form]改为dict[session_key, OrderedDict[form_token, form]]_get_pending_form_by_token(精确查找)、_get_pending_form_by_w_suffix(Telegram 64 字节兼容)、_get_latest_pending_form、_iter_pending_forms(最新优先遍历)_clear_pending_form支持精确清单条或清整 session2. 路由匹配改进(difysvapi.py)
_resolve_pending_form:按 form_token → workflow_run_id → w_suffix → 最新 的优先级查找3. Lark 卡片:新卡承载 re-pause(lark.py)
_open_new_form_card:re-pause 时创建新卡片(新 card_id + reply),旧卡片保留为 resume 快照node_title通过msg._resume_node_title从 runner 透传到 adapter4. Telegram 适配器修复(telegram.py)
w字段(workflow_run_id 末 8 位),解决 64 字节 callback_data 限制w作为w_suffix透传给 runnersource_platform_object=update,修复assert isinstance(..., Update)失败update.message.message_thread_id改为update.effective_message+getattr,修复 callback_query 的update.message为 Nonesend_message_draft添加RetryAfter和Message_too_long保护5. Pipeline 兼容性
修改文件
src/langbot/pkg/provider/runners/difysvapi.pysrc/langbot/pkg/platform/sources/lark.pysrc/langbot/pkg/platform/sources/telegram.pysrc/langbot/libs/dify_service_api/v1/client.pysrc/langbot/pkg/pipeline/respback/respback.pysrc/langbot/pkg/platform/sources/lark.yaml测试场景
图片:

