From cc2789f37f6b3a2111773c7a98033eb067780453 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Fri, 28 Mar 2025 15:45:08 +0800 Subject: [PATCH] fix: import add warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1054090 --user=王孝刚 【知识库】飞书知识库-导入文档-未选择导入文件时,导入有提示信息 https://www.tapd.cn/57709429/s/1678039 --- ui/src/locales/lang/en-US/views/document.ts | 3 ++- ui/src/locales/lang/zh-CN/views/document.ts | 3 ++- ui/src/locales/lang/zh-Hant/views/document.ts | 9 +++++---- ui/src/views/dataset/ImportDocumentDataset.vue | 10 ++++++++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ui/src/locales/lang/en-US/views/document.ts b/ui/src/locales/lang/en-US/views/document.ts index bbf6e35e9..c2b8a40b4 100644 --- a/ui/src/locales/lang/en-US/views/document.ts +++ b/ui/src/locales/lang/en-US/views/document.ts @@ -173,6 +173,7 @@ export default { selectDocument: 'Select Document', tip1: 'Only documents and tables are supported. Documents will be segmented based on titles, and tables will be converted to Markdown format before segmentation.', tip2: 'The system does not store the original document. Before importing the document, it is recommended to standardize the document segmentation markers.', - allCheck: 'Select All' + allCheck: 'Select All', + errorMessage1: 'Please select a document' } } diff --git a/ui/src/locales/lang/zh-CN/views/document.ts b/ui/src/locales/lang/zh-CN/views/document.ts index 8a6602323..8f00840ac 100644 --- a/ui/src/locales/lang/zh-CN/views/document.ts +++ b/ui/src/locales/lang/zh-CN/views/document.ts @@ -170,6 +170,7 @@ export default { selectDocument: '选择文档', tip1: '仅支持文档和表格类型,文档会根据标题分段,表格会转为Markdown格式后再分段。', tip2: '系统不存储原始文档,导入文档前,建议规范文档的分段标识。', - allCheck: '全选' + allCheck: '全选', + errorMessage1: '请选择文档' } } diff --git a/ui/src/locales/lang/zh-Hant/views/document.ts b/ui/src/locales/lang/zh-Hant/views/document.ts index dc3d80407..a2c9b1634 100644 --- a/ui/src/locales/lang/zh-Hant/views/document.ts +++ b/ui/src/locales/lang/zh-Hant/views/document.ts @@ -12,7 +12,7 @@ export default { cancelGenerateQuestion: '取消生成問題', cancelVectorization: '取消向量化', cancelGenerate: '取消生成', - export: '匯出', + export: '匯出' }, tip: { saveMessage: '當前的更改尚未保存,確認退出嗎?', @@ -149,7 +149,7 @@ export default { label: '相似度高于', placeholder: '直接返回分段内容', requiredMessage: '请输入相似度' - }, + } }, hitHandlingMethod: { optimization: '模型優化', @@ -163,12 +163,13 @@ export default { tip3: '標籤中,系統會自動關聯標籤中的問題;', tip4: '生成效果取決於所選模型和提示詞,用戶可自行調整至最佳效果。', prompt1: `內容:{data}\n\n請總結上面的內容,並根據內容總結生成 5 個問題。\n回答要求:\n - 請只輸出問題;\n - 請將每個問題放置在`, - prompt2: `標籤中。`, + prompt2: `標籤中。` }, feishu: { selectDocument: '選擇文檔', tip1: '僅支持文檔和表格類型,文檔會根據標題分段,表格會轉為Markdown格式後再分段。', tip2: '系統不存儲原始文檔,導入文檔前,建議規範文檔的分段標識。', - allCheck: '全選' + allCheck: '全選', + errorMessage1: '請選擇文檔' } } diff --git a/ui/src/views/dataset/ImportDocumentDataset.vue b/ui/src/views/dataset/ImportDocumentDataset.vue index f4b44bbe3..ef41a9bdb 100644 --- a/ui/src/views/dataset/ImportDocumentDataset.vue +++ b/ui/src/views/dataset/ImportDocumentDataset.vue @@ -41,7 +41,7 @@ @change="handleAllCheckChange" /> -
+
import { ref, reactive, computed, onUnmounted } from 'vue' import { useRouter, useRoute } from 'vue-router' -import { MsgConfirm, MsgSuccess } from '@/utils/message' +import { MsgConfirm, MsgSuccess, MsgWarning } from '@/utils/message' import { getImgUrl } from '@/utils/utils' import { t } from '@/locales' import type Node from 'element-plus/es/components/tree/src/model/node' @@ -186,6 +186,12 @@ function submit() { type: node.type } }) + if (newList.length === 0) { + disabled.value = false + MsgWarning(t('views.document.feishu.errorMessage1')) + loading.value = false + return + } dataset .importLarkDocument(datasetId, newList, loading) .then((res) => {