mirror of
http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage.git
synced 2025-12-24 10:12:58 +08:00
feat(knowledge): 新增分段编辑功能并优化详情页面布局- 在 DocumentDrawer 组件中添加新增分段按钮
- 在 QAModel 和 TextModel 组件中增加分段操作功能 -优化 KnowledgeInfo 组件布局,调整 padding 值
This commit is contained in:
@@ -8,8 +8,8 @@
|
|||||||
>
|
>
|
||||||
<!-- drawer title -->
|
<!-- drawer title -->
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex align-items-">
|
<div class="flex align-items-c">
|
||||||
<div class="flex">
|
<div class="flex align-items-c">
|
||||||
<img
|
<img
|
||||||
:src="descriptions.dataset.knowledgeImage"
|
:src="descriptions.dataset.knowledgeImage"
|
||||||
alt=""
|
alt=""
|
||||||
@@ -20,6 +20,10 @@
|
|||||||
{{ descriptions.dataset.segmentedMode | filterSegmentedMode }}
|
{{ descriptions.dataset.segmentedMode | filterSegmentedMode }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
|
<el-button class="line-button ml40" size="medium" icon="el-icon-plus">
|
||||||
|
新增分段
|
||||||
|
</el-button>
|
||||||
|
|
||||||
<!-- <el-button class="line-button ml10" size="medium">元数据标注</el-button>-->
|
<!-- <el-button class="line-button ml10" size="medium">元数据标注</el-button>-->
|
||||||
|
|
||||||
<!-- <div class="ml10">-->
|
<!-- <div class="ml10">-->
|
||||||
|
|||||||
@@ -8,17 +8,42 @@
|
|||||||
:class="{ active: activeSegment === index }"
|
:class="{ active: activeSegment === index }"
|
||||||
@click="handleSegmentClick(index)"
|
@click="handleSegmentClick(index)"
|
||||||
>
|
>
|
||||||
<div>
|
<div class="flex align-items-c justify-content-b" style="gap: 8px">
|
||||||
<span class="el-icon-s-unfold"></span>
|
<div class="flex align-items-c " style="gap: 8px">
|
||||||
<span class="segment-number">分段 - {{ index + 1 }}</span> ·
|
<span class="el-icon-s-unfold"></span>
|
||||||
<span v-if="segment.word_count > 0"
|
<span class="segment-number">分段 - {{ index + 1 }}</span
|
||||||
>{{ segment.word_count }}个字符</span
|
>·
|
||||||
|
<span v-if="segment.word_count > 0"
|
||||||
|
>{{ segment.word_count }}个字符</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="actions ml10 flex align-items-c mr10"
|
||||||
|
style="gap: 10px"
|
||||||
|
v-if="!noEdit"
|
||||||
>
|
>
|
||||||
|
<!-- 删除 编辑-->
|
||||||
|
<!-- <el-icon class="el-icon-edit" @click.native.stop=""></el-icon>-->
|
||||||
|
<!-- <el-icon-->
|
||||||
|
<!-- class="el-icon-delete"-->
|
||||||
|
<!-- @click.native.stop="deleteSegment"-->
|
||||||
|
<!-- ></el-icon>-->
|
||||||
|
<!-- <el-switch-->
|
||||||
|
<!-- size="mini"-->
|
||||||
|
<!-- @click.native.stop=""-->
|
||||||
|
<!-- v-model="segment.enabled"-->
|
||||||
|
<!-- ></el-switch>-->
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="context">
|
|
||||||
<p>Q {{ segment.content }}</p>
|
<div>
|
||||||
<p>A {{ segment.answer }}</p>
|
<div class="context">
|
||||||
|
<p>Q {{ segment.content }}</p>
|
||||||
|
<p>A {{ segment.answer }}</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div class="segment-keywords flex" v-if="segment.keywords && segment.keywords.length">-->
|
<!-- <div class="segment-keywords flex" v-if="segment.keywords && segment.keywords.length">-->
|
||||||
<!-- <p v-for="(item, index) in segment.keywords" :key="index" class="mr10">#{{ item }}</p>-->
|
<!-- <p v-for="(item, index) in segment.keywords" :key="index" class="mr10">#{{ item }}</p>-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
@@ -74,7 +99,7 @@
|
|||||||
class="mr10"
|
class="mr10"
|
||||||
size="medium"
|
size="medium"
|
||||||
type="info"
|
type="info"
|
||||||
closable
|
:closable="!noEdit"
|
||||||
@close="tagClose(item)"
|
@close="tagClose(item)"
|
||||||
>
|
>
|
||||||
{{ item }}
|
{{ item }}
|
||||||
@@ -88,7 +113,7 @@
|
|||||||
@keyup.enter.native="handleInputConfirm"
|
@keyup.enter.native="handleInputConfirm"
|
||||||
/>
|
/>
|
||||||
<el-button
|
<el-button
|
||||||
v-else
|
v-if="!noEdit && !createdTag"
|
||||||
size="medium"
|
size="medium"
|
||||||
@click="showInput"
|
@click="showInput"
|
||||||
class="fs12"
|
class="fs12"
|
||||||
@@ -100,7 +125,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="dialog-footer text-right">
|
<div class="dialog-footer text-right">
|
||||||
<el-button @click="dialogVisible = false" size="medium">关闭</el-button>
|
<el-button @click="dialogVisible = false" size="medium">关闭</el-button>
|
||||||
<el-button @click="saveUS" size="medium" type="primary">保存</el-button>
|
<el-button @click="saveUS" size="medium" type="primary" v-if="!noEdit"
|
||||||
|
>保存</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</div>
|
</div>
|
||||||
@@ -111,6 +138,10 @@ import { segmentUpdate } from '@/api/generatedApi'
|
|||||||
export default {
|
export default {
|
||||||
name: 'QAModel',
|
name: 'QAModel',
|
||||||
props: {
|
props: {
|
||||||
|
noEdit: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
visible: Boolean,
|
visible: Boolean,
|
||||||
descriptions: {
|
descriptions: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -130,6 +161,14 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
deleteSegment() {
|
||||||
|
this.$messageBox(
|
||||||
|
() => {},
|
||||||
|
'是否删除当前分段,删除后不可恢复',
|
||||||
|
'warning',
|
||||||
|
'提示'
|
||||||
|
)
|
||||||
|
},
|
||||||
saveUS() {
|
saveUS() {
|
||||||
let params = {
|
let params = {
|
||||||
keywords: this.descriptions.data[this.activeSegment].keywords,
|
keywords: this.descriptions.data[this.activeSegment].keywords,
|
||||||
|
|||||||
@@ -9,18 +9,43 @@
|
|||||||
:class="{ active: activeSegment === index }"
|
:class="{ active: activeSegment === index }"
|
||||||
@click="handleSegmentClick(index)"
|
@click="handleSegmentClick(index)"
|
||||||
>
|
>
|
||||||
<!-- <el-checkbox class="mr pt15" :label="index">-->
|
<div class="flex align-items-c justify-content-b" style="gap: 8px">
|
||||||
<span class="el-icon-s-unfold"></span>
|
<div class="flex align-items-c " style="gap: 8px">
|
||||||
<span class="segment-number"
|
<!-- <el-checkbox class="mr pt15" :label="index">-->
|
||||||
>分段 - {{ (index + 1).toString().padStart(2, '0') }}</span
|
<span class="el-icon-s-unfold"></span>
|
||||||
>
|
<span class="segment-number"
|
||||||
<span v-if="segment.word_count > 0">
|
>分段 - {{ (index + 1).toString().padStart(2, '0') }}</span
|
||||||
· {{ segment.word_count }}个字符 ·</span
|
>
|
||||||
>
|
<span v-if="segment.word_count > 0">
|
||||||
<span> {{ 0 }} 次召回次数</span>
|
· {{ segment.word_count }}个字符 ·</span
|
||||||
|
>
|
||||||
|
<span> {{ segment.hit_count }} 次召回次数</span>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="actions ml10 flex align-items-c mr10"
|
||||||
|
style="gap: 10px"
|
||||||
|
v-if="!noEdit"
|
||||||
|
>
|
||||||
|
<!-- 删除 编辑-->
|
||||||
|
<!-- <el-icon class="el-icon-edit" @click.native.stop=""></el-icon>-->
|
||||||
|
<!-- <el-icon-->
|
||||||
|
<!-- class="el-icon-delete"-->
|
||||||
|
<!-- @click.native.stop="deleteSegment"-->
|
||||||
|
<!-- ></el-icon>-->
|
||||||
|
<!-- <el-switch-->
|
||||||
|
<!-- size="mini"-->
|
||||||
|
<!-- @click.native.stop=""-->
|
||||||
|
<!-- v-model="segment.enabled"-->
|
||||||
|
<!-- ></el-switch>-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- </el-checkbox>-->
|
<!-- </el-checkbox>-->
|
||||||
<div>
|
<div>
|
||||||
<p class="context">{{ segment.content }}</p>
|
<div>
|
||||||
|
<p class="context">{{ segment.content }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="segment-keywords flex"
|
class="segment-keywords flex"
|
||||||
v-if="segment.keywords && segment.keywords.length"
|
v-if="segment.keywords && segment.keywords.length"
|
||||||
@@ -73,7 +98,7 @@
|
|||||||
:key="index"
|
:key="index"
|
||||||
class="mr10 ellipsis"
|
class="mr10 ellipsis"
|
||||||
size="medium"
|
size="medium"
|
||||||
closable
|
:closable="!noEdit"
|
||||||
type="info"
|
type="info"
|
||||||
@close="tagClose(item)"
|
@close="tagClose(item)"
|
||||||
>
|
>
|
||||||
@@ -88,7 +113,7 @@
|
|||||||
@keyup.enter.native="handleInputConfirm"
|
@keyup.enter.native="handleInputConfirm"
|
||||||
/>
|
/>
|
||||||
<el-button
|
<el-button
|
||||||
v-else
|
v-if="!noEdit && !createdTag"
|
||||||
size="medium"
|
size="medium"
|
||||||
@click="showInput"
|
@click="showInput"
|
||||||
class="fs12"
|
class="fs12"
|
||||||
@@ -100,7 +125,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
<el-button @click="dialogVisible = false" size="medium">关闭</el-button>
|
<el-button @click="dialogVisible = false" size="medium">关闭</el-button>
|
||||||
<el-button @click="saveUS" size="medium" type="primary">保存</el-button>
|
<el-button @click="saveUS" size="medium" type="primary" v-if="!noEdit"
|
||||||
|
>保存</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</div>
|
</div>
|
||||||
@@ -111,6 +138,10 @@ import { segmentUpdate } from '@/api/generatedApi'
|
|||||||
export default {
|
export default {
|
||||||
name: 'TextModel',
|
name: 'TextModel',
|
||||||
props: {
|
props: {
|
||||||
|
noEdit: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
visible: Boolean,
|
visible: Boolean,
|
||||||
descriptions: {
|
descriptions: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -131,6 +162,15 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
deleteSegment() {
|
||||||
|
this.$messageBox(
|
||||||
|
() => {},
|
||||||
|
'是否删除当前分段,删除后不可恢复',
|
||||||
|
'warning',
|
||||||
|
'提示'
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
saveUS() {
|
saveUS() {
|
||||||
let params = {
|
let params = {
|
||||||
keywords: this.descriptions.data[this.activeSegment].keywords,
|
keywords: this.descriptions.data[this.activeSegment].keywords,
|
||||||
|
|||||||
@@ -330,6 +330,7 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<knowledge-info
|
<knowledge-info
|
||||||
|
:noEdit="true"
|
||||||
:form="activeForm"
|
:form="activeForm"
|
||||||
:fullscreen="true"
|
:fullscreen="true"
|
||||||
:key="activeForm.id"
|
:key="activeForm.id"
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
noEdit: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
fullscreen: {
|
fullscreen: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
@@ -166,11 +170,13 @@ export default {
|
|||||||
<div class="content-card el-card mt20">
|
<div class="content-card el-card mt20">
|
||||||
<div class="knowledge-content" v-if="descriptions">
|
<div class="knowledge-content" v-if="descriptions">
|
||||||
<text-model
|
<text-model
|
||||||
|
:noEdit="noEdit"
|
||||||
v-if="descriptions.doc_form === 'text_model'"
|
v-if="descriptions.doc_form === 'text_model'"
|
||||||
:descriptions="descriptions"
|
:descriptions="descriptions"
|
||||||
:parentForm="form"
|
:parentForm="form"
|
||||||
/>
|
/>
|
||||||
<q-a-model
|
<q-a-model
|
||||||
|
:noEdit="noEdit"
|
||||||
v-else-if="descriptions.doc_form === 'qa_model'"
|
v-else-if="descriptions.doc_form === 'qa_model'"
|
||||||
:descriptions="descriptions"
|
:descriptions="descriptions"
|
||||||
:parentForm="form"
|
:parentForm="form"
|
||||||
@@ -206,7 +212,7 @@ export default {
|
|||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.form-container {
|
.form-container {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 15px;
|
padding: 5px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
border: 1px solid #ebeef5;
|
border: 1px solid #ebeef5;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user