会议模式:修复判断/while 结论不显示(node_done 没带 nodeType)+ 标题写上参数和状态
用户反馈"还是没有结果,节点标题要把运行状态、具体参数写出来"。
【根因:node_done 事件根本没带 nodeType】
在设备上直接跑了一遍,把事件流和落盘的运行记录对着看:
EV node_done j verdict=True branch='true' ← 结论有 ✓
STEP j nodeType=None verdict=True branch='true' ← 但 nodeType 是 None ✗
`node_start` 带 nodeType,`node_done` 没带。于是运行记录里每一步的
nodeType 都是空的,结果界面那个 `when (nodeType == "judge" && ...)`
一个分支都进不去 —— **标签代码是对的,数据没送到**。
(上一版我只改了历史记录的渲染,还以为是渲染条件的问题,其实卡在这儿。)
修:两份引擎的 node_done / node_error 都带上 nodeType。
【顺便按用户要求把标题写全】
用户原话:"节点标题要把运行状态、具体参数写出来"。
只写"判断"两个字的话,图上有五个判断节点就完全分不清是哪个、
更不知道它当时在判什么,回看运行记录等于白看。
现在每一步的标题是「节点名 · 第 N 轮 · 具体参数 → 运行状态」:
4 判断 · 第 1 轮 · 包含「苹果」 [判断:真]
8 while 循环 · 第 3 轮 [条件为真 → 继续循环]
3 写变量 · isRun = 2
9 智能体 · 第 1 轮 你好呀~我是豆包…
参数按节点类型取:
judge 包含「x」/ 不含「x」/ 字数 > n / 为空 / 不为空 / 让模型判断
var isRun = 2(写死的值)或 isRun ← 上游
readvar 变量名
value 那个常量
老记录里没存 nodeType 的,从图里按 id 找节点补上。
【实测(模拟器截图确认)】
7 判断 · 第 1 轮 · 为空 [判断:假]
8 while 循环 · 第 3 轮 [条件为真 · 继续循环]
9 智能体 · 第 1 轮 你好呀~我是豆包…
10 判断 · 第 1 轮 · 为空 [判断:假]
...
【顺带】
- exec 线中间的方向箭头也验证了:开始事件→判断 中间一个 ▶,走向一目了然
- 修掉一个重复:轮次同时进了标题和旁边,界面上出现"第 3 轮 第 3 轮"
【验证】
- 引擎回归 40/40,Node 与 Python 16/16 逐用例一致
- 会议 HTTP 13/13 ×2
- 模拟器实测:判断/while 的结论标签、标题参数全部正确显示
【另外发现(不是 bug,是演示图的问题)】
while 的循环体里如果"写变量"每次都把变量写回同一个值,条件永远为真,
会一直转到 MAX_LOOP_ITERS=200 才停。轮次上限兜住了,但图本身应该让条件收敛。
This commit is contained in:
@@ -678,7 +678,9 @@ export async function runMeeting({ meeting, settings, userInput, emit, runAgentF
|
||||
// 否则循环回来的内容会被起点覆盖掉,重复就没意义了
|
||||
const text = input || String(node.text || '').trim() || (userInput || '');
|
||||
outputs[nodeId] = text;
|
||||
emit({ type: 'node_done', nodeId, output: text, run: runIndex, note: '用的初始输入' });
|
||||
emit({ type: 'node_done',
|
||||
nodeId,
|
||||
nodeType, output: text, run: runIndex, note: '用的初始输入' });
|
||||
nextIds = execOut(edges, nodeId).map((e) => e.to);
|
||||
} else if (nodeType === 'agent') {
|
||||
const raw = await runAgentFn(node, input, settings, emit, nodeId, variables);
|
||||
@@ -690,7 +692,9 @@ export async function runMeeting({ meeting, settings, userInput, emit, runAgentF
|
||||
// 压根覆盖不到(真发生过:引擎测试全绿,一上 HTTP 就漏出 [[SET]])。
|
||||
const { text: cleaned, changed } = applySets(raw, variables, node.writeVars);
|
||||
outputs[nodeId] = cleaned;
|
||||
emit({ type: 'node_done', nodeId, output: cleaned, run: runIndex });
|
||||
emit({ type: 'node_done',
|
||||
nodeId,
|
||||
nodeType, output: cleaned, run: runIndex });
|
||||
if (Object.keys(changed).length) {
|
||||
// 改了哪些变量要让用户看见,不然就是"背地里改了我的东西"
|
||||
emit({
|
||||
@@ -726,7 +730,9 @@ export async function runMeeting({ meeting, settings, userInput, emit, runAgentF
|
||||
variables[name] = value;
|
||||
outputs[nodeId] = value;
|
||||
emit({
|
||||
type: 'node_done', nodeId, output: value, run: runIndex,
|
||||
type: 'node_done',
|
||||
nodeId,
|
||||
nodeType, output: value, run: runIndex,
|
||||
note: `变量 ${name} = ${value.slice(0, 40)}`,
|
||||
});
|
||||
// ★ 写变量**有 exec 出线**(蓝图里 Set 节点就是 exec 进 → exec 出),
|
||||
@@ -740,7 +746,9 @@ export async function runMeeting({ meeting, settings, userInput, emit, runAgentF
|
||||
const value = variables[name] ?? '';
|
||||
outputs[nodeId] = value;
|
||||
emit({
|
||||
type: 'node_done', nodeId, output: value, run: runIndex,
|
||||
type: 'node_done',
|
||||
nodeId,
|
||||
nodeType, output: value, run: runIndex,
|
||||
note: `读到 ${name}` + (value ? '' : '(还没设过,是空的)'),
|
||||
});
|
||||
nextIds = execOut(edges, nodeId).map((e) => e.to);
|
||||
@@ -760,7 +768,8 @@ export async function runMeeting({ meeting, settings, userInput, emit, runAgentF
|
||||
outputs[nodeId] = input;
|
||||
emit({
|
||||
type: 'node_done',
|
||||
nodeId,
|
||||
nodeId,
|
||||
nodeType,
|
||||
output: input,
|
||||
run: runIndex,
|
||||
verdict: passed,
|
||||
@@ -773,15 +782,21 @@ export async function runMeeting({ meeting, settings, userInput, emit, runAgentF
|
||||
} else if (nodeType === 'end') {
|
||||
outputs[nodeId] = String(node.text || '').trim() || input;
|
||||
finalOutput = outputs[nodeId];
|
||||
emit({ type: 'node_done', nodeId, output: finalOutput, run: runIndex });
|
||||
emit({ type: 'node_done',
|
||||
nodeId,
|
||||
nodeType, output: finalOutput, run: runIndex });
|
||||
nextIds = [];
|
||||
} else {
|
||||
emit({ type: 'node_error', nodeId, error: `不认识的节点类型:${nodeType}` });
|
||||
emit({ type: 'node_error',
|
||||
nodeId,
|
||||
nodeType, error: `不认识的节点类型:${nodeType}` });
|
||||
nextIds = [];
|
||||
}
|
||||
} catch (err) {
|
||||
// 单个节点出错不该让整场会议停摆:记下来,继续跑下游
|
||||
emit({ type: 'node_error', nodeId, error: err.message, run: runIndex });
|
||||
emit({ type: 'node_error',
|
||||
nodeId,
|
||||
nodeType, error: err.message, run: runIndex });
|
||||
outputs[nodeId] = '';
|
||||
nextIds = execOut(edges, nodeId).map((e) => e.to);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user