mirror of
http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage.git
synced 2025-12-06 09:26:48 +08:00
feat(knowledge): 添加知识库关联智能体功能并优化分段查询接口
- 在知识库详情页面添加关联智能体列表 - 实现相关智能体的查询和展示功能 - 优化分段查询接口,改为 POST 请求 -调整分段搜索输入框样式和功能 - 移除不必要的控制台日志输出
This commit is contained in:
@@ -265,8 +265,8 @@ export function uploadFileByTemplate(data) {
|
||||
export function datasetQuerySegments(data) {
|
||||
return request({
|
||||
url: getUrl(`/datasetDocumentEx/querySegments`),
|
||||
method: 'get',
|
||||
params: data,
|
||||
method: 'post',
|
||||
data,
|
||||
noLoading: true
|
||||
})
|
||||
}
|
||||
@@ -474,6 +474,15 @@ export function switchStatus(data) {
|
||||
return request({
|
||||
url: getUrl(`/datasetDocumentEx/segment/switchStatus`),
|
||||
method: 'post',
|
||||
data
|
||||
data,
|
||||
noLoading: true
|
||||
})
|
||||
}
|
||||
// 知识库关联智能体
|
||||
export function relatedApps(data) {
|
||||
return request({
|
||||
url: getUrl(`/datasetsEx/relatedApps`),
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -96,8 +96,6 @@ export default {
|
||||
|
||||
// 当路由参数 id 变化时,更新 dify 的 src
|
||||
if (thirdAppId) {
|
||||
console.log(`current params:`, this.agent.params)
|
||||
|
||||
this.agent.src = `${DIFY_URL}/app/${thirdAppId}/workflow?${
|
||||
this.params
|
||||
}`
|
||||
|
||||
@@ -24,7 +24,6 @@ export default {
|
||||
watch: {
|
||||
'dialog.agent': {
|
||||
handler(val) {
|
||||
console.log(val)
|
||||
this.image = val.image
|
||||
this.imageType = val.imageType
|
||||
this.background = val.backgroundColor
|
||||
|
||||
@@ -283,7 +283,6 @@ export default {
|
||||
},
|
||||
async getRuleList() {
|
||||
let res = await getRulesList({ ruleType: 1 })
|
||||
console.log(res)
|
||||
this.ruleList = res.content.content
|
||||
},
|
||||
// 获取详情
|
||||
@@ -311,7 +310,6 @@ export default {
|
||||
})
|
||||
},
|
||||
queryExistingRules(val) {
|
||||
console.log(val)
|
||||
if (val) {
|
||||
this.getDetail(val)
|
||||
}
|
||||
|
||||
@@ -43,14 +43,23 @@
|
||||
segmentedMode | filterSegmentedMode
|
||||
}}</span>
|
||||
|
||||
<el-dropdown size="medium" placement="right">
|
||||
<span class="segment-content cursor-pointer">关联应用</span>
|
||||
<el-dropdown
|
||||
size="medium"
|
||||
placement="right"
|
||||
v-if="relatedAppList.length > 0"
|
||||
@command="handleRelatedApp"
|
||||
>
|
||||
<span class="segment-content cursor-pointer"
|
||||
>{{ relatedAppList.length }} 个关联应用</span
|
||||
>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item>123</el-dropdown-item>
|
||||
<el-dropdown-item>123</el-dropdown-item>
|
||||
<el-dropdown-item>123</el-dropdown-item>
|
||||
<el-dropdown-item>123</el-dropdown-item>
|
||||
<el-dropdown-item>123</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
v-for="item in relatedAppList"
|
||||
:command="item"
|
||||
disabled
|
||||
>
|
||||
<span>{{ item.appName }}</span>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
@@ -258,7 +267,8 @@ import {
|
||||
datasetQuerySegments,
|
||||
datasetsExPages,
|
||||
datasetUpdate,
|
||||
getDatasetById
|
||||
getDatasetById,
|
||||
relatedApps
|
||||
} from '@/api/generatedApi'
|
||||
import { getUserList } from '@/api/generatedApi/system'
|
||||
import {
|
||||
@@ -284,6 +294,7 @@ export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
relatedAppList: [],
|
||||
displayStatus,
|
||||
hitTestConfig: {
|
||||
title: '命中测试',
|
||||
@@ -390,13 +401,6 @@ export default {
|
||||
// 跳转到知识库编辑
|
||||
jumpEditKnowledge() {
|
||||
this.drawerForm = true
|
||||
// let { datasetId } = this.$route.query
|
||||
// this.$router.push({
|
||||
// path: '/knowledge/knowledge-create',
|
||||
// query: {
|
||||
// datasetId: datasetId
|
||||
// }
|
||||
// })
|
||||
},
|
||||
/**
|
||||
* 检索设置
|
||||
@@ -479,26 +483,6 @@ export default {
|
||||
}
|
||||
this.drawer = true
|
||||
this.getDocumentExInfo(row.id)
|
||||
// // 调用查询分段信息接口
|
||||
// datasetQuerySegments({ documentId: row.id }).then(res => {
|
||||
// if (res) {
|
||||
// // this.descriptions = JSON.parse(
|
||||
// // JSON.stringify({
|
||||
// // dataset: {
|
||||
// // knowledgeName: this.knowledgeName,
|
||||
// // segmentedMode: this.segmentedMode,
|
||||
// // knowledgeImage: this.knowledgeImage
|
||||
// // },
|
||||
// // ...row,
|
||||
// // ...res.content.content
|
||||
// // })
|
||||
// // )
|
||||
// this.drawer = true
|
||||
//
|
||||
// // 调用datasetDocumentEx接口获取分词规则和词频规则
|
||||
// this.getDocumentExInfo(row.id)
|
||||
// }
|
||||
// })
|
||||
},
|
||||
|
||||
jumpToUpload(params) {
|
||||
@@ -609,6 +593,17 @@ export default {
|
||||
},
|
||||
close() {
|
||||
this.metadataOperatorDrawer.visible = false
|
||||
},
|
||||
|
||||
getRelatedApps() {
|
||||
relatedApps({ id: this.$route.query.datasetId }).then(res => {
|
||||
if (res) {
|
||||
this.relatedAppList = res.content.content.intelligentAppDTOS
|
||||
}
|
||||
})
|
||||
},
|
||||
handleRelatedApp(item) {
|
||||
// console.log(item)
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
@@ -636,14 +631,16 @@ export default {
|
||||
this.getKnowledgeFiledList()
|
||||
// 获取用户下拉列表
|
||||
this.getUserData()
|
||||
let documentId = sessionStorage.getItem('documentId')
|
||||
if (documentId) {
|
||||
setTimeout(() => {
|
||||
let row = this.list.filter(item => item.id === documentId)
|
||||
this.viewDocumentDetail(row[0])
|
||||
sessionStorage.removeItem('documentId')
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
// 获取关联智能体
|
||||
this.getRelatedApps()
|
||||
// let documentId = sessionStorage.getItem('documentId')
|
||||
// if (documentId) {
|
||||
// setTimeout(() => {
|
||||
// let row = this.list.filter(item => item.id === documentId)
|
||||
// this.viewDocumentDetail(row[0])
|
||||
// sessionStorage.removeItem('documentId')
|
||||
// }, 1000)
|
||||
},
|
||||
computed: {
|
||||
datasetId() {
|
||||
|
||||
@@ -140,7 +140,8 @@ export default {
|
||||
knowledgeForm: {
|
||||
name: 'knowledgeForm',
|
||||
component: knowledgeForm
|
||||
}
|
||||
},
|
||||
relatedAppList: []
|
||||
}
|
||||
},
|
||||
props: {},
|
||||
@@ -160,6 +161,7 @@ export default {
|
||||
this.datasetList = res.content.content
|
||||
})
|
||||
},
|
||||
|
||||
createdKnowLedge(item) {
|
||||
this.datasetId = item ? item.id : ''
|
||||
this.drawer = true
|
||||
|
||||
@@ -113,11 +113,7 @@ export default {
|
||||
segmentIds: [id],
|
||||
status: state ? 0 : 1 //枚举值:0-启用 1-禁用
|
||||
}
|
||||
switchStatus(params).then(res => {
|
||||
if (res) {
|
||||
console.log(res)
|
||||
}
|
||||
})
|
||||
switchStatus(params)
|
||||
},
|
||||
|
||||
inputSegment() {
|
||||
@@ -213,8 +209,9 @@ export default {
|
||||
let params = {
|
||||
documentId: this.form.id,
|
||||
page: this.segmentPage,
|
||||
size: this.segmentLimit,
|
||||
pageSize: this.segmentLimit,
|
||||
keyword: this.keyWords
|
||||
// keyword: this.searchText
|
||||
}
|
||||
datasetQuerySegments(params).then(res => {
|
||||
this.descriptions = res.content.content
|
||||
@@ -307,7 +304,8 @@ export default {
|
||||
<el-input
|
||||
style="width: 50vh;"
|
||||
size="small"
|
||||
placeholder="分段搜索"
|
||||
placeholder="按下回车搜索分段内容"
|
||||
clearable
|
||||
v-model="searchText"
|
||||
@input="inputSegment"
|
||||
@keydown.enter.native="searchSegment"
|
||||
@@ -327,7 +325,7 @@ export default {
|
||||
<div
|
||||
v-if="descriptions"
|
||||
class="knowledge-content"
|
||||
v-loading="descriptions.data && descriptions.data.length <= 0"
|
||||
v-loading="!descriptions.data"
|
||||
>
|
||||
<q-a-model
|
||||
:class="segmentTotal > 0 ? '' : ''"
|
||||
@@ -335,14 +333,13 @@ export default {
|
||||
:descriptions="descriptions"
|
||||
:parentForm="form"
|
||||
:style="{
|
||||
height: segmentTotal > 10 ? 'calc(100% - 40px)' : '100%',
|
||||
height: 'calc(100% - 40px)',
|
||||
overflowX: 'hidden',
|
||||
overflowY: 'auto'
|
||||
}"
|
||||
/>
|
||||
|
||||
<div
|
||||
v-if="segmentTotal > 10"
|
||||
style="height: 40px;width:100%;position: sticky;bottom: -1px;color:Red;background: #fff;"
|
||||
class="flex align-items-c justify-content-b"
|
||||
>
|
||||
@@ -350,7 +347,6 @@ export default {
|
||||
<el-pagination
|
||||
background
|
||||
small
|
||||
hide-on-single-page
|
||||
@size-change="sizeChange"
|
||||
@current-change="currentChange"
|
||||
:total="segmentTotal"
|
||||
@@ -468,7 +464,7 @@ export default {
|
||||
|
||||
.knowledge-content {
|
||||
position: relative;
|
||||
height: calc(100vh - 270px);
|
||||
height: calc(100vh - 290px);
|
||||
overflow-y: auto;
|
||||
//&::-webkit-scrollbar {
|
||||
// width: 4px;
|
||||
@@ -477,7 +473,7 @@ export default {
|
||||
}
|
||||
|
||||
.full-height {
|
||||
height: calc(100vh - 270px);
|
||||
height: calc(100vh - 290px);
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user