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