会议模式:空输入不再悄悄判错(报出来)+ 结果界面改成按运行链列每一步
用户三条反馈。
【1. "明明有值却判断为true,里面的好多判断都是不对的"】
先把每种判断条件都实测了一遍 —— **规则本身全是对的**:
内容='苹果 香蕉':contains 苹果→True empty→False not_empty→True ...
内容='' :empty→True
真正的问题是**判断节点拿到的是空输入**:exec 线只排顺序、不传值,
所以"一根线连到底"的图里下游收到空串,而空串判"为空"当然为真。
用户看到的就是"明明有值却判断为真",但怎么查都查不出规则哪里错了。
**与其让它悄悄判错,不如直接说清楚。** 现在引擎会检查:
输入是空的、而 exec 上游明明有内容 → 发一条 node_warn:
输入是空的:上游「智能体」有内容,但你没连**数据线**。
exec 线只排顺序、不传值 —— 要传值得再连一根彩色数据线。
这条警告会**画在节点卡片上**(红字),不是只进日志。
【2. "运行连运行到哪了也不知道"】
- 标题栏直接写出来:`正在跑:智能体(第 12 步)`
- 执行到哪,哪条 exec 线上就有一串光点沿曲线流动(850ms 一轮)
- 每个节点照旧显示 运行中/完成/出错
【3. "结果界面我要的是:把每次运行的结果都写出来而不是节点的状态,是按照运行链来的"】
原来"本次"那一块是**按节点在图里的坐标排序**的 —— 循环里的节点会被排到一起,
完全看不出第几轮先跑了谁。改成**运行链**:
- 引擎按 node_start 的**执行顺序**记下每一步(节点 + 第几轮)
- 结果界面按序号 1、2、3… 一路列下来,就是这条链实际的走法
- 循环转几轮就有几条,同一个节点跑多轮会标「第 N 轮」
- 判断 / while 在标题旁挂一枚小标签:判断:真 / 判断:假 /
条件为真 · 继续循环 / 条件为假 · 结束循环
- 「复制本次结果」也跟着改成链式文本(1. 智能体(第 2 轮)…)
【顺带修的】
- Python 侧插入警告代码时缩进错了 4 格,导致整份文件语法错误
(验证脚本立刻报"Python 侧可执行 失败")—— 修好
- 补了 MeetingEvent.warn / MeetingStep.verdict+branch 字段和它们的解析
【验证】
- 引擎回归 40/40,Node 与 Python 16/16 逐用例一致
- 会议 HTTP 13/13 ×2、语音 41/41、Markdown 19/19
- 实测告警:判断节点只连 exec 时,事件流里出现
"⚠ 警告 j 输入是空的:上游「智能体」有内容,但你没连**数据线**"
This commit is contained in:
@@ -51,6 +51,7 @@ import androidx.compose.animation.core.tween
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateListOf
|
||||
import androidx.compose.runtime.mutableStateMapOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
@@ -299,6 +300,16 @@ private fun MeetingEditorScreen(vm: AppViewModel, initial: Meeting, onBack: () -
|
||||
)
|
||||
// 判断 / while 的结论(true/false/body/done),结果界面要写明
|
||||
val nodeVerdict = remember { mutableStateMapOf<String, String>() }
|
||||
// ★ 运行链:按**执行顺序**记下每一步。
|
||||
// 结果界面要的是"这条链上每一步的结果",不是一堆节点的最终状态 ——
|
||||
// 循环转几轮就有几条记录,一眼能看出先后。
|
||||
val liveTrace = remember { mutableStateListOf<Triple<String, String, Int>>() }
|
||||
// 当前正在跑哪个节点(界面顶部要显示"运行到哪了")
|
||||
var nowRunning by remember { mutableStateOf("") }
|
||||
// 每个节点的告警(比如"输入是空的,你漏了数据线")。
|
||||
// ★ 空输入如果不说出来,用户只会看到"明明有值却判断为真",
|
||||
// 怎么查都查不出规则哪里错了 —— 规则本身没错。
|
||||
val nodeWarn = remember { mutableStateMapOf<String, String>() }
|
||||
|
||||
var panX by remember { mutableStateOf(0f) }
|
||||
var panY by remember { mutableStateOf(0f) }
|
||||
@@ -342,6 +353,11 @@ private fun MeetingEditorScreen(vm: AppViewModel, initial: Meeting, onBack: () -
|
||||
)
|
||||
Text(
|
||||
when {
|
||||
// ★ "运行到哪了"要一眼看得见:只有节点上的勾和线的流动,
|
||||
// 循环转很多轮时还是不知道现在第几步。所以直接写出来。
|
||||
running && nowRunning.isNotBlank() ->
|
||||
"正在跑:$nowRunning(第 ${liveTrace.size} 步)"
|
||||
running -> "正在准备…"
|
||||
linkingFrom != null -> "点目标节点的左侧圆点接线(点空白取消)"
|
||||
dirty -> "未保存"
|
||||
// 手势规则要写出来:两指平移不是所有人一上来就知道的
|
||||
@@ -380,6 +396,10 @@ private fun MeetingEditorScreen(vm: AppViewModel, initial: Meeting, onBack: () -
|
||||
when (ev.type) {
|
||||
"node_start" -> {
|
||||
liveStatus[ev.nodeId] = "running"
|
||||
liveTrace.add(
|
||||
Triple(ev.nodeId, ev.title.ifBlank { ev.nodeType }, ev.run)
|
||||
)
|
||||
nowRunning = ev.title.ifBlank { ev.nodeType }
|
||||
// ★ 执行流到这一步了:把这根 exec 线点亮,让它"流"起来。
|
||||
// 蓝图里就是靠这个看出"现在跑到哪了" ——
|
||||
// 节点上的勾只说明"跑过了",看不出**正在跑哪条线**。
|
||||
@@ -396,6 +416,7 @@ private fun MeetingEditorScreen(vm: AppViewModel, initial: Meeting, onBack: () -
|
||||
nodeVerdict[ev.nodeId] = ev.branch
|
||||
}
|
||||
}
|
||||
"node_warn" -> nodeWarn[ev.nodeId] = ev.warn
|
||||
"node_error" -> {
|
||||
liveStatus[ev.nodeId] = "error"
|
||||
nodeOutputs[ev.nodeId] = "出错:${ev.error}"
|
||||
@@ -403,6 +424,7 @@ private fun MeetingEditorScreen(vm: AppViewModel, initial: Meeting, onBack: () -
|
||||
"meeting_done" -> {
|
||||
running = false
|
||||
litEdge = -1
|
||||
nowRunning = ""
|
||||
if (ev.error.isNotBlank()) runError = ev.error
|
||||
}
|
||||
}
|
||||
@@ -856,6 +878,7 @@ private fun MeetingEditorScreen(vm: AppViewModel, initial: Meeting, onBack: () -
|
||||
node = node,
|
||||
status = status,
|
||||
output = nodeOutputs[node.id] ?: "",
|
||||
warn = nodeWarn[node.id] ?: "",
|
||||
linking = linkingFrom?.nodeId == node.id,
|
||||
inDegree = meeting.edges.count { it.to == node.id },
|
||||
outDegree = meeting.edges.count { it.from == node.id },
|
||||
@@ -981,6 +1004,7 @@ private fun MeetingEditorScreen(vm: AppViewModel, initial: Meeting, onBack: () -
|
||||
vm = vm,
|
||||
meeting = meeting,
|
||||
liveOutputs = nodeOutputs,
|
||||
liveTrace = liveTrace.toList(),
|
||||
onBack = { showResult = false },
|
||||
)
|
||||
return
|
||||
@@ -1574,6 +1598,8 @@ private fun MeetingResultScreen(
|
||||
vm: AppViewModel,
|
||||
meeting: Meeting,
|
||||
liveOutputs: Map<String, String>,
|
||||
/** 本次运行的**运行链**:按执行顺序记的 (节点id, 标题, 第几轮) */
|
||||
liveTrace: List<Triple<String, String, Int>>,
|
||||
onBack: () -> Unit,
|
||||
) {
|
||||
var runs by remember { mutableStateOf<List<MeetingRun>>(emptyList()) }
|
||||
@@ -1592,12 +1618,11 @@ private fun MeetingResultScreen(
|
||||
loading = false
|
||||
}
|
||||
|
||||
// 当前这次(刚跑完、还没落盘成历史的那份)
|
||||
val current = remember(meeting.id, liveOutputs.size) {
|
||||
meeting.nodes
|
||||
.filter { it.type != "end" && liveOutputs[it.id].orEmpty().isNotBlank() }
|
||||
.sortedWith(compareBy({ it.y }, { it.x }))
|
||||
}
|
||||
// ★ 当前这次 = **运行链**(按执行顺序),不是"按图里的位置排序的节点"。
|
||||
// 用户要的是"这条链是怎么一步步走下来的":循环转几轮就有几条,
|
||||
// 先后顺序就是执行顺序。按坐标排的话,循环里的节点会被排到一起,
|
||||
// 完全看不出第几轮先跑了谁。
|
||||
val current = liveTrace
|
||||
val currentFinal = meeting.nodes.firstOrNull { it.type == "end" }
|
||||
?.let { liveOutputs[it.id] }.orEmpty()
|
||||
|
||||
@@ -1708,26 +1733,48 @@ private fun MeetingResultScreen(
|
||||
}
|
||||
Spacer(Modifier.height(10.dp))
|
||||
}
|
||||
current.forEach { node ->
|
||||
Text(
|
||||
node.title.ifBlank {
|
||||
when (node.type) {
|
||||
"start" -> "初始输入"
|
||||
"judge" -> "判断"
|
||||
else -> "智能体"
|
||||
// ★ **运行链**:按执行顺序一步步列出每一步的结果。
|
||||
// 序号就是"整条链上的第几步",循环转几轮就有几条 ——
|
||||
// 这才是用户要的"运行链的每次结果"。
|
||||
current.forEachIndexed { i, step ->
|
||||
val (nodeId, title, runNo) = step
|
||||
Row {
|
||||
Text(
|
||||
"${i + 1}",
|
||||
fontSize = 11.sp,
|
||||
color = Doubao.Blue,
|
||||
fontWeight = FontWeight.Medium,
|
||||
modifier = Modifier.width(20.dp).padding(top = 1.dp),
|
||||
)
|
||||
Column(Modifier.weight(1f)) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(
|
||||
title,
|
||||
fontSize = 13.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
color = doubaoText(),
|
||||
)
|
||||
// 同一个节点跑了多轮就把轮次写出来
|
||||
if (liveTrace.count { it.first == nodeId } > 1) {
|
||||
Spacer(Modifier.width(6.dp))
|
||||
Text(
|
||||
"第 $runNo 轮",
|
||||
fontSize = 11.sp,
|
||||
color = doubaoTextSecondary(),
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
fontSize = 13.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
color = doubaoText(),
|
||||
)
|
||||
Spacer(Modifier.height(3.dp))
|
||||
Text(
|
||||
liveOutputs[node.id].orEmpty(),
|
||||
fontSize = 12.sp,
|
||||
color = doubaoTextSecondary(),
|
||||
lineHeight = 17.sp,
|
||||
)
|
||||
val body = liveOutputs[nodeId].orEmpty()
|
||||
if (body.isNotBlank()) {
|
||||
Text(
|
||||
body,
|
||||
fontSize = 12.sp,
|
||||
color = doubaoTextSecondary(),
|
||||
lineHeight = 17.sp,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Spacer(Modifier.height(10.dp))
|
||||
}
|
||||
if (currentFinal.isNotBlank()) {
|
||||
@@ -1741,9 +1788,13 @@ private fun MeetingResultScreen(
|
||||
val text = buildString {
|
||||
append(currentFinal)
|
||||
append("\n\n————\n")
|
||||
current.forEach { n ->
|
||||
append("【${n.title.ifBlank { n.type }}】\n")
|
||||
append(liveOutputs[n.id].orEmpty())
|
||||
current.forEachIndexed { i, step ->
|
||||
append("${i + 1}. ${step.second}")
|
||||
if (current.count { it.first == step.first } > 1) {
|
||||
append("(第 ${step.third} 轮)")
|
||||
}
|
||||
append("\n")
|
||||
append(liveOutputs[step.first].orEmpty())
|
||||
append("\n\n")
|
||||
}
|
||||
}
|
||||
@@ -1808,35 +1859,60 @@ private fun MeetingResultScreen(
|
||||
)
|
||||
if (open) {
|
||||
Spacer(Modifier.height(8.dp))
|
||||
// 同一个节点跑过几轮?用来决定要不要标"第N轮"
|
||||
// ★ **运行链**:按执行顺序把每一步的结果列出来。
|
||||
//
|
||||
// 不是"节点状态一览",而是"这条链是怎么一步步走下来的"——
|
||||
// 循环转几轮就有几条记录,先后顺序一目了然。
|
||||
// 序号也是执行顺序,不是节点在图里的位置。
|
||||
val countByNode = run.steps.groupingBy { it.nodeId }.eachCount()
|
||||
run.steps.forEach { s ->
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
run.steps.forEachIndexed { i, s ->
|
||||
Row(Modifier.padding(top = 8.dp)) {
|
||||
// 序号:这一步是整条链上的第几步
|
||||
Text(
|
||||
buildString {
|
||||
append("【${nodeLabel(s)}】")
|
||||
if ((countByNode[s.nodeId] ?: 0) > 1) {
|
||||
append(" 第 ${s.run} 轮")
|
||||
}
|
||||
},
|
||||
fontSize = 12.sp,
|
||||
"${i + 1}",
|
||||
fontSize = 11.sp,
|
||||
color = Doubao.Blue,
|
||||
fontWeight = FontWeight.Medium,
|
||||
color = if (s.error.isNotBlank()) {
|
||||
MaterialTheme.colorScheme.error
|
||||
} else {
|
||||
doubaoText()
|
||||
},
|
||||
modifier = Modifier
|
||||
.width(20.dp)
|
||||
.padding(top = 1.dp),
|
||||
)
|
||||
// ★ 判断 / while 走的是哪条路,写在标题旁边
|
||||
Spacer(Modifier.width(6.dp))
|
||||
VerdictBadge(s)
|
||||
Column(Modifier.weight(1f)) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(
|
||||
buildString {
|
||||
append(nodeLabel(s))
|
||||
if ((countByNode[s.nodeId] ?: 0) > 1) {
|
||||
append(" · 第 ${s.run} 轮")
|
||||
}
|
||||
},
|
||||
fontSize = 12.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
color = if (s.error.isNotBlank()) {
|
||||
MaterialTheme.colorScheme.error
|
||||
} else {
|
||||
doubaoText()
|
||||
},
|
||||
)
|
||||
// 判断 / while 走的是哪条路,写在标题旁边
|
||||
Spacer(Modifier.width(6.dp))
|
||||
VerdictBadge(s)
|
||||
}
|
||||
val body = if (s.error.isNotBlank()) {
|
||||
"出错:${s.error}"
|
||||
} else {
|
||||
s.output.ifBlank { s.note }
|
||||
}
|
||||
if (body.isNotBlank()) {
|
||||
Text(
|
||||
body,
|
||||
fontSize = 12.sp,
|
||||
color = doubaoTextSecondary(),
|
||||
lineHeight = 17.sp,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Text(
|
||||
if (s.error.isNotBlank()) "出错:${s.error}" else s.output,
|
||||
fontSize = 12.sp,
|
||||
color = doubaoTextSecondary(),
|
||||
lineHeight = 17.sp,
|
||||
)
|
||||
}
|
||||
Text(
|
||||
"复制这次",
|
||||
@@ -1891,6 +1967,8 @@ private fun NodeCard(
|
||||
outDegree: Int,
|
||||
/** 正在连线的引脚种类(exec / data);null = 没在连线。用来灰掉接不上的引脚 */
|
||||
linkingKind: String?,
|
||||
/** 这个节点的告警(比如"输入是空的,漏了数据线") */
|
||||
warn: String = "",
|
||||
modifier: Modifier,
|
||||
) {
|
||||
val accent = nodeColor(node.type)
|
||||
@@ -2024,6 +2102,20 @@ private fun NodeCard(
|
||||
modifier = Modifier.padding(horizontal = 6.dp),
|
||||
)
|
||||
Spacer(Modifier.weight(1f))
|
||||
// ★ 告警:最典型的那个是"输入是空的,你漏了数据线"。
|
||||
// 不说出来的话,用户只会看到"明明有值却判断为真",
|
||||
// 怎么查都查不出规则哪里错了 —— 规则本身没错,是没喂给它值。
|
||||
if (warn.isNotBlank()) {
|
||||
Text(
|
||||
"⚠ $warn",
|
||||
fontSize = 8.sp,
|
||||
color = Color(0xFFD93025),
|
||||
maxLines = 4,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
lineHeight = 11.sp,
|
||||
modifier = Modifier.padding(horizontal = 6.dp),
|
||||
)
|
||||
}
|
||||
// 进出路数写在最底下:多路是智能体的常态,不显示用户不知道自己接全没有
|
||||
Text(
|
||||
buildString {
|
||||
|
||||
@@ -918,6 +918,27 @@ def run_meeting(*, meeting: dict, settings: dict, user_input: str,
|
||||
|
||||
incoming = _collect_input(node_id, edges, outputs, variables, by_id)
|
||||
|
||||
# ★ 输入是空的、但 exec 上游明明有内容 → **大声报出来**。
|
||||
#
|
||||
# 这是最容易踩、也最难查的一个坑:exec 线只排顺序、不传值,
|
||||
# 所以"一根线连到底"的图里下游拿到的是空串。
|
||||
# 判断节点拿到空串时,"为空"当然为真 —— 用户看到的是
|
||||
# "明明有值却判断为真",怎么查都查不出规则哪里错了(规则本身没错)。
|
||||
#
|
||||
# 与其让它悄悄判错,不如直接说"你漏画了一根数据线"。
|
||||
if not _data_in(edges, node_id):
|
||||
ups = [(e.get('from'), outputs.get(e.get('from')))
|
||||
for e in _exec_in(edges, node_id)]
|
||||
ups = [(nid, t) for nid, t in ups if t]
|
||||
if ups:
|
||||
who = by_id.get(ups[0][0], {}).get('title') or ups[0][0]
|
||||
emit({
|
||||
'type': 'node_warn',
|
||||
'nodeId': node_id,
|
||||
'warn': f'输入是空的:上游「{who}」有内容,但你没连**数据线**。'
|
||||
f'exec 线只排顺序、不传值 —— 要传值得再连一根彩色数据线。',
|
||||
})
|
||||
|
||||
try:
|
||||
if node_type == 'start':
|
||||
# 第二轮开始,"初始输入"要把**自己上一轮的输出**当输入,
|
||||
|
||||
Reference in New Issue
Block a user