You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
import {
|
|
memo,
|
|
} from 'react'
|
|
import { Markdown } from '@/app/components/base/markdown'
|
|
import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor'
|
|
import { CodeLanguage } from '@/app/components/workflow/nodes/code/types'
|
|
import type { WorkflowProcess } from '@/app/components/base/chat/types'
|
|
import { FileList } from '@/app/components/base/file-uploader'
|
|
|
|
const ResultTab = ({
|
|
data,
|
|
content,
|
|
currentTab,
|
|
}: {
|
|
data?: WorkflowProcess
|
|
content: any
|
|
currentTab: string
|
|
}) => {
|
|
return (
|
|
<>
|
|
{currentTab === 'RESULT' && (
|
|
<div className='p-4 space-y-3'>
|
|
{data?.resultText && <Markdown content={data?.resultText || ''} />}
|
|
{!!data?.files?.length && (
|
|
<div className='flex flex-col gap-2'>
|
|
{data?.files.map((item: any) => (
|
|
<div key={item.varName} className='flex flex-col gap-1 system-xs-regular'>
|
|
<div className='py-1 text-text-tertiary '>{item.varName}</div>
|
|
<FileList
|
|
files={item.list}
|
|
showDeleteAction={false}
|
|
showDownloadAction
|
|
canPreview
|
|
/>
|
|
</div>
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
)}
|
|
{currentTab === 'DETAIL' && content && (
|
|
<div className='p-4'>
|
|
<CodeEditor
|
|
readOnly
|
|
title={<div>JSON OUTPUT</div>}
|
|
language={CodeLanguage.json}
|
|
value={content}
|
|
isJSONStringifyBeauty
|
|
/>
|
|
</div>
|
|
)}
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default memo(ResultTab)
|