优化: ai-chat 对话流布局与轨迹信息密度改造
- 分组行去统计化,调用统计归并轨迹卡头部 - 相对时间改时间分隔线,跨日显绝对时间 - 思考过程单行 pill 化,答案卡加 accent 边 - 工具卡短路径展示与耗时提示统一 - 高风险工具名单启动时同步后端注册表 - 自动重试改琥珀细条,红卡与手动重试仅终态 - 轨迹卡头并时间线行,显轮次号与绝对时间 - 运行中摘要补当前工具名与失败计数 - 执行中工具卡加实时计时,耗时统一人话口径 - 重试残留清理改标记匹配,替代中文子串硬编码
This commit is contained in:
@@ -63,17 +63,21 @@ export function handleStreamingEvent(event: AiChatEvent): boolean {
|
||||
return true
|
||||
|
||||
case 'AiStreamRetry': {
|
||||
// 重试中——首条重试推新错误气泡,后续仅更新其 content(单气泡聚合,根治 N+1 气泡)
|
||||
// 重试中——首条重试推过渡气泡(isRetry 标记,MessageList 渲染为琥珀细条而非错误红卡),
|
||||
// 后续仅更新其 content(单气泡聚合,根治 N+1 气泡)。isError 保持 true:
|
||||
// flushCurrentText 靠它跳过本气泡,部分流式回复仍回填前一条 assistant 消息。
|
||||
const lastMsg = state.messages[state.messages.length - 1]
|
||||
const retryText = t('ai.aiStreamRetry', { attempt: event.attempt, max: event.max_attempts })
|
||||
if (lastMsg && lastMsg.isError) {
|
||||
lastMsg.content = retryText
|
||||
lastMsg.isRetry = true
|
||||
} else {
|
||||
state.messages.push({
|
||||
id: `err-${nextMsgId()}` as MessageId,
|
||||
role: 'assistant',
|
||||
content: retryText,
|
||||
isError: true,
|
||||
isRetry: true,
|
||||
timestamp: Date.now(),
|
||||
} as AiMessage)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user