From f87a227997d6a210b25bb51bda82648564263c6f Mon Sep 17 00:00:00 2001
From: wxg0103 <727495428@qq.com>
Date: Fri, 28 Mar 2025 15:45:08 +0800
Subject: [PATCH 1/2] 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 bbf6e35e933..c2b8a40b479 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 8a660232357..8f00840ace5 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 dc3d804078f..a2c9b1634c3 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 f4b44bbe38a..ef41a9bdbab 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) => {
From 930e9729c85f0c2684e5746c59a2e7574270c264 Mon Sep 17 00:00:00 2001
From: wxg0103 <727495428@qq.com>
Date: Fri, 28 Mar 2025 18:24:01 +0800
Subject: [PATCH 2/2] refactor: lark
---
ui/src/locales/lang/en-US/views/document.ts | 2 +-
ui/src/locales/lang/zh-CN/views/document.ts | 2 +-
ui/src/locales/lang/zh-Hant/views/document.ts | 2 +-
.../views/dataset/ImportDocumentDataset.vue | 47 ++++++++++++++++++-
4 files changed, 48 insertions(+), 5 deletions(-)
diff --git a/ui/src/locales/lang/en-US/views/document.ts b/ui/src/locales/lang/en-US/views/document.ts
index c2b8a40b479..3b3d5911064 100644
--- a/ui/src/locales/lang/en-US/views/document.ts
+++ b/ui/src/locales/lang/en-US/views/document.ts
@@ -171,7 +171,7 @@ export default {
},
feishu: {
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.',
+ tip1: 'Supports document and table types such as Feishu documents, TXT, Markdown, PDF, DOCX, HTML, XLS, XLSX, CSV, ZIP Feishu files. Documents will be segmented according to 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',
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 8f00840ace5..b3e6f1213ae 100644
--- a/ui/src/locales/lang/zh-CN/views/document.ts
+++ b/ui/src/locales/lang/zh-CN/views/document.ts
@@ -168,7 +168,7 @@ export default {
},
feishu: {
selectDocument: '选择文档',
- tip1: '仅支持文档和表格类型,文档会根据标题分段,表格会转为Markdown格式后再分段。',
+ tip1: '支持文档和表格类型飞书文档、支持TXT、Markdown、PDF、DOCX、HTML、XLS、XLSX、CSV、ZIP飞书文件,文档会根据标题分段,表格会转为Markdown格式后再分段。',
tip2: '系统不存储原始文档,导入文档前,建议规范文档的分段标识。',
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 a2c9b1634c3..1942d5ebc73 100644
--- a/ui/src/locales/lang/zh-Hant/views/document.ts
+++ b/ui/src/locales/lang/zh-Hant/views/document.ts
@@ -167,7 +167,7 @@ export default {
},
feishu: {
selectDocument: '選擇文檔',
- tip1: '僅支持文檔和表格類型,文檔會根據標題分段,表格會轉為Markdown格式後再分段。',
+ tip1: '支持檔案和表格類型飛書檔案、支持TXT、Markdown、PDF、DOCX、HTML、XLS、XLSX、CSV、ZIP飛書檔案,檔案會根據標題分段,表格會轉為Markdown格式後再分段。',
tip2: '系統不存儲原始文檔,導入文檔前,建議規範文檔的分段標識。',
allCheck: '全選',
errorMessage1: '請選擇文檔'
diff --git a/ui/src/views/dataset/ImportDocumentDataset.vue b/ui/src/views/dataset/ImportDocumentDataset.vue
index ef41a9bdbab..d512fd55b75 100644
--- a/ui/src/views/dataset/ImportDocumentDataset.vue
+++ b/ui/src/views/dataset/ImportDocumentDataset.vue
@@ -63,13 +63,55 @@
src="@/assets/fileType/docx-icon.svg"
alt=""
height="22"
- v-else-if="data.type === 'docx'"
+ v-else-if="data.type === 'docx' || data.name.endsWith('.docx')"
/>
+
+
+
+
+
+
+
{{ node.label }}
@@ -236,6 +278,7 @@ function back() {
margin-bottom: 20px;
}
}
+
.xlsx-icon {
svg {
width: 24px;