feat: 将工作流与 FAQ 上传上限扩至 20MB

- 同步管理端、用户中心与后端工作流文件校验

- 扩展 FAQ 普通及分享上传限制并补充边界测试
This commit is contained in:
2026-07-30 17:39:13 +08:00
parent 2abff304ed
commit 100d744c25
12 changed files with 93 additions and 16 deletions

View File

@@ -179,7 +179,7 @@
"answerRequired": "Answer is required",
"collectionRequired": "Collection id is required",
"imageTypeInvalid": "Only JPG/PNG/WEBP/GIF images are supported",
"imageSizeExceeded": "Image size must be less than 5MB",
"imageSizeExceeded": "Image size must be less than 20MB",
"imageUploadFailed": "Image upload failed",
"import": {
"title": "Import FAQ",

View File

@@ -179,7 +179,7 @@
"answerRequired": "答案不能为空",
"collectionRequired": "知识库ID不能为空",
"imageTypeInvalid": "仅支持 JPG/PNG/WEBP/GIF 图片",
"imageSizeExceeded": "图片大小不能超过5MB",
"imageSizeExceeded": "图片大小不能超过20MB",
"imageUploadFailed": "图片上传失败",
"import": {
"title": "导入FAQ",

View File

@@ -45,7 +45,7 @@ const props = defineProps({
});
const emit = defineEmits(['submit', 'update:modelValue']);
const MAX_IMAGE_SIZE = 5 * 1024 * 1024;
const MAX_IMAGE_SIZE = 20 * 1024 * 1024;
const ALLOWED_IMAGE_TYPES = new Set([
'image/gif',
'image/jpeg',

View File

@@ -127,11 +127,21 @@ describe('workflowFileValue', () => {
});
it('上传前校验单文件大小限制', () => {
const oversizedFile = new File([new Uint8Array(6 * 1024 * 1024)], 'large.pdf');
const acceptedFile = new File(
[new Uint8Array(20 * 1024 * 1024)],
'accepted.pdf',
);
const oversizedFile = new File(
[new Uint8Array(20 * 1024 * 1024 + 1)],
'large.pdf',
);
expect(() =>
validateWorkflowFileSelection([], [oversizedFile]),
).toThrow('单个文件不能超过 5.0 MB');
validateWorkflowFileSelection([], [acceptedFile]),
).not.toThrow();
expect(() => validateWorkflowFileSelection([], [oversizedFile])).toThrow(
'单个文件不能超过 20.0 MB',
);
});
it('上传前校验总大小限制', () => {

View File

@@ -21,7 +21,7 @@ export interface WorkflowResourceLike {
export const WORKFLOW_FILE_LIMITS = {
maxCount: 10,
maxSingleSize: 5 * 1024 * 1024,
maxSingleSize: 20 * 1024 * 1024,
maxTotalSize: 50 * 1024 * 1024,
} as const;