From 489371dcba3a7a9d9b1542c851bc08bdc4c3f38b Mon Sep 17 00:00:00 2001 From: Ethan-Zhang Date: Fri, 17 Oct 2025 17:47:51 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=E5=88=86=E9=A1=B5=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E9=87=8D=E5=8F=A0=E9=97=AE=E9=A2=98&=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E9=99=90=E5=88=B6=E9=97=AE=E9=A2=98&?= =?UTF-8?q?=E5=88=86=E6=AE=B5=E5=86=85=E5=AE=B9=E6=88=AA=E6=96=AD=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=B8=8E=E5=AD=97=E6=95=B0=E9=99=90=E5=88=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/KnowledgeForm/index.vue | 36 ++------ src/components/Upload/index.vue | 23 +++++- src/lang/package/en.ts | 4 +- src/lang/package/zh-cn.ts | 4 +- src/styles/knowledgeFileSection.scss | 44 +++++----- src/views/knowledgeFile/index.vue | 30 ++++++- src/views/knowledgeFileSection/index.vue | 101 ++++++++++++----------- 7 files changed, 132 insertions(+), 110 deletions(-) diff --git a/src/components/KnowledgeForm/index.vue b/src/components/KnowledgeForm/index.vue index c4f67de..88d2e2e 100644 --- a/src/components/KnowledgeForm/index.vue +++ b/src/components/KnowledgeForm/index.vue @@ -186,21 +186,13 @@ - - - - + prop="rerankerModel"> + :suffix-icon="IconCaretDown"> ({ embeddingModel: '', tokenizer: '', // 检索设置 - enableReranker: true, // 默认开启 rerankerModel: '', // 其他 docTypes: [], @@ -406,7 +396,6 @@ onMounted(async () => { uploadCountLimit: props.formData?.uploadCountLimit || 128, chunkMethod: props.formData?.chunkMethod || 'semantic', chunkIdentifier: props.formData?.chunkIdentifier || '\\n\\n', - enableReranker: props.formData?.enableReranker || false, rerankerModel: props.formData?.rerankerModel || '', } as RuleForm) ) @@ -447,8 +436,10 @@ onMounted(async () => { ruleForm.value.embeddingModel = emBeddingModelOptions.value?.[0].value || ''; ruleForm.value.defaultParseMethod = parserMethodOptions.value?.[0].value || ''; // 默认选择jaccard dis reranker - const defaultReranker = rerankerOptions.value?.find(item => item.name === 'jaccard dis reranker'); - ruleForm.value.rerankerModel = defaultReranker?.value || rerankerOptions.value?.[0]?.value || ''; + if (!ruleForm.value.rerankerModel) { + const defaultReranker = rerankerOptions.value?.find(item => item.name === 'jaccard dis reranker'); + ruleForm.value.rerankerModel = defaultReranker?.value || rerankerOptions.value?.[0]?.value || ''; + } } }); @@ -519,19 +510,6 @@ const handleSectionClick = (sectionKey: string) => { activeSection.value = sectionKey; }; -const handleRerankerToggle = (value: string | number | boolean) => { - const boolValue = Boolean(value); - if (!boolValue) { - // 关闭Reranker时,清空相关设置 - ruleForm.value.rerankerModel = ''; - } else { - // 开启Reranker时,设置默认值 - if (!ruleForm.value.rerankerModel) { - const defaultReranker = rerankerOptions.value?.find(item => item.name === 'jaccard dis reranker'); - ruleForm.value.rerankerModel = defaultReranker?.value || rerankerOptions.value?.[0]?.value || ''; - } - } -}; const rules = reactive>({ // 基本设置 @@ -630,7 +608,7 @@ const submitForm = async (formEl: FormInstance | undefined) => { embeddingModel: ruleForm.value.embeddingModel, tokenizer: ruleForm.value?.tokenizer?.toLocaleLowerCase(), // 检索设置 - enableReranker: ruleForm.value.enableReranker, + enableReranker: true, // 固定为true,始终启用reranker rerankerModel: ruleForm.value.rerankerModel, enableCompression: false, // 固定为false,不再提供UI配置 enableDocumentCategory: false, // 固定为false,不再提供UI配置 diff --git a/src/components/Upload/index.vue b/src/components/Upload/index.vue index cc83f92..cad16a2 100644 --- a/src/components/Upload/index.vue +++ b/src/components/Upload/index.vue @@ -285,6 +285,25 @@ let maxFileSizesInfo = computed(() => { } }); +let singleFileSizeInfo = computed(() => { + if (props.singleFileSize <= 0) return '0MB'; + if (props.singleFileSize < 1) { + return (props.singleFileSize * 1024).toFixed(0) + 'MB'; + } else { + return props.singleFileSize + 'GB'; + } +}); + +// 专门用于错误提示的MB数值(不带单位) +let singleFileSizeMB = computed(() => { + if (props.singleFileSize <= 0) return 0; + if (props.singleFileSize < 1) { + return (props.singleFileSize * 1024).toFixed(0); + } else { + return (props.singleFileSize * 1024).toFixed(0); + } +}); + // 表格实例引用 const fileTableRef = ref(); const handleSelectionChange = (val: TableRow[]) => { @@ -433,7 +452,7 @@ const uploadFiles = () => { if (handleLimitSize(fileTableList.data)) { ElMessage({ showClose: true, - message: t('dialogTipText.singleFileSize'), + message: t('dialogTipText.singleFileSize', { size: singleFileSizeMB.value }), icon: IconError, customClass: 'o-message--error', duration: 3000, @@ -510,7 +529,7 @@ const uploadKnowledgeFile = () => { if (handleLimitSize(fileTableList.data)) { ElMessage({ showClose: true, - message: t('dialogTipText.singleFileSize'), + message: t('dialogTipText.singleFileSize', { size: singleFileSizeMB.value }), icon: IconError, customClass: 'o-message--error', duration: 3000, diff --git a/src/lang/package/en.ts b/src/lang/package/en.ts index 2f4b0fb..9fcc1d7 100644 --- a/src/lang/package/en.ts +++ b/src/lang/package/en.ts @@ -460,7 +460,7 @@ export default { fileZipFormat: 'The file must be in .zip format. A maximum of five asssets with a total size of 5 GB can be uploaded.', fileAllFormat: - 'The file can be in .xlsx,.pdf,.doc,.docx,.txt,.pptx,.html,.json,.yaml,.md,.jpeg,.png or .zip format. A maximum of 100 files with a total size of 500 MB can be uploaded.', + 'The file can be in .xlsx,.pdf,.doc,.docx,.txt,.pptx,.html,.json,.yaml,.md,.jpeg,.png or .zip format. A maximum of {maxFileNum} files with a total size of {maxSize} can be uploaded.', fileDataSetFormat: 'The file supports import in xlsx, yaml and json formats. Up to 10 files can be uploaded, and each file contains no more than 512 pieces of data.', continueAdd: 'You can drag files to the list area below to add more.', @@ -468,7 +468,7 @@ export default { dragFile: 'Drop files here.', fileName: 'File name', fileSize: 'Size', - singleFileSize: 'The size of a file cannot exceed 20 MB.', + singleFileSize: 'The size of a file cannot exceed {size}MB.', fileNums: 'File Number', fileSizes: 'File Size', confirmDelDataset: 'Are you sure to delete the selected dataset?', diff --git a/src/lang/package/zh-cn.ts b/src/lang/package/zh-cn.ts index c973339..739eb0e 100644 --- a/src/lang/package/zh-cn.ts +++ b/src/lang/package/zh-cn.ts @@ -468,7 +468,7 @@ export default { confirmCancelAnalytic: '确认取消解析?点击确认后将停止解析,请谨慎操作。', fileZipFormat: '文件支持.zip格式,最多支持上传5个资产库,资产库总大小不超过5GB', fileAllFormat: - '文件支持.xlsx,.pdf,.doc,.docx,.txt,.pptx,.html,.json,.yaml,.md,.zip,.jpeg,.png格式,最多支持上传128个文件,文件总大小不超过500MB', + '文件支持.xlsx,.pdf,.doc,.docx,.txt,.pptx,.html,.json,.yaml,.md,.zip,.jpeg,.png格式,最多支持上传{maxFileNum}个文件,文件总大小不超过{maxSize}', fileDataSetFormat: '文件支持xlsx、yaml和json格式导入,最多支持上传10个文件,每个文件包含的数据量不超过512条', continueAdd: '您仍可以通过拖拽文件到下方列表区域进行文件添加', @@ -476,7 +476,7 @@ export default { dragFile: '将文件拖到此处', fileName: '文件名', fileSize: '大小', - singleFileSize: '单个文件大小不能超过20MB', + singleFileSize: '单个文件大小不能超过{size}MB', fileNums: '文件数', fileSizes: '文件大小', confirmDelDataset: '确定删除选择的数据集吗?', diff --git a/src/styles/knowledgeFileSection.scss b/src/styles/knowledgeFileSection.scss index 4db58fc..747d58e 100644 --- a/src/styles/knowledgeFileSection.scss +++ b/src/styles/knowledgeFileSection.scss @@ -85,7 +85,6 @@ flex: 1; min-width: 700px; height: 100%;; - overflow: hidden; background: var(--o-bg-color-base); border-top-right-radius: 4px; border-bottom-right-radius: 4px; @@ -154,8 +153,16 @@ } } + .kf-section-container-content { + display: flex; + flex-direction: column; + height: calc(100% - 40px); + } + .kf-section-container-table-box { - height: 100%; + flex: 1; + overflow-y: auto; + margin-bottom: 8px; .el-scrollbar { padding-right: 24px; @@ -164,12 +171,14 @@ .el-table__body { width: unset !important; } + } - .el-pagination{ - position: absolute; - bottom: 24px; - - } + .kf-section-container-pagination { + flex-shrink: 0; + padding: 16px 0; + border-top: 1px solid var(--o-border-color-base); + background: var(--o-bg-color-base); + } .el-scrollbar .el-scrollbar__bar .el-scrollbar__thumb { background: rgb(195, 206, 223) !important; @@ -197,8 +206,8 @@ .el-table { width: 100%; - max-height: calc(100% - 96px) !important; - overflow-x: hidden !important; + height: 100%; + overflow: visible !important; } .showPagination { @@ -358,9 +367,10 @@ font-size: 12px; } - .el-pagination { - margin-top: 0; - margin-top: 24px !important; + .kf-section-container-pagination .el-pagination { + margin-bottom: 4px; + display: flex; + justify-content: center; } .el-pagination .el-input__inner { @@ -400,7 +410,6 @@ width: 100%; } } -} .kf-section-ops-dowlon { @@ -527,11 +536,6 @@ 0 -1px 0 0 inset #6395FD, -1px 0 0 0 inset #6395FD; } -.kf-section-container-table-box { - .el-table__body { - -webkit-border-vertical-spacing: 8px; // 垂直间距 - } -} .kf-section-container .kf-section-container-action .kf-section-container-right .el-table__body .kf-selection{ width: 40px !important; } @@ -571,7 +575,3 @@ } } } - -.fileSectionPage{ - inset: auto auto 84px 391px !important; -} \ No newline at end of file diff --git a/src/views/knowledgeFile/index.vue b/src/views/knowledgeFile/index.vue index d783159..a36431c 100644 --- a/src/views/knowledgeFile/index.vue +++ b/src/views/knowledgeFile/index.vue @@ -429,11 +429,11 @@ :title="$t('btnText.importFile')"> ({ const kbInfo = ref({}); const checkedFilterList = ref([]); const filterCategoryList = ref([]); + +// 动态计算Upload组件的限制参数 +const uploadLimits = computed(() => { + const countLimit = kbInfo.value?.uploadCountLimit || 100; + const sizeLimitMB = kbInfo.value?.uploadSizeLimit || 512; // MB + return { + maxFileNum: countLimit, + maxSize: sizeLimitMB / 1024, // 转换为GB:MB ÷ 1024 + singleFileSize: 256 / 1024, // 256MB转换为GB(保持单个文件限制为256MB) + }; +}); + +// 动态生成提示文本 +const dynamicTipText = computed(() => { + const countLimit = kbInfo.value?.uploadCountLimit || 100; + const sizeLimitMB = kbInfo.value?.uploadSizeLimit || 512; + const sizeText = sizeLimitMB >= 1024 ? `${(sizeLimitMB / 1024).toFixed(1)}GB` : `${sizeLimitMB}MB`; + return t('dialogTipText.fileAllFormat', { + maxFileNum: countLimit, + maxSize: sizeText + }); +}); const pollingKfTimer = ref(); const filterStatusList = ref(); const filterEnableList = ref(); diff --git a/src/views/knowledgeFileSection/index.vue b/src/views/knowledgeFileSection/index.vue index 70a3756..c62c5ce 100644 --- a/src/views/knowledgeFileSection/index.vue +++ b/src/views/knowledgeFileSection/index.vue @@ -168,57 +168,60 @@ -
- - - +
+
+ + + - - + + +
+
+ +
@@ -247,7 +250,7 @@ type="textarea" :autosize="{ minRows: 10}" :placeholder="$t('assetFile.contentPlaceholder')" - maxlength="1000" + maxlength="8096" :show-word-limit="true" />