handleDownload({ fileName, content })}
+ handleDownload={() => mutate(undefined)}
/>
@@ -56,7 +59,7 @@ export default function FileCard({
return (
handleDownload({ fileName, content })}
+ onClick={() => mutate(undefined)}
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
>
@@ -69,7 +72,7 @@ export default function FileCard({
handleDownload({ fileName, content })}
+ handleDownload={() => mutate(undefined)}
/>
);
diff --git a/src/frontend/src/modals/IOModal/components/chatView/fileComponent/utils/handle-download.tsx b/src/frontend/src/modals/IOModal/components/chatView/fileComponent/utils/handle-download.tsx
deleted file mode 100644
index 53a9cf7705f..00000000000
--- a/src/frontend/src/modals/IOModal/components/chatView/fileComponent/utils/handle-download.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-import {
- BACKEND_URL,
- BASE_URL_API,
-} from "../../../../../../constants/constants";
-
-let isDownloading = false;
-
-export default async function handleDownload({
- fileName,
- content,
-}: {
- fileName: string;
- content: string;
-}): Promise {
- if (isDownloading) return;
-
- try {
- isDownloading = true;
-
- const response = await fetch(`${BASE_URL_API}files/download/${content}`);
- if (!response.ok) {
- throw new Error("Network response was not ok");
- }
-
- const blob = await response.blob();
- const url = URL.createObjectURL(blob);
-
- const link = document.createElement("a");
- link.href = url;
- link.setAttribute("download", fileName); // Set the filename
- document.body.appendChild(link);
- link.click();
- document.body.removeChild(link);
-
- URL.revokeObjectURL(url); // Clean up the URL object
- } catch (error) {
- console.error("Failed to download file:", error);
- } finally {
- isDownloading = false;
- }
-}
diff --git a/src/frontend/src/modals/IOModal/components/chatView/index.tsx b/src/frontend/src/modals/IOModal/components/chatView/index.tsx
index 5e0b2d4fd3d..fd6bb270a97 100644
--- a/src/frontend/src/modals/IOModal/components/chatView/index.tsx
+++ b/src/frontend/src/modals/IOModal/components/chatView/index.tsx
@@ -80,7 +80,6 @@ export default function ChatView({
const is_ai =
sender === "Machine" || sender === null || sender === undefined;
-
return {
isSend: !is_ai,
message,
diff --git a/src/frontend/src/types/components/index.ts b/src/frontend/src/types/components/index.ts
index 632b24d1bfc..ddd5a2a48e9 100644
--- a/src/frontend/src/types/components/index.ts
+++ b/src/frontend/src/types/components/index.ts
@@ -617,7 +617,7 @@ export interface Props {
export type fileCardPropsType = {
fileName: string;
- content: string;
+ path: string;
fileType: string;
showFile?: boolean;
};