发布 v1.10 #5

Merged
czm merged 147 commits from develop into main 2026-08-20 11:36:27 +08:00
3 changed files with 18 additions and 3 deletions
Showing only changes of commit fceedd02cd - Show all commits

View File

@@ -4,6 +4,7 @@ import type { UploadProps } from 'element-plus';
import { ref } from 'vue';
import { useAppConfig } from '@easyflow/hooks';
import { $t } from '@easyflow/locales';
import { useAccessStore } from '@easyflow/stores';
import { UploadFilled } from '@element-plus/icons-vue';
@@ -26,6 +27,8 @@ const props = defineProps({
});
const emit = defineEmits(['success', 'error', 'onChange']);
const MAX_FILE_SIZE_BYTES = 100 * 1024 * 1024;
const ACCEPTED_FILE_TYPES = '.txt,.pdf,.docx,.md,.pptx,.xlsx';
const accessStore = useAccessStore();
const headers = ref({
'easyflow-token': accessStore.accessToken,
@@ -51,6 +54,14 @@ const handleError: UploadProps['onError'] = (error) => {
emit('error', normalizedError);
};
const beforeUpload: UploadProps['beforeUpload'] = (rawFile) => {
if (rawFile.size <= MAX_FILE_SIZE_BYTES) {
return true;
}
ElMessage.warning($t('message.upload.fileTooLarge'));
return false;
};
// 文件状态变化回调
const handleChange: UploadProps['onChange'] = (file, fileList) => {
emit('onChange', file, fileList);
@@ -86,6 +97,8 @@ defineExpose({
drag
:headers="headers"
:action="`${apiURL}${props.action}`"
:accept="ACCEPTED_FILE_TYPES"
:before-upload="beforeUpload"
:on-success="handleSuccess"
:on-error="handleError"
:on-change="handleChange"
@@ -97,7 +110,7 @@ defineExpose({
</ElIcon>
<div class="flex flex-col gap-1">
<span class="text-base">{{ $t('message.upload.title') }}</span>
<span class="text-sm text-[#75808d]">{{
<span class="text-muted-foreground text-sm">{{
$t('message.upload.description')
}}</span>
</div>

View File

@@ -27,7 +27,8 @@
"copyFail": "Copy fail",
"upload": {
"title": "Click or drag and drop files here to upload",
"description": "TXT, PDF, DOCX, MD, PPT, PPTX files are supported. Each upload allows one file only, with a maximum size of 20M per file."
"description": "TXT, PDF, DOCX, MD, PPTX, and XLSX files are supported, up to 100 MB each.",
"fileTooLarge": "Each file must not exceed 100 MB"
},
"uploadFileFirst": "Please upload the file first",
"deleteModelAlert": "This operation will delete the large model. Are you sure to delete it?",

View File

@@ -27,7 +27,8 @@
"copyFail": "复制失败",
"upload": {
"title": "点击或将文件拖拽到这里上传",
"description": "TXT, PDF, DOCX, MD, PPT, PPTX 格式文件,单个大小不超过20M。"
"description": "支持 TXTPDFDOCX、MD、PPTX、XLSX,单个文件不超过 100 MB。",
"fileTooLarge": "单个文件大小不能超过 100 MB"
},
"uploadFileFirst": "请先上传文件",
"deleteModelAlert": "该操作会删除大模型,确定删除吗?",