【已审核】fix(agent): 附加文件/文件夹类型选择改用 Proma 自身弹窗 - #1467
Open
climashscape wants to merge 1 commit into
Open
Conversation
climashscape
marked this pull request as ready for review
August 6, 2026 12:25
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.
概述
Composer 输入工具栏的「附加文件或文件夹」按钮在 Windows/Linux 上会先弹出 Electron 系统原生 MessageBox(dialog.showMessageBox)选择"文件/文件夹"类型,再打开系统文件选择器——系统弹窗与 Proma 自身 UI 风格割裂(Windows 原生对话框外观)。本 PR 将类型选择移到渲染层,用 Proma 自己的 Dialog(新增 AttachmentContentDialog)完成,主进程按类型直接打开对应系统选择器,体验统一。
改动
apps/electron/src/main/lib/attachment-service.ts:openFileOrFolderDialog(type: 'file' | 'folder')改为必传类型,删除系统 MessageBox 分支,按类型直接打开多选选择器(file:openFile+multiSelections+FILE_FILTERS;folder:openDirectory+multiSelections);新增运行时 type 守卫,防止非法值被静默当作 folderapps/electron/src/main/ipc.ts:handler 透传 typeapps/electron/src/preload/index.ts:API 签名加 type 参数并透传apps/electron/src/renderer/components/agent/AgentView.tsx:handleAttachContent改为打开 Proma 类型弹窗;新增handleAttachContentType(含双击重入锁,防止退出动画期间连点重复打开选择器);附件/目录处理逻辑逐字复用原实现apps/electron/src/renderer/components/agent/AttachmentContentDialog.tsx(新增):Proma 风格类型选择弹窗——标题「附加文件或文件夹」、DialogDescription「请选择要附加的内容类型」、三个按钮(取消 ghost / 文件 default+autoFocus / 文件夹 outline),文件为默认操作(与原系统 MessageBox defaultId=0 语义一致)packages/shared/src/types/agent.ts:通道注释同步为"类型由渲染层 Dialog 决定"测试
bun run typecheck:全部 6 包 exit 0bun run dev确认弹窗外观与交互链路)紧急度
常规
备注