From d50744af4eddf1c603f8164085d7f7a2aac699b5 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 13 Mar 2026 17:14:16 +0800 Subject: [PATCH] bugfix --- README.md | 35 ++++++++++++++++------------------- SKILL.md | 2 +- dagflow/dagflow.py | 2 +- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index ea9a93d..819e5c5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Workflow Engine 使用说明书 -> 版本:v1.1(sqlor 持久化 + 子流程 input/output mapping) - 本文档用于说明当前 Workflow Engine 的**设计目标、核心概念、数据模型、DSL 用法、执行语义以及使用示例**。不涉及未来规划能力。 --- @@ -45,10 +43,10 @@ 包含内容: -* 起始节点(start) +* 流程id(id) * 节点集合(nodes) * 边集合(edges) - +* 流程启动上下文规格说明(ctx_spec) --- ### 2.2 FlowInstance(流程实例) @@ -57,7 +55,6 @@ * 持有自己的: * ctx(上下文) - * active_nodes(当前活跃节点) * status(running / finished) **所有流转都发生在实例中,而不是定义中。** @@ -68,9 +65,9 @@ | 类型 | 说明 | | -------- | ------------------ | +| start | 开始节点 | | task | 普通执行节点(业务 / skill) | -| decision | 条件判断节点 | -| join | 并发汇合节点 | +| haman | 手工节点 | | subflow | 子流程节点 | | end | 结束节点 | @@ -99,7 +96,6 @@ * id:实例 ID * flow_def_id:关联定义 * ctx:JSON 上下文 -* active_nodes:当前节点集合 * status:running / finished --- @@ -160,32 +156,32 @@ id: order_flow_v1 start: start nodes: - start: - type: task + start: # 每个流程必须要有一个start + type: start # 类型必须是start - end: - type: end + end: # 每个流程必须要有一个end + type: end # 类型必须上end task1: title: task1 title type: task description: desc - input_ctx:["k1:g1", "k2.kk1:g2"] # 可选, 缺省使用流程实例的全部ctx - output_ctx:["k1:ck1", "k2:ck2.x"] # 可选, 缺失全部输出更新到流程实例的ctx + input_ctx: jinja2的模版字符串 # 可选, 缺省使用流程实例的全部ctx + output_ctx: jinja2的模版字符串 可选, 缺失全部输出更新到流程实例的ctx subflow1: title: subf type: subflow subflow_id: payment_flow_v2 - input_ctx:["k1:g1", "k2.kk1:g2"] # 可选, 缺省使用流程实例的全部ctx - output_ctx:["k1:ck1", "k2:ck2.x"] # 可选, 子流程实例的ctx到本流程实例的缺失全部输出更新到流程实例的ctx + input_ctx: jinja2的模版字符串 # 可选, 缺省使用流程实例的全部ctx + output_ctx: jinja2的模版字符串 # 可选, 子流程实例的ctx到本流程实例的缺失全部输出更新到流程实例的ctx humantask1: title: conform type: human description: desc - input_ctx:["k1:g1", "k2.kk1:g2"] # 可选, 缺省使用流程实例的全部ctx - output_ctx:["k1:ck1", "k2:ck2.x"] # 可选, 缺失全部输出更新到流程实例的ctx + input_ctx: jinja2的模版字符串 # 可选, 缺省使用流程实例的全部ctx + output_ctx: jinja2的模版字符串 # 可选, 缺失全部输出更新到流程实例的ctx edges: - from: start @@ -193,6 +189,7 @@ edges: multile_on: ctx.charpter # when: ctx.x == 'xxx' # 可选,转移条件 ``` + ### 流程定义节点数据要求 除开始节点和结束节点外,所有节点都需要有 ``` @@ -245,7 +242,7 @@ edges: edges: - from: gen_docs to: evalution_chapter - multiple_on: ctx.docs.chapters + foreach: ctx.docs.chapters ``` #### Fork(隐式) diff --git a/SKILL.md b/SKILL.md index 15021b2..37208e8 100644 --- a/SKILL.md +++ b/SKILL.md @@ -10,5 +10,5 @@ description: 根据用户输入创建工作流 ## 新建流程 将用户输入拆解为流程引擎添加流程的json数据,然后调用以下函数 ``` -CALL:{ "function": "add_new_workflow", "params":{"name":流程名字,"dsl":YAML格式的符合上述流程规范的流程定义} +CALL:{ "function": "add_new_workflow", "params":{"name":流程名字,"description": 用户输入的"dsl":YAML格式的符合上述流程规范的流程定义} ``` diff --git a/dagflow/dagflow.py b/dagflow/dagflow.py index d2d7314..2110f9a 100644 --- a/dagflow/dagflow.py +++ b/dagflow/dagflow.py @@ -316,7 +316,7 @@ where backid=${backid}$ cond = edge.get('when') if cond and not eval(cond, {}, {'ctx': ctx}): continue - m_on = edge.get('multiple_on') + m_on = edge.get('foreach') ns = { 'm_on': m_on, 'ctx': ctx,