【已审核】feat(agent): 问答 Tab 重构为 Agent 支线追问面板 - #1474
Open
climashscape wants to merge 2 commits into
Open
Conversation
added 2 commits
August 6, 2026 20:55
数据模型:ConversationMeta 新增 sourceType/parentAgentSessionId/sourceKind/sourceRef/sourceLabel/seedSelection(shared 0.1.52),createConversation/IPC/preload 透传。 创建链路:抽 useOpenSideChat 统一四处新建入口,新建继承 Agent 会话模型,来源标注与首问引用持久化。 UI:ChatView 新增 variant=side-qa 精简问答视图(裁置顶/并排/系统提示/提示词侧栏/AgentRecommendBanner),SideQaHeader 来源标注,窄面板空态精简文案,快捷键按 conversationId 精确寻址。 上下文继承:主进程按归属注入 Agent 已选文件(字节截断+总量预检+二进制过滤),追问延续自动携带 seedSelection 引用。 列表语义:左侧 Chat 列表/全局搜索/切换器排除问答会话,右侧按 Agent 会话聚合线程,支持删除与父会话级联清理。 自审修复:来源标签/seed 移除一致性/Cmd+L 焦点竞争/stop 寻址(null=仅 Agent)/minimap 裁剪/模型兜底等全部落地。
- Tab 栏:问答 Tab 改为与「文件」「文件改动」一致的纯切换 button(补 hover 反馈、点击区域、文字对齐),移除 Tab 栏上的 X 关闭按钮 - 关闭入口迁移:SideQaHeader 新增关闭按钮,解绑当前问答会话后停留在问答 Tab 回到「查看现有问答」列表(无可选对话时由 effectiveActiveTab 兜底隐藏)
climashscape
marked this pull request as ready for review
August 6, 2026 13:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
Agent 问答体验重构:原「打开右侧问答」会隐式创建新 Chat 对话,且右侧问答样式与左侧不统一(issue #1440)。本 PR 将问答 Tab 重构为 Agent 支线追问面板——问答会话与 Agent 会话绑定(来源标注 + 上下文继承),从左侧 Chat 列表/全局搜索/切换器中剔除,仅在 Agent 会话侧按线程聚合展示。
数据模型:
ConversationMeta新增sourceType / parentAgentSessionId / sourceKind / sourceRef / sourceLabel / seedSelection(shared bump 0.1.52),createConversation/ IPC / preload 透传来源信息。创建链路:抽
useOpenSideChat统一四处新建入口(Agent 历史选区 / 草稿选区 / 预览选区 / 快捷键),新建问答会话继承 Agent 会话模型,来源标注与首问引用(seedSelection)持久化,父会话删除时级联清理。UI:
ChatView新增variant=side-qa精简问答视图(裁掉置顶/并排/系统提示/提示词侧栏/AgentRecommendBanner);新增SideQaHeader来源标注头;窄面板空态精简文案;快捷键按conversationId精确寻址(修复 Cmd+L 焦点竞争)。上下文继承:主进程按归属注入 Agent 已选文件(字节截断 + 总量预检 + 二进制过滤);追问延续自动携带 seedSelection 引用。
列表语义:左侧 Chat 列表 / 全局搜索 / Tab 切换器排除问答会话;右侧按 Agent 会话聚合线程,支持删除与父会话级联清理。
改动
packages/shared/src/types/chat.ts:ConversationMeta来源字段 +createConversation参数扩展(+27)apps/electron/src/main/lib/chat-service.ts/conversation-manager.ts/ipc.ts/preload/index.ts:主进程透传来源、上下文注入(已选文件字节截断/总量预检/二进制过滤)、级联清理(+293)apps/electron/src/renderer/hooks/useOpenSideChat.ts(新增):统一四入口新建链路(+208)apps/electron/src/renderer/components/chat/SideQaHeader.tsx(新增):来源标注头(+62)apps/electron/src/renderer/lib/time-format.ts(新增):时间格式化工具(+21)ChatView/ChatInput/ChatMessages/SidePanel/LeftSidebar/SearchDialog/TabSwitcher/ScratchPadView/AgentHistorySelectionLayer/DiffTabContent/SelectionActionPopover/GlobalShortcuts/useFocusAgentSessionInput:问答视图变体、来源入口接入、列表过滤(-333)DiffPanelTabBar/SideQaHeader/ChatView/SidePanel(0e704cfe):问答 Tab 与「文件」「文件改动」Tab 显示逻辑与 UI 统一——纯切换按钮(hover/对齐一致),关闭入口从 Tab 栏移至问答头部(SideQaHeader 右上角),关闭当前问答后停留在问答 Tab 回到「查看现有问答」列表(无可选对话时自动隐藏)bun.lock/packages/shared/package.json:shared 0.1.52测试
bun run typecheck:全部 6 包 exit 0(含 0e704cf 修订)bun run dev人工确认)紧急度
常规
备注
Closes #1440
parentAgentSessionId为空即普通 Chat,不影响现有数据