修复: AiCompleted 携带 pinned_goals 根治目标面板刷新

This commit is contained in:
2026-06-28 04:51:08 +08:00
parent dcc3f0d230
commit ead490783f
6 changed files with 49 additions and 7 deletions

View File

@@ -372,7 +372,7 @@ export type AiChatEvent = ({
} | {
// UX-2025-04 / CR-30-2 / 决策 F-260616-07 a1: incomplete 标记流中途失败保文(网络中断),
// 前端据此差异化展示(如系统提示「⚠ 响应因网络中断不完整」)。正常完成/停止均为 undefined。
type: 'AiCompleted'; total_tokens: number; prompt_tokens: number; completion_tokens: number; incomplete?: boolean
type: 'AiCompleted'; total_tokens: number; prompt_tokens: number; completion_tokens: number; incomplete?: boolean; pinned_goals?: string[]
} | {
type: 'AiError'; error: string; error_type?: AiErrorType
} | {

View File

@@ -580,7 +580,11 @@ function handleLifecycleEvent(event: AiChatEvent): boolean {
timestamp: Date.now(),
})
}
// 对话透明化 L1:刷新会话列表(更新 pinned_goals)
// 对话透明化 L1:直接从事件更新 pinned_goals,不等 loadConversations 异步刷新
if (event.pinned_goals && state.activeConversationId) {
const conv = state.conversations.find(c => c.id === state.activeConversationId)
if (conv) conv.pinned_goals = event.pinned_goals
}
void loadConversations()
// token 用量记录(开关开时):lastTokenUsage 供当前回复展示,convTokenTotal 累加对话总量
if (isShowTokenUsage()) {