mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: Add import document view
This commit is contained in:
parent
3a9780dc4f
commit
460de60019
|
|
@ -48,14 +48,16 @@
|
|||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="apiType === 'document'" :label="$t('components.selectParagraph.title')" prop="state">
|
||||
<el-form-item
|
||||
v-if="apiType === 'document'"
|
||||
:label="$t('components.selectParagraph.title')"
|
||||
prop="state"
|
||||
>
|
||||
<el-radio-group v-model="state" class="radio-block">
|
||||
<el-radio value="error" size="large">{{
|
||||
$t('components.selectParagraph.error')
|
||||
}}</el-radio>
|
||||
<el-radio value="all" size="large">{{
|
||||
$t('components.selectParagraph.all')
|
||||
}}</el-radio>
|
||||
<el-radio value="all" size="large">{{ $t('components.selectParagraph.all') }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
|
@ -147,7 +149,7 @@ const submitHandle = async (formEl: FormInstance) => {
|
|||
if (apiType.value === 'paragraph') {
|
||||
const data = {
|
||||
...form.value,
|
||||
paragraph_id_list: idList.value,
|
||||
paragraph_id_list: idList.value
|
||||
}
|
||||
paragraphApi.batchGenerateRelated(id, documentId, data, loading).then(() => {
|
||||
MsgSuccess(t('views.document.generateQuestion.successMessage'))
|
||||
|
|
@ -185,9 +187,4 @@ function getModel() {
|
|||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
<style lang="scss" scope>
|
||||
.update-info {
|
||||
background: #d6e2ff;
|
||||
line-height: 25px;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scope></style>
|
||||
|
|
|
|||
|
|
@ -168,5 +168,11 @@ export default {
|
|||
prompt1:
|
||||
'Content: {data}\n \n Please summarize the above and generate 5 questions based on the summary. \nAnswer requirements: \n - Please output only questions; \n - Please place each question in',
|
||||
prompt2: 'tag.'
|
||||
},
|
||||
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.',
|
||||
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'
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export default {
|
|||
cancelGenerateQuestion: '取消生成问题',
|
||||
cancelVectorization: '取消向量化',
|
||||
cancelGenerate: '取消生成',
|
||||
export: '导出',
|
||||
export: '导出'
|
||||
},
|
||||
tip: {
|
||||
saveMessage: '当前的更改尚未保存,确认退出吗?',
|
||||
|
|
@ -108,7 +108,7 @@ export default {
|
|||
GENERATE: '生成中',
|
||||
SYNC: '同步中',
|
||||
REVOKE: '取消中',
|
||||
finish:'完成'
|
||||
finish: '完成'
|
||||
},
|
||||
enableStatus: {
|
||||
label: '启用状态',
|
||||
|
|
@ -149,7 +149,7 @@ export default {
|
|||
label: '相似度高于',
|
||||
placeholder: '直接返回分段内容',
|
||||
requiredMessage: '请输入相似度'
|
||||
},
|
||||
}
|
||||
},
|
||||
hitHandlingMethod: {
|
||||
optimization: '模型优化',
|
||||
|
|
@ -163,6 +163,12 @@ export default {
|
|||
tip3: '标签中,系统会自动关联标签中的问题;',
|
||||
tip4: '生成效果依赖于所选模型和提示词,用户可自行调整至最佳效果。',
|
||||
prompt1: `内容:{data}\n\n请总结上面的内容,并根据内容总结生成 5 个问题。\n回答要求:\n- 请只输出问题;\n- 请将每个问题放置`,
|
||||
prompt2: `标签中。`,
|
||||
prompt2: `标签中。`
|
||||
},
|
||||
feishu: {
|
||||
selectDocument: '选择文档',
|
||||
tip1: '仅支持文档和表格类型,文档会根据标题分段,表格会转为Markdown格式后再分段。',
|
||||
tip2: '系统不存储原始文档,导入文档前,建议规范文档的分段标识。',
|
||||
allCheck: '全选'
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,5 +164,11 @@ export default {
|
|||
tip4: '生成效果取決於所選模型和提示詞,用戶可自行調整至最佳效果。',
|
||||
prompt1: `內容:{data}\n\n請總結上面的內容,並根據內容總結生成 5 個問題。\n回答要求:\n - 請只輸出問題;\n - 請將每個問題放置在`,
|
||||
prompt2: `標籤中。`,
|
||||
},
|
||||
feishu: {
|
||||
selectDocument: '選擇文檔',
|
||||
tip1: '僅支持文檔和表格類型,文檔會根據標題分段,表格會轉為Markdown格式後再分段。',
|
||||
tip2: '系統不存儲原始文檔,導入文檔前,建議規範文檔的分段標識。',
|
||||
allCheck: '全選'
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import Layout from '@/layout/layout-template/DetailLayout.vue'
|
|||
const datasetRouter = {
|
||||
path: '/dataset',
|
||||
name: 'dataset',
|
||||
meta: { title: 'views.dataset.title', permission: 'DATASET:READ' },
|
||||
meta: { title: 'views.dataset.title', permission: 'DATASET:READ' },
|
||||
component: () => import('@/layout/layout-template/AppLayout.vue'),
|
||||
redirect: '/dataset',
|
||||
children: [
|
||||
|
|
@ -13,7 +13,7 @@ const datasetRouter = {
|
|||
component: () => import('@/views/dataset/index.vue')
|
||||
},
|
||||
{
|
||||
path: '/dataset/:type', // upload
|
||||
path: '/dataset/upload',
|
||||
name: 'UploadDocumentDataset',
|
||||
meta: { activeMenu: '/dataset' },
|
||||
component: () => import('@/views/dataset/UploadDocumentDataset.vue'),
|
||||
|
|
@ -85,7 +85,14 @@ const datasetRouter = {
|
|||
meta: { activeMenu: '/dataset' },
|
||||
component: () => import('@/views/paragraph/index.vue'),
|
||||
hidden: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/dataset/import',
|
||||
name: 'ImportDocumentDataset',
|
||||
meta: { activeMenu: '/dataset' },
|
||||
component: () => import('@/views/dataset/ImportDocumentDataset.vue'),
|
||||
hidden: true
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -765,3 +765,9 @@ h5 {
|
|||
width: 90% !important;
|
||||
}
|
||||
}
|
||||
|
||||
// 蓝色提示框
|
||||
.update-info {
|
||||
background: #d6e2ff;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,149 @@
|
|||
<template>
|
||||
<LayoutContainer :header="$t('views.document.importDocument')" class="create-dataset">
|
||||
<template #backButton>
|
||||
<back-button @click="back"></back-button>
|
||||
</template>
|
||||
<div class="create-dataset__main flex" v-loading="loading">
|
||||
<div class="create-dataset__component main-calc-height">
|
||||
<el-scrollbar>
|
||||
<div class="upload-document p-24">
|
||||
<h4 class="title-decoration-1 mb-8">
|
||||
{{ $t('views.document.feishu.selectDocument') }}
|
||||
</h4>
|
||||
<el-form
|
||||
ref="FormRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-position="top"
|
||||
require-asterisk-position="right"
|
||||
>
|
||||
<div class="mt-16 mb-16">
|
||||
<el-radio-group v-model="form.fileType" class="app-radio-button-group">
|
||||
<el-radio-button value="txt">{{
|
||||
$t('views.document.fileType.txt.label')
|
||||
}}</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<div class="update-info flex p-8-12 border-r-4 mb-16">
|
||||
<div class="mt-4">
|
||||
<AppIcon iconName="app-warning-colorful" style="font-size: 16px"></AppIcon>
|
||||
</div>
|
||||
<div class="ml-16 lighter">
|
||||
<p>{{ $t('views.document.feishu.tip1') }}</p>
|
||||
<p>{{ $t('views.document.feishu.tip2') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-never border-r-4 mb-16">
|
||||
<el-checkbox
|
||||
v-model="allCheck"
|
||||
:label="$t('views.document.feishu.allCheck')"
|
||||
size="large"
|
||||
class="ml-24"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<el-tree :props="props" :load="loadNode" lazy show-checkbox />
|
||||
</el-form>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</div>
|
||||
<div class="create-dataset__footer text-right border-t">
|
||||
<el-button @click="router.go(-1)">{{ $t('common.cancel') }}</el-button>
|
||||
|
||||
<el-button @click="submit" type="primary">
|
||||
{{ $t('views.document.buttons.import') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</LayoutContainer>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, onUnmounted } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
|
||||
import documentApi from '@/api/document'
|
||||
import { MsgConfirm, MsgSuccess } from '@/utils/message'
|
||||
import { t } from '@/locales'
|
||||
import type Node from 'element-plus/es/components/tree/src/model/node'
|
||||
|
||||
interface Tree {
|
||||
name: string
|
||||
leaf?: boolean
|
||||
}
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const {
|
||||
query: { id } // id为datasetID,有id的是上传文档
|
||||
} = route
|
||||
|
||||
const loading = ref(false)
|
||||
const disabled = ref(false)
|
||||
const allCheck = ref(false)
|
||||
const form = ref({
|
||||
fileType: 'txt',
|
||||
fileList: [] as any
|
||||
})
|
||||
|
||||
const rules = reactive({
|
||||
fileList: [
|
||||
{ required: true, message: t('views.document.upload.requiredMessage'), trigger: 'change' }
|
||||
]
|
||||
})
|
||||
|
||||
const props = {
|
||||
label: 'name',
|
||||
children: 'zones',
|
||||
isLeaf: 'leaf'
|
||||
}
|
||||
|
||||
const loadNode = (node: Node, resolve: (data: Tree[]) => void) => {
|
||||
if (node.level === 0) {
|
||||
return resolve([{ name: 'region' }])
|
||||
}
|
||||
if (node.level > 1) return resolve([])
|
||||
|
||||
setTimeout(() => {
|
||||
const data: Tree[] = [
|
||||
{
|
||||
name: 'leaf',
|
||||
leaf: true
|
||||
},
|
||||
{
|
||||
name: 'zone'
|
||||
}
|
||||
]
|
||||
|
||||
resolve(data)
|
||||
}, 500)
|
||||
}
|
||||
|
||||
function submit() {
|
||||
loading.value = true
|
||||
}
|
||||
function back() {
|
||||
router.go(-1)
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.create-dataset {
|
||||
&__component {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
overflow: hidden;
|
||||
}
|
||||
&__footer {
|
||||
padding: 16px 24px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background: #ffffff;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.upload-document {
|
||||
width: 70%;
|
||||
margin: 0 auto;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -323,8 +323,5 @@ defineExpose({
|
|||
color: var(--el-color-primary-light-5);
|
||||
}
|
||||
}
|
||||
.update-info {
|
||||
background: #d6e2ff;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue