mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-16 18:15:55 +08:00
image download
This commit is contained in:
parent
2a6d9c3211
commit
b491c93b1c
@ -6,6 +6,7 @@ type FileImageRenderProps = {
|
||||
alt?: string
|
||||
onLoad?: () => void
|
||||
onError?: () => void
|
||||
showDownloadAction?: boolean
|
||||
}
|
||||
const FileImageRender = ({
|
||||
imageUrl,
|
||||
@ -13,15 +14,17 @@ const FileImageRender = ({
|
||||
alt,
|
||||
onLoad,
|
||||
onError,
|
||||
showDownloadAction,
|
||||
}: FileImageRenderProps) => {
|
||||
return (
|
||||
<div className={cn('border-[2px] border-effects-image-frame shadow-xs', className)}>
|
||||
<img
|
||||
className='w-full h-full object-cover'
|
||||
className={cn('w-full h-full object-cover', showDownloadAction && 'cursor-pointer')}
|
||||
alt={alt}
|
||||
onLoad={onLoad}
|
||||
onError={onError}
|
||||
src={imageUrl}
|
||||
onClick={() => showDownloadAction && window.open(imageUrl, '_blank')}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
@ -8,12 +8,14 @@ import { ReplayLine } from '@/app/components/base/icons/src/vender/other'
|
||||
type FileImageItemProps = {
|
||||
file: FileEntity
|
||||
showDeleteAction?: boolean
|
||||
showDownloadAction?: boolean
|
||||
onRemove?: (fileId: string) => void
|
||||
onReUpload?: (fileId: string) => void
|
||||
}
|
||||
const FileImageItem = ({
|
||||
file,
|
||||
showDeleteAction,
|
||||
showDownloadAction,
|
||||
onRemove,
|
||||
onReUpload,
|
||||
}: FileImageItemProps) => {
|
||||
@ -34,6 +36,7 @@ const FileImageItem = ({
|
||||
<FileImageRender
|
||||
className='w-[68px] h-[68px] shadow-md'
|
||||
imageUrl={base64Url || url || ''}
|
||||
showDownloadAction={showDownloadAction}
|
||||
/>
|
||||
{
|
||||
progress > 0 && progress < 100 && (
|
||||
|
@ -33,6 +33,7 @@ export const FileList = ({
|
||||
key={file.id}
|
||||
file={file}
|
||||
showDeleteAction={showDeleteAction}
|
||||
showDownloadAction={showDownloadAction}
|
||||
onRemove={onRemove}
|
||||
onReUpload={onReUpload}
|
||||
/>
|
||||
|
@ -14,7 +14,10 @@ import type {
|
||||
Inputs,
|
||||
} from '@/app/components/base/chat/types'
|
||||
import type { InputForm } from '@/app/components/base/chat/chat/type'
|
||||
import { processOpeningStatement } from '@/app/components/base/chat/chat/utils'
|
||||
import {
|
||||
getProcessedInputs,
|
||||
processOpeningStatement,
|
||||
} from '@/app/components/base/chat/chat/utils'
|
||||
import { useToastContext } from '@/app/components/base/toast'
|
||||
import { TransferMethod } from '@/types/app'
|
||||
import {
|
||||
@ -191,9 +194,10 @@ export const useChat = (
|
||||
|
||||
handleResponding(true)
|
||||
|
||||
const { files, ...restParams } = params
|
||||
const { files, inputs, ...restParams } = params
|
||||
const bodyParams = {
|
||||
files: getProcessedFiles(files || []),
|
||||
inputs: getProcessedInputs(inputs || {}, formSettings?.inputsForm || []),
|
||||
...restParams,
|
||||
}
|
||||
if (bodyParams?.files?.length) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user