feat: paste local files into chat attachments

Copied local files previously required the attachment picker. The chat
composer now imports one or more supported files directly from paste,
sharing parsing progress, limits, and batch rollback with file selection.
Text and screenshot paste remain available, and failures preserve drafts.

Validation: prior 166 focused tests, typecheck, and lint passed; 28 targeted
tests passed again before commit. The prior full suite had 4214 passes,
67 skips, and 6 window-recovery failures; window tests passed 10/10 alone.
Native clipboard behavior was verified on Windows; macOS/Linux remain unverified.

Release note: 现在可在文件管理器中复制一个或多个支持的本地文件,直接粘贴到聊天输入框添加附件;可查看读取和解析进度,失败时保留草稿与已有附件。
This commit is contained in:
mesalogo
2026-09-15 08:05:31 +08:00
parent e1fe1cf10a
commit d4f1668c9b
19 changed files with 344 additions and 29 deletions
+6
View File
@@ -1486,6 +1486,12 @@ const desktopApi: DesktopApi = {
) as Promise<RuntimeNativeSnapshot>
},
context: {
getFilePath: (file) => webUtils.getPathForFile(file),
importFiles: (paths) =>
ipcRenderer.invoke(
ipcChannels.contextImportFiles,
{ paths }
) as Promise<ContextAttachment[]>,
selectFiles: () =>
ipcRenderer.invoke(
ipcChannels.contextSelectFiles