首页工作流会话重构与产出内嵌:后端 UUID 认领 + 产出对话内直接预览

会话机制:
- 建连不传本地会话号,由后端生成 UUID 并经首帧 ack 认领(claimSessionId 就地迁移全部状态)
- 删除执行完成后轮询会话列表替换本地条目的双路径逻辑,统一认领后刷新
- 清理 virtual_ 特判,收敛为 hasBackendSessionId 单一语义判断

产出展示:
- flow_complete 事件自带 resultFileUrls 直接构建产出卡片(buildOutputsFromUrls)
- 完成文案改为「 执行完成」,产出以消息形式展示在对话里
- 产出媒体(图片/视频/音频)常驻内嵌预览,图片点击放大,text/file 保持文件行
- ChatList 自动续载增加次数上限,防止 hasMore 恒真时无限加载循环
This commit is contained in:
2026-08-17 17:59:24 +08:00
parent bb15c053e6
commit 13a2aeee9f
6 changed files with 349 additions and 110 deletions
+4 -3
View File
@@ -30,6 +30,7 @@ export const WsEventType = {
ReasoningChunk: 'reasoning_chunk', // 思考内容增量(逐 chunk
NodeStart: 'node_start', // 工作流节点开始(进度推进)
NodeComplete: 'node_complete', // 工作流节点完成(进度推进)
FlowComplete: 'flow_complete', // 工作流执行完成(后端完成信号,日志末尾事件)
Error: 'error', // 出错
} as const;
@@ -108,11 +109,11 @@ export function getToolResultText(msg: WsStreamMessage): string {
return '';
}
/** error → 错误文案(error 字段为详细原因优先;其次 message;再 data.message / data.error / data.msg */
/** error → 错误文案(message 优先展示简洁业务提示;error 详细原因仅在 message 缺失时兜底 */
export function getErrorText(msg: WsStreamMessage): string {
// 详细失败原因(含节点名/具体错误),优先展示
if (typeof msg?.error === 'string' && msg.error) return msg.error;
// 只显示 message 的消息(用户确认),error 详细原因不再作为界面展示内容
if (typeof msg?.message === 'string' && msg.message) return msg.message;
if (typeof msg?.error === 'string' && msg.error) return msg.error;
const d = msg?.data;
if (typeof d === 'string') return d;
if (d && typeof d === 'object') {