Skip to content

feat: Agent 支持通过引用方式附加文件(文件夹之前已实现)#85

Open
zongshuai818 wants to merge 3 commits intoErlichLiu:mainfrom
zongshuai818:feat/attach-files-by-reference
Open

feat: Agent 支持通过引用方式附加文件(文件夹之前已实现)#85
zongshuai818 wants to merge 3 commits intoErlichLiu:mainfrom
zongshuai818:feat/attach-files-by-reference

Conversation

@zongshuai818
Copy link
Contributor

@zongshuai818 zongshuai818 commented Mar 6, 2026

功能描述

支持通过引用方式附加外部文件到 Agent 会话,不再复制文件到工作区。

主要变更

1. 新增功能 (053c738)

  • 在 AgentSessionMeta 中添加 attachedFiles 字段存储附加文件路径
  • 新增 attachFile/detachFile IPC 通道和处理器
  • 修改选择文件功能为附加文件,通过引用方式附加而不是复制
  • 更新文件浏览器 UI,统一展示附加的文件和文件夹
  • 附加的文件通过 SDK additionalDirectories 参数传递,Agent 可以通过 @ 引用
  • 附加文件支持三点菜单操作(打开、在文件夹中显示、移除)

2. Bug 修复 (1165d89)

  • 修复 @ 引用时无法搜索到附加文件的问题
  • 搜索工作区文件时现在也扫描附加的单文件(不仅是附加目录)

测试计划

  • 点击附加文件按钮选择文件,文件应显示在文件列表中
  • 使用 @ 引用时应能搜索到附加的文件
  • 附加文件的三点菜单功能正常(打开、在文件夹中显示、移除)
  • 附加目录功能保持正常

相关文件

  • apps/electron/src/main/ipc.ts
  • apps/electron/src/main/lib/agent-orchestrator.ts
  • apps/electron/src/preload/index.ts
  • apps/electron/src/renderer/components/agent/AgentView.tsx
  • apps/electron/src/renderer/components/agent/SidePanel.tsx
  • apps/electron/src/renderer/components/file-browser/FileDropZone.tsx
  • apps/electron/src/renderer/components/ai-elements/rich-text-input.tsx
  • apps/electron/src/renderer/components/file-browser/file-mention-suggestion.tsx
  • packages/shared/src/types/agent.ts

- 在 AgentSessionMeta 中添加 attachedFiles 字段存储附加文件路径
- 新增 attachFile/detachFile IPC 通道和处理器
- 修改选择文件功能为附加文件,通过引用方式附加而不是复制
- 更新文件浏览器 UI,统一展示附加的文件和文件夹
- 附加的文件通过 SDK additionalDirectories 参数传递,Agent 可以通过 @ 引用
- 附加文件支持三点菜单操作(打开、在文件夹中显示、移除)
@zongshuai818 zongshuai818 changed the title feat: Agent 支持通过引用方式附加文件 feat: Agent 支持通过引用方式附加文件(文件夹之前已经实现) Mar 7, 2026
@zongshuai818 zongshuai818 changed the title feat: Agent 支持通过引用方式附加文件(文件夹之前已经实现) feat: Agent 支持通过引用方式附加文件(文件夹之前已实现) Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant