diff --git a/src/components/run/RunContent.tsx b/src/components/run/RunContent.tsx index 2cc1bb86..3a676a00 100644 --- a/src/components/run/RunContent.tsx +++ b/src/components/run/RunContent.tsx @@ -37,6 +37,7 @@ interface RunContentProps { export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRef, abortRunHandler }: RunContentProps) => { const { t } = useTranslation(); const [tab, setTab] = React.useState('output'); + const [markdownContent, setMarkdownContent] = useState(''); const [schemaData, setSchemaData] = useState([]); const [schemaColumns, setSchemaColumns] = useState([]); @@ -63,6 +64,15 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe setTab(tab); }, [interpretationInProgress]); + useEffect(() => { + if (row.serializableOutput?.markdown && Array.isArray(row.serializableOutput.markdown)) { + const markdownData = row.serializableOutput.markdown[0]; + if (markdownData && markdownData.content) { + setMarkdownContent(markdownData.content); + } + } + }, [row.serializableOutput]); + useEffect(() => { if (row.status === 'running' || row.status === 'queued' || row.status === 'scheduled') { setSchemaData([]); @@ -374,6 +384,22 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe }, 100); }; + const downloadMarkdown = (content: string, filename: string) => { + const blob = new Blob([content], { type: 'text/markdown;charset=utf-8;' }); + const url = URL.createObjectURL(blob); + + const link = document.createElement("a"); + link.href = url; + link.setAttribute("download", filename); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + + setTimeout(() => { + URL.revokeObjectURL(url); + }, 100); + }; + const renderDataTable = ( data: any[], @@ -636,11 +662,70 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe const hasData = schemaData.length > 0 || listData.length > 0 || legacyData.length > 0; const hasScreenshots = row.binaryOutput && Object.keys(row.binaryOutput).length > 0; + const hasMarkdown = markdownContent.length > 0; return ( + {hasMarkdown ? ( + + + }> + + + Markdown Output + + + + + theme.palette.mode === 'dark' ? '#1e1e1e' : '#f5f5f5' + }} + > + + {markdownContent} + + + + + + + + + + + ) : ( + // Traditional robot output + <> {row.status === 'running' || row.status === 'queued' ? ( <> @@ -939,6 +1024,8 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe )} + + )}