mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-17 23:35:52 +08:00
fix: file size
This commit is contained in:
parent
6fdcf6ee21
commit
0ab525a691
@ -158,6 +158,7 @@ const Answer: FC<AnswerProps> = ({
|
||||
{
|
||||
allFiles?.length && (
|
||||
<FileList
|
||||
className='my-1'
|
||||
files={allFiles}
|
||||
showDeleteAction={false}
|
||||
showDownloadAction
|
||||
|
@ -5,8 +5,10 @@ import FileImageItem from './file-image-item'
|
||||
import FileItem from './file-item'
|
||||
import type { FileUpload } from '@/app/components/base/features/types'
|
||||
import { SupportUploadFileTypes } from '@/app/components/workflow/types'
|
||||
import cn from '@/utils/classnames'
|
||||
|
||||
type FileListProps = {
|
||||
className?: string
|
||||
files: FileEntity[]
|
||||
onRemove?: (fileId: string) => void
|
||||
onReUpload?: (fileId: string) => void
|
||||
@ -14,6 +16,7 @@ type FileListProps = {
|
||||
showDownloadAction?: boolean
|
||||
}
|
||||
export const FileList = ({
|
||||
className,
|
||||
files,
|
||||
onReUpload,
|
||||
onRemove,
|
||||
@ -21,7 +24,7 @@ export const FileList = ({
|
||||
showDownloadAction = false,
|
||||
}: FileListProps) => {
|
||||
return (
|
||||
<div className='flex flex-wrap gap-2'>
|
||||
<div className={cn('flex flex-wrap gap-2', className)}>
|
||||
{
|
||||
files.map((file) => {
|
||||
if (file.supportFileType === SupportUploadFileTypes.image) {
|
||||
|
@ -122,7 +122,7 @@ export const getProcessedFilesFromResponse = (files: FileResponse[]) => {
|
||||
return {
|
||||
id: fileItem.related_id,
|
||||
name: fileItem.filename,
|
||||
size: 0,
|
||||
size: fileItem.size || 0,
|
||||
type: fileItem.mime_type,
|
||||
progress: 100,
|
||||
transferMethod: fileItem.transfer_method,
|
||||
|
@ -22,7 +22,7 @@ const ProgressCircle: React.FC<ProgressCircleProps> = ({
|
||||
}) => {
|
||||
const radius = size / 2
|
||||
const center = size / 2
|
||||
const angle = (percentage / 100) * 360
|
||||
const angle = (percentage / 101) * 360
|
||||
const radians = (angle * Math.PI) / 180
|
||||
const x = center + radius * Math.cos(radians - Math.PI / 2)
|
||||
const y = center + radius * Math.sin(radians - Math.PI / 2)
|
||||
|
@ -133,6 +133,7 @@ export type FileResponse = {
|
||||
related_id: string
|
||||
extension: string
|
||||
filename: string
|
||||
size: number
|
||||
mime_type: string
|
||||
transfer_method: TransferMethod
|
||||
type: string
|
||||
|
Loading…
x
Reference in New Issue
Block a user