fix: Trace Viewer 内容渲染修复

1. useAgentStream: 每轮迭代只创建一个 TraceStep, 状态转换时更新而非新建; tool_result 反向搜索包含 toolCallId 的步骤, 修复工具结果丢失

2. TraceStep: 渲染工具状态图标/结果/错误/耗时; Thought 添加 maxHeight 200+滚动; 展开状态用户操作后不被自动覆盖

3. ToolResultBlock: 移除 500 字符截断, 改为 maxHeight 300+滚动

4. ToolCallCard: 参数区域添加 overflowY auto+wordBreak
This commit is contained in:
thzxx
2026-07-07 21:13:51 +08:00
parent 6f08759f63
commit ed59305b5e
4 changed files with 168 additions and 44 deletions
+2 -2
View File
@@ -20,8 +20,8 @@ export function ToolResultBlock({ toolCall }: ToolResultBlockProps): React.JSX.E
<Typography variant="caption" sx={{ fontWeight: 500, color: 'text.primary' }}>{toolCall.name} </Typography>
{toolCall.durationMs != null && <Typography variant="caption" sx={{ ml: 'auto', color: 'text.secondary' }}>{formatDuration(toolCall.durationMs)}</Typography>}
</Stack>
<Box component="pre" sx={{ fontSize: 11, borderRadius: 1, px: 1, py: 0.75, overflowX: 'auto', bgcolor: 'background.default', color: 'text.secondary', fontFamily: "'SF Mono',monospace", maxHeight: 120, m: 0 }}>
{resultStr.length > 500 ? resultStr.slice(0, 500) + '\n... [截断]' : resultStr}
<Box component="pre" sx={{ fontSize: 11, borderRadius: 1, px: 1, py: 0.75, overflowX: 'auto', overflowY: 'auto', bgcolor: 'background.default', color: 'text.secondary', fontFamily: "'SF Mono',monospace", maxHeight: 300, m: 0, whiteSpace: 'pre-wrap', wordBreak: 'break-all' }}>
{resultStr}
</Box>
</Box>
);