feat(vscode): support drag-and-drop file attachments in chat (#535)

* feat(vscode): implement file drop API for handling dropped files in VS Code

* refactor(vscode): deduplicate attachment parsing for picked and dropped files
This commit is contained in:
Asuta
2026-02-27 20:21:12 +02:00
committed by GitHub
parent 1d8ff97c95
commit b68a10571c
3 changed files with 214 additions and 44 deletions
+9
View File
@@ -486,6 +486,15 @@ const handleLocalApiRequest = async (url: URL, init?: RequestInit) => {
return new Response(JSON.stringify(data), { status: 200, headers: { 'Content-Type': 'application/json' } });
}
if (pathname.startsWith('/api/vscode/drop-files') && method === 'POST') {
const body = init?.body ? JSON.parse(init.body as string) : {};
const uris = Array.isArray((body as { uris?: unknown[] }).uris)
? (body as { uris: unknown[] }).uris.filter((value): value is string => typeof value === 'string')
: [];
const data = await sendBridgeMessage('api:files/drop', { uris });
return new Response(JSON.stringify(data), { status: 200, headers: { 'Content-Type': 'application/json' } });
}
if (pathname.startsWith('/api/config/agents/')) {
const encodedName = pathname.slice('/api/config/agents/'.length);
const name = decodeURIComponent(encodedName);