优化: 前端走查 P2+UX(status union + ApprovalPopup hack消除/拖动JS API/Esc)

- status union: AiMessage 加 status 字面量联合,删 AiChat/MessageList AiMessageWithStatus 重复+cast
- ApprovalPopup: 删 _placeholder hack(toolDisplayName 提纯函数) + dispatchApprovalIPC 共享分派消除三套重复 + always 按钮语义对齐 + closeWithFallback 兜底 + 拖动 JS API startDragging(避子元素覆盖) + Esc 快捷键
This commit is contained in:
lxy
2026-08-02 10:43:30 +08:00
parent ef77120912
commit f1773dde4f
7 changed files with 234 additions and 136 deletions
+9
View File
@@ -466,6 +466,15 @@ export interface AiMessage {
role: 'user' | 'assistant' | 'tool' | 'system'
content: string
isError?: boolean
/**
* 消息上下文状态(F-15 手动上下文管理)。
* null | undefined | 'active' → 正常消息
* 'archived_segment' → 清空上下文归档标记(前端折叠成"已归档 N 条"分隔条)
* 'compressed' → 压缩标记(后端不再发给 LLM;前端照常展开)
* 'truncated' → switchConversation 已过滤,前端不渲染
* 字面量联合:改 status 取值时编译器拦截,避免散布 string cast 失去类型校验。
*/
status?: 'active' | 'archived_segment' | 'compressed' | 'truncated' | null
toolCalls?: AiToolCallInfo[]
/** 生成该消息的 model(仅 assistant 消息,历史消息从 DB 读) */
model?: string