优化: miniapp渲染(图片/checkbox/代码高亮) + MCP规则共享下沉 + 文档重写 + 节点风格对齐

This commit is contained in:
lxy
2026-08-08 21:39:30 +08:00
parent 9eb2995a74
commit e7228231d1
11 changed files with 587 additions and 167 deletions
+16 -7
View File
@@ -1,14 +1,14 @@
//! SubflowNode — 嵌套子工作流节点
//! 子工作流节点 — 加载一个子 DAG 并在当前执行上下文中递归执行
//!
//! 加载一个子模板(DagDef)并在当前执行上下文中递归执行。
//! 用于复用通用流程(如"代码审查"可作为任意主流程的子步骤)。
//! 执行结果不直接展开节点,而是返回子 DAG 的 JSON 快照,由 DagExecutor 消费展开。
use async_trait::async_trait;
use df_workflow::dag_def::DagDef;
use df_workflow::node::{Node, NodeContext, NodeOutput, NodeResult, NodeSchema};
use serde::{Deserialize, Serialize};
/// SubflowNode 配置
/// 子工作流配置
#[derive(Debug, Clone, Serialize, Deserialize)]
struct SubflowConfig {
/// 子工作流 DAG 定义(内联 JSON)
@@ -21,13 +21,13 @@ struct SubflowConfig {
/// 最大递归深度(安全阀)
const MAX_DEPTH: u32 = 10;
/// SubflowNode — 嵌套子工作流
/// 子工作流节点
pub struct SubflowNode;
#[async_trait]
impl Node for SubflowNode {
async fn execute(&self, ctx: NodeContext) -> NodeResult {
tracing::info!("SubflowNode 执行: {}", ctx.node_id);
tracing::info!("SubflowNode 执行: node_id={}", ctx.node_id);
let config: SubflowConfig = serde_json::from_value(ctx.config.clone())
.map_err(|e| anyhow::anyhow!("SubflowNode 配置解析失败: {}", e))?;
@@ -84,11 +84,20 @@ impl Node for SubflowNode {
},
"required": ["dag"]
}),
output: serde_json::json!({}),
output: serde_json::json!({
"type": "object",
"properties": {
"subflow": { "type": "boolean" },
"node_count": { "type": "integer" },
"edge_count": { "type": "integer" },
"max_depth": { "type": "integer" },
"dag": { "type": "object" }
}
}),
}
}
fn node_type(&self) -> &'static str {
fn node_type(&self) -> &str {
"subflow"
}
}