会议模式:修"列表没检查出来还是文本" + 标签页重名 + 长文本收起来
用户:"结果界面一塌糊涂,列表没检查出来还是文本",并给了 hy.json(两豆包辩论)。
【真凶:边的 kind 会过期,节点的出口类型不会】
那张图里 p1 / p2 是**列表**变量,读变量(p1) 的出口类型也是列表;
但 `readvar(p1) → 最终输出` 那条边的 kind 写的是 **'str'**
(连线是变量还是 str 类型时接的,后来变量改成了列表)。
我原来按**边上的 kind** 判最终输出的类型 → 判成文本 →
一份 JSON 数组被当一大坨文字铺在界面上。这就是用户看到的"还是文本"。
改成:**优先看来源节点的实际出口类型**(readvar 的出口 = 变量登记表里的类型),
拿不到才退回边上的 kind,再拿不到就看内容像不像 JSON 数组。
两份引擎都改了。
实测(用户那张图,22/22 条边):
[list ] 最终输出 = '["..."]' ← p1
[list ] 最终输出 = '["..."]' ← p2
[str ] 最终输出 = '...' ← cp
【标签页重名】
图上有 3 个 end 节点、标题都叫「最终输出」(默认名),
原样显示就是一排一模一样的标签,点哪个都不知道。
现在重名的补序号:「最终输出 1 / 2 / 3」。
【同一个 end 跑多次只留最后一次】
"最终输出"顾名思义是最后的结果。循环里连了 end 的话,每轮都记一条,
结果界面就会堆出一排标题相同的标签页。现在按 nodeId 去重、只留最新。
【长文本默认收起来】
辩论这种场景一段输出好几千字,全铺开的话下面的内容得翻半天才看得到 ——
用户说的"一塌糊涂"有一半是这个。现在超过 240 字的默认只显示 6 行,
下面给「展开全文(共 N 字)」。
【顺带发现 Node 侧缺一大块】
对拍暴露出 Node 的 end 分支**根本没做 results 收集**(之前那次镜像没落上),
所以它连"多个最终输出"都不支持。补全:results 数组、类型判定、
去重、meeting_done 带回 results、aborted 分支也带回。
(这正是对拍的价值:不跑它就一直以为两边一样。)
【验证】
- 引擎回归 40/40,Node 与 Python **16/16 逐用例一致**
- 会议 HTTP 13/13 ×2、语音 41/41、Markdown 19/19
- 用用户给的 hy.json 实测:22/22 条边保留,三个最终输出的类型判定全部正确
This commit is contained in:
@@ -2052,12 +2052,34 @@ private fun ResultValueView(r: MeetingResult) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> Text(
|
else -> {
|
||||||
r.value.ifBlank { "(没有输出)" },
|
// ★ 长文本默认**收起来**。
|
||||||
fontSize = 13.sp,
|
// 辩论这种场景一段输出能有好几千字,全铺开的话下面的内容
|
||||||
color = doubaoText(),
|
// 得翻半天才看得到,结果界面就"一塌糊涂"了(用户的原话)。
|
||||||
lineHeight = 19.sp,
|
// 默认只显示开头几行,想看全文点"展开"。
|
||||||
)
|
var open by remember(r.value) { mutableStateOf(false) }
|
||||||
|
val long = r.value.length > 240
|
||||||
|
Text(
|
||||||
|
r.value.ifBlank { "(没有输出)" },
|
||||||
|
fontSize = 13.sp,
|
||||||
|
color = doubaoText(),
|
||||||
|
lineHeight = 19.sp,
|
||||||
|
maxLines = if (open || !long) Int.MAX_VALUE else 6,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
)
|
||||||
|
if (long) {
|
||||||
|
Spacer(Modifier.height(4.dp))
|
||||||
|
Text(
|
||||||
|
if (open) "收起" else "展开全文(共 ${r.value.length} 字)",
|
||||||
|
fontSize = 11.sp,
|
||||||
|
color = Doubao.Blue,
|
||||||
|
modifier = Modifier
|
||||||
|
.clip(RoundedCornerShape(6.dp))
|
||||||
|
.clickable { open = !open }
|
||||||
|
.padding(horizontal = 6.dp, vertical = 3.dp),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2073,6 +2095,16 @@ private fun ResultsPanel(results: List<MeetingResult>) {
|
|||||||
var tab by remember(results) { mutableStateOf(0) }
|
var tab by remember(results) { mutableStateOf(0) }
|
||||||
val idx = tab.coerceIn(0, results.size - 1)
|
val idx = tab.coerceIn(0, results.size - 1)
|
||||||
|
|
||||||
|
// ★ 标签页**重名要区分开**。
|
||||||
|
// 图上多个 end 节点的标题都叫"最终输出"是常态(默认名),
|
||||||
|
// 原样展示就是一排一模一样的标签,点哪个都不知道。
|
||||||
|
// 重名的补上序号,至少能分辨"这是第几个最终输出"。
|
||||||
|
val dupTitles = results.groupingBy { it.title.ifBlank { "最终输出" } }.eachCount()
|
||||||
|
fun tabLabel(i: Int): String {
|
||||||
|
val base = results[i].title.ifBlank { "最终输出" }
|
||||||
|
return if ((dupTitles[base] ?: 0) > 1) "$base ${i + 1}" else base
|
||||||
|
}
|
||||||
|
|
||||||
Column(Modifier.fillMaxWidth()) {
|
Column(Modifier.fillMaxWidth()) {
|
||||||
if (results.size > 1) {
|
if (results.size > 1) {
|
||||||
// 多个输出才需要标签页;只有一个就直接展示,省一行
|
// 多个输出才需要标签页;只有一个就直接展示,省一行
|
||||||
@@ -2081,10 +2113,10 @@ private fun ResultsPanel(results: List<MeetingResult>) {
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.horizontalScroll(rememberScrollState()),
|
.horizontalScroll(rememberScrollState()),
|
||||||
) {
|
) {
|
||||||
results.forEachIndexed { i, r ->
|
results.forEachIndexed { i, _ ->
|
||||||
val on = i == idx
|
val on = i == idx
|
||||||
Text(
|
Text(
|
||||||
r.title.ifBlank { "输出 ${i + 1}" },
|
tabLabel(i),
|
||||||
fontSize = 13.sp,
|
fontSize = 13.sp,
|
||||||
color = if (on) Color.White else doubaoTextSecondary(),
|
color = if (on) Color.White else doubaoTextSecondary(),
|
||||||
fontWeight = if (on) FontWeight.Medium else FontWeight.Normal,
|
fontWeight = if (on) FontWeight.Medium else FontWeight.Normal,
|
||||||
@@ -2107,7 +2139,7 @@ private fun ResultsPanel(results: List<MeetingResult>) {
|
|||||||
) {
|
) {
|
||||||
Column(Modifier.padding(12.dp)) {
|
Column(Modifier.padding(12.dp)) {
|
||||||
Text(
|
Text(
|
||||||
cur.title.ifBlank { "最终输出" } + "(${typeLabel(cur.type)})",
|
tabLabel(idx) + "(${typeLabel(cur.type)})",
|
||||||
fontSize = 11.sp,
|
fontSize = 11.sp,
|
||||||
color = Doubao.Blue,
|
color = Doubao.Blue,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1484,12 +1484,46 @@ def run_meeting(*, meeting: dict, settings: dict, user_input: str,
|
|||||||
elif node_type == 'end':
|
elif node_type == 'end':
|
||||||
# ★ 最终输出可以有**多个**(结果界面用标签页展示),每个还能是不同类型、
|
# ★ 最终输出可以有**多个**(结果界面用标签页展示),每个还能是不同类型、
|
||||||
# 展示方式不同。所以每个 end 节点都把自己那份结果和类型记下来。
|
# 展示方式不同。所以每个 end 节点都把自己那份结果和类型记下来。
|
||||||
value = (node.get('text') or '').strip() or incoming
|
value = (node.get('text') or '').strip()
|
||||||
|
if not value:
|
||||||
|
value = incoming
|
||||||
|
# 和"写变量"同样的道理:只连了 exec 线时,用上游的输出。
|
||||||
|
# 用户的心智模型是"这根线连过来了,所以把刚才产生的东西显示出来",
|
||||||
|
# 逼他必须再拉一根数据线,只会让他看到一片空白还不知道为什么。
|
||||||
|
if not _data_in(edges, node_id):
|
||||||
|
ups = [outputs.get(e.get('from'))
|
||||||
|
for e in _exec_in(edges, node_id)]
|
||||||
|
ups = [t for t in ups if t]
|
||||||
|
if ups:
|
||||||
|
value = ups[-1]
|
||||||
outputs[node_id] = value
|
outputs[node_id] = value
|
||||||
# 类型取数据入线的类型;没有数据线就按文本
|
# 类型:**优先看来源节点的实际出口类型**,不要信边上的 kind。
|
||||||
kinds = [_kind(e) for e in _data_in(edges, node_id)]
|
#
|
||||||
rtype = kinds[0] if kinds else 'str'
|
# 踩过的坑:读变量(p1) 的出口类型是"列表",但那条边的 kind
|
||||||
|
# 写的是 'str'(连线是在变量还是 str 类型的时候接的、后来变量
|
||||||
|
# 改成了列表)。结果最终输出把一份 JSON 数组当文本显示,
|
||||||
|
# 界面上就是一大坨 —— 用户的原话"列表没检查出来还是文本"。
|
||||||
|
#
|
||||||
|
# 边的 kind 会过期,节点的出口类型不会。
|
||||||
|
ins = _data_in(edges, node_id)
|
||||||
|
rtype = ''
|
||||||
|
if ins:
|
||||||
|
rtype = _data_out_type(ins[0].get('from')) or ''
|
||||||
|
if not rtype:
|
||||||
|
rtype = _kind(ins[0]) if ins else ''
|
||||||
|
if rtype not in PIN_TYPES:
|
||||||
|
# 还是没有就**看内容像什么**:JSON 数组当列表
|
||||||
|
v = value.strip()
|
||||||
|
rtype = 'list' if (v.startswith('[') and v.endswith(']')) else 'str'
|
||||||
|
if rtype == 'str' and not ins:
|
||||||
|
v = value.strip()
|
||||||
|
if v.startswith('[') and v.endswith(']'):
|
||||||
|
rtype = 'list'
|
||||||
final_output = value
|
final_output = value
|
||||||
|
# ★ 同一个 end 节点跑过多次时**只留最后一次** ——
|
||||||
|
# "最终输出"顾名思义是最后的结果。循环里连了 end 的话,
|
||||||
|
# 每轮都 append 会在结果界面堆出一排标题一模一样的标签页。
|
||||||
|
results[:] = [r for r in results if r.get('nodeId') != node_id]
|
||||||
results.append({
|
results.append({
|
||||||
'nodeId': node_id,
|
'nodeId': node_id,
|
||||||
'title': node.get('title') or '最终输出',
|
'title': node.get('title') or '最终输出',
|
||||||
|
|||||||
@@ -603,6 +603,8 @@ export async function runMeeting({ meeting, settings, userInput, emit, runAgentF
|
|||||||
const budget = nodes.reduce((sum, n) => sum + (limitOf(n) || 200), 0);
|
const budget = nodes.reduce((sum, n) => sum + (limitOf(n) || 200), 0);
|
||||||
const maxSteps = Math.max(20, budget * 2 + nodes.length);
|
const maxSteps = Math.max(20, budget * 2 + nodes.length);
|
||||||
let finalOutput = '';
|
let finalOutput = '';
|
||||||
|
// 所有 end 节点的产出(结果界面按标签页展示)
|
||||||
|
const results = [];
|
||||||
|
|
||||||
const canRun = (id) => {
|
const canRun = (id) => {
|
||||||
const node = byId.get(id);
|
const node = byId.get(id);
|
||||||
@@ -626,7 +628,7 @@ export async function runMeeting({ meeting, settings, userInput, emit, runAgentF
|
|||||||
while (queue.length && steps < maxSteps) {
|
while (queue.length && steps < maxSteps) {
|
||||||
if (shouldStop && shouldStop()) {
|
if (shouldStop && shouldStop()) {
|
||||||
emit({ type: 'meeting_done', output: finalOutput, aborted: true });
|
emit({ type: 'meeting_done', output: finalOutput, aborted: true });
|
||||||
return { output: finalOutput, aborted: true };
|
return { output: finalOutput, results, aborted: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
const nodeId = queue.shift();
|
const nodeId = queue.shift();
|
||||||
@@ -800,8 +802,37 @@ export async function runMeeting({ meeting, settings, userInput, emit, runAgentF
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (nodeType === 'end') {
|
} else if (nodeType === 'end') {
|
||||||
outputs[nodeId] = String(node.text || '').trim() || input;
|
// ★ 最终输出可以有**多个**(结果界面用标签页展示),每个还能是不同类型、
|
||||||
finalOutput = outputs[nodeId];
|
// 展示方式不同。所以每个 end 节点都把自己那份结果和类型记下来。
|
||||||
|
let value = String(node.text || '').trim();
|
||||||
|
if (!value) {
|
||||||
|
value = input;
|
||||||
|
// 和"写变量"同样的道理:只连了 exec 线时,用上游的输出。
|
||||||
|
if (dataIn(edges, nodeId).length === 0) {
|
||||||
|
const ups = execIn(edges, nodeId)
|
||||||
|
.map((e) => outputs[e.from])
|
||||||
|
.filter((t) => t);
|
||||||
|
if (ups.length) value = ups[ups.length - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
outputs[nodeId] = value;
|
||||||
|
finalOutput = value;
|
||||||
|
|
||||||
|
// 类型:**优先看来源节点的实际出口类型**,不要信边上的 kind ——
|
||||||
|
// 边的 kind 会过期(连线时变量还是 str,后来改成了列表),
|
||||||
|
// 节点的出口类型不会。不这样判的话,一份 JSON 数组会被当文本显示。
|
||||||
|
const insList = dataIn(edges, nodeId);
|
||||||
|
let rtype = insList.length ? (dataOutType(byId.get(insList[0].from)) || '') : '';
|
||||||
|
if (!rtype && insList.length) rtype = kindOf(insList[0]);
|
||||||
|
if (!PIN_TYPES.includes(rtype)) {
|
||||||
|
const v = String(value).trim();
|
||||||
|
rtype = (v.startsWith('[') && v.endsWith(']')) ? 'list' : 'str';
|
||||||
|
}
|
||||||
|
// 同一个 end 节点跑过多次只留最后一次("最终输出"就是最后的结果)
|
||||||
|
for (let i = results.length - 1; i >= 0; i -= 1) {
|
||||||
|
if (results[i].nodeId === nodeId) results.splice(i, 1);
|
||||||
|
}
|
||||||
|
results.push({ nodeId, title: node.title || '最终输出', type: rtype, value });
|
||||||
emit({ type: 'node_done',
|
emit({ type: 'node_done',
|
||||||
nodeId,
|
nodeId,
|
||||||
nodeType, output: finalOutput, run: runIndex });
|
nodeType, output: finalOutput, run: runIndex });
|
||||||
@@ -829,6 +860,6 @@ export async function runMeeting({ meeting, settings, userInput, emit, runAgentF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit({ type: 'meeting_done', output: finalOutput });
|
emit({ type: 'meeting_done', output: finalOutput, results });
|
||||||
return { output: finalOutput };
|
return { output: finalOutput, results };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
会议模式:加文件导入/导出(剪贴板对长文本不可靠,会被截断)
|
|
||||||
|
|
||||||
用户:"会议粘贴json被截断,加上支持文件导入"
|
|
||||||
|
|
||||||
【为什么会截断】
|
|
||||||
剪贴板对**长文本**不可靠 —— 各大 ROM 都有自己的一套截断策略
|
|
||||||
(有的按字节、有的按字符、有的只对"看起来像密码/令牌"的东西截),
|
|
||||||
而会议 JSON 动不动几 KB。用户遇到的截断不是输入框的问题,是剪贴板本身的。
|
|
||||||
所以光把输入框加高没用,得给一条**不经过剪贴板**的路。
|
|
||||||
|
|
||||||
【加了什么】
|
|
||||||
- **导出到文件…**:系统保存对话框(CreateDocument,application/json),
|
|
||||||
文件名默认「会议名.json」。导出完提示"已导出到文件(N 字符)",
|
|
||||||
报字符数是为了让用户能和导入时对一下、确认没缺。
|
|
||||||
- **从文件导入…**:系统打开对话框(OpenDocument),
|
|
||||||
读进来直接解析;解析失败会明说"这个文件不是合法的会议 JSON",
|
|
||||||
而不是默默什么都没发生。
|
|
||||||
- 菜单里文件那两项都标了「推荐」,并且说明了原因
|
|
||||||
("剪贴板对长文本不可靠,几 KB 会截断")—— 用户看得见为什么。
|
|
||||||
- 粘贴输入框也加高了(110→140,最大 190→300),
|
|
||||||
并且在下面显示**已粘 N 个字符**,用户能自己核对有没有被截断。
|
|
||||||
|
|
||||||
【结构上的整理】
|
|
||||||
把"导成 JSON"和"导入一份内容"抽成 meetingJson() / applyImported() 两个函数,
|
|
||||||
剪贴板导出、文件导出、文件导入、粘贴导入**四条路共用**:
|
|
||||||
只要有一处各写一遍,就会出现"文件导出的能导入、剪贴板导出的不行"这种事。
|
|
||||||
applyImported 只换图不换名字和 id(用户是在编辑这一场会议,换的是内容不是身份)。
|
|
||||||
|
|
||||||
【踩的坑(第三次了,这次记牢)】
|
|
||||||
又用 PowerShell 按行号剪贴代码块把函数挪位置,结果把 launcher 插进了
|
|
||||||
别的 composable(报 Unresolved reference 'context'/'dirty')。
|
|
||||||
**这个 3400 行的 Kotlin 文件不能再按行号剪** —— 还原后用 edit 工具
|
|
||||||
按锚点逐处改,一次就过。以后只用 edit。
|
|
||||||
|
|
||||||
【验证】
|
|
||||||
- 引擎回归 40/40,Node 与 Python 16/16 逐用例一致
|
|
||||||
- 会议 HTTP 13/13 ×2
|
|
||||||
- 截图确认:⋮ 菜单里"导出到文件…(推荐)""复制会议 JSON""从文件导入…(推荐)"
|
|
||||||
"粘贴会议 JSON…" 四项齐全
|
|
||||||
45
tmp-msg-fix3.txt
Normal file
45
tmp-msg-fix3.txt
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
会议模式:修"列表没检查出来还是文本" + 标签页重名 + 长文本收起来
|
||||||
|
|
||||||
|
用户:"结果界面一塌糊涂,列表没检查出来还是文本",并给了 hy.json(两豆包辩论)。
|
||||||
|
|
||||||
|
【真凶:边的 kind 会过期,节点的出口类型不会】
|
||||||
|
那张图里 p1 / p2 是**列表**变量,读变量(p1) 的出口类型也是列表;
|
||||||
|
但 `readvar(p1) → 最终输出` 那条边的 kind 写的是 **'str'**
|
||||||
|
(连线是变量还是 str 类型时接的,后来变量改成了列表)。
|
||||||
|
|
||||||
|
我原来按**边上的 kind** 判最终输出的类型 → 判成文本 →
|
||||||
|
一份 JSON 数组被当一大坨文字铺在界面上。这就是用户看到的"还是文本"。
|
||||||
|
|
||||||
|
改成:**优先看来源节点的实际出口类型**(readvar 的出口 = 变量登记表里的类型),
|
||||||
|
拿不到才退回边上的 kind,再拿不到就看内容像不像 JSON 数组。
|
||||||
|
两份引擎都改了。
|
||||||
|
|
||||||
|
实测(用户那张图,22/22 条边):
|
||||||
|
[list ] 最终输出 = '["..."]' ← p1
|
||||||
|
[list ] 最终输出 = '["..."]' ← p2
|
||||||
|
[str ] 最终输出 = '...' ← cp
|
||||||
|
|
||||||
|
【标签页重名】
|
||||||
|
图上有 3 个 end 节点、标题都叫「最终输出」(默认名),
|
||||||
|
原样显示就是一排一模一样的标签,点哪个都不知道。
|
||||||
|
现在重名的补序号:「最终输出 1 / 2 / 3」。
|
||||||
|
|
||||||
|
【同一个 end 跑多次只留最后一次】
|
||||||
|
"最终输出"顾名思义是最后的结果。循环里连了 end 的话,每轮都记一条,
|
||||||
|
结果界面就会堆出一排标题相同的标签页。现在按 nodeId 去重、只留最新。
|
||||||
|
|
||||||
|
【长文本默认收起来】
|
||||||
|
辩论这种场景一段输出好几千字,全铺开的话下面的内容得翻半天才看得到 ——
|
||||||
|
用户说的"一塌糊涂"有一半是这个。现在超过 240 字的默认只显示 6 行,
|
||||||
|
下面给「展开全文(共 N 字)」。
|
||||||
|
|
||||||
|
【顺带发现 Node 侧缺一大块】
|
||||||
|
对拍暴露出 Node 的 end 分支**根本没做 results 收集**(之前那次镜像没落上),
|
||||||
|
所以它连"多个最终输出"都不支持。补全:results 数组、类型判定、
|
||||||
|
去重、meeting_done 带回 results、aborted 分支也带回。
|
||||||
|
(这正是对拍的价值:不跑它就一直以为两边一样。)
|
||||||
|
|
||||||
|
【验证】
|
||||||
|
- 引擎回归 40/40,Node 与 Python **16/16 逐用例一致**
|
||||||
|
- 会议 HTTP 13/13 ×2、语音 41/41、Markdown 19/19
|
||||||
|
- 用用户给的 hy.json 实测:22/22 条边保留,三个最终输出的类型判定全部正确
|
||||||
Reference in New Issue
Block a user