将知识挖掘从主流程里独立出来

This commit is contained in:
wu.jifen
2025-06-19 18:02:06 +08:00
parent 26892f7a7e
commit 6957d4dad8
8 changed files with 478 additions and 289 deletions

View File

@@ -28,6 +28,15 @@ export function extractEmbedding(data) {
}) })
} }
// 上传到知识库 - 拆分和题词内容
export function splitAndExtractEmbedding(data) {
return request({
url: getUrl(`/datasetDocumentEx/splitAndExtract/embedding`),
method: 'post',
data
})
}
// 上传到知识库 - 原文件 // 上传到知识库 - 原文件
export function directEmbedding(data) { export function directEmbedding(data) {
return request({ return request({
@@ -72,3 +81,12 @@ export function extractSegmentEstimate(data) {
data data
}) })
} }
// 分段预览-拆分和题词题词内容
export function splitAndExtractSegmentEstimate(data) {
return request({
url: getUrl(`/datasetDocumentEx/splitAndExtract/segment_estimate`),
method: 'post',
data
})
}

View File

@@ -1,6 +1,6 @@
import config from '@/config' import config from '@/config'
import urlMap from '@/config/urlMap' import urlMap from '@/config/urlMap'
export default function getUrl(url, domainType = 'admin') { export default function getUrl(url, domainType = 'jifen') {
let domain = '' let domain = ''
// if (domainType === 'admin') { // if (domainType === 'admin') {
// domain = config.admin // domain = config.admin

View File

@@ -1,7 +1,7 @@
let envInfo = process.env let envInfo = process.env
let [admin, jifen, zixi, hz] = [ let [admin, jifen, zixi, hz] = [
envInfo.VUE_APP_ADMIN, envInfo.VUE_APP_ADMIN,
'http://192.168.8.58:7196/', 'http://192.168.8.65:7196/',
'http://192.168.8.165:7196/', 'http://192.168.8.165:7196/',
'http://10.147.17.161:7196/' 'http://10.147.17.161:7196/'
] ]

View File

@@ -1,124 +1,129 @@
import layout from '@/views/app/layout/layout.vue' import layout from "@/views/app/layout/layout.vue";
import redirect from '@/views/app/redirect/index.vue' import redirect from "@/views/app/redirect/index.vue";
const home = () => import('@/views/app/Home')
const home = () => import("@/views/app/Home");
export default [ export default [
{ {
path: '/', path: "/",
component: layout, component: layout,
redirect: '/home', redirect: "/home",
name: 'home', name: "home",
meta: { meta: {
title: '主页', title: "主页",
icon: 'icon-zhuye', icon: "icon-zhuye",
affix: true affix: true
}, },
children: [ children: [
{ {
path: '/home', path: "/home",
name: 'home-page', name: "home-page",
component: home, component: home,
meta: { meta: {
title: '主页', title: "主页",
icon: 'icon-zhuye' icon: "icon-zhuye"
} }
} }
] ]
}, },
{ {
path: '/knowledge', path: "/knowledge",
name: 'knowledge', name: "knowledge",
component: layout, component: layout,
redirect: '/knowledge/list', redirect: "/knowledge/list",
meta: { meta: {
title: 'AI知识库', title: "AI知识库",
icon: 'el-icon-s-home', icon: "el-icon-s-home",
affix: true affix: true
}, },
children: [ children: [
{ {
path: '/knowledge/list', path: "/knowledge/list",
name: 'knowledge-list', name: "knowledge-list",
component: redirect, component: redirect,
// redirect: '/knowledge/list', // redirect: '/knowledge/list',
meta: { meta: {
title: '知识库', title: "知识库",
icon: 'icon-dengpao1', icon: "icon-dengpao1",
affix: true affix: true
}, },
children: [ children: [
{ {
path: '/knowledge/list', path: "/knowledge/list",
name: 'knowledge-home', name: "knowledge-home",
component: () => import('@/views/knowledge/index.vue'), component: () => import("@/views/knowledge/index.vue"),
meta: { meta: {
breadcrumb: false, breadcrumb: false,
title: '知识库', title: "知识库",
icon: 'el-icon-s-home' icon: "el-icon-s-home"
} }
}, },
{ {
path: '/knowledge/detail', path: "/knowledge/detail",
name: 'knowledge-detail', name: "knowledge-detail",
component: redirect, component: redirect,
redirect: '/knowledge/detail', redirect: "/knowledge/detail",
hidden: true, hidden: true,
meta: { meta: {
title: '知识库详情', title: "知识库详情",
icon: 'el-icon-s-home' icon: "el-icon-s-home"
}, },
children: [ children: [
{ {
path: '/knowledge/knowledge-create', path: "/knowledge/knowledge-create",
name: 'knowledge-create', name: "knowledge-create",
component: () => component: () =>
import('@/views/knowledge/detail/components/knowledgeForm.vue'), import("@/views/knowledge/detail/components/knowledgeForm.vue"),
meta: { meta: {
breadcrumb: false, breadcrumb: false,
title: '知识库详情', title: "知识库详情",
icon: 'el-icon-s-home' icon: "el-icon-s-home"
} }
}, },
{ {
path: '/knowledge/detail', path: "/knowledge/detail",
name: 'knowledge-detail-page', name: "knowledge-detail-page",
component: () => import('@/views/knowledge/detail/index.vue'), component: () => import("@/views/knowledge/detail/index.vue"),
meta: { meta: {
breadcrumb: false, breadcrumb: false,
title: '知识库详情', title: "知识库详情",
icon: 'el-icon-s-home' icon: "el-icon-s-home"
} }
}, },
{ {
path: '/knowledge/detail/create', path: "/knowledge/detail/create",
name: 'knowledge-create-page', name: "knowledge-create-page",
component: () => import('@/views/knowledge/detail/create.vue'), component: () => import("@/views/knowledge/detail/create.vue"),
meta: { meta: {
title: '知识库新增', title: "知识库新增",
icon: 'el-icon-s-home' icon: "el-icon-s-home"
}
},
{
path: "/knowledge/detail/customWord",
name: "custom-word",
component: () => import("@/views/knowledge/detail/components/words/WordIndex.vue")
},
{
path: "/knowledge/reviewKnowledge",
name: "knowledge-review-knowledge",
component: () =>
import("@/views/knowledge/detail/reviewKnowledge.vue"),
meta: {
title: "直接上传至知识库",
icon: "el-icon-s-home"
} }
}, },
{ {
path: '/knowledge/reviewKnowledge', path: "/knowledge/detail/segments",
name: 'knowledge-review-knowledge', name: "knowledge-segments",
component: () => component: () =>
import('@/views/knowledge/detail/reviewKnowledge.vue'), import("@/views/knowledge/detail/components/viewSegments/index.vue"),
meta: { meta: {
title: '直接上传至知识库', title: "分段查看",
icon: 'el-icon-s-home' icon: "el-icon-s-home"
}
},
{
path: '/knowledge/detail/segments',
name: 'knowledge-segments',
component: () =>
import('@/views/knowledge/detail/components/viewSegments/index.vue'),
meta: {
title: '分段查看',
icon: 'el-icon-s-home'
} }
} }
] ]
@@ -126,58 +131,58 @@ export default [
] ]
}, },
{ {
path: '/knowledge/track', path: "/knowledge/track",
name: 'knowledge-track', name: "knowledge-track",
component: redirect, component: redirect,
redirect: '/knowledge/track', redirect: "/knowledge/track",
meta: { meta: {
title: '任务轨迹', title: "任务轨迹",
icon: 'icon-dingwei', icon: "icon-dingwei",
affix: true affix: true
}, },
children: [ children: [
{ {
path: '/knowledge/track', path: "/knowledge/track",
name: 'track-page', name: "track-page",
component: () => import('@/views/track/Index.vue'), component: () => import("@/views/track/Index.vue"),
meta: { meta: {
breadcrumb: false, breadcrumb: false,
title: '任务轨迹', title: "任务轨迹",
icon: 'icon-dingwei' icon: "icon-dingwei"
} }
}, },
{ {
path: '/rules', path: "/rules",
name: 'rules-page', name: "rules-page",
component: () => import('@/views/rules/Index.vue'), component: () => import("@/views/rules/Index.vue"),
hidden: true, hidden: true,
meta: { meta: {
title: '规则管理', title: "规则管理",
icon: 'el-icon-s-home' icon: "el-icon-s-home"
} }
} }
] ]
}, },
{ {
path: '/knowledge/rule', path: "/knowledge/rule",
name: 'knowledge-rule', name: "knowledge-rule",
component: redirect, component: redirect,
redirect: '/knowledge/rule', redirect: "/knowledge/rule",
meta: { meta: {
title: '规则管理', title: "规则管理",
icon: 'icon-guizeshezhi', icon: "icon-guizeshezhi",
affix: true affix: true
}, },
children: [ children: [
{ {
path: '/knowledge/rule', path: "/knowledge/rule",
name: 'rule-page', name: "rule-page",
component: () => import('@/views/rules/Index.vue'), component: () => import("@/views/rules/Index.vue"),
meta: { meta: {
title: '规则管理', title: "规则管理",
icon: 'el-icon-s-home' icon: "el-icon-s-home"
} }
} }
] ]
@@ -186,103 +191,103 @@ export default [
}, },
// 智能体详情 // 智能体详情
{ {
path: '/agent', path: "/agent",
name: 'agent', name: "agent",
component: layout, component: layout,
redirect: '/agent/:thirdAppId/workflow', redirect: "/agent/:thirdAppId/workflow",
meta: { meta: {
title: '智能体', title: "智能体",
icon: 'icon-notebook', icon: "icon-notebook",
affix: true affix: true
}, },
children: [ children: [
{ {
path: '/agent/:thirdAppId/workflow', path: "/agent/:thirdAppId/workflow",
name: 'agent-workflow', name: "agent-workflow",
component: () => import('@/views/agent/views/workflow/index.vue'), component: () => import("@/views/agent/views/workflow/index.vue"),
meta: { meta: {
title: 'agent', title: "agent",
icon: 'icon-notebook' icon: "icon-notebook"
} }
} }
] ]
}, },
{ {
path: '/system', path: "/system",
name: 'system', name: "system",
component: layout, component: layout,
redirect: '/system/user', redirect: "/system/user",
meta: { meta: {
title: '系统管理', title: "系统管理",
icon: 'el-icon-setting', icon: "el-icon-setting",
affix: true affix: true
}, },
children: [ children: [
{ {
path: '/system/user', path: "/system/user",
name: 'system-user', name: "system-user",
component: () => import('@/views/system/user/index.vue'), component: () => import("@/views/system/user/index.vue"),
meta: { meta: {
title: '用户管理', title: "用户管理",
icon: 'el-icon-user' icon: "el-icon-user"
} }
}, },
{ {
path: '/system/menu', path: "/system/menu",
name: 'system-menu', name: "system-menu",
component: () => import('@/views/system/menu/index.vue'), component: () => import("@/views/system/menu/index.vue"),
meta: { meta: {
title: '菜单管理', title: "菜单管理",
icon: 'el-icon-s-tools' icon: "el-icon-s-tools"
} }
}, },
{ {
path: '/system/role', path: "/system/role",
name: 'system-role', name: "system-role",
component: () => import('@/views/system/role/index.vue'), component: () => import("@/views/system/role/index.vue"),
meta: { meta: {
title: '角色管理', title: "角色管理",
icon: 'el-icon-s-custom' icon: "el-icon-s-custom"
} }
} }
] ]
}, },
{ {
path: '/intelligentAgent', path: "/intelligentAgent",
name: 'intelligentAgent', name: "intelligentAgent",
component: layout, component: layout,
redirect: '/intelligentAgent/list', redirect: "/intelligentAgent/list",
meta: { meta: {
title: 'AI智能体', title: "AI智能体",
icon: 'icon-notebook', icon: "icon-notebook",
affix: true affix: true
}, },
children: [ children: [
{ {
path: '/intelligentAgent/list', path: "/intelligentAgent/list",
name: 'intelligentAgent-list', name: "intelligentAgent-list",
component: () => import('@/views/intelligent-agent/index.vue'), component: () => import("@/views/intelligent-agent/index.vue"),
meta: { meta: {
title: 'AI智能体', title: "AI智能体",
icon: 'icon-notebook', icon: "icon-notebook",
accessToken: '', accessToken: "",
refreshToken: '' refreshToken: ""
} }
}, },
{ {
path: '/intelligentAgent/logs-overview', path: "/intelligentAgent/logs-overview",
name: 'intelligentAgent-logs-overview', name: "intelligentAgent-logs-overview",
component: () => component: () =>
import('@/views/intelligent-agent/children/Logs&overview/index.vue'), import("@/views/intelligent-agent/children/Logs&overview/index.vue"),
hidden: true, hidden: true,
meta: { meta: {
title: '日志与监测', title: "日志与监测",
icon: 'icon-notebook', icon: "icon-notebook",
accessToken: '', accessToken: "",
refreshToken: '' refreshToken: ""
} }
} }
] ]
} }
] ];

View File

@@ -1,89 +1,116 @@
<template> <template>
<div class="splitConfig mt20"> <div class='splitConfig mt20'>
<ul class="flex"> <div v-if='!isRedig && digRes.length'>
<!-- 自动题词 --> <div class='preview-content'>
<li <template v-if='digRes && digRes.length > 0'>
class="flex" <r-table
:class="activeIndex === index ? 'active' : ''" :columns='columns'
v-for="(item, index) in splitOptions" :data='digRes'
:key="index" :deletion='false'
@click="handleClick(index)" ></r-table>
> </template>
<div> <el-empty
<svg v-else-if='!extractResults || extractResults.length === 0'
v-if="index === 0" description='暂无题词结果'
t="1744335709188" ></el-empty>
class="icon" </div>
viewBox="0 0 1024 1024" </div>
version="1.1" <div v-else>
xmlns="http://www.w3.org/2000/svg" <ul class='flex'>
p-id="2464" <!-- 自动题词 -->
width="32" <li
height="32" class='flex'
> :class="activeIndex === index ? 'active' : ''"
<path v-for='(item, index) in splitOptions'
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" :key='index'
fill="#1D85ED" @click='handleClick(index)'
p-id="2465" >
></path> <div>
</svg> <svg
<svg v-if='index === 0'
v-if="index === 1" t='1744335709188'
t="1744335834635" class='icon'
class="icon" viewBox='0 0 1024 1024'
viewBox="0 0 1024 1024" version='1.1'
version="1.1" xmlns='http://www.w3.org/2000/svg'
xmlns="http://www.w3.org/2000/svg" p-id='2464'
p-id="7994" width='32'
width="32" height='32'
height="32" >
> <path
<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'
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" fill='#1D85ED'
p-id="7995" p-id='2465'
fill="#d81e06" ></path>
></path> </svg>
<path <svg
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" v-if='index === 1'
p-id="7996" t='1744335834635'
fill="#d81e06" class='icon'
></path> viewBox='0 0 1024 1024'
</svg> version='1.1'
</div> xmlns='http://www.w3.org/2000/svg'
<div class="block"> p-id='7994'
<h3>{{ item.title }}</h3> width='32'
<p class="tips">{{ item.description }}</p> height='32'
<p v-if="item.tip" class="tips">{{ item.tip }}</p> >
</div> <path
</li> 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'
</ul> p-id='7995'
<!-- 弹窗组件 --> fill='#d81e06'
<custom-split-dialog class="active" ref="customTable"> ></path>
</custom-split-dialog> <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>
<!-- 添加题词预览组件 --> <!-- 添加题词预览组件 -->
<extract-preview <extract-preview
:visible.sync="previewVisible" style='z-index: 2010'
:extract-results="extractResults" :visible.sync='previewVisible'
:is-auto-extract="activeIndex === 0" :extract-results='extractResults'
:loading="previewLoading" :is-auto-extract='activeIndex === 0'
:documentList="documentList" :loading='previewLoading'
@confirm="handlePreviewConfirm" :documentList='documentList'
/> @confirm='handlePreviewConfirm'
/>
</div>
<div class='card-bottom text-right mt10'>
<el-button size='medium' @click='redig'>重新挖掘</el-button>
<el-button
type='primary'
size='medium'
@click='nextStep(documentExtractId)'
>确定</el-button>
</div>
</div> </div>
</template> </template>
<script> <script>
import CustomSplitDialog from './CustomWords.vue' import CustomSplitDialog from "./CustomWords.vue";
import ExtractPreview from './ExtractPreview.vue' import ExtractPreview from "./ExtractPreview.vue";
import { import {
execExtract, execExtract,
getExtractResultList, getExtractResultList,
saveContentToDocument saveContentToDocument
} from '@/api/generatedApi' } from "@/api/generatedApi";
export default { export default {
name: 'splitConfig', name: "splitConfig",
components: { components: {
CustomSplitDialog, CustomSplitDialog,
ExtractPreview ExtractPreview
@@ -97,38 +124,45 @@ export default {
previewLoading: false, previewLoading: false,
splitOptions: [ splitOptions: [
{ {
icon: 'el-icon-setting', icon: "el-icon-setting",
title: '自动题词', title: "立即挖掘",
description: description:
'使用系统默认的题词方式,适合新手或紧急任务,直接使用系统预设题词规则处理文本。', "使用系统默认的题词方式,适合新手或紧急任务,直接使用系统预设题词规则处理文本。",
tip: '提示:首次使用时建议先用自动题词测试效果,再决定是否调整。' tip: "提示:首次使用时建议先用自动题词测试效果,再决定是否调整。"
}, },
{ {
icon: 'el-icon-medal', icon: "el-icon-medal",
title: '自定义题词', title: "自定义规则",
description: description:
'使用自定义题词方式可以根据具体需求灵活调整文本分割逻辑。', "使用自定义题词方式可以根据具体需求灵活调整文本分割逻辑。",
tip: '但需要权衡灵活性与复杂度,需要用户具备一定的题词经验。' tip: "但需要权衡灵活性与复杂度,需要用户具备一定的题词经验。"
} }
], ],
documentId: '' isRedig: false,
} // 题词结果
digRes: [],
documentId: ""
};
}, },
props: { props: {
documentList: { documentList: {
type: Array, type: Array,
default: () => [] default: () => []
},
documentExtractId: {
type: String,
default: () => ""
} }
}, },
watch: {}, watch: {},
filters: {}, filters: {},
methods: { methods: {
handleClick(index) { handleClick(index) {
this.activeIndex = index this.activeIndex = index;
if (index === 1) { if (index === 1) {
this.$refs.customTable.init() this.$refs.customTable.init();
} else { } else {
this.$refs.customTable.close() this.$refs.customTable.close();
} }
}, },
@@ -137,67 +171,67 @@ export default {
let params = { let params = {
documentId: documentId, documentId: documentId,
beAuto: this.activeIndex === 0 beAuto: this.activeIndex === 0
} };
let splitDocIds = documentId.split(',') let splitDocIds = documentId.split(",");
if (splitDocIds.length > 1) { if (splitDocIds.length > 1) {
params.documentId = undefined params.documentId = undefined;
params.documentIds = splitDocIds params.documentIds = splitDocIds;
} }
if (!params.beAuto && this.$refs.customTable.ruleId) { if (!params.beAuto && this.$refs.customTable.ruleId) {
params.rulesId = this.$refs.customTable.ruleId params.rulesId = this.$refs.customTable.ruleId;
} }
return params return params;
}, },
// 执行题词操作 // 执行题词操作
async execExtractOperation(params) { async execExtractOperation(params) {
if (!params.beAuto && !params.rulesId) { if (!params.beAuto && !params.rulesId) {
this.$message.error('请勾选数据') this.$message.error("请勾选数据");
return false return false;
} }
const res = await execExtract(params) const res = await execExtract(params);
if (res.content.result !== '0') { if (res.content.result !== "0") {
throw new Error(res.content.resultMessage || '执行题词失败') throw new Error(res.content.resultMessage || "执行题词失败");
} }
return res.content.content return res.content.content;
}, },
// 显示预览 // 显示预览
showExtractPreview(results) { showExtractPreview(results) {
this.extractResults = results || [] this.extractResults = results || [];
this.previewVisible = true this.previewVisible = true;
}, },
// 获取题词结果列表 - 修改后的方法 // 获取题词结果列表 - 修改后的方法
async getExtractResultOperation(documentId) { async getExtractResultOperation(documentId) {
if (documentId) { if (documentId) {
this.documentId = documentId this.documentId = this.documentExtractId;
} }
this.previewLoading = true // this.previewLoading = true
const params = { documentId } const params = { documentId: this.documentExtractId };
const res = await getExtractResultList(params) const res = await getExtractResultList(params);
if (res.content.result !== '0') { if (res.content.result !== "0") {
throw new Error(res.content.resultMessage || '获取题词结果失败') throw new Error(res.content.resultMessage || "获取题词结果失败");
} }
const results = res.content.content || [] this.digRes = res.content.content || [];
// 显示预览弹窗 // 显示预览弹窗
this.showExtractPreview(results) // this.showExtractPreview(results)
}, },
// 处理预览确认 // 处理预览确认
handlePreviewConfirm(extractResults) { handlePreviewConfirm(extractResults) {
this.$router.push({ this.$router.push({
path: '/knowledge/reviewKnowledge', path: "/knowledge/reviewKnowledge",
query: { query: {
documentId: this.documentId, documentId: this.documentId,
datasetId: this.$route.query.datasetId, datasetId: this.$route.query.datasetId,
active: '3' active: "3"
} }
}) });
// this.saveContentToDocumentOperation(this.documentId, extractResults) // this.saveContentToDocumentOperation(this.documentId, extractResults)
}, },
@@ -210,55 +244,99 @@ export default {
attribute: item.attribute, attribute: item.attribute,
attributeContent: item.attributeContent attributeContent: item.attributeContent
})) }))
} };
const res = await saveContentToDocument(params) const res = await saveContentToDocument(params);
// 使用 push 的方式返回,防止出现页面异常跳转的问题 // 使用 push 的方式返回,防止出现页面异常跳转的问题
// this.$router.go(-1) // this.$router.go(-1)
this.$router.push({ this.$router.push({
path: '/knowledge/detail', path: "/knowledge/detail",
query: { ...this.$route.query } query: { ...this.$route.query }
}) });
}, },
// 主方法 // 主方法
nextStep(documentId) { async nextStep(documentId) {
this.documentId = documentId this.documentId = documentId;
return new Promise(async (resolve, reject) => { this.$router.push({
try { path: "/knowledge/detail/create",
// 1. 执行题词 query: {
const params = this.buildExecExtractParams(documentId) ...this.$route.query,
this.execExtractOperation(params).then(async res => { documentId: this.documentId,
if (res) { activeLevel: this.isRedig ? 1 : 2
// await this.getExtractResultOperation(documentId)
// 显示预览弹窗
this.showExtractPreview(res)
}
})
} catch (error) {
console.error('题词操作失败:', error)
reject({
success: false,
message: error.message || '题词操作失败'
})
} }
}) });
// return new Promise(async (resolve, reject) => {
// try {
// // 1. 执行题词
// const params = this.buildExecExtractParams(documentId)
// this.execExtractOperation(params).then(async res => {
// if (res) {
// await this.getExtractResultOperation(documentId)
// // 显示预览弹窗
// // this.showExtractPreview(res)
// }
// })
// } catch (error) {
// console.error('题词操作失败:', error)
// reject({
// success: false,
// message: error.message || '题词操作失败'
// })
// }
// })
},
redig() {
this.isRedig = !this.isRedig;
} }
}, },
created() {}, created() {
mounted() {}, this.getExtractResultOperation();
computed: {} },
} mounted() {
},
computed: {
columns: vm => {
return [
{
prop: "attribute",
label: "属性",
width: 90
},
{
prop: "attributeContent",
label: "题词内容",
render: (h, p) => {
return h("el-input", {
props: {
value: p.row.attributeContent,
size: "medium",
disabled: !vm.isEdit
},
on: {
input: value => {
p.row.attributeContent = value;
}
}
});
}
}
];
}
}
};
</script> </script>
<style scoped lang="scss"> <style scoped lang='scss'>
@import '@/assets/sass/renderSass/theme.scss'; @import '@/assets/sass/renderSass/theme.scss';
.splitConfig { .splitConfig {
.title { .title {
font-size: 20px; font-size: 20px;
margin: 10px 0; margin: 10px 0;
font-weight: bold; font-weight: bold;
} }
ul { ul {
list-style-type: none; list-style-type: none;
padding: 10px; padding: 10px;
@@ -276,17 +354,21 @@ export default {
font-size: 14px; font-size: 14px;
color: #666; color: #666;
} }
.block { .block {
margin-left: 20px; margin-left: 20px;
h3 { h3 {
margin-bottom: 20px; margin-bottom: 20px;
font-size: 16px; font-size: 16px;
color: #333; color: #333;
} }
.tips { .tips {
color: #9e9e9e; color: #9e9e9e;
} }
} }
&.active { &.active {
border: 1px solid var(--color-primary); border: 1px solid var(--color-primary);
//background: #fefefe; //background: #fefefe;

View File

@@ -29,7 +29,7 @@
<div class="icon-text" v-else>2</div> <div class="icon-text" v-else>2</div>
</template> </template>
</el-step> </el-step>
<el-step title="题词拆分配置"> <el-step title="直接上传至知识库">
<template slot="icon"> <template slot="icon">
<div class="icon-text" v-if="active === 2">STEP3</div> <div class="icon-text" v-if="active === 2">STEP3</div>
<div class="icon-text" v-else>3</div> <div class="icon-text" v-else>3</div>
@@ -64,15 +64,22 @@
@handleReUpload="handleReUpload" @handleReUpload="handleReUpload"
:documentId="documentId" :documentId="documentId"
></step-split-config> ></step-split-config>
<step-words <!-- <step-words-->
ref="words" <!-- ref="words"-->
<!-- v-if="active === 2"-->
<!-- :documentList="this.documentList"-->
<!-- ></step-words>-->
<review-knowledge
:documentId="documentId"
ref="reviewKnowledge"
v-if="active === 2" v-if="active === 2"
:documentList="this.documentList" :documentList="this.documentList"
></step-words> >
</review-knowledge>
</transition> </transition>
</div> </div>
</div> </div>
<div class="card-bottom text-right"> <div class="card-bottom text-right" v-if="active < 2">
<el-button size="medium" @click="$router.history.go(-1)">取消</el-button> <el-button size="medium" @click="$router.history.go(-1)">取消</el-button>
<el-button size="medium" @click="active--" v-if="active > 1" <el-button size="medium" @click="active--" v-if="active > 1"
>上一步</el-button >上一步</el-button
@@ -127,6 +134,8 @@ import SplitConfig from '@/views/knowledge/detail/components/split/Index.vue'
import Words from '@/views/knowledge/detail/components/words/Index.vue' import Words from '@/views/knowledge/detail/components/words/Index.vue'
import magic from '@/assets/images/konwledge/magic.png' import magic from '@/assets/images/konwledge/magic.png'
import { datasetDocumentEx, directEmbedding } from '@/api/generatedApi' import { datasetDocumentEx, directEmbedding } from '@/api/generatedApi'
import ReviewKnowledge from '@/views/knowledge/detail/reviewKnowledge.vue'
import router from '@/router'
// import StepC // import StepC
export default { export default {
name: 'create', name: 'create',
@@ -143,6 +152,7 @@ export default {
props: {}, props: {},
watch: {}, watch: {},
components: { components: {
ReviewKnowledge,
StepSplitConfig: SplitConfig, StepSplitConfig: SplitConfig,
StepPreprocessing, StepPreprocessing,
StepWords: Words StepWords: Words
@@ -219,6 +229,7 @@ export default {
}, },
async nextStep() { async nextStep() {
this.updateRouteParams()
if (this.active === 0) { if (this.active === 0) {
this.$refs.stepPreProcessing.uploadFiled() this.$refs.stepPreProcessing.uploadFiled()
} else if (this.active === 1) { } else if (this.active === 1) {
@@ -227,6 +238,15 @@ export default {
await this.$refs.words.nextStep(this.documentId) await this.$refs.words.nextStep(this.documentId)
} }
}, },
updateRouteParams() {
this.$router.replace({
query: {
...this.$route.query, // 保留当前所有查询参数
documentId: this.documentId, // 修改你需要的参数
active: this.active
}
})
},
// 预览完成 // 预览完成
handlePreviewConfirm() { handlePreviewConfirm() {
this.active = 2 this.active = 2
@@ -253,6 +273,7 @@ export default {
this.documentId = documentId this.documentId = documentId
await this.getDocumentId(documentId) await this.getDocumentId(documentId)
} }
// TODO case 2 控制台报错 Cannot read properties of undefined (reading 'getExtractResultOperation'
if (activeLevel !== undefined) { if (activeLevel !== undefined) {
this.active = Number(activeLevel) this.active = Number(activeLevel)
switch (this.active) { switch (this.active) {

View File

@@ -256,6 +256,20 @@
</el-drawer> </el-drawer>
<!--检索设置弹窗--> <!--检索设置弹窗-->
<search-setting ref="searchSetting"></search-setting> <search-setting ref="searchSetting"></search-setting>
<!--知识挖掘抽屉-->
<el-drawer
:title="knowledgeMiningDrawer.title"
:visible.sync="knowledgeMiningDrawer.visible"
size="45%"
:wrapperClosable="false"
>
<words
ref="words"
@openMetaDrawer="handleMetaData"
@close="close"
:document-extract-id="documentExtractId"
></words>
</el-drawer>
</div> </div>
</template> </template>
<script> <script>
@@ -281,6 +295,7 @@ import MetaData from '@/views/knowledge/detail/components/metaData/Index.vue'
import MetadataOperator from '@/views/knowledge/detail/components/metaData/MetadataOperator.vue' import MetadataOperator from '@/views/knowledge/detail/components/metaData/MetadataOperator.vue'
import SearchSetting from '@/views/knowledge/detail/components/SearchSetting/Index.vue' import SearchSetting from '@/views/knowledge/detail/components/SearchSetting/Index.vue'
import { displayStatus } from '@/assets/js/utils/utilOptions' import { displayStatus } from '@/assets/js/utils/utilOptions'
import Words from '@/views/knowledge/detail/components/words/Index.vue'
export default { export default {
name: 'index', name: 'index',
// 父子组件共享 // 父子组件共享
@@ -306,6 +321,10 @@ export default {
title: '标注元数据', title: '标注元数据',
visible: false visible: false
}, },
knowledgeMiningDrawer: {
title: '知识挖掘',
visible: false
},
activeName: -1, activeName: -1,
drawer: false, drawer: false,
drawerForm: false, drawerForm: false,
@@ -336,7 +355,8 @@ export default {
documentDetail: { documentDetail: {
splitRules: '', splitRules: '',
extractRules: '' extractRules: ''
} },
documentExtractId: ''
} }
}, },
props: {}, props: {},
@@ -347,7 +367,8 @@ export default {
hitTest, hitTest,
knowledgeForm, knowledgeForm,
DocumentDrawer, DocumentDrawer,
MetadataOperator MetadataOperator,
Words
}, },
methods: { methods: {
getUserData() { getUserData() {
@@ -521,6 +542,18 @@ export default {
} }
}) })
}, },
// 知识挖掘操作
handleKnoledgeMining(row) {
this.knowledgeMiningDrawer.visible = true
this.documentExtractId = row.id
// this.$nextTick(() => {
// if (this.$refs.metadataOperator) {
// // 如果需要初始化或传递数据,可以在这里处理
// // 例如传递当前行数据
// this.$refs.metadataOperator.init(row.id)
// }
// })
},
// 获取文档详细信息(包含分词规则和词频规则) // 获取文档详细信息(包含分词规则和词频规则)
getDocumentExInfo(documentId) { getDocumentExInfo(documentId) {
datasetDocumentEx({ documentId }) datasetDocumentEx({ documentId })
@@ -813,6 +846,24 @@ export default {
} }
// '标注元数据' // '标注元数据'
), ),
params.row.optStatus > 1
? h(
'el-button',
{
class: 'floatSpan',
props: {
type: 'primary',
size: 'mini',
icon: 'el-icon-cpu',
title: '知识挖掘'
},
on: {
click: () => this.handleKnoledgeMining(params.row)
}
}
// '知识挖掘'
)
: '',
params.row.optStatus < 4 params.row.optStatus < 4
? h( ? h(
'el-button', 'el-button',

View File

@@ -132,6 +132,12 @@
</div> </div>
<div class="buttons text-right"> <div class="buttons text-right">
<el-button class="line-button" size="medium" @click="saveUs"
>保存并处理拆分内容</el-button
>
<el-button class="line-button" size="medium" @click="saveUs"
>保存并处理题词内容</el-button
>
<el-button class="line-button" size="medium" @click="saveUs" <el-button class="line-button" size="medium" @click="saveUs"
>保存并处理</el-button >保存并处理</el-button
> >
@@ -236,8 +242,8 @@ import {
segmentEstimate, segmentEstimate,
preprocessSegmentEstimate, preprocessSegmentEstimate,
splitSegmentEstimate, splitSegmentEstimate,
extractSegmentEstimate extractSegmentEstimate, splitAndExtractEmbedding, splitAndExtractSegmentEstimate
} from '@/api/generatedApi/embedding' } from "@/api/generatedApi/embedding";
import MarkdownIt from 'markdown-it' import MarkdownIt from 'markdown-it'
import markdownItKatex from 'markdown-it-katex' import markdownItKatex from 'markdown-it-katex'
@@ -313,6 +319,9 @@ export default {
case '3': case '3':
api = extractSegmentEstimate api = extractSegmentEstimate
break break
case '4':
api = splitAndExtractSegmentEstimate
break
} }
api({ api({
documentId: splitDocIds[this.activeIndex], documentId: splitDocIds[this.activeIndex],
@@ -369,6 +378,9 @@ export default {
case '3': case '3':
api = extractEmbedding api = extractEmbedding
break break
case '4':
api = splitAndExtractEmbedding
break
} }
let params = { let params = {