diff --git a/apps/web-remix/app/components/pages/pipelines/Nodes/CustomNodes/FileOutput.tsx b/apps/web-remix/app/components/pages/pipelines/Nodes/CustomNodes/FileOutput.tsx index f09e09e0..afb892db 100644 --- a/apps/web-remix/app/components/pages/pipelines/Nodes/CustomNodes/FileOutput.tsx +++ b/apps/web-remix/app/components/pages/pipelines/Nodes/CustomNodes/FileOutput.tsx @@ -3,7 +3,10 @@ import { Download } from 'lucide-react'; import { ItemList } from '~/components/list/ItemList'; interface FileOutputProps { - files: Blob[]; + files: { + content: Blob; + name: string; + }[]; } export const FileOutput: React.FC = ({ files }) => { @@ -11,14 +14,14 @@ export const FileOutput: React.FC = ({ files }) => { ({ id: index, file }))} + items={files.map((file, index) => ({ id: index, file: file.content, name: file.name }))} renderItem={(file) => } /> ); }; interface FileOutputListItemProps { - file: { id: number; file: Blob }; + file: { id: number; file: Blob, name: string }; } export function FileOutputListItem({ file }: FileOutputListItemProps) { return ( @@ -29,21 +32,21 @@ export function FileOutputListItem({ file }: FileOutputListItemProps) {
- {'foo file name'} + {file.name}
- + ); } -function DownloadButton({ blob }: { blob: Blob }) { +function DownloadButton({ blob, name }: { blob: Blob, name: string }) { const downloadFile = () => { const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; - a.download = 'file.txt'; + a.download = name; document.body.appendChild(a); a.click(); document.body.removeChild(a); diff --git a/apps/web-remix/app/components/pages/pipelines/Nodes/CustomNodes/NodeFieldsOutput.tsx b/apps/web-remix/app/components/pages/pipelines/Nodes/CustomNodes/NodeFieldsOutput.tsx index afa4dfd6..f0897ac7 100644 --- a/apps/web-remix/app/components/pages/pipelines/Nodes/CustomNodes/NodeFieldsOutput.tsx +++ b/apps/web-remix/app/components/pages/pipelines/Nodes/CustomNodes/NodeFieldsOutput.tsx @@ -99,7 +99,10 @@ function checkIfStringPayloads(events: IEvent[]) { // } function getFileOutput(event: IEvent) { - return new Blob([event.payload], { type: 'file' }); + return { + content: new Blob([event.payload], { type: event.metadata.file_type }), + name: event.metadata.file_name, + }; } interface TextOutputProps { diff --git a/apps/web-remix/app/components/pages/pipelines/RunPipelineProvider.tsx b/apps/web-remix/app/components/pages/pipelines/RunPipelineProvider.tsx index 839ea3cc..4091a8f6 100644 --- a/apps/web-remix/app/components/pages/pipelines/RunPipelineProvider.tsx +++ b/apps/web-remix/app/components/pages/pipelines/RunPipelineProvider.tsx @@ -20,6 +20,7 @@ export interface IEvent { block: string; output: string; payload: any; + metadata: any; } interface IRunPipelineContext { events: IEvent[]; @@ -65,8 +66,7 @@ export const RunPipelineProvider: React.FC = ({ ); const onMessage = useCallback( - (block: string, output: string, payload: any) => - setEvents((events) => [...events, { block, output, payload }]), + (block: string, output: string, payload: any, metadata: any) => setEvents((events) => [...events, { block, output, payload, metadata }]), [], );