mirror of
http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage.git
synced 2025-12-16 06:16:51 +08:00
Merge branch 'dev' of http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage into dev
This commit is contained in:
@@ -21,7 +21,40 @@ export function getDatasetById(params) {
|
||||
export function datasetUpdate(data) {
|
||||
return request({
|
||||
url: getUrl('/datasets/update'),
|
||||
method: 'get',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
// 知识库新增
|
||||
export function datasetCreate(data) {
|
||||
return request({
|
||||
url: getUrl('/datasetsEx/create'),
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
// 知识库删除
|
||||
export function datasetDelete(data) {
|
||||
return request({
|
||||
url: getUrl(`/datasetsEx/delete?id=${data.id}`),
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
//minerU 获取bbox
|
||||
export function minerUBbox(params) {
|
||||
return request({
|
||||
url:'http://192.168.8.165:7196/document/mineru/bbox_json',
|
||||
// url: getUrl('/document/mineru/bbox_json'),
|
||||
method: 'get',
|
||||
params:params
|
||||
})
|
||||
}
|
||||
//minerU 获取markdown
|
||||
export function minerUMarkDown(params) {
|
||||
return `http://192.168.8.165:7196/document/mineru/md?documentId=${params.documentId}`
|
||||
// url: getUrl('/document/mineru/md'),
|
||||
|
||||
}
|
||||
|
||||
@@ -48,6 +48,14 @@ service.interceptors.response.use(
|
||||
response => {
|
||||
const res = response.data
|
||||
endLoading()
|
||||
if(!res.content){
|
||||
Message({
|
||||
message: res.message,
|
||||
type: 'error',
|
||||
duration: 5 * 500
|
||||
})
|
||||
return Promise.reject(res)
|
||||
}
|
||||
if (response.request.responseType == 'blob' || response.request.responseType == 'Blob') {
|
||||
return response.data
|
||||
}
|
||||
|
||||
@@ -142,6 +142,9 @@
|
||||
.lineH35 {
|
||||
line-height: 35px;
|
||||
}
|
||||
.lineH25 {
|
||||
line-height: 25px;
|
||||
}
|
||||
.lineH40 {
|
||||
line-height: 40px;
|
||||
}
|
||||
@@ -258,3 +261,90 @@ body .el-collapse-item__wrap {
|
||||
.cursor-pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
.view-body {
|
||||
text-align: left;
|
||||
font-size: 14px;
|
||||
div{
|
||||
outline: unset;
|
||||
|
||||
}
|
||||
|
||||
/* 添加一些基本的样式以美化 Markdown 内容 */
|
||||
|
||||
p {
|
||||
font-size: 16px;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin-top: 24px;
|
||||
margin-bottom: 12px;
|
||||
border-bottom: 1px dashed #cecece;
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
ul, ol {
|
||||
margin: 16px 0;
|
||||
padding-left: 32px;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #007BFF;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
code {
|
||||
background-color: #f1f1f1;
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
font-family: 'Courier New', Courier, monospace;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
pre {
|
||||
background-color: #f1f1f1;
|
||||
padding: 16px;
|
||||
border-radius: 4px;
|
||||
overflow-x: auto;
|
||||
font-family: 'Courier New', Courier, monospace;
|
||||
}
|
||||
|
||||
pre code {
|
||||
background-color: transparent;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table {
|
||||
border: 1px solid #f9f9f9;
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
background: linear-gradient(to bottom, #ffffff, #f9f9f9);
|
||||
}
|
||||
|
||||
th, td {
|
||||
border: 1px solid #ccc;
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
// 添加斑马条纹效果
|
||||
tr:nth-child(even) {
|
||||
background-color: #f9fafc;
|
||||
}
|
||||
}
|
||||
|
||||
173
src/components/RenderMinerU/index.vue
Normal file
173
src/components/RenderMinerU/index.vue
Normal file
@@ -0,0 +1,173 @@
|
||||
<template>
|
||||
<div style="height: 100%;">
|
||||
<div class="flex" style="height:calc(100% - 20px);flex:1">
|
||||
<iframe
|
||||
id="iframe"
|
||||
:src="`${iframeSrc}/pdfjs-dist/web/viewer.html?file=${encodeURIComponent(prdUrl)}`"
|
||||
class="miner-u el-card is-always-shadow ml20"
|
||||
></iframe>
|
||||
<div style="flex:1;max-width: 800px;" class="mh20 miner-u-md">
|
||||
<el-tabs type="border-card" style="height: 100%;overflow: hidden" @tab-click="changeTab">
|
||||
<el-tab-pane label="预览" style="overflow:scroll;">
|
||||
<div v-html="markdownHtml" class="view-body"></div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="编辑">
|
||||
<div class="lineH25" contenteditable id="md-editor" @blur="emitMarkDown">{{ markdown }}</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { minerUBbox, minerUMarkDown } from '@/api/generatedApi/index'
|
||||
import { DEFAULT_COLOR_SECTION, PDF_COLOR_PICKER } from './pdf-color'
|
||||
import MarkdownIt from 'markdown-it'
|
||||
import markdownItKatex from 'markdown-it-katex'
|
||||
const md = new MarkdownIt({
|
||||
html: true
|
||||
}).use(markdownItKatex)
|
||||
export default {
|
||||
name: 'index',
|
||||
data() {
|
||||
return {
|
||||
prdUrl: ``,
|
||||
iframeSrc: window.location.href,
|
||||
bboxList: [],
|
||||
markdown: '',
|
||||
md,
|
||||
markdownHtml: ''
|
||||
}
|
||||
},
|
||||
props: {},
|
||||
watch: {},
|
||||
components: {},
|
||||
filters: {},
|
||||
methods: {
|
||||
emitMarkDown() {
|
||||
let pre = document.getElementById('md-editor').innerText
|
||||
this.$emit('getMarkDownIt', { innerText: pre })
|
||||
},
|
||||
formatJson(data) {
|
||||
return data.map(item => {
|
||||
let bboxes = []
|
||||
// 处理预处理块
|
||||
if (item.preproc_blocks && item.preproc_blocks.length > 0) {
|
||||
item.preproc_blocks.forEach(block => {
|
||||
bboxes.push({
|
||||
type: block.type,
|
||||
bbox: block.bbox,
|
||||
color: PDF_COLOR_PICKER[block.type] || DEFAULT_COLOR_SECTION
|
||||
})
|
||||
})
|
||||
}
|
||||
// 处理丢弃块
|
||||
if (item.discarded_blocks && item.discarded_blocks.length > 0) {
|
||||
item.discarded_blocks.forEach(block => {
|
||||
bboxes.push({
|
||||
type: block.type,
|
||||
bbox: block.bbox,
|
||||
color: PDF_COLOR_PICKER[block.type] || DEFAULT_COLOR_SECTION
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
...item,
|
||||
bboxes
|
||||
}
|
||||
})
|
||||
},
|
||||
// bbox 解析 传递 颜色
|
||||
getPDFDetailBbox() {
|
||||
minerUBbox({ documentId: 1 }).then(res => {
|
||||
this.bboxList = this.formatJson(JSON.parse(JSON.stringify(res.content.content)))
|
||||
})
|
||||
},
|
||||
changeTab() {
|
||||
let pre = document.getElementById('md-editor').innerText
|
||||
this.markdownHtml = md.render(pre)
|
||||
},
|
||||
async getPDFDetailMarkDown() {
|
||||
const response = await fetch(minerUMarkDown({ documentId: 1 }))
|
||||
this.markdown = await response.text()
|
||||
|
||||
this.markdownHtml = this.md.render(this.markdown)
|
||||
},
|
||||
// 向 iframe 发送消息
|
||||
sendMessageToIframe(type, message) {
|
||||
// 获取 iframe 元素
|
||||
const iframe = document.getElementById('iframe')
|
||||
// 检查 iframe 是否存在并且可以发送消息
|
||||
if (iframe && iframe.contentWindow) {
|
||||
iframe.contentWindow.postMessage(
|
||||
{
|
||||
type,
|
||||
data: message
|
||||
},
|
||||
'*'
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getPDFDetailBbox()
|
||||
this.getPDFDetailMarkDown()
|
||||
},
|
||||
mounted() {
|
||||
// 监听 iframe 的 postMessage 事件
|
||||
window.addEventListener('message', event => {
|
||||
// 检查消息来源是否合法
|
||||
if (event.origin + '/' === process.env.BASE_URL) {
|
||||
// 根据消息状态执行不同操作
|
||||
switch (event.data.status) {
|
||||
case 'loaded':
|
||||
// 格式化 JSON 数据并发送给 iframe
|
||||
this.sendMessageToIframe('initExtractLayerData', this.bboxList)
|
||||
this.sendMessageToIframe('title', '')
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (event.data.pageNum) {
|
||||
const num = event.data.pageNum || 1
|
||||
this.sendMessageToIframe('pageChange', num)
|
||||
}
|
||||
if (event.data.pageNumDetail) {
|
||||
const pageNumDetail = event.data.pageNumDetail || 1
|
||||
|
||||
this.page.value = pageNumDetail
|
||||
this.sendMessageToIframe('pageNumDetail', pageNumDetail)
|
||||
}
|
||||
})
|
||||
},
|
||||
computed: {}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.miner-u {
|
||||
outline: none;
|
||||
border: none;
|
||||
flex: 1;
|
||||
border-radius: unset;
|
||||
//width:500px;
|
||||
//height:100%
|
||||
}
|
||||
|
||||
#md-editor {
|
||||
//超过宽度自动折行
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
overflow: auto;
|
||||
outline: none;
|
||||
border: none;
|
||||
}
|
||||
.miner-u-md {
|
||||
/deep/ .el-tabs--border-card > .el-tabs__content {
|
||||
height: calc(100% - 30px);
|
||||
overflow: auto;
|
||||
}
|
||||
.tabs__content {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
37
src/components/RenderMinerU/pdf-color.js
Normal file
37
src/components/RenderMinerU/pdf-color.js
Normal file
@@ -0,0 +1,37 @@
|
||||
export const PDF_COLOR_PICKER = {
|
||||
title: {
|
||||
line: 'rgba(121, 124, 255, 1)',
|
||||
fill: 'rgba(121, 124, 255, 0.4)'
|
||||
},
|
||||
text: {
|
||||
line: 'rgba(230, 122, 171, 1)',
|
||||
fill: 'rgba(230, 122, 171, 0.4)'
|
||||
},
|
||||
interline_equation: {
|
||||
line: 'rgba(240, 240, 124, 1)',
|
||||
fill: 'rgba(240, 240, 124, 0.4)'
|
||||
},
|
||||
discarded: {
|
||||
line: 'rgba(164,164,164,1)',
|
||||
fill: 'rgba(164,164,164,0.4)'
|
||||
},
|
||||
image: {
|
||||
line: 'rgba(149, 226, 115, 1)',
|
||||
fill: 'rgba(149, 226, 115, 0.4)'
|
||||
},
|
||||
table: {
|
||||
line: 'rgba(230, 113, 230, 1)',
|
||||
fill: 'rgba(230, 113, 230, 0.4)'
|
||||
},
|
||||
inline_equation: {
|
||||
line: 'rgba(150, 232, 172, 1)',
|
||||
fill: 'rgba(150, 232, 172, 0.4)'
|
||||
}
|
||||
};
|
||||
|
||||
export const DEFAULT_COLOR_SECTION = {
|
||||
line: 'rgba(166, 113, 230, 1)',
|
||||
fill: 'rgba(166, 113, 230, 0.4)'
|
||||
};
|
||||
|
||||
export const PDF_TEMPLATE_URL_KEY = 't';
|
||||
@@ -11,6 +11,7 @@ import RenderTable from './components/RenderTable'
|
||||
import RenderSwiper from './components/RenderSwiper'
|
||||
import VueEditor from './components/VueEditor'
|
||||
import MavonEditor from './components/MavonEditor'
|
||||
import RenderMinerU from '@/components/RenderMinerU/index.vue'
|
||||
import utils from '@/assets/js/common'
|
||||
// 生成的数据交互api
|
||||
import generatedApi from '@/api/generatedApi'
|
||||
@@ -32,6 +33,7 @@ Vue.use(ElementUI, { locale })
|
||||
//二次封装的el-table
|
||||
Vue.component('RTable', RenderTable)
|
||||
Vue.component('RSwiper', RenderSwiper)
|
||||
Vue.component('RMinerU', RenderMinerU)
|
||||
// 富文本编辑器
|
||||
Vue.component('VEditor', VueEditor)
|
||||
// 富文本编辑器 可视化代码
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
<template>
|
||||
<div class="splitConfig mt20">
|
||||
文件拆分规则
|
||||
<ul>
|
||||
<!-- 自动拆分 -->
|
||||
<li class="flex" v-for="(item, index) in splitOptions" :key="index" @click="handleClick(index)">
|
||||
<div>
|
||||
<i :class="item.icon" size="50"></i>
|
||||
</div>
|
||||
<div>
|
||||
<h3>{{ item.title }}</h3>
|
||||
{{ item.description }}<br>
|
||||
<span v-if="item.tip">{{ item.tip }}</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- 弹窗组件 -->
|
||||
<custom-split-dialog
|
||||
v-if="dialogVisible"
|
||||
:visible="dialogVisible"
|
||||
:form="form"
|
||||
:table-data="tableData">
|
||||
</custom-split-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import CustomSplitDialog from './split/CustomSplitDialog.vue';
|
||||
|
||||
export default {
|
||||
name: 'splitConfig',
|
||||
components: {
|
||||
CustomSplitDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
form: {
|
||||
// 表单数据
|
||||
},
|
||||
tableData: [
|
||||
// 表格数据示例
|
||||
{ id: 1, name: 'Item 1', selected: false },
|
||||
{ id: 2, name: 'Item 2', selected: false },
|
||||
{ id: 3, name: 'Item 3', selected: false }
|
||||
],
|
||||
splitOptions: [
|
||||
{
|
||||
icon: 'el-icon-setting',
|
||||
title: '自动拆分',
|
||||
description: '使用系统默认的拆分方式,适合新手或紧急任务,直接使用系统优化后的算法处理文本。',
|
||||
tip: '提示:首次使用时建议先用自动拆分测试效果,再决定是否调整。'
|
||||
},
|
||||
{
|
||||
icon: 'el-icon-medal',
|
||||
title: '自定义拆分',
|
||||
description: '使用自定义拆分方式可以根据具体需求灵活调整文本分割逻辑,但需要权衡灵活性与复杂度,需要用户具备一定的规则定制经验。',
|
||||
tip: ''
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
props: {},
|
||||
watch: {},
|
||||
filters: {},
|
||||
methods: {
|
||||
designSplit() {
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
handleClick(index) {
|
||||
console.log('Clicked index:', index);
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
mounted() {},
|
||||
computed: {}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang='scss'>
|
||||
.splitConfig {
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
|
||||
li {
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid #d9d9d9;
|
||||
padding: 15px;
|
||||
border-radius: 6px;
|
||||
list-style-type: none;
|
||||
|
||||
h3 {
|
||||
margin-bottom: 15px;
|
||||
font-size: 18px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 10px 0;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -2,103 +2,122 @@
|
||||
<div class='container index-container'>
|
||||
<el-card shadow="hover">
|
||||
<div slot="header" class="clearfix">
|
||||
<h3>新增知识库</h3>
|
||||
<h3>{{$route.query.datasetId ? '修改' : '新增'}}知识库</h3>
|
||||
</div>
|
||||
<el-row >
|
||||
<el-col :span='21' :offset='1'>
|
||||
<el-form :model="model" ref="model" label-width="100px">
|
||||
<el-form-item label="知识库名称:" prop="knowledgeName">
|
||||
<el-input></el-input>
|
||||
<el-form :model="model" ref="model" label-width="120px" :rules='rules'>
|
||||
<el-form-item label="知识库名称:" prop="name">
|
||||
<el-input v-model='model.name'></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="描述(可选):" prop="knowledgeName" requried>
|
||||
<el-input type='textarea'></el-input>
|
||||
<el-form-item label="描述(可选):" prop="description" requried>
|
||||
<el-input type='textarea' v-model='model.description'></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="分段模式:" prop="knowledgeName" requried>
|
||||
<el-radio-group>
|
||||
<el-radio label="1">通用分段模式</el-radio>
|
||||
<el-radio label="1">Q&A分段模式</el-radio>
|
||||
<el-form-item label="分段模式:" prop="segmentedMode" requried>
|
||||
<el-radio-group v-model='model.segmentedMode'>
|
||||
<el-radio :label="0">通用分段模式</el-radio>
|
||||
<el-radio :label="1">Q&A分段模式</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
|
||||
<el-col :span='24' class='text-center'>
|
||||
<el-button type='primary' size='medium' @click='save'>创建</el-button>
|
||||
<el-button type='primary' size='medium' @click='save'>{{$route.query.datasetId ? '保存' : '创建'}}</el-button>
|
||||
<el-button size='medium' @click='$router.go(-1)'>取消 </el-button>
|
||||
<el-button size='medium' @click='jumpKnowledgeList' v-if='infoDialogVisible'>返回知识库列表</el-button>
|
||||
<el-button size='medium' @click='jumpKnowledgeDetail' v-if='infoDialogVisible'>查看知识库详情 </el-button>
|
||||
</el-col>
|
||||
|
||||
|
||||
|
||||
|
||||
</el-row>
|
||||
|
||||
|
||||
|
||||
</el-card>
|
||||
|
||||
|
||||
<!-- <el-dialog title="知识库操作成功" :visible.sync="infoDialogVisible" width="50%"></el-dialog>-->
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import 'nprogress/nprogress.css' // progress bar style
|
||||
import renderLoading from '@/components/RenderLoading/loading/index'
|
||||
import NProgress from 'nprogress'
|
||||
|
||||
import { getDatasetById,datasetUpdate,datasetCreate } from '@/api/generatedApi/index'
|
||||
export default {
|
||||
name: 'knowledgeForm',
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
props: {
|
||||
knowledgeForm: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
knowledgeName:''
|
||||
}
|
||||
}
|
||||
},
|
||||
knowledgeId: {
|
||||
type: String
|
||||
return {
|
||||
infoDialogVisible:false,
|
||||
|
||||
model:{
|
||||
description:'',
|
||||
name:'',
|
||||
segmentedMode:null,
|
||||
id:null
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '请输入知识库名称', trigger: 'blur' },
|
||||
],
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {},
|
||||
watch: {},
|
||||
components: {},
|
||||
filters: {},
|
||||
methods: {
|
||||
jumpKnowledgeList(){
|
||||
this.$router.push({
|
||||
path: '/knowledge/list',
|
||||
})
|
||||
},
|
||||
jumpKnowledgeDetail(item){
|
||||
this.$router.push({
|
||||
path: '/knowledge/detail',
|
||||
query:{
|
||||
datasetId:this.model.id
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
getDetail (){
|
||||
let { datasetId } = this.$route.query
|
||||
if(!datasetId) return
|
||||
getDatasetById({ id:datasetId }).then(res=>{
|
||||
this.model = {
|
||||
...res.content.content
|
||||
}
|
||||
})
|
||||
},
|
||||
save(){
|
||||
// 配置进度条参数
|
||||
// NProgress.configure({
|
||||
// showSpinner: false, // 隐藏转圈圈
|
||||
// })
|
||||
this.$refs.model.validate(valid => {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
(!this.$route.query.datasetId?datasetCreate:datasetUpdate)(this.model).then(res=>{
|
||||
// 添加保存成功的提示
|
||||
this.$message.success('保存成功');
|
||||
this.model.id = res.content.content.id
|
||||
this.infoDialogVisible = true
|
||||
// this.$router.go(-1)
|
||||
})
|
||||
})
|
||||
|
||||
// setTimeout(()=>{
|
||||
//
|
||||
// NProgress.done();
|
||||
// },5000)
|
||||
|
||||
// let loadingDom = document.getElementById('knowledgeFormDrawer').querySelector('.el-drawer')
|
||||
|
||||
// console.log(loadingDom)
|
||||
// let loading = renderLoading.service({
|
||||
// target:loadingDom,
|
||||
// })
|
||||
|
||||
// loading.close()
|
||||
|
||||
// 添加保存成功的提示
|
||||
this.$message.success('保存成功');
|
||||
},
|
||||
},
|
||||
created() {
|
||||
},
|
||||
mounted() {
|
||||
this.getDetail()
|
||||
},
|
||||
computed: {
|
||||
// model 获取 knowledgeForm
|
||||
model() {
|
||||
return this.knowledgeForm
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,85 +1,103 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 添加预处理结果预览对话框 -->
|
||||
<el-dialog
|
||||
<el-drawer
|
||||
title="添加知识拆分规则"
|
||||
:visible.sync="dialogVisible"
|
||||
width="650px">
|
||||
<el-form ref="ruleForm" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="规则名称:" prop="ruleName">
|
||||
<el-input v-model="form.ruleName" placeholder="请输入规则名称"></el-input>
|
||||
<span>支持中文、英文、数字、下划线(_),50个字符以内,不能以下划线为开头</span>
|
||||
<el-button type="primary" size="mini" @click="queryExistingRules">查询并导入现有规则</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="属性:" prop="style">
|
||||
<el-input v-model="form.ruleName" placeholder="请输入属性"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="属性描述:" prop="style">
|
||||
<el-input v-model="form.ruleName" placeholder="请输入属性描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="关键词:" prop="style">
|
||||
<el-input v-model="form.ruleName" placeholder="请输入关键词"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="题词示例:" prop="style">
|
||||
<el-input v-model="form.ruleName" placeholder="请输入题词示例"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="提示词:" prop="promptWord">
|
||||
<el-input type="textarea" v-model="form.promptWord" placeholder="请输入提示词"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" size="medium" @click="addSplitRule">+ 新增拆分规则</el-button>
|
||||
<el-button size="medium" @click="deleteSplitRule">- 删除拆分规则</el-button>
|
||||
size="50%">
|
||||
<div class="content">
|
||||
<el-form ref="ruleForm" :model="form" :rules="rules" label-width="120px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="规则名称" prop="ruleName">
|
||||
<el-input v-model="form.ruleName" placeholder="请输入规则名称"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-select v-model="form.ruleName" placeholder="查询并导入现有规则"></el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<p class="tips">支持中文、英文、数字、下划线(_),50个字符以内,不能以下划线为开头</p>
|
||||
<div v-for="(rule, index) in form.rules" :key="index">
|
||||
<el-form-item label="样式" :prop="'rules.' + index + '.style'">
|
||||
<el-input v-model="rule.style" placeholder="请输入样式"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="提示词" :prop="'rules.' + index + '.promptWord'">
|
||||
<el-input type="textarea" v-model="rule.promptWord" placeholder="请输入提示词"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" :prop="'rules.' + index + '.remark'">
|
||||
<el-input type="textarea" v-model="rule.remark" placeholder="请输入规则备注"></el-input>
|
||||
</el-form-item>
|
||||
<div class="text-right mb20">
|
||||
<el-button type="primary" size="medium" @click="copyRule">复制拆分规则</el-button>
|
||||
<el-button type="primary" size="medium" @click="addSplitRule">+ 新增拆分规则</el-button>
|
||||
<el-button v-if="form.rules.length > 1" type="danger" size="small" @click="removeRule(index)">删除规则</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'AddRule',
|
||||
props: {
|
||||
dialogVisible: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
form: {
|
||||
ruleName: '',
|
||||
style: '',
|
||||
promptWord: '',
|
||||
remark: ''
|
||||
rules: [
|
||||
{
|
||||
ruleName: '',
|
||||
style: '',
|
||||
promptWord: '',
|
||||
remark: ''
|
||||
}
|
||||
]
|
||||
},
|
||||
rules: {
|
||||
ruleName: [
|
||||
{ required: true, message: '请输入规则名称', trigger: 'blur' }
|
||||
],
|
||||
style: [
|
||||
{ required: true, message: '请选择样式', trigger: 'change' }
|
||||
],
|
||||
promptWord: [
|
||||
{ required: true, message: '请输入提示词', trigger: 'blur' }
|
||||
]
|
||||
rules: {
|
||||
required: true,
|
||||
type: 'array',
|
||||
fields: {
|
||||
style: [
|
||||
{ required: true, message: '请选择样式', trigger: 'change' }
|
||||
],
|
||||
promptWord: [
|
||||
{ required: true, message: '请输入提示词', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
queryExistingRules() {
|
||||
// 查询并导入现有规则的逻辑
|
||||
},
|
||||
// 复制
|
||||
copyRule(){
|
||||
|
||||
},
|
||||
// 新增
|
||||
addSplitRule() {
|
||||
this.$refs.ruleForm.validate((valid) => {
|
||||
if (valid) {
|
||||
// 新增拆分规则的逻辑
|
||||
} else {
|
||||
console.log('表单验证失败');
|
||||
return false;
|
||||
}
|
||||
this.form.rules.push({
|
||||
ruleName: '',
|
||||
style: '',
|
||||
promptWord: '',
|
||||
remark: ''
|
||||
});
|
||||
},
|
||||
removeRule(index) {
|
||||
this.form.rules.splice(index, 1);
|
||||
},
|
||||
deleteSplitRule() {
|
||||
// 删除拆分规则的逻辑
|
||||
console.log('删除拆分规则');
|
||||
@@ -96,5 +114,13 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
|
||||
.content{
|
||||
padding: 20px;
|
||||
.tips{
|
||||
font-size: 14px ;
|
||||
color: #999;
|
||||
margin-left: 120px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<!-- 表单内容 -->
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="知识名称">
|
||||
<el-input v-model="form.field1" size="medium" placeholder="知识名称"></el-input>
|
||||
<el-form-item label="知识拆分规则">
|
||||
<el-input v-model="form.field1" size="medium" placeholder="请输入知识拆分规则"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@@ -14,9 +14,9 @@
|
||||
</el-row>
|
||||
<!-- 其他表单项 -->
|
||||
</el-form>
|
||||
<r-table :columns="columns" :data="list" :deletion="false"></r-table>
|
||||
<r-table :columns="columns" :data="tableData" :deletion="false"></r-table>
|
||||
<!-- 添加 AddRule 组件 -->
|
||||
<add-rule :dialogVisible.sync="addRuleVisible"></add-rule>
|
||||
<add-rule ref="addRule"></add-rule>
|
||||
|
||||
<!-- 添加预览弹窗 -->
|
||||
<el-dialog
|
||||
@@ -44,27 +44,30 @@ export default {
|
||||
AddRule // 注册 AddRule 组件
|
||||
},
|
||||
props: {
|
||||
visible: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
},
|
||||
form: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
tableData: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [{}],
|
||||
visible: false,
|
||||
form: {
|
||||
// 表单数据
|
||||
},
|
||||
tableData: [
|
||||
// 表格数据示例
|
||||
{ id: 1, name: 'Item 1', selected: false },
|
||||
{ id: 2, name: 'Item 2', selected: false },
|
||||
{ id: 3, name: 'Item 3', selected: false }
|
||||
],
|
||||
addRuleVisible: false, // 控制 AddRule 组件的显示状态
|
||||
previewDialogVisible: false // 控制预览弹窗的显示状态
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(){
|
||||
this.visible = true;
|
||||
},
|
||||
close(){
|
||||
this.visible = false;
|
||||
},
|
||||
handlePreview(row) {
|
||||
// 预览逻辑
|
||||
console.log('Preview', row);
|
||||
@@ -78,7 +81,8 @@ export default {
|
||||
this.$emit('update:visible', false)
|
||||
},
|
||||
addRule() {
|
||||
this.addRuleVisible = true; // 显示 AddRule 组件
|
||||
this.$refs.addRule.init()
|
||||
// this.addRuleVisible = true; // 显示 AddRule 组件
|
||||
},
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?')
|
||||
@@ -94,35 +98,29 @@ export default {
|
||||
{
|
||||
type: 'selection',
|
||||
prop: 'knowledgeName',
|
||||
width: '200px',
|
||||
align: 'center',
|
||||
render: (h, params) => {
|
||||
return h('div', [h('span', params.row.knowledgeName)])
|
||||
}
|
||||
width: '50',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
key: '知识拆分规则名称',
|
||||
prop: 'knowledgeName',
|
||||
width: '200px',
|
||||
align: 'center',
|
||||
render: (h, params) => {
|
||||
return h('div', [h('span', params.row.knowledgeName)])
|
||||
}
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
key: '规则内容',
|
||||
prop: 'knowledgeName',
|
||||
width: '200px',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
key: '备注',
|
||||
prop: 'knowledgeDesc'
|
||||
prop: 'knowledgeDesc',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
key: '操作',
|
||||
prop: 'knowledgeDesc',
|
||||
width: '200px',
|
||||
width: '150px',
|
||||
align: 'center',
|
||||
render: (h, params) => {
|
||||
return h('span', {}, [
|
||||
h(
|
||||
|
||||
116
src/views/knowledge/detail/components/split/SplitConfig.vue
Normal file
116
src/views/knowledge/detail/components/split/SplitConfig.vue
Normal file
@@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<div class="splitConfig mt20">
|
||||
<p class="title">
|
||||
文件拆分规则:
|
||||
</p>
|
||||
<ul>
|
||||
<!-- 自动拆分 -->
|
||||
<li class="flex" :class="activeIndex === index ? 'active' : ''" v-for="(item, index) in splitOptions" :key="index" @click="handleClick(index)">
|
||||
<div>
|
||||
<svg v-if="index === 0" t="1744335709188" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2464" width="32" height="32"><path d="M933.868272 511.691752a140.807706 140.807706 0 0 1 90.131728-131.067068 525.562914 525.562914 0 0 0-57.334136-138.64997 139.882962 139.882962 0 0 1-184.948826-184.948826A525.562914 525.562914 0 0 0 643.067068 0a140.376159 140.376159 0 0 1-262.134136 0A525.562914 525.562914 0 0 0 242.282962 57.334136a139.882962 139.882962 0 0 1-184.948826 184.948826A506.698134 506.698134 0 0 0 0 380.932932a140.376159 140.376159 0 0 1 0 262.134136 525.562914 525.562914 0 0 0 57.334136 138.64997 139.882962 139.882962 0 0 1 184.948826 184.948826 525.562914 525.562914 0 0 0 138.64997 57.334136 140.376159 140.376159 0 0 1 262.134136 0 525.562914 525.562914 0 0 0 138.64997-57.334136 139.882962 139.882962 0 0 1 184.948826-184.948826 506.698134 506.698134 0 0 0 57.334136-138.64997A140.807706 140.807706 0 0 1 933.868272 511.691752zM511.691752 652.437809A140.437809 140.437809 0 1 1 652.437809 511.691752 140.499458 140.499458 0 0 1 511.691752 652.437809z" fill="#1D85ED" p-id="2465"></path></svg>
|
||||
<svg v-if="index === 1" t="1744335834635" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7994" width="32" height="32"><path d="M746 181.1c10.3 0 19.4 6.1 23.3 15.6l1 2.3 1.2 2.2 110.4 210c2.9 8.6 0.9 18.3-5.3 25l-0.6 0.7-0.6 0.7-344.5 401.9c-6.4 6.7-14.1 7.7-18.2 7.7s-11.7-1-18.2-7.7L150.1 437.6l-0.6-0.7-0.6-0.7c-6.2-6.8-8.2-16.4-5.3-25l110.4-210 1.2-2.2 1-2.3c3.9-9.5 13.1-15.6 23.3-15.6H746m0-54.6H279.4c-32.3 0-61.4 19.5-73.8 49.3L93.8 388.7c-11.9 28.7-6 61.6 14.9 84.4l345.2 402.7c15.8 17.3 37.3 25.9 58.9 25.9 21.5 0 43-8.6 58.9-25.9l345.2-402.7c20.9-22.9 26.8-55.8 14.9-84.4l-112-212.9c-12.3-29.8-41.5-49.3-73.8-49.3z" p-id="7995" fill="#d81e06"></path><path d="M513.9 524.6c-19.1 0-37.5-8.1-50.4-22.2l-97.7-106.7c-10.2-11.1-9.4-28.4 1.7-38.5 11.1-10.2 28.4-9.4 38.5 1.7l97.7 106.7c3.6 3.9 7.9 4.5 10.2 4.5 2.3 0 6.6-0.6 10.2-4.5l95.5-104.2c10.2-11.1 27.4-11.9 38.5-1.7 11.1 10.2 11.9 27.4 1.7 38.5l-95.5 104.2c-13 14.1-31.3 22.2-50.4 22.2z" p-id="7996" fill="#d81e06"></path></svg>
|
||||
</div>
|
||||
<div class="block">
|
||||
<h3>{{ item.title }}</h3>
|
||||
<p class="tips">{{ item.description }}</p>
|
||||
<p v-if="item.tip" class="tips">{{ item.tip }}</p>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- 弹窗组件 -->
|
||||
<custom-split-dialog
|
||||
class="active"
|
||||
ref="customTable">
|
||||
</custom-split-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CustomSplitDialog from './CustomSplitDialog.vue';
|
||||
|
||||
export default {
|
||||
name: 'splitConfig',
|
||||
components: {
|
||||
CustomSplitDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
activeIndex: 0,
|
||||
splitOptions: [
|
||||
{
|
||||
icon: 'el-icon-setting',
|
||||
title: '自动拆分',
|
||||
description: '使用系统默认的拆分方式,适合新手或紧急任务,直接使用系统优化后的算法处理文本。',
|
||||
tip: '提示:首次使用时建议先用自动拆分测试效果,再决定是否调整。'
|
||||
},
|
||||
{
|
||||
icon: 'el-icon-medal',
|
||||
title: '自定义拆分',
|
||||
description: '使用自定义拆分方式可以根据具体需求灵活调整文本分割逻辑,但需要权衡灵活性与复杂度,需要用户具备一定的规则定制经验。',
|
||||
tip: ''
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
props: {},
|
||||
watch: {},
|
||||
filters: {},
|
||||
methods: {
|
||||
handleClick(index) {
|
||||
this.activeIndex = index;
|
||||
if (index === 1) {
|
||||
this.$refs.customTable.init()
|
||||
} else {
|
||||
this.$refs.customTable.close()
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
mounted() {},
|
||||
computed: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
.splitConfig {
|
||||
.title {
|
||||
font-size: 15px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 10px;
|
||||
|
||||
li {
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid #d9d9d9;
|
||||
padding: 15px;
|
||||
border-radius: 6px;
|
||||
list-style-type: none;
|
||||
width: 80%;
|
||||
|
||||
p {
|
||||
margin: 10px 0;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
.block{
|
||||
margin-left: 20px;
|
||||
h3 {
|
||||
margin-bottom: 20px;
|
||||
font-size: 18px;
|
||||
color: #333;
|
||||
}
|
||||
.tips{
|
||||
color: #9E9E9E;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
.active{
|
||||
border: 1px solid #409EFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
132
src/views/knowledge/detail/components/words/AddRule.vue
Normal file
132
src/views/knowledge/detail/components/words/AddRule.vue
Normal file
@@ -0,0 +1,132 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 添加预处理结果预览对话框 -->
|
||||
<el-drawer
|
||||
title="添加知识拆分规则"
|
||||
:visible.sync="dialogVisible"
|
||||
size="50%">
|
||||
<div class="content">
|
||||
<el-form ref="ruleForm" :model="form" :rules="rules" label-width="120px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="规则名称" prop="ruleName">
|
||||
<el-input v-model="form.ruleName" placeholder="请输入规则名称"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-select v-model="form.ruleName" placeholder="查询并导入现有规则"></el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<p class="tips">支持中文、英文、数字、下划线(_),50个字符以内,不能以下划线为开头</p>
|
||||
<div v-for="(rule, index) in form.rules" :key="index">
|
||||
<el-form-item label="属性" :prop="'rules.' + index + '.style'">
|
||||
<el-input v-model="rule.style" placeholder="请输入属性"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="属性描述" :prop="'rules.' + index + '.style'">
|
||||
<el-input v-model="rule.style" placeholder="请输入属性描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="关键词" :prop="'rules.' + index + '.style'">
|
||||
<el-input v-model="rule.style" placeholder="请输入关键词"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="题词示例" :prop="'rules.' + index + '.style'">
|
||||
<el-input v-model="rule.style" placeholder="请输入题词示例"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="提示词" :prop="'rules.' + index + '.promptWord'">
|
||||
<el-input type="textarea" v-model="rule.promptWord" placeholder="请输入提示词"></el-input>
|
||||
</el-form-item>
|
||||
<div class="text-right mb20">
|
||||
<el-button type="primary" size="medium" @click="copyRule">复制题词规则</el-button>
|
||||
<el-button type="primary" size="medium" @click="addSplitRule">+ 新增题词规则</el-button>
|
||||
<el-button v-if="form.rules.length > 1" type="danger" size="small" @click="removeRule(index)">删除题词规则</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'AddRule',
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
form: {
|
||||
rules: [
|
||||
{
|
||||
ruleName: '',
|
||||
style: '',
|
||||
promptWord: '',
|
||||
remark: ''
|
||||
}
|
||||
]
|
||||
},
|
||||
rules: {
|
||||
ruleName: [
|
||||
{ required: true, message: '请输入规则名称', trigger: 'blur' }
|
||||
],
|
||||
rules: {
|
||||
required: true,
|
||||
type: 'array',
|
||||
fields: {
|
||||
style: [
|
||||
{ required: true, message: '请选择样式', trigger: 'change' }
|
||||
],
|
||||
promptWord: [
|
||||
{ required: true, message: '请输入提示词', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
queryExistingRules() {
|
||||
// 查询并导入现有规则的逻辑
|
||||
},
|
||||
// 复制
|
||||
copyRule(){
|
||||
|
||||
},
|
||||
// 新增
|
||||
addSplitRule() {
|
||||
this.form.rules.push({
|
||||
ruleName: '',
|
||||
style: '',
|
||||
promptWord: '',
|
||||
remark: ''
|
||||
});
|
||||
},
|
||||
removeRule(index) {
|
||||
this.form.rules.splice(index, 1);
|
||||
},
|
||||
deleteSplitRule() {
|
||||
// 删除拆分规则的逻辑
|
||||
console.log('删除题词规则');
|
||||
},
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?')
|
||||
.then(_ => {
|
||||
done();
|
||||
})
|
||||
.catch(_ => {});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
.content{
|
||||
padding: 20px;
|
||||
.tips{
|
||||
font-size: 14px ;
|
||||
color: #999;
|
||||
margin-left: 120px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
165
src/views/knowledge/detail/components/words/CustomWords.vue
Normal file
165
src/views/knowledge/detail/components/words/CustomWords.vue
Normal file
@@ -0,0 +1,165 @@
|
||||
<template>
|
||||
<div v-if="visible">
|
||||
<el-form :model="form" label-width="100px">
|
||||
<!-- 表单内容 -->
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="知识拆分规则">
|
||||
<el-input v-model="form.field1" size="medium" placeholder="请输入知识拆分规则"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-button type="primary" size="medium" @click="addRule" class="ml20">+ 新增规则</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 其他表单项 -->
|
||||
</el-form>
|
||||
<r-table :columns="columns" :data="tableData" :deletion="false"></r-table>
|
||||
<!-- 添加 AddRule 组件 -->
|
||||
<add-rule ref="addRule"></add-rule>
|
||||
|
||||
<!-- 添加预览弹窗 -->
|
||||
<el-dialog
|
||||
title="拆分结果预览"
|
||||
:visible.sync="previewDialogVisible"
|
||||
width="60%">
|
||||
<div class="preview-content">
|
||||
<!-- 预览内容区域 -->
|
||||
这里是预览的内容
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="medium" type="primary" @click="previewDialogVisible = false">确定</el-button>
|
||||
<el-button size="medium" @click="previewDialogVisible = false">取消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddRule from './AddRule.vue'; // 导入 AddRule 组件
|
||||
|
||||
export default {
|
||||
name: 'CustomSplitDialog',
|
||||
components: {
|
||||
AddRule // 注册 AddRule 组件
|
||||
},
|
||||
props: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
form: {
|
||||
// 表单数据
|
||||
},
|
||||
tableData: [
|
||||
// 表格数据示例
|
||||
{ id: 1, name: 'Item 1', selected: false },
|
||||
{ id: 2, name: 'Item 2', selected: false },
|
||||
{ id: 3, name: 'Item 3', selected: false }
|
||||
],
|
||||
addRuleVisible: false, // 控制 AddRule 组件的显示状态
|
||||
previewDialogVisible: false // 控制预览弹窗的显示状态
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(){
|
||||
this.visible = true;
|
||||
},
|
||||
close(){
|
||||
this.visible = false;
|
||||
},
|
||||
handlePreview(row) {
|
||||
// 预览逻辑
|
||||
console.log('Preview', row);
|
||||
this.previewDialogVisible = true; // 显示预览弹窗
|
||||
},
|
||||
handleEdit(row) {
|
||||
// 修改逻辑
|
||||
console.log('Edit', row)
|
||||
},
|
||||
closeDialog() {
|
||||
this.$emit('update:visible', false)
|
||||
},
|
||||
addRule() {
|
||||
this.$refs.addRule.init()
|
||||
// this.addRuleVisible = true; // 显示 AddRule 组件
|
||||
},
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?')
|
||||
.then(_ => {
|
||||
done();
|
||||
})
|
||||
.catch(_ => {});
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
columns() {
|
||||
return [
|
||||
{
|
||||
type: 'selection',
|
||||
prop: 'knowledgeName',
|
||||
width: '50',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
key: '知识拆分规则名称',
|
||||
prop: 'knowledgeName',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
key: '规则内容',
|
||||
prop: 'knowledgeName',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
key: '备注',
|
||||
prop: 'knowledgeDesc',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
key: '操作',
|
||||
prop: 'knowledgeDesc',
|
||||
width: '150px',
|
||||
align: 'center',
|
||||
render: (h, params) => {
|
||||
return h('span', {}, [
|
||||
h(
|
||||
'el-button',
|
||||
{
|
||||
class: 'floatSpan',
|
||||
props: {
|
||||
type: 'primary',
|
||||
size: 'medium'
|
||||
},
|
||||
on: {
|
||||
click: () => this.handleEdit(params.row)
|
||||
}
|
||||
},
|
||||
'修改'
|
||||
),
|
||||
h(
|
||||
'el-button',
|
||||
{
|
||||
class: 'floatSpan',
|
||||
props: {
|
||||
type: 'primary',
|
||||
size: 'medium'
|
||||
},
|
||||
on: {
|
||||
click: () => this.handlePreview(params.row)
|
||||
}
|
||||
},
|
||||
'预览'
|
||||
)
|
||||
])
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
// 样式可以根据需要调整
|
||||
</style>
|
||||
@@ -1,15 +1,116 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="container">
|
||||
</div>
|
||||
<div class="splitConfig mt20">
|
||||
<p class="title">
|
||||
文件题词规则:
|
||||
</p>
|
||||
<ul>
|
||||
<!-- 自动题词 -->
|
||||
<li class="flex" :class="activeIndex === index ? 'active' : ''" v-for="(item, index) in splitOptions" :key="index" @click="handleClick(index)">
|
||||
<div>
|
||||
<svg v-if="index === 0" t="1744335709188" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2464" width="32" height="32"><path d="M933.868272 511.691752a140.807706 140.807706 0 0 1 90.131728-131.067068 525.562914 525.562914 0 0 0-57.334136-138.64997 139.882962 139.882962 0 0 1-184.948826-184.948826A525.562914 525.562914 0 0 0 643.067068 0a140.376159 140.376159 0 0 1-262.134136 0A525.562914 525.562914 0 0 0 242.282962 57.334136a139.882962 139.882962 0 0 1-184.948826 184.948826A506.698134 506.698134 0 0 0 0 380.932932a140.376159 140.376159 0 0 1 0 262.134136 525.562914 525.562914 0 0 0 57.334136 138.64997 139.882962 139.882962 0 0 1 184.948826 184.948826 525.562914 525.562914 0 0 0 138.64997 57.334136 140.376159 140.376159 0 0 1 262.134136 0 525.562914 525.562914 0 0 0 138.64997-57.334136 139.882962 139.882962 0 0 1 184.948826-184.948826 506.698134 506.698134 0 0 0 57.334136-138.64997A140.807706 140.807706 0 0 1 933.868272 511.691752zM511.691752 652.437809A140.437809 140.437809 0 1 1 652.437809 511.691752 140.499458 140.499458 0 0 1 511.691752 652.437809z" fill="#1D85ED" p-id="2465"></path></svg>
|
||||
<svg v-if="index === 1" t="1744335834635" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7994" width="32" height="32"><path d="M746 181.1c10.3 0 19.4 6.1 23.3 15.6l1 2.3 1.2 2.2 110.4 210c2.9 8.6 0.9 18.3-5.3 25l-0.6 0.7-0.6 0.7-344.5 401.9c-6.4 6.7-14.1 7.7-18.2 7.7s-11.7-1-18.2-7.7L150.1 437.6l-0.6-0.7-0.6-0.7c-6.2-6.8-8.2-16.4-5.3-25l110.4-210 1.2-2.2 1-2.3c3.9-9.5 13.1-15.6 23.3-15.6H746m0-54.6H279.4c-32.3 0-61.4 19.5-73.8 49.3L93.8 388.7c-11.9 28.7-6 61.6 14.9 84.4l345.2 402.7c15.8 17.3 37.3 25.9 58.9 25.9 21.5 0 43-8.6 58.9-25.9l345.2-402.7c20.9-22.9 26.8-55.8 14.9-84.4l-112-212.9c-12.3-29.8-41.5-49.3-73.8-49.3z" p-id="7995" fill="#d81e06"></path><path d="M513.9 524.6c-19.1 0-37.5-8.1-50.4-22.2l-97.7-106.7c-10.2-11.1-9.4-28.4 1.7-38.5 11.1-10.2 28.4-9.4 38.5 1.7l97.7 106.7c3.6 3.9 7.9 4.5 10.2 4.5 2.3 0 6.6-0.6 10.2-4.5l95.5-104.2c10.2-11.1 27.4-11.9 38.5-1.7 11.1 10.2 11.9 27.4 1.7 38.5l-95.5 104.2c-13 14.1-31.3 22.2-50.4 22.2z" p-id="7996" fill="#d81e06"></path></svg>
|
||||
</div>
|
||||
<div class="block">
|
||||
<h3>{{ item.title }}</h3>
|
||||
<p class="tips">{{ item.description }}</p>
|
||||
<p v-if="item.tip" class="tips">{{ item.tip }}</p>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- 弹窗组件 -->
|
||||
<custom-split-dialog
|
||||
class="active"
|
||||
ref="customTable">
|
||||
</custom-split-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CustomSplitDialog from './CustomWords.vue';
|
||||
|
||||
export default {
|
||||
name: 'splitConfig',
|
||||
components: {
|
||||
CustomSplitDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
activeIndex: 0,
|
||||
splitOptions: [
|
||||
{
|
||||
icon: 'el-icon-setting',
|
||||
title: '自动题词',
|
||||
description: '使用系统默认的题词方式,适合新手或紧急任务,直接使用系统预设题词规则处理文本。',
|
||||
tip: '提示:首次使用时建议先用自动题词测试效果,再决定是否调整。'
|
||||
},
|
||||
{
|
||||
icon: 'el-icon-medal',
|
||||
title: '自定义题词',
|
||||
description: '使用自定义题词方式可以根据具体需求灵活调整文本分割逻辑,但需要权衡灵活性与复杂度,需要用户具备一定的题词经验。',
|
||||
tip: ''
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
props: {},
|
||||
watch: {},
|
||||
filters: {},
|
||||
methods: {
|
||||
handleClick(index) {
|
||||
this.activeIndex = index;
|
||||
if (index === 1) {
|
||||
this.$refs.customTable.init()
|
||||
} else {
|
||||
this.$refs.customTable.close()
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
mounted() {},
|
||||
computed: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
.splitConfig {
|
||||
.title {
|
||||
font-size: 15px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 10px;
|
||||
|
||||
<style scoped lang="scss">
|
||||
li {
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid #d9d9d9;
|
||||
padding: 15px;
|
||||
border-radius: 6px;
|
||||
list-style-type: none;
|
||||
width: 80%;
|
||||
|
||||
p {
|
||||
margin: 10px 0;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
.block{
|
||||
margin-left: 20px;
|
||||
h3 {
|
||||
margin-bottom: 20px;
|
||||
font-size: 18px;
|
||||
color: #333;
|
||||
}
|
||||
.tips{
|
||||
color: #9E9E9E;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
.active{
|
||||
border: 1px solid #409EFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,43 +1,51 @@
|
||||
<template>
|
||||
<div class='container create-container'>
|
||||
<div class="container create-container">
|
||||
<el-card shadow="hover">
|
||||
<div slot="header" class="clearfix">
|
||||
<h3>创建知识库</h3>
|
||||
|
||||
</div>
|
||||
<div class='card-body'>
|
||||
<el-steps :active="active" simple finish-status="success" >
|
||||
<div class="card-body">
|
||||
<el-steps :active="active" simple finish-status="success">
|
||||
<el-step title="文件上传/预处理"></el-step>
|
||||
<el-step title="拆分配置"></el-step>
|
||||
<el-step title="题词配置"></el-step>
|
||||
</el-steps>
|
||||
|
||||
<div class='components'>
|
||||
<step-preprocessing v-if='active===0' @getForm='getForm'></step-preprocessing>
|
||||
<split-config v-if='active===1'></split-config>
|
||||
<div class="components">
|
||||
<step-preprocessing v-if="active === 0" @getForm="getForm"></step-preprocessing>
|
||||
<split-config v-if="active === 1"></split-config>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class='card-bottom'>
|
||||
<el-button type="primary" size='medium' @click='fetchApi'>一键处理</el-button>
|
||||
<el-button type="primary" size='medium' @click='active++' v-if='active<2'>下一步</el-button>
|
||||
<el-button type="primary" size='medium' v-if='active === 2'>确定</el-button>
|
||||
<el-button type="primary" size='medium' @click='active--' v-if='active>=1'>上一步</el-button>
|
||||
<el-button type="primary" size='medium' >取消</el-button>
|
||||
<div class="card-bottom">
|
||||
<el-button type="primary" size="medium" @click="fetchApi">一键处理</el-button>
|
||||
<el-button type="primary" size="medium" @click="active++" v-if="active < 2">下一步</el-button>
|
||||
<el-button type="primary" size="medium" v-if="active === 2">确定</el-button>
|
||||
<el-button type="primary" size="medium" @click="active--" v-if="active >= 1">上一步</el-button>
|
||||
<el-button type="primary" size="medium">取消</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-drawer :visible.sync="visible" size="80%" title="预处理结果预览">
|
||||
<div class="mv10 mh20 text-right">
|
||||
<el-button type="primary" size="medium">保存并处理</el-button>
|
||||
<el-button size="medium">取消</el-button>
|
||||
</div>
|
||||
<div style="height:calc(100% - 55px);">
|
||||
<r-miner-u></r-miner-u>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import StepPreprocessing from './components/preprocessing.vue'
|
||||
import SplitConfig from "@/views/knowledge/detail/components/SplitConfig.vue";
|
||||
// import StepC
|
||||
import SplitConfig from '@/views/knowledge/detail/components/split/SplitConfig.vue'
|
||||
export default {
|
||||
name: 'create',
|
||||
data() {
|
||||
return {
|
||||
active:0
|
||||
visible: true,
|
||||
active: 0
|
||||
}
|
||||
},
|
||||
props: {},
|
||||
@@ -48,33 +56,34 @@ export default {
|
||||
},
|
||||
filters: {},
|
||||
methods: {
|
||||
getForm(){},
|
||||
fetchApi(){
|
||||
|
||||
},
|
||||
},
|
||||
created() {
|
||||
},
|
||||
mounted() {
|
||||
getForm() {},
|
||||
fetchApi() {}
|
||||
},
|
||||
created() {},
|
||||
mounted() {},
|
||||
computed: {}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang='scss'>
|
||||
/deep/ .card-bottom{
|
||||
position: relative;
|
||||
width: 100%;
|
||||
padding-top: 20px;
|
||||
&::after{
|
||||
content: '';
|
||||
border-top: 1px solid #ebeef5;
|
||||
position: absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
width:100%
|
||||
}
|
||||
& .el-button{
|
||||
<style scoped lang="scss">
|
||||
/deep/.el-drawer__header {
|
||||
margin-bottom: unset;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
}
|
||||
/deep/ .card-bottom {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
padding-top: 10px;
|
||||
&::after {
|
||||
content: '';
|
||||
border-top: 1px solid #ebeef5;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
}
|
||||
& .el-button {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -93,10 +93,14 @@ export default {
|
||||
},
|
||||
// 保存知识库标题
|
||||
saveKnowledgeName(){
|
||||
let { datasetId } = this.$route.query
|
||||
this.knowledgeName = this.copyKnowledgeName
|
||||
// 调用update接口
|
||||
datasetUpdate({
|
||||
|
||||
name:this.knowledgeName,
|
||||
description:this.knowledgeDesc,
|
||||
segmentedMode:this.segmentedMode,
|
||||
id:datasetId,
|
||||
}).then(res=>{
|
||||
this.editKnowledge = false
|
||||
})
|
||||
@@ -108,19 +112,21 @@ export default {
|
||||
|
||||
// 跳转去上传文件
|
||||
jumpAddKnowledge() {
|
||||
let { datasetId } = this.$route.query
|
||||
this.$router.push({
|
||||
path: '/knowledge/detail/create',
|
||||
query: {
|
||||
datasetId: ''
|
||||
datasetId: datasetId
|
||||
}
|
||||
})
|
||||
},
|
||||
// 跳转到知识库编辑
|
||||
jumpEditKnowledge(){
|
||||
let { datasetId } = this.$route.query
|
||||
this.$router.push({
|
||||
path: '/knowledge/knowledge-create',
|
||||
query: {
|
||||
datasetId: ''
|
||||
datasetId: datasetId
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
</div>
|
||||
<div class="item-bottom mt20">
|
||||
<el-button type="text" class="fs14" @click="knowLedgeDetail(item)">查看详情</el-button>
|
||||
<el-button type="text" class="fs14">修改</el-button>
|
||||
<el-button type="text" class="fs14 danger">删除</el-button>
|
||||
<el-button type="text" class="fs14" @click='createdKnowLedge(item)'>修改</el-button>
|
||||
<el-button type="text" class="fs14 danger" @click='deleteKnowLedge(item)'>删除</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
@@ -49,7 +49,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { docManageDataset } from '@/api/generatedApi/index'
|
||||
import { docManageDataset,datasetDelete } from '@/api/generatedApi/index'
|
||||
import knowledgeForm from '@/views/knowledge/detail/components/knowledgeForm.vue'
|
||||
|
||||
export default {
|
||||
@@ -82,11 +82,11 @@ export default {
|
||||
this.datasetList = res.content.content
|
||||
})
|
||||
},
|
||||
createdKnowLedge() {
|
||||
createdKnowLedge(item) {
|
||||
this.$router.push({
|
||||
path: '/knowledge/knowledge-create',
|
||||
query: {
|
||||
datasetId: ''
|
||||
query:{
|
||||
datasetId: item?item.id:null
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -97,6 +97,22 @@ export default {
|
||||
datasetId: item.id
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteKnowLedge(item) {
|
||||
this.$confirm('此操作将永久删除该知识库, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
datasetDelete({id: item.id}).then(res => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
})
|
||||
this.getList()
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
|
||||
Reference in New Issue
Block a user