重构: 巨函数拆分 + 清理历史标记注释 + custom_prompt/停止按钮/tunnel 改进
This commit is contained in:
@@ -6,7 +6,7 @@ use std::collections::HashMap;
|
||||
/// DAG 定义 — 可序列化/反序列化,用于持久化和模板
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct DagDef {
|
||||
// BUG-260621-01: nodes/edges 加 #[serde(default)]。
|
||||
// nodes/edges 加 #[serde(default)]。
|
||||
// 前端 run_workflow 推进链传空 dag `{}`(设计意图:空 dag + target_status →
|
||||
// workflow.rs:91 dag.nodes.is_empty() 进 template_for 自动选模板)。原无 default
|
||||
// 时,`{}` 在 Tauri IPC 入口反序列化 DagDef 即报 `missing field nodes`,挡在选模板
|
||||
@@ -91,7 +91,7 @@ impl Default for DagDef {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
// BUG-260621-01: 前端 run_workflow 推进链传空 dag `{}`,serde 必须能反序列化
|
||||
// 前端 run_workflow 推进链传空 dag `{}`,serde 必须能反序列化
|
||||
// 成空 DagDef(非报 missing field),后续 workflow.rs:91 dag.nodes.is_empty()
|
||||
// 进 template_for 选模板。nodes/edges 加 #[serde(default)] 前此用例会失败。
|
||||
#[test]
|
||||
|
||||
@@ -98,27 +98,27 @@ impl DagExecutor {
|
||||
let mut any_edge_passed = false; // 任一入边放行(含无条件边)
|
||||
if let Some(preds) = adjacency_in.get(node_id) {
|
||||
for (pred_id, cond) in preds {
|
||||
if let Some(out) = outputs.get(pred_id) {
|
||||
if eval_conditions {
|
||||
if let Some(cond) = cond {
|
||||
has_any_cond_edge = true;
|
||||
// 以 source output.data 为 context 求值;失败保守 false
|
||||
let passed = ConditionEngine::evaluate(cond, &out.data)
|
||||
.unwrap_or(false);
|
||||
if passed {
|
||||
inputs.insert(pred_id.clone(), out.clone());
|
||||
any_edge_passed = true;
|
||||
}
|
||||
} else {
|
||||
// 无 condition 的入边:无条件放行(必收集)
|
||||
inputs.insert(pred_id.clone(), out.clone());
|
||||
any_edge_passed = true;
|
||||
}
|
||||
} else {
|
||||
// flag 关:condition 完全忽略,旧行为全收集
|
||||
inputs.insert(pred_id.clone(), out.clone());
|
||||
any_edge_passed = true;
|
||||
let Some(out) = outputs.get(pred_id) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
// flag 关:condition 完全忽略,旧行为全收集;
|
||||
// flag 开 + 无 condition 入边:无条件放行(必收集);
|
||||
// flag 开 + 有 condition 入边:以 source output.data 为 context 求值,
|
||||
// 失败保守 false(对齐引擎语义)。
|
||||
let passed = match (eval_conditions, cond) {
|
||||
(false, _) => true,
|
||||
(true, None) => true,
|
||||
(true, Some(c)) => {
|
||||
ConditionEngine::evaluate(c, &out.data).unwrap_or(false)
|
||||
}
|
||||
};
|
||||
if eval_conditions && cond.is_some() {
|
||||
has_any_cond_edge = true;
|
||||
}
|
||||
if passed {
|
||||
inputs.insert(pred_id.clone(), out.clone());
|
||||
any_edge_passed = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user