mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-19 03:56:42 +08:00
### What problem does this PR solve? Fix: Remove the file size and quantity restrictions of the upload control #9613 #9598 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -85,7 +85,7 @@ function Root({ children }: React.PropsWithChildren) {
|
|||||||
<Sonner position={'top-right'} expand richColors closeButton></Sonner>
|
<Sonner position={'top-right'} expand richColors closeButton></Sonner>
|
||||||
<Toaster />
|
<Toaster />
|
||||||
</ConfigProvider>
|
</ConfigProvider>
|
||||||
<ReactQueryDevtools buttonPosition={'top-left'} />
|
<ReactQueryDevtools buttonPosition={'top-left'} initialIsOpen={false} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,12 +26,7 @@ export function UploaderTabs({ setFiles }: UploaderTabsProps) {
|
|||||||
<TabsTrigger value="password">{t('fileManager.s3')}</TabsTrigger>
|
<TabsTrigger value="password">{t('fileManager.s3')}</TabsTrigger>
|
||||||
</TabsList>
|
</TabsList>
|
||||||
<TabsContent value="account">
|
<TabsContent value="account">
|
||||||
<FileUploader
|
<FileUploader onValueChange={setFiles} accept={{ '*': [] }} />
|
||||||
maxFileCount={8}
|
|
||||||
maxSize={8 * 1024 * 1024}
|
|
||||||
onValueChange={setFiles}
|
|
||||||
accept={{ '*': [] }}
|
|
||||||
/>
|
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
<TabsContent value="password">{t('common.comingSoon')}</TabsContent>
|
<TabsContent value="password">{t('common.comingSoon')}</TabsContent>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import { Progress } from '@/components/ui/progress';
|
|||||||
import { ScrollArea } from '@/components/ui/scroll-area';
|
import { ScrollArea } from '@/components/ui/scroll-area';
|
||||||
import { useControllableState } from '@/hooks/use-controllable-state';
|
import { useControllableState } from '@/hooks/use-controllable-state';
|
||||||
import { cn, formatBytes } from '@/lib/utils';
|
import { cn, formatBytes } from '@/lib/utils';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
function isFileWithPreview(file: File): file is File & { preview: string } {
|
function isFileWithPreview(file: File): file is File & { preview: string } {
|
||||||
return 'preview' in file && typeof file.preview === 'string';
|
return 'preview' in file && typeof file.preview === 'string';
|
||||||
@ -168,14 +169,14 @@ export function FileUploader(props: FileUploaderProps) {
|
|||||||
accept = {
|
accept = {
|
||||||
'image/*': [],
|
'image/*': [],
|
||||||
},
|
},
|
||||||
maxSize = 1024 * 1024 * 2,
|
maxSize = 1024 * 1024 * 10000000,
|
||||||
maxFileCount = 1,
|
maxFileCount = 100000000000,
|
||||||
multiple = false,
|
multiple = false,
|
||||||
disabled = false,
|
disabled = false,
|
||||||
className,
|
className,
|
||||||
...dropzoneProps
|
...dropzoneProps
|
||||||
} = props;
|
} = props;
|
||||||
|
const { t } = useTranslation();
|
||||||
const [files, setFiles] = useControllableState({
|
const [files, setFiles] = useControllableState({
|
||||||
prop: valueProp,
|
prop: valueProp,
|
||||||
onChange: onValueChange,
|
onChange: onValueChange,
|
||||||
@ -267,7 +268,7 @@ export function FileUploader(props: FileUploaderProps) {
|
|||||||
<div
|
<div
|
||||||
{...getRootProps()}
|
{...getRootProps()}
|
||||||
className={cn(
|
className={cn(
|
||||||
'group relative grid h-52 w-full cursor-pointer place-items-center rounded-lg border-2 border-dashed border-muted-foreground/25 px-5 py-2.5 text-center transition hover:bg-muted/25',
|
'group relative grid h-72 w-full cursor-pointer place-items-center rounded-lg border-2 border-dashed border-muted-foreground/25 px-5 py-2.5 text-center transition hover:bg-muted/25',
|
||||||
'ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
'ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
||||||
isDragActive && 'border-muted-foreground/50',
|
isDragActive && 'border-muted-foreground/50',
|
||||||
isDisabled && 'pointer-events-none opacity-60',
|
isDisabled && 'pointer-events-none opacity-60',
|
||||||
@ -298,14 +299,15 @@ export function FileUploader(props: FileUploaderProps) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col gap-px">
|
<div className="flex flex-col gap-px">
|
||||||
<p className="font-medium text-muted-foreground">
|
<p className="font-medium text-muted-foreground">
|
||||||
Drag {`'n'`} drop files here, or click to select files
|
{t('knowledgeDetails.uploadTitle')}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-sm text-muted-foreground/70">
|
<p className="text-sm text-muted-foreground/70">
|
||||||
You can upload
|
{t('knowledgeDetails.uploadDescription')}
|
||||||
|
{/* You can upload
|
||||||
{maxFileCount > 1
|
{maxFileCount > 1
|
||||||
? ` ${maxFileCount === Infinity ? 'multiple' : maxFileCount}
|
? ` ${maxFileCount === Infinity ? 'multiple' : maxFileCount}
|
||||||
files (up to ${formatBytes(maxSize)} each)`
|
files (up to ${formatBytes(maxSize)} each)`
|
||||||
: ` a file with ${formatBytes(maxSize)}`}
|
: ` a file with ${formatBytes(maxSize)}`} */}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -63,7 +63,6 @@ export function UploadAgentForm({ hideModal, onOk }: IModalProps<any>) {
|
|||||||
value={field.value}
|
value={field.value}
|
||||||
onValueChange={field.onChange}
|
onValueChange={field.onChange}
|
||||||
maxFileCount={1}
|
maxFileCount={1}
|
||||||
maxSize={4 * 1024 * 1024}
|
|
||||||
accept={{ '*.json': [FileMimeType.Json] }}
|
accept={{ '*.json': [FileMimeType.Json] }}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|||||||
@ -35,7 +35,6 @@ export default function ChatBasicSetting() {
|
|||||||
value={field.value}
|
value={field.value}
|
||||||
onValueChange={field.onChange}
|
onValueChange={field.onChange}
|
||||||
maxFileCount={1}
|
maxFileCount={1}
|
||||||
maxSize={4 * 1024 * 1024}
|
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|||||||
@ -59,8 +59,6 @@ export function ImportMcpForm({ hideModal, onOk }: IModalProps<any>) {
|
|||||||
<FileUploader
|
<FileUploader
|
||||||
value={field.value}
|
value={field.value}
|
||||||
onValueChange={field.onChange}
|
onValueChange={field.onChange}
|
||||||
maxFileCount={1}
|
|
||||||
maxSize={4 * 1024 * 1024}
|
|
||||||
accept={{ '*.json': [FileMimeType.Json] }}
|
accept={{ '*.json': [FileMimeType.Json] }}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|||||||
Reference in New Issue
Block a user