diff --git a/AgentCompany-New/src/main/app/ipc-handlers.ts b/AgentCompany-New/src/main/app/ipc-handlers.ts
index 7f2f9a6e..ffaff708 100644
--- a/AgentCompany-New/src/main/app/ipc-handlers.ts
+++ b/AgentCompany-New/src/main/app/ipc-handlers.ts
@@ -188,9 +188,9 @@ export function registerIpcHandlers(deps: IpcDeps): void {
ipcMain.handle(IPC_CHANNELS.importFile, async (_event, input) => {
try {
- await files.importFile(input);
- deps.mainWindow.webContents.send(IPC_CHANNELS.rendererEvent, { type: "snapshot-changed" });
- return ok(snapshot.load());
+ const fileId = await files.importFile(input);
+ if (fileId) deps.mainWindow.webContents.send(IPC_CHANNELS.rendererEvent, { type: "snapshot-changed" });
+ return ok(fileId);
} catch (error) {
return fail("file_import_failed", error instanceof Error ? error.message : String(error));
}
diff --git a/AgentCompany-New/src/renderer/src/pages/ChatPage.tsx b/AgentCompany-New/src/renderer/src/pages/ChatPage.tsx
index 686416c5..7e045bc2 100644
--- a/AgentCompany-New/src/renderer/src/pages/ChatPage.tsx
+++ b/AgentCompany-New/src/renderer/src/pages/ChatPage.tsx
@@ -224,6 +224,13 @@ export function ChatPage({ snapshot, actions }: PageProps) {
actorId: employee.id,
}));
+ const attachFile = () => {
+ void window.agentCompany.importFile({ orgId }).then((result) => {
+ if (!result.ok) throw new Error(result.error.message);
+ if (result.data) setAttachmentFileId(result.data);
+ });
+ };
+
return (
decideApproval(approvalId, "approved")}
onDecline={(approvalId) => decideApproval(approvalId, "declined")}
diff --git a/AgentCompany-New/src/renderer/src/pages/FilesPage.tsx b/AgentCompany-New/src/renderer/src/pages/FilesPage.tsx
index 3c2ded6c..576a4bf2 100644
--- a/AgentCompany-New/src/renderer/src/pages/FilesPage.tsx
+++ b/AgentCompany-New/src/renderer/src/pages/FilesPage.tsx
@@ -35,6 +35,12 @@ export function FilesPage({ snapshot, actions }: PageProps) {
const pinnedFiles = files.filter((file) => file.pinned);
const totalBytes = visibleFiles.reduce((sum, file) => sum + file.sizeBytes, 0);
+ const upload = () => {
+ void window.agentCompany.importFile({ orgId }).then((result) => {
+ if (!result.ok) throw new Error(result.error.message);
+ });
+ };
+
return (
-