Skip to content

feat: 文件树拖拽到输入框生成 ContextMention(文件+目录)#492

Open
gy212 wants to merge 1 commit intoop7418:mainfrom
gy212:codex/pr171-refresh-contextmention
Open

feat: 文件树拖拽到输入框生成 ContextMention(文件+目录)#492
gy212 wants to merge 1 commit intoop7418:mainfrom
gy212:codex/pr171-refresh-contextmention

Conversation

@gy212
Copy link
Copy Markdown
Contributor

@gy212 gy212 commented Apr 15, 2026

背景

这是对旧 PR #171最新主线重发版。旧 PR 提交时间较早,位置已经比较靠后;本 PR 基于最新 main 重新整理后提交,方便继续 review。

保持不变的核心意图

  • 文件树拖拽到输入框时,生成对应的 ContextMention
  • 同时覆盖文件目录两种来源

这次针对最新主线的适配方式

  • src/components/ai-elements/file-tree.tsx
    • 为文件/目录节点补充拖拽 payload(统一 MIME)
  • src/components/chat/MessageInput.tsx
    • 仅拦截来自文件树的自定义拖拽
    • drop 目录时插入 @path
    • drop 文件时插入 @path,并复用现有附件桥接逻辑
  • src/lib/file-tree-dnd.ts
    • 抽出拖拽 MIME / payload 解析 / mention 追加逻辑
  • src/__tests__/unit/file-tree-dnd.test.ts
    • 补充 payload 解析与 mention 追加规则的定点测试

范围说明

验证

  • ✅ Typecheck(目标分支当前代码)通过:
    • node node_modules/typescript/bin/tsc --noEmit --pretty false
  • ✅ 定点单测通过:
    • node node_modules/tsx/dist/cli.mjs --test src/__tests__/unit/file-tree-dnd.test.ts src/__tests__/unit/message-input-interactions.test.ts
  • ⚠️ 本地全量 npm run test 未能作为最终证据:
    • 原因不是本次功能逻辑本身,而是本机缺少 better-sqlite3 所需原生构建产物
    • 本地 npm install 进一步暴露出 zlib-sync 原生模块需要 Windows SDK 10.0.22621.0
    • 因此建议以 CI / 具备完整原生依赖的环境补跑全量验证

与旧 PR 的关系

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 15, 2026

@codex-automation is attempting to deploy a commit to the op7418's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

2 participants