feat: add @ file mention support in chat input and unify directory attachment

Support typing "@" in the chat input to trigger a file list popup with
filtering, keyboard navigation, and file/directory attachment. Directories
from the sidebar file tree now attach as resource links instead of injecting
text into the input.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
xintaofei
2026-04-02 22:43:27 +08:00
parent e87f930ec1
commit 9396127cd9
6 changed files with 379 additions and 158 deletions

9
src/lib/path-utils.ts Normal file
View File

@@ -0,0 +1,9 @@
export function joinFsPath(basePath: string, relPath: string): string {
if (!relPath) return basePath
const separator = basePath.includes("\\") ? "\\" : "/"
const normalizedRel = relPath.replace(/[\\/]/g, separator)
if (basePath.endsWith("/") || basePath.endsWith("\\")) {
return `${basePath}${normalizedRel}`
}
return `${basePath}${separator}${normalizedRel}`
}