mirror of
https://github.com/open-webui/open-webui
synced 2025-05-22 13:54:20 +00:00
enh: apply file size limit to knowledge
This commit is contained in:
parent
f806ab0bd2
commit
c69d1c86fe
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import { mobile, showSidebar, knowledge as _knowledge } from '$lib/stores';
|
import { mobile, showSidebar, knowledge as _knowledge, config } from '$lib/stores';
|
||||||
|
|
||||||
import { updateFileDataContentById, uploadFile, deleteFileById } from '$lib/apis/files';
|
import { updateFileDataContentById, uploadFile, deleteFileById } from '$lib/apis/files';
|
||||||
import {
|
import {
|
||||||
@ -131,6 +131,22 @@
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
($config?.file?.max_size ?? null) !== null &&
|
||||||
|
file.size > ($config?.file?.max_size ?? 0) * 1024 * 1024
|
||||||
|
) {
|
||||||
|
console.log('File exceeds max size limit:', {
|
||||||
|
fileSize: file.size,
|
||||||
|
maxSize: ($config?.file?.max_size ?? 0) * 1024 * 1024
|
||||||
|
});
|
||||||
|
toast.error(
|
||||||
|
$i18n.t(`File size should not exceed {{maxSize}} MB.`, {
|
||||||
|
maxSize: $config?.file?.max_size
|
||||||
|
})
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
knowledge.files = [...(knowledge.files ?? []), fileItem];
|
knowledge.files = [...(knowledge.files ?? []), fileItem];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user