Skip to content

Commit

Permalink
Merge branch 'feat/support-file-download-in-workflow' into deploy/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
JzoNgKVO committed Dec 5, 2024
2 parents 9269ee5 + ab8df37 commit 8409ed2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
21 changes: 14 additions & 7 deletions web/app/components/app/text-generate/item/result-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ 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 FileListInLog from '@/app/components/base/file-uploader/file-list-in-log'
import { FileList } from '@/app/components/base/file-uploader'

const ResultTab = ({
data,
Expand Down Expand Up @@ -58,12 +58,19 @@ const ResultTab = ({
<>
{data?.resultText && <Markdown content={data?.resultText || ''} />}
{!!data?.files?.length && (
<FileListInLog
noBorder
noPadding
isExpanded
fileList={data.files as any[]}
/>
<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>
)}
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const FileItem = ({
onRemove,
onReUpload,
}: FileItemProps) => {
const { id, name, type, progress, url, isRemote } = file
const { id, name, type, progress, url, base64Url, isRemote } = file
const ext = getFileExtension(name, type, isRemote)
const uploadError = progress === -1

Expand Down Expand Up @@ -86,7 +86,7 @@ const FileItem = ({
className='hidden group-hover/file-item:flex absolute -right-1 -top-1'
onClick={(e) => {
e.stopPropagation()
downloadFile(url || '', name)
downloadFile(url || base64Url || '', name)
}}
>
<RiDownloadLine className='w-3.5 h-3.5 text-text-tertiary' />
Expand Down
20 changes: 12 additions & 8 deletions web/app/components/workflow/run/result-text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ImageIndentLeft } from '@/app/components/base/icons/src/vender/line/edi
import { Markdown } from '@/app/components/base/markdown'
import LoadingAnim from '@/app/components/base/chat/chat/loading-anim'
import StatusContainer from '@/app/components/workflow/run/status-container'
import FileListInLog from '@/app/components/base/file-uploader/file-list-in-log'
import { FileList } from '@/app/components/base/file-uploader'

type ResultTextProps = {
isRunning?: boolean
Expand Down Expand Up @@ -55,13 +55,17 @@ const ResultText: FC<ResultTextProps> = ({
<Markdown content={outputs} />
</div>
)}
{!!allFiles?.length && (
<FileListInLog
noBorder
isExpanded
fileList={allFiles}
/>
)}
{!!allFiles?.length && allFiles.map(item => (
<div key={item.varName} className='px-4 py-2 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>
Expand Down

0 comments on commit 8409ed2

Please sign in to comment.