feat:ocr2.0开发

ocr_2.0
xiangcongshuai 6 months ago
parent 7076e54c4f
commit c4a9390f0b

@ -66,3 +66,11 @@ export function caseEvidenceVerify(data) {
data
})
}
/** 重新提取*/
export function caseEvidenceAnalysis(data) {
return request({
url: `/caseEvidence/analysis`,
method: 'get',
params: data
})
}

@ -72,3 +72,20 @@ export function addOrUpdPrompt(data) {
data
})
}
/** 提示词调试 */
export function promptDebugging(data) {
return request({
url: `/prompt/promptDebugging`,
method: 'post',
data
})
}
/** 详情 */
export function queryPromptDetails(data) {
return request({
url: `/prompt/getById`,
method: 'post',
data
})
}

@ -5,7 +5,7 @@ const network = {
// 默认的接口地址 如果是开发环境和生产环境走vab-mock-server当然你也可以选择自己配置成需要的接口地址
baseURL:
process.env.NODE_ENV === 'development'
? 'http://192.168.10.25:8097/fu-hsi-server'
? 'http://192.168.10.138:8097/fu-hsi-server'
: '/fuHsiApi',
// 配后端数据的接收方式application/json;charset=UTF-8或者application/x-www-form-urlencoded;charset=UTF-8
contentType: 'application/json;charset=UTF-8',

@ -0,0 +1,5 @@
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M20.7777 6.05V19.5556C20.7777 20.9 19.6777 22 18.3333 22H3.66661C2.32217 22 1.22217 20.9 1.22217 19.5556V2.44444C1.22217 1.1 2.32217 0 3.66661 0H14.7277L20.7777 6.05Z" fill="#D23B41"/>
<path d="M14.7278 4.82778V0L20.7778 6.05H15.95C15.2778 6.05 14.7278 5.5 14.7278 4.82778Z" fill="#9C171C"/>
<path d="M14.6153 14.2377C14.3598 14.212 14.105 14.1595 13.8496 14.0287C14.0787 13.9828 14.2816 13.9828 14.5108 13.9828C15.0211 13.9828 15.1194 14.1069 15.1194 14.1857C14.9691 14.2377 14.7919 14.2578 14.6153 14.2377ZM12.0168 13.904C11.4607 14.0287 10.8447 14.212 10.2886 14.4149V14.3623L10.2361 14.3886C10.5172 13.8258 10.7732 13.2428 11.0018 12.6537L11.0219 12.68L11.0476 12.6341C11.3293 13.0662 11.6893 13.4982 12.0688 13.8777H11.9906L12.0168 13.904ZM10.6944 8.96868C10.7207 8.9424 10.7732 8.9424 10.7922 8.9424H10.8716C11.0069 9.37438 10.9975 9.83872 10.8447 10.2648C10.6681 9.85846 10.5899 9.40073 10.6944 8.96868ZM7.5655 16.5489L7.48667 16.5752C7.71456 16.2455 8.03289 15.9887 8.40334 15.8357C8.20045 16.1688 7.91872 16.4242 7.5655 16.5489ZM14.5371 13.2165C13.9999 13.2165 13.4701 13.2953 12.9329 13.3937C12.295 12.8098 11.7616 12.1211 11.3556 11.3575C11.7877 9.93057 11.8139 8.96807 11.4797 8.50973C11.4021 8.40766 11.3023 8.32461 11.1878 8.2669C11.0734 8.20919 10.9472 8.17833 10.8191 8.17668C10.4915 8.1504 10.1835 8.30746 10.0332 8.58246C9.57484 9.34818 10.2361 10.8472 10.5441 11.4626C10.1835 12.5559 9.75206 13.5966 9.18861 14.6178C6.7735 15.6585 6.72095 16.2935 6.72095 16.5226C6.72095 16.8037 6.878 17.0855 7.153 17.2101C7.2575 17.2883 7.40845 17.314 7.53922 17.314C8.17478 17.314 8.91422 16.6008 9.6995 15.2002C10.6944 14.7944 11.6893 14.4668 12.7306 14.2377C13.2636 14.6824 13.9229 14.9481 14.6153 14.9973C15.0473 14.9973 15.8852 14.9973 15.8852 14.1332C15.9114 13.7995 15.7348 13.2428 14.5371 13.2165Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -227,8 +227,15 @@ export const asyncRoutes = [
path: '/add-prompt',
name: 'AddPrompt',
permission: 'p_promptManagement',
component: () => import('@/views/promptManagement/PromptConfig/add/index.vue'),
component: () => import('@/views/promptManagement/PromptConfig/add/add.vue'),
meta: { title: '新增提示词', affix: true }
},
{
path: '/edit-prompt/:id',
name: 'EditPrompt',
permission: 'p_promptManagement',
component: () => import('@/views/promptManagement/PromptConfig/add/edit.vue'),
meta: { title: '编辑提示词', affix: true }
}
]
},

@ -13,7 +13,7 @@
v-model="addInfo.directoryList"
style="width: 100%;"
:options="treeData"
:props="{ checkStrictly: true,label:'categoryName',children:'child',value:'id' }"
:props="{ label:'categoryName',children:'child',value:'id' }"
clearable
@change="selectDirectory"
/>
@ -39,7 +39,7 @@
</div>
</el-form-item>
<el-form-item label="模版类型" prop="type">
<el-input v-model="addInfo['type']" clearable placeholder="请输入" />
<el-input v-model="addInfo['type']" readonly placeholder="请输入" />
</el-form-item>
<el-form-item label="文件夹名称" prop="directoryName">
<el-input v-model="addInfo['directoryName']" clearable placeholder="请输入" />
@ -112,13 +112,18 @@ export default {
getCaseEvidenceTree({ caseId: this.caseId, caseType: 1 }).then(res => {
if (res.code === 200) {
this.treeData = res.data
for (let i = this.treeData.length - 1; i >= 0; i--) {
if (!this.treeData[i].child) {
this.treeData.splice(i, 1)
}
}
}
})
},
handleAdd() {
this.$refs.add.show()
},
selectDirectory(item) {
selectDirectory() {
const nodes = this.$refs.cascaderRef.getCheckedNodes()
console.log(nodes)
this.$set(this.addInfo, 'type', nodes[0].data.promptName)

@ -28,12 +28,13 @@
<div class="mid-content">
<div class="left">
<el-scrollbar v-if="selectList.length > 0" class="left-scroll">
<vuedraggable v-model="selectList" animation="400" class="img_list">
<vuedraggable v-model="selectList" animation="400" class="img_list" @end="handleDragEnd">
<div v-for="(item,index) in selectList" :key="index" class="img_item" :class="[item.fileId === selectInfo.fileId?'actived':'']">
<img v-if="['jpg', 'png'].includes(item.fileType)" :src="getImgUrl(item.fileId)" @click="selectItem(item)">
<img v-if="['jpg', 'png'].includes(item.fileType)" :src="getImgUrl(item.fileId)" @click="selectItem(index)">
</img>
<svg-icon v-if="[ 'doc', 'docx'].includes(item.fileType)" class="svg-img" icon-class="docx" />
<svg-icon v-if="[ 'doc', 'docx'].includes(item.fileType)" class="svg-img" icon-class="docx" @click="selectItem(index)" />
<svg-icon v-if="[ 'pdf'].includes(item.fileType)" class="svg-img" icon-class="pdf" @click="selectItem(index)" />
</div>
</vuedraggable>
@ -64,7 +65,7 @@
</div>
</div>
<div class="FormInfo">
<el-form ref="form" :model="selectInfo" :rules="rules" label-width="100px" style="margin-top: 10px">
<el-form v-if="level === '2'" ref="form" :model="selectInfo.evidenceInfo" :rules="rules" label-width="100px" style="margin-top: 10px">
<el-row :gutter="10" class="form-content">
<el-col :span="24">
<el-form-item label="证据名称" prop="title">
@ -72,11 +73,58 @@
</el-form-item>
</el-col>
</el-row>
<el-row v-if="selectInfo.evidenceInfo.property.length > 0" :gutter="10" class="form-content">
<el-row :gutter="10" class="form-content">
<el-col :span="24">
<el-form-item label="提供人" prop="provider">
<el-input v-model="selectInfo.evidenceInfo.provider" placeholder="请输入提供人" />
</el-form-item>
</el-col>
</el-row>
<el-row v-if="selectInfo.evidenceInfo.property" :gutter="10" class="form-content">
<el-col v-for="(item,index) in selectInfo.evidenceInfo.property" :key="index" :span="24">
<el-form-item :label="item.attrName">
<el-input v-if="item.attrValueType ==='text'" v-model="item.attrValue" placeholder="请输入" />
<el-form-item v-if="item.attrValueType" :label="item.attrName">
<el-input v-if="item.attrValueType ==='1'" v-model="item.attrValue" placeholder="请输入" />
<el-input v-if="item.attrValueType ==='2'" v-model="item.attrValue" type="number" placeholder="请输入" />
<el-date-picker
v-if="item.attrValueType ==='3'"
v-model="item.attrValue"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="date"
placeholder="选择日期"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-form v-if="level === '3'" ref="form" :model="evidenceInfo" :rules="rules" label-width="100px" style="margin-top: 10px">
<el-row :gutter="10" class="form-content">
<el-col :span="24">
<el-form-item label="证据名称" prop="title">
<el-input v-model="evidenceInfo.title" placeholder="请输入证据名称" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10" class="form-content">
<el-col :span="24">
<el-form-item label="提供人" prop="provider">
<el-input v-model="evidenceInfo.provider" placeholder="请输入提供人" />
</el-form-item>
</el-col>
</el-row>
<el-row v-if="evidenceInfo.property" :gutter="10" class="form-content">
<el-col v-for="(item,index) in evidenceInfo.property" :key="index" :span="24">
<el-form-item v-if="item.attrValueType" :label="item.attrName">
<el-input v-if="item.attrValueType ==='1'" v-model="item.attrValue" placeholder="请输入" />
<el-input v-if="item.attrValueType ==='2'" v-model="item.attrValue" type="number" placeholder="请输入" />
<el-date-picker
v-if="item.attrValueType ==='3'"
v-model="item.attrValue"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="date"
placeholder="选择日期"
/>
</el-form-item>
</el-col>
</el-row>
@ -106,6 +154,7 @@ export default {
caseNo: '',
caseName: '',
dataInfo: {},
evidenceInfo: undefined,
navList: [],
//
evidenceTypeList: JSON.parse(sessionStorage.getItem('evidence_type')),
@ -118,6 +167,7 @@ export default {
},
treeData: [],
flag: true,
level: '',
selectInfo: {
evidenceInfo: {
property: [],
@ -162,22 +212,19 @@ export default {
getImgUrl(id) {
return `${baseURL}${commonDownloadFile}${id}`
},
selectItem(item) {
this.selectInfo = item
selectItem(index) {
this.selectInfo = this.selectList[index]
this.activedImg = `${baseURL}${commonDownloadFile}${this.selectInfo.fileId}`
},
reset() {
this.getTreeList()
},
findNodeById(nodes, id) {
for (const node of nodes) {
if (node.id === id) {
return node
node.fileInfoList = this.selectList
} else if (node.child) {
const foundNode = this.findNodeById(node.child, id)
if (foundNode) {
return foundNode
}
this.findNodeById(node.child, id)
}
}
return null
@ -197,20 +244,21 @@ export default {
return null
},
handleNodeClick(data) {
this.selectId = data.id
// this.selectId = data.id
this.navList = []
this.navList = this.getParentNames(data, this.treeData)
const nodeItem = this.findNodeById(this.treeData, this.selectId)
if (nodeItem.fileInfoList.length === 0) {
const newNodeItem = this.getFileList(nodeItem.child)
this.$refs.tree.setCurrentKey(newNodeItem.id)
this.selectList = newNodeItem.fileInfoList
this.selectInfo = this.selectList[0]
const nodeItem = this.getFileList(this.treeData)
if (nodeItem.evidenceInfo) {
this.level = '3'
this.evidenceInfo = nodeItem.evidenceInfo
} else {
this.level = '2'
}
this.selectList = nodeItem.fileInfoList
this.selectInfo = this.selectList[0]
}
this.selectId = nodeItem.id
this.navList.push(data.directoryName)
this.$refs.tree.setCurrentKey(this.selectId)
},
checkEvidence(nodes) {
for (const item of nodes) {
@ -228,6 +276,9 @@ export default {
}
}
},
handleAdd() {
this.$refs.add.show()
},
save() {
this.checkEvidence(this.treeData)
if (this.flag) {
@ -249,7 +300,11 @@ export default {
this.$baseMessage.error('证据不能为空!')
}
},
handleDragEnd() {
this.findNodeById(this.treeData, this.selectId)
},
submit() {
console.log('2323', this.selectList)
this.save()
this.$emit('submit')
}
@ -298,7 +353,7 @@ export default {
display: flex;
flex: 1;
.left {
width: 55%;
margin-right: 24px;
position: relative;
// background: #F6F8F9;
@ -324,12 +379,13 @@ export default {
background: #F6F8F9;
width: 150px;
margin-right: 14px;
height: calc(100vh - 408px);
}
.act_img {
padding: 16px 28px;
flex: 1;
background: #F6F8F9;
height: calc(100vh - 420px);
height: calc(100vh - 472px);
background-size: 100% 100%;
display: flex;
align-items: center;
@ -343,7 +399,7 @@ export default {
}
}
.right {
width: 45%;
flex: 1;
position: relative;
border: 1px solid #DCE3EB;
display: flex;
@ -370,6 +426,7 @@ export default {
background: #F6F8F9;
border-radius: 8px 8px 8px 8px;
margin-left: 24px;
overflow-y: auto;
// height: calc(100vh - 350px);
padding: 0 24px;
margin-bottom: 72px;
@ -408,6 +465,10 @@ export default {
border-radius: 6px 6px 6px 6px;
border: 1px solid #D1D3D6;
cursor: move;
img {
width: 98px;
height: 138px;
}
}
.svg-img {
width: 98px;
@ -519,7 +580,7 @@ export default {
<style lang="scss" scoped>
::v-deep .el-textarea__inner {
height: calc(100vh - 450px);
height: calc(100vh - 472px);
border: none;
box-shadow: none;
}

@ -8,20 +8,20 @@
<template #status="{row}">
<div v-if="row.status === '2'" class="status">
<img src="@/assets/record/success.png" alt="">
<span>识别成功</span>
<span>处理完毕</span>
</div>
<div v-if="row.status === '3'" class="status">
<img src="@/assets/record/error.png" alt="">
<span>识别失败</span>
<span>处理失败</span>
</div>
<div v-if="row.status === '4'">
<img src="@/assets/record/success.png" alt="">
<span>已核实</span>
</div>
<!-- <div v-if="row.status === '0'">
<img src="@/assets/record/error.png" alt="">
<span>未识别</span>
</div> -->
<div v-if="row.status === '1' || row.status === '0'" class="status">
<!-- <img src="@/assets/record/error.png" alt=""> -->
<div v-loading="true" style="width: 20px;height: 20px;margin-right: 8px;position: relative;top: 12px;" />
<span>正在识别</span>
<span>处理中</span>
</div>
</template>
<template #opera="{ row, rowIndex}">
@ -72,10 +72,10 @@ export default {
{ title: '序号', type: 'seq', width: '80px' },
{ title: '证据名称', field: 'evidenceName' },
{ title: '附件名称', field: 'attachmentName' },
{ title: '模板类型', field: 'templateName',width:'200px' },
{ title: '证据类型', field: 'evidenceTypeName',width:'200px' },
{ title: '附件大小', field: 'attachmentSize',width:'150px' },
{ title: '状态', slots: { default: 'status' }, align: 'center' },
{ title: '模板类型', field: 'templateName', width: '200px' },
{ title: '证据类型', field: 'evidenceTypeName', width: '200px' },
{ title: '附件大小', field: 'attachmentSize', width: '150px' },
{ title: '状态', slots: { default: 'status' }, align: 'center' }
// { title: '', slots: { default: 'opera' }, fixed: 'right', width: '200px' }
],
data: [
@ -132,6 +132,16 @@ export default {
this.$router.push({ path: `/case-details/${this.$route.params.id}/${this.$route.query.caseName}`, query: { isEdit: 1, caseNo: this.$route.query.caseNo }})
},
next() {
let flag = true
this.gridOptions.data.forEach(e => {
if (e.status !== '2') {
flag = false
}
})
if (!flag) {
this.$baseMessage.error('有部分文件未识别成功!')
return
}
this.$emit('save', this.$route.query.recordId)
}
}

@ -1,5 +1,5 @@
<template>
<div class="UploadEvidence">
<div v-loading="loading" class="UploadEvidence">
<div class="left-tree">
<el-input
v-model="filterText"
@ -48,11 +48,12 @@
</div>
</div>
<div v-if="selectList.length > 0" class="file-content">
<vuedraggable v-model="selectList" animation="400" class="file-list">
<vuedraggable v-model="selectList" animation="400" class="file-list" @end="handleDragEnd">
<div v-for="(item,index) in selectList" :key="index" class="file-item" @click="selectItem(index)">
<div class="main-content">
<img v-if="item.type === 1" src="@/assets/file/type1.png" alt="">
<svg-icon v-if="item.type === 3" class="svg-img" icon-class="docx" />
<svg-icon v-if="item.type === 4" class="svg-img" icon-class="pdf" />
<img v-if="item.type === 2" class="file-img" :src="getImgUrl(item.fileId)" alt="">
</div>
<div class="footer">{{ item.fileName }}</div>
@ -92,7 +93,7 @@ export default {
//
uploadOption: {
action: `${baseURL}/minio/uploadFile`,
accept: '.bmp,.jpg,.png,.doc,.docx'
accept: '.bmp,.jpg,.png,.doc,.docx,.pdf'
},
token: getAccessToken(),
filterText: '',
@ -105,7 +106,8 @@ export default {
caseName: '',
selectList: [],
selectId: '1',
treeData: []
treeData: [],
loading: false
}
},
mounted() {
@ -118,7 +120,7 @@ export default {
const isLt5M = file.size / 1024 / 1024 < 5
const filename = file.name
const postfix = filename.substring(filename.lastIndexOf('.'))
if (!['.jpg', '.png', '.doc', '.docx'].includes(postfix)) {
if (!['.jpg', '.png', '.doc', '.docx', '.pdf'].includes(postfix)) {
this.$message.error('上传的文件格式不符合要求!')
return false
}
@ -139,6 +141,8 @@ export default {
}
if (['.doc', '.docx'].includes(postfix)) {
obj.type = 3
} else if (['.pdf'].includes(postfix)) {
obj.type = 4
}
// const selectItem = this.findSelectNode(this.treeData)
this.addNodeProperty(this.selectId, obj)
@ -150,12 +154,16 @@ export default {
this.$baseMessage.error('请选择文件!')
return
}
let flag = true
list.forEach(e => {
if (e.type === 1) {
this.$baseMessage.error('不能删除文件夹!')
return
flag = false
}
})
if (!flag) {
this.$baseMessage.error('不能删除文件夹!!')
return
}
this.delFiles()
},
//
@ -288,12 +296,16 @@ export default {
this.$baseMessage.error('请选择文件!')
return
}
let flag = true
list.forEach(e => {
if (e.type === 1) {
this.$baseMessage.error('不能移动文件夹!')
return
flag = false
}
})
if (!flag) {
this.$baseMessage.error('不能移动文件夹!')
return
}
this.$refs.MoveFolderRef.show()
},
closed() {
@ -308,21 +320,39 @@ export default {
this.$baseMessage.error('请分类!')
return
}
this.loading = true
const list = JSON.parse(JSON.stringify(this.treeData))
list.splice(0, 1)
ocrAndExtract({
evidenceFileList: list,
caseId: this.$route.params.id
}).then(res => {
this.loading = false
if (res.code === 200) {
this.$baseMessage.success('新增成功!')
this.$emit('save', res.data)
}
}).catch(() => {
//
this.loading = false
})
},
addFolder() {
this.$refs.AddFolderRef.show()
},
changeTreeData(nodes, id) {
for (const node of nodes) {
if (node.id === id) {
node.fileInfoList = this.selectList
} else if (node.child) {
this.changeTreeData(node.child, id)
}
}
return null
},
handleDragEnd() {
this.changeTreeData(this.treeData, this.selectId)
},
getImgUrl(id) {
return `${baseURL}${commonDownloadFile}${id}`
}
@ -404,10 +434,10 @@ export default {
flex: 1;
border: 1px dashed #3763ff;
padding: 24px;
display: flex;
margin-top: 16px;
.file-list {
display: flex;
flex-wrap: wrap;
}
.file-item {
width: 190px;
@ -415,6 +445,7 @@ export default {
position: relative;
margin-right: 16px;
cursor: pointer;
margin-bottom: 16px;
.main-content {
background: #F5F5F5;
height: 188px;

@ -28,9 +28,27 @@
<span v-if="index !== navList.length -1">></span>
</div>
</div>
<vxe-grid v-bind="gridOptions" style="margin-top: 10px">
<vxe-grid v-bind="gridOptions" style="margin-top: 10px;width: calc(100vw - 630px);">
<template #status="{row}">
<div v-if="row.processStatus === '2'" class="status">
<img src="@/assets/record/success.png" alt="">
<span>处理完毕</span>
</div>
<div v-if="row.processStatus === '3'" class="status">
<img src="@/assets/record/error.png" alt="">
<span>处理失败</span>
</div>
<div v-if="row.processStatus === '4'">
<span>已核实</span>
</div>
<div v-if="row.processStatus === '1' || row.processStatus === '0'" class="status">
<div v-loading="true" style="width: 20px;height: 20px;margin-right: 8px;position: relative;top: 12px;" />
<span>处理中</span>
</div>
</template>
<template #opera="{row}">
<el-button type="text" @click="handelEdit(row)"></el-button>
<el-button v-if="row.processStatus === '3'" type="text" @click="handelExtract(row)"></el-button>
<el-button type="text" style="color: red" @click="handleDel(row)"></el-button>
</template>
</vxe-grid>
@ -58,7 +76,7 @@ import EditEvidence from '@/views/caseDetails/components/edit/EditEvidence.vue'
import AddFolder from './AddEvidence/AddFolder.vue'
import { queryEvidenceList, deleteEvidence } from '@/api/caseDetails'
import { debounce } from '@/utils'
import { getCaseEvidenceFileTree, getCaseEvidenceDirectoryList } from '@/api/caseDetails/evidence'
import { getCaseEvidenceFileTree, caseEvidenceAnalysis } from '@/api/caseDetails/evidence'
import SelectUploadType from './SelectUploadType.vue'
export default {
name: 'CaseEvidence',
@ -84,12 +102,15 @@ export default {
columns: [
{ title: '序号', type: 'seq', width: 80 },
{ title: '证据名称', field: 'evidenceName' },
{ title: '证据类型', field: 'evidenceTypeDesc' },
{ title: '格式', field: 'evidenceFormat', width: 150 },
{ title: '提供人', field: 'provider', width: 200 },
{ title: '状态', slots: { default: 'status' }, align: 'center', width: 200 },
{ title: '证据类型', field: 'evidenceTypeDesc', width: 200 },
// { title: '', field: 'confessionMaterial' },
{ title: '最新时间', field: 'updateTime' },
{ title: '操作', slots: { default: 'opera' }, fixed: 'right', width: '100px' }
{ title: '最新时间', field: 'updateTime', width: 200 },
{ title: '操作', slots: { default: 'opera' }, fixed: 'right', width: '150px' }
],
data: [{}]
data: []
},
treeData: [],
selectId: '',
@ -189,22 +210,30 @@ export default {
},
//
handelEdit(row) {
if (row.contentType === '2') {
this.$router.push({ path: `/edit-evidence/${this.caseId}`, query: { caseName: this.$route.params.caseName, caseNo: this.$route.query.caseNo, evidenceId: row.id }})
} else {
this.$refs.edit.show(row, true)
if (row.evidenceFormat === '文件夹' && !row.fileList) {
this.$baseMessage.error('当前文件夹不可编辑!')
return
}
this.$router.push({ path: `/edit-evidence/${this.caseId}`, query: { caseName: this.$route.params.caseName, caseNo: this.$route.query.caseNo, evidenceId: row.id }})
},
handleSelect(val) {
val === '1' ? this.$refs.edit.show() : this.$router.push({ path: `/add-evidence/${this.caseId}`, query: { caseName: this.$route.params.caseName, caseNo: this.$route.query.caseNo }})
},
async handelExtract(row) {
const { code, msg } = await caseEvidenceAnalysis({
evidenceId: row.id
})
code === 200 ? this.$baseMessage.success(msg || '提取成功!') : this.$baseMessage.error(msg || '提取失败!')
this.fetchData()
},
//
handleDel(row) {
this.$baseConfirm('你确定要删除当前项吗', null, async() => {
const { code, msg } = await deleteEvidence({
evidenceId: row.id
evidenceId: row.id,
fileId: row.fileId
})
code === 200 ? this.$baseMessage.success(msg || '删除成功!') : this.$baseMessage.error(msg || '删除成功!')
code === 200 ? this.$baseMessage.success(msg || '删除成功!') : this.$baseMessage.error(msg || '删除失败!')
this.fetchData()
})
}
@ -240,6 +269,22 @@ export default {
.evidence-main {
flex: 1;
}
.status {
display: flex;
justify-content: center;
align-items: center;
img {
width: 20px;
height: 20px;
margin-right: 8px;
}
::v-deep {
.el-loading-spinner .circular {
width: 20px;
height: 20px;
}
}
}
.nav-list {
display: flex;
font-size: 16px;

@ -10,12 +10,13 @@
<div class="mid-content">
<div class="left">
<el-scrollbar v-if="selectList.length > 0" class="left-scroll">
<vuedraggable v-model="selectList" animation="400" class="img_list">
<div v-for="(item,index) in selectList" :key="index" :class="[item.fileId === selectInfo.fileId?'actived':'']">
<img v-if="['jpg', 'png'].includes(item.fileType)" class="img_item" :src="getImgUrl(item.fileId)" @click="selectItem(item)">
<vuedraggable v-model="selectList" animation="400" class="img_list" @end="handleDragEnd">
<div v-for="(item,index) in selectList" :key="index" class="img_item" :class="[item.fileId === selectInfo.fileId?'actived':'']">
<img v-if="['jpg', 'png'].includes(item.fileType)" :src="getImgUrl(item.fileId)" @click="selectItem(index)">
</img>
<svg-icon v-if="[ 'doc', 'docx'].includes(item.fileType)" class="svg-img" icon-class="docx" />
<svg-icon v-if="[ 'doc', 'docx'].includes(item.fileType)" class="svg-img" icon-class="docx" @click="selectItem(index)" />
<svg-icon v-if="[ 'pdf'].includes(item.fileType)" class="svg-img" icon-class="pdf" @click="selectItem(index)" />
</div>
</vuedraggable>
@ -46,7 +47,7 @@
</div>
</div>
<div class="FormInfo">
<el-form ref="form" :model="selectInfo" :rules="rules" label-width="100px" style="margin-top: 10px">
<el-form v-if="level === '2'" ref="form" :model="selectInfo.evidenceInfo" :rules="rules" label-width="100px" style="margin-top: 10px">
<el-row :gutter="10" class="form-content">
<el-col :span="24">
<el-form-item label="证据名称" prop="title">
@ -54,11 +55,58 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10" class="form-content">
<el-col :span="24">
<el-form-item label="提供人" prop="provider">
<el-input v-model="selectInfo.evidenceInfo.provider" placeholder="请输入提供人" />
</el-form-item>
</el-col>
</el-row>
<el-row v-if="selectInfo.evidenceInfo.property" :gutter="10" class="form-content">
<el-col v-for="(item,index) in selectInfo.evidenceInfo.property" :key="index" :span="24">
<el-form-item :label="item.attrName">
<el-input v-if="item.attrValueType ==='text'" v-model="item.attrValue" placeholder="请输入" />
<el-form-item v-if="item.attrValueType" :label="item.attrName">
<el-input v-if="item.attrValueType ==='1'" v-model="item.attrValue" placeholder="请输入" />
<el-input v-if="item.attrValueType ==='2'" v-model="item.attrValue" type="number" placeholder="请输入" />
<el-date-picker
v-if="item.attrValueType ==='3'"
v-model="item.attrValue"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="date"
placeholder="选择日期"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-form v-if="level === '3'" ref="form" :model="evidenceInfo" :rules="rules" label-width="100px" style="margin-top: 10px">
<el-row :gutter="10" class="form-content">
<el-col :span="24">
<el-form-item label="证据名称" prop="title">
<el-input v-model="evidenceInfo.title" placeholder="请输入证据名称" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10" class="form-content">
<el-col :span="24">
<el-form-item label="提供人" prop="provider">
<el-input v-model="evidenceInfo.provider" placeholder="请输入提供人" />
</el-form-item>
</el-col>
</el-row>
<el-row v-if="evidenceInfo.property" :gutter="10" class="form-content">
<el-col v-for="(item,index) in evidenceInfo.property" :key="index" :span="24">
<el-form-item v-if="item.attrValueType" :label="item.attrName">
<el-input v-if="item.attrValueType ==='1'" v-model="item.attrValue" placeholder="请输入" />
<el-input v-if="item.attrValueType ==='2'" v-model="item.attrValue" type="number" placeholder="请输入" />
<el-date-picker
v-if="item.attrValueType ==='3'"
v-model="item.attrValue"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="date"
placeholder="选择日期"
/>
</el-form-item>
</el-col>
</el-row>
@ -83,6 +131,7 @@ export default {
data() {
return {
selectList: [],
evidenceInfo: undefined,
activedImg: '',
caseNo: '',
caseName: '',
@ -93,7 +142,7 @@ export default {
title: [{ required: true, message: '证据名称不能为空!', trigger: 'blur' }]
},
flag: true,
treeData: [],
level: '',
selectInfo: {
evidenceInfo: {
property: [],
@ -112,10 +161,11 @@ export default {
getImgUrl(id) {
return `${baseURL}${commonDownloadFile}${id}`
},
selectItem(item) {
this.selectInfo = item
selectItem(index) {
this.selectInfo = this.selectList[index]
this.activedImg = `${baseURL}${commonDownloadFile}${this.selectInfo.fileId}`
},
reset() {
this.getTreeList()
},
@ -124,7 +174,7 @@ export default {
if (res.code === 200) {
this.treeData = res.data
this.$nextTick(() => {
this.handleNodeClick(res.data[0])
this.handleNodeClick()
})
}
})
@ -132,12 +182,9 @@ export default {
findNodeById(nodes, id) {
for (const node of nodes) {
if (node.id === id) {
return node
node.fileInfoList = this.selectList
} else if (node.child) {
const foundNode = this.findNodeById(node.child, id)
if (foundNode) {
return foundNode
}
this.findNodeById(node.child, id)
}
}
return null
@ -156,20 +203,30 @@ export default {
}
return null
},
handleNodeClick(data) {
this.selectId = data.id
const nodeItem = this.findNodeById(this.treeData, this.selectId)
if (nodeItem.fileInfoList.length === 0) {
const newNodeItem = this.getFileList(nodeItem.child)
this.selectList = newNodeItem.fileInfoList
this.selectId = newNodeItem.id
this.selectInfo = this.selectList[0]
handleNodeClick() {
const nodeItem = this.getFileList(this.treeData)
if (nodeItem.evidenceInfo) {
this.level = '3'
this.evidenceInfo = nodeItem.evidenceInfo
} else {
this.level = '2'
}
this.selectList = nodeItem.fileInfoList
this.selectInfo = this.selectList[0]
this.selectId = nodeItem.id
}
console.log('111', this.selectList, this.selectInfo)
// this.selectId = data.id
// const nodeItem = this.findNodeById(this.treeData, this.selectId)
// if (nodeItem.fileInfoList.length === 0) {
// const newNodeItem = this.getFileList(nodeItem.child)
// this.selectList = newNodeItem.fileInfoList
// this.selectId = newNodeItem.id
// this.selectInfo = this.selectList[0]
// } else {
// this.selectList = nodeItem.fileInfoList
// this.selectInfo = this.selectList[0]
// this.selectId = nodeItem.id
// }
},
checkEvidence(nodes) {
for (const item of nodes) {
@ -177,7 +234,7 @@ export default {
for (let i = 0; i < item.fileInfoList.length; i++) {
if (!item.fileInfoList[i].evidenceInfo.title) {
this.handleNodeClick(item)
this.selectItem(item.fileInfoList[i])
this.selectItem(i)
this.flag = false
break
}
@ -191,7 +248,7 @@ export default {
this.checkEvidence(this.treeData)
if (this.flag) {
caseEvidenceVerify({
batchNo: this.$route.query.recordId,
evidenceId: this.$route.query.evidenceId,
caseId: this.$route.params.id,
evidenceDirectoryList: this.treeData
}).then(res => {
@ -208,7 +265,11 @@ export default {
this.$baseMessage.error('证据不能为空!')
}
},
handleDragEnd() {
this.findNodeById(this.treeData, this.selectId)
},
submit() {
console.log('2323', this.selectList, this.treeData)
this.save()
}
}
@ -260,6 +321,7 @@ export default {
background: #F6F8F9;
width: 150px;
margin-right: 14px;
height: calc(100vh - 368px);
}
.act_img {
padding: 16px 28px;
@ -348,10 +410,14 @@ export default {
.img_item {
width: 98px;
height: 138px;
// margin-bottom: 16px;
margin-bottom: 16px;
border-radius: 6px 6px 6px 6px;
border: 1px solid #D1D3D6;
cursor: move;
img {
width: 98px;
height: 138px;
}
}
}
.boder1 {

@ -7,21 +7,28 @@
<div class="left">
<div class="title">识别结果预览</div>
<div class="left-content">
<div class="top">证据模板买卖合同</div>
<!-- <div class="empty">
<div v-if="dataInfo.name" class="top">{{ `${dataInfo.name}` }}</div>
<div v-if="dataList.length === 0" class="empty">
<img src="@/assets/common/file_empty.png" alt="">
<span>暂无结果请在右侧输入调试内容或上传文档</span>
</div> -->
</div>
<div v-if="dataList.length > 0" class="data-list">
<div v-for="(item,index) in dataList" :key="index" class="data-item">
<div class="left">{{ item.attrName }}</div>
<div class="right">{{ item.attrValue }}</div>
</div>
</div>
</div>
</div>
<div class="right">
<div class="right-item">
<span>调试内容</span>
<el-input
v-model="textarea"
v-model="text"
type="textarea"
:rows="8"
placeholder="请输入"
@blur="submit"
/>
</div>
<div class="right-item">
@ -35,6 +42,7 @@
:data="{
temp: true
}"
:on-remove="remove"
:on-success="handleSuccess"
:before-upload="beforeUpload"
>
@ -52,6 +60,7 @@
<script>
import { baseURL } from '@/config'
import { getAccessToken } from '@/utils/accessToken'
import { promptDebugging } from '@/api/promptManagement'
export default {
name: 'PromptDebug',
data() {
@ -62,7 +71,7 @@ export default {
width: '1200px',
hiddenFooter: true
},
textarea: '',
text: '',
//
uploadOption: {
action: `${baseURL}/minio/uploadFile`,
@ -71,13 +80,20 @@ export default {
token: getAccessToken(),
fileId: '',
fileList: [],
dataList: [],
tripleList: [],
dataInfo: undefined
}
},
methods: {
show(data) {
show(data, list) {
this.fileId = ''
this.dataList = []
this.drawerOption.show = true
this.dataInfo = data
if (list) {
this.list = list
}
},
beforeUpload(file) {
const isLt5M = file.size / 1024 / 1024 < 5
@ -95,12 +111,28 @@ export default {
},
handleSuccess(res, file) {
this.fileId = res.data
// const obj = {
// name: file.name,
// fileId: res.data
// }
// this.fileList.push(obj)
// this.imgOcrIdentify(res.data)
this.submit()
},
remove() {
this.fileId = ''
},
//
submit() {
const params = {
text: this.text,
type: this.dataInfo.type,
prompt: this.dataInfo.prompt,
extractAttributes: this.dataInfo.extractAttributes,
fileId: this.fileId
}
if (params.type === '2') {
params.tripleList = this.list
}
promptDebugging(params).then(res => {
if (res.code === 200) {
this.dataList = res.data
}
})
}
}
}
@ -146,6 +178,28 @@ export default {
line-height: 53px;
padding-left: 24px;
}
.data-list {
display: flex;
flex-direction: column;
padding: 24px;
overflow: auto;
height: calc(100vh - 400px);
.data-item {
display: flex;
margin-bottom: 24px;
align-items: center;
.left {
width: 120px;
font-size: 16px;
color: #666666;
text-align: right;
}
.right {
margin-left: 24px;font-size: 16px;
color: #333333;
}
}
}
}
}
.right {

@ -16,9 +16,6 @@
@copy="onCopy($event)"
@click="showList(false)"
/>
<div v-if="showWordLimit && maxlength" class="custom-at-limit">
{{ inputValueLen }}/{{ maxlength }}
</div>
</div>
<div :key="`customInput${taskPanelIsInFullScreen}`">
<el-popover
@ -34,7 +31,6 @@
ref="customSelectContent"
class="custom-select-content custom-scroll"
>
<div
v-for="(item, index) in dataList"
@ -46,7 +42,7 @@
@click="handleClickOperatorItem(item)"
>
<div class="custom-select-item-content">
{{ item.name }}
{{ item }}
</div>
</div>
</div>
@ -67,7 +63,7 @@ export default {
//
showWordLimit: {
type: Boolean,
default: false
default: true
},
//
disabled: {
@ -79,10 +75,19 @@ export default {
type: [Number, String],
default: '3000'
},
//
height: {
type: String,
default: '100px'
},
setRefresh: {
type: Object,
default: () => {}
},
dataList: {
type: Array,
default: () => []
},
//
value: {
type: String,
@ -99,15 +104,9 @@ export default {
startOffset: 0,
// @dom
searSpan: null,
//
dataList: [
{
name: 'xxxx'
},
{
name: 'dddd'
}
],
//
searchOperatorLoad: false,
// @
selectionIndex: 0,
// dom
@ -212,9 +211,9 @@ export default {
// contenteditablefalse
dom.setAttribute('contenteditable', 'false')
// iddom便
dom.setAttribute('data-id', item.name)
dom.setAttribute('data-id', item)
dom.innerHTML = `{${item.name}}&nbsp;`
dom.innerHTML = `{${item}}&nbsp;`
return dom
},
@ -376,10 +375,12 @@ export default {
}
} else if (event.key === 'Enter') {
event.preventDefault()
if (!this.searchOperatorLoad) {
this.handleClickOperatorItem(
this.dataList[this.selectedIndex]
)
}
}
} else if (event.key === 'Backspace' && this.isSelectAll()) {
//
this.$refs.customInput.innerText = ''
@ -636,10 +637,13 @@ export default {
},
//
async remoteMethod() {
const query = this.listInputValue
this.searchOperatorLoad = true
this.searchOperatorLoad = false
},
handleNameShift(item) {
const name = item.name || ''
const name = item.realname || ''
if (!name) return '--'
if (name.length > 1) {
return name.slice(0, 1)
@ -703,7 +707,10 @@ export default {
line-height: 12px;
}
::v-deep.custom-textarea {
height: calc(100vh - 400px);
white-space: pre-wrap;
height: calc(100vh - 500px);
border: 1px solid #dcdfe6;
border-radius: 4px;
background-color: #ffffff;
padding: 5px 15px;
color: #606266;
@ -713,10 +720,6 @@ export default {
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
position: relative;
word-break: break-all;
.el-textarea__inner {
border: none;
resize: none;
}
&.show-word-limit {
padding-bottom: 16px;
}

@ -0,0 +1,26 @@
<template>
<div>
<AddEditPrompt />
</div>
</template>
<script>
import AddEditPrompt from './index.vue'
export default {
name: 'AddPrompt',
components: {
AddEditPrompt
},
data() {
return {
}
},
mounted() {
},
methods: {
}
}
</script>

@ -0,0 +1,26 @@
<template>
<div>
<AddEditPrompt />
</div>
</template>
<script>
import AddEditPrompt from './index.vue'
export default {
name: 'EditPrompt',
components: {
AddEditPrompt
},
data() {
return {
}
},
mounted() {
},
methods: {
}
}
</script>

@ -11,28 +11,40 @@
</el-select>
</el-form-item>
<el-form-item label="提示词类型" prop="type">
<el-select v-model="dataInfo['type']" style="width: 100%;" placeholder="请选择提示词类型">
<el-select v-model="dataInfo['type']" style="width: 100%;" placeholder="请选择提示词类型" @change="selectType">
<el-option v-for="item in typeOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="提示词名称" prop="name">
<el-input v-model="dataInfo['name']" clearable placeholder="请输入提示词名称" />
</el-form-item>
<el-form-item v-if="dataInfo.type ==='1'" label="所属目录" prop="evidenceCategoryList">
<el-cascader v-model="dataInfo.evidenceCategoryList" style="width: 100%;" :props="defaultProps" :options="treeData" />
<el-form-item v-if="dataInfo.type ==='1'" label="所属目录" prop="evidenceCategoryIdList">
<el-cascader v-model="dataInfo.evidenceCategoryIdList" style="width: 100%;" :props="defaultProps" :options="treeData" />
</el-form-item>
<!-- <el-form-item v-if="dataInfo.type ==='1'" label="类目图标" prop="caseType">
<div class="select-img">
<div class="sel-btn" @click="openSelectImg"></div>
</div>
</el-form-item> -->
<el-form-item v-if="dataInfo.type ==='2'" label="分类" prop="typeList">
<el-select v-model="dataInfo['typeList']" multiple style="width: 100%;" placeholder="请选择分类">
<el-option
v-for="item in typeData"
:key="item.id"
:value="item.id"
:label="item.recordType"
/>
</el-select>
</el-form-item>
<el-form-item v-if="dataInfo.type ==='1'" label="提取属性" prop="extractAttributes">
<div class="params-table">
<div class="top">
<span style="width: 450px;">字典标签</span>
<span style="width: 150px;">字典数值</span>
<span style="width: 450px;">属性键值</span>
<span style="width: 150px;">属性类型</span>
<span style="width: 80px;">操作</span>
</div>
<div class="params-table-content">
<div v-for="(item,index) in dataInfo.extractAttributes" :key="index" class="table-item">
<el-input v-model="item.attrName" style="width: 400px;margin-right: 40px;" placeholder="请输入" />
<el-select v-model="item.attrValueType" style="width: 120px;margin-right: 40px;" clearable placeholder="请选择">
@ -40,27 +52,44 @@
</el-select>
<i class="el-icon-delete" @click="delItem(index)" />
</div>
</div>
<div class="add-table" @click="addItem">
<i class="el-icon-circle-plus-outline" style="color: #3763FF;font-size: 16px;" />
<span>添加数据</span>
</div>
</div>
</el-form-item>
<el-form-item v-if="dataInfo.type ==='2'" label="参数配置">
<vxe-grid
ref="entityTable"
v-bind="entityOptions"
> <template #templateName_edit="{row}">
<el-input v-model="row['templateName']" placeholder="请输入" />
</template>
<template #value_edit="{row}">
<el-input v-model="row['value']" placeholder="请输入" />
</template>
</vxe-grid>
</el-form-item>
<el-form-item v-if="dataInfo.type ==='3'" label="提示词规则" prop="rules">
<el-input v-model="dataInfo['rules']" :row="4" readonly type="textarea" />
</el-form-item>
</el-form>
</div>
<div class="right">
<div class="right-header">
<span>提示词配置</span>
<div class="btn-list">
<div class="ai-btn">
<!-- <div class="ai-btn">
<i class="el-icon-refresh" />
<span>AI自动生成</span>
</div>
</div> -->
<div class="btn" @click="handleDebug"></div>
</div>
</div>
<div class="content">
<div v-if="dataInfo.prompt" class="content">
<!-- <el-input
v-model="dataInfo['prompt']"
type="textarea"
@ -68,8 +97,10 @@
placeholder="请输入提示词模板"
/> -->
<PromptInput
v-model="customInputHTML"
v-model="dataInfo.prompt"
placeholder=""
:data-list="promptValue[dataInfo.type]"
@inputText="handleChangeInputText"
@changeChosen="handleChangeChosen"
/>
@ -79,7 +110,6 @@
</div>
<div class="footer-btns">
<div class="btn" @click="submit"></div>
<div class="btn" @click="submit"></div>
<div class="reset_btn" @click="reset"></div>
</div>
@ -91,8 +121,9 @@
import PromptDebug from './PromptDebug.vue'
import SelectImg from './SelectImg.vue'
import { getCaseEvidenceTree } from '@/api/caseDetails/evidence'
import { addOrUpdPrompt } from '@/api/promptManagement'
import PromptInput from './PromptInput.vue'
import { addOrUpdPrompt, getChunkClassify, queryPromptDetails } from '@/api/promptManagement'
import mixin from '@/views/mixin'
export default {
name: 'AddPrompt',
components: {
@ -102,104 +133,151 @@ export default {
},
data() {
return {
dataInfo: {
// html
customInputHTML: '',
// 使使
customInputText: '',
// @
customInputMentions: [],
dataInfo: {
rules: '(问[:](.*?))\s*答[:](.*?)(?=(问[:]|$))',
caseType: '',
type: '1',
name: '',
evidenceCategoryList: [],
typeList: [],
extractAttributes: [],
prompt: '请根据属性定义从源文本中提取属性:\n' +
'\n' +
'示例文本:\n' +
'"\n' +
'甲方:张三公司\n' +
'乙方:\n' +
'数量5000吨水泥\n' +
'合同金额8346元\n' +
'支付时间2022年11月30日\n' +
'履行期限2022年12月1日至2023年12月1日\n' +
'签订日期2022年11月23日\n' +
'"\n' +
'\n' +
'示例结果:\n' +
'{\n' +
' "甲方名称": "张三公司",\n' +
' "乙方名称": "",\n' +
' "数量": "5000吨水泥",\n' +
' "合同金额": "8346.00",\n' +
' "支付时间": "2022-11-30",\n' +
' "履行期限": "2022年12月1日至2023年12月1日",\n' +
' "签订日期": "2022-11-23"\n' +
'}\n' +
'\n' +
'源文本:\n' +
'{ocr_txt}\n' +
'\n' +
'属性定义:\n' +
'{attr_define}\n' +
'\n' +
'### 注意事项:\n' +
'1. 将结果以JSON格式返回。不需要进行解释。\n' +
'2. 如果某字段提取不到,则返回""。\n' +
'3. 日期格式为yyyy-MM-dd数字格式返回保留两位小数。\n' +
'4. 值为文本类型的数据,尽量使用原文中的文字。\n' +
'5. 只可以使用原文中的文字,不可以自行添加内容。\n' +
'\n' +
'回溯你输出的结果确保你的输出结果符合json格式。'
prompt: ''
},
tableList: [{
name: '',
type: ''
}],
promptValue: {
'1': ['source_text', 'attr_define'],
'2': ['headEntityType', 'tailEntityType', 'relation']
},
//
entityOptions: {
...mixin.data().gridOptions,
height: '300px',
editConfig: {
trigger: 'click',
mode: 'cell'
},
editRules: {
result: [{ required: true, message: '不能为空!' }]
},
columns: [
{ title: '类型', field: 'type' },
{ title: '占位符', field: 'templateName' },
{ title: '实体类型', field: 'value', editRender: { placeholder: '请点击输入...' }, slots: { edit: 'value_edit' }}
],
data: []
},
rules: {
caseType: [{ required: true, message: '案件类型不能为空!', trigger: 'blur' }],
type: [{ required: true, message: '提示词类型不能为空!', trigger: 'blur' }],
name: [{ required: true, message: '提示词名称不能为空!', trigger: 'blur' }],
extractAttributes: [{ required: true, message: '提取属性不能为空!', trigger: 'blur' }]
typeList: [{ required: true, message: '分类不能为空!', trigger: 'change' }],
extractAttributes: [{ required: true, message: '提取属性不能为空!', trigger: 'change' }]
},
defaultProps: {
children: 'child',
label: 'categoryName',
value: 'id',
checkStrictly: true
value: 'id'
},
treeData: [],
id: '',
extractList: [
{
label: '输入框',
value: 'text'
},
{
label: '日期',
value: 'date'
}
],
extractList: JSON.parse(sessionStorage.getItem('prompt_attribute_valuetype')),
typeData: [], //
//
caseTypeOptions: JSON.parse(sessionStorage.getItem('case_type')),
typeOptions: JSON.parse(sessionStorage.getItem('prompt_type'))
typeOptions: JSON.parse(sessionStorage.getItem('prompt_type')),
//
promptTextList: JSON.parse(sessionStorage.getItem('prompt_prototype_default_text'))
}
},
mounted() {
this.getTreeList()
this.queryChunkClassify()
this.selectType('1')
if (this.$route.params.id) {
this.getDetails()
}
},
methods: {
//
queryChunkClassify() {
getChunkClassify().then(res => {
this.typeData = res.data
})
},
//
getDetails() {
queryPromptDetails({
id: this.$route.params.id
}).then(res => {
if (res.code === 200) {
this.dataInfo = res.data
this.entityOptions.data = res.data.tripleList || []
this.data.rules = '(问[:](.*?))\s*答[:](.*?)(?=(问[:]|$))'
}
})
},
selectType(val) {
this.$set(this.dataInfo, 'prompt', null)
this.$nextTick(() => {
const text = this.getPromptText(val)
this.$set(this.dataInfo, 'prompt', text || ' ')
console.log('text', this.dataInfo)
})
if (val === '2') {
this.entityOptions.data = [
{
type: '头节点',
templateName: 'headEntityType',
value: ''
},
{
type: '关系',
templateName: 'relation',
value: ''
}, {
type: '尾节点',
templateName: 'tailEntityType',
value: ''
}
]
}
},
getPromptText(val) {
for (const item of this.promptTextList) {
if (item.value === val) {
return item.label
}
}
},
//
handleChangeInputText(val) {
this.customInputText = val
console.log('111', val)
},
//
handleChangeChosen(val) {
this.customInputMentions = val
}, handleDebug() {
this.$refs.PromptDebugRef.show()
},
handleDebug() {
if (this.dataInfo.type === '3') {
this.$baseMessage.error('分类不能调试!')
return
}
this.$refs.form.validate(valid => {
if (valid) {
this.$refs.PromptDebugRef.show(this.dataInfo, this.entityOptions.data)
}
})
},
openSelectImg() {
this.$refs.SelectImgRef.show()
@ -209,6 +287,11 @@ export default {
getCaseEvidenceTree({ caseType: 1 }).then(res => {
if (res.code === 200) {
this.treeData = res.data
for (let i = this.treeData.length - 1; i >= 0; i--) {
if (!this.treeData[i].child) {
this.treeData.splice(i, 1)
}
}
}
})
},
@ -222,19 +305,37 @@ export default {
this.dataInfo.extractAttributes.splice(index, 1)
},
reset() {
this.dataInfo = {
rules: '(问[:](.*?))\s*答[:](.*?)(?=(问[:]|$))',
caseType: '',
type: '1',
name: '',
evidenceCategoryIdList: [],
typeList: [],
extractAttributes: [],
prompt: ''
}
this.selectType('1')
},
submit() {
this.$refs.form.validate(valid => {
if (valid) {
const params = {
id: this.id,
id: this.$route.params.id,
...this.dataInfo,
evidenceCategoryId: this.dataInfo.evidenceCategoryList[this.dataInfo.evidenceCategoryList.length - 1 ]
evidenceCategoryId: this.dataInfo.evidenceCategoryIdList[this.dataInfo.evidenceCategoryIdList.length - 1 ]
}
if (params.type === '2') {
params.tripleList = this.entityOptions.data
}
addOrUpdPrompt(params).then(res => {
const { code, msg } = res
code === 200 ? (this.id ? this.$baseMessage.success(msg || '编辑成功!') : this.$baseMessage.success(msg || '新增成功!')) : (this.id ? this.$baseMessage.error(msg || '编辑失败!') : this.$baseMessage.error(msg || '新增失败!'))
this.$store.dispatch(
'tabsBar/delRoute',
this.$route
)
this.$router.push({ path: '/prompt-config' })
})
}
})
@ -300,6 +401,10 @@ export default {
color: #888888;
}
}
.params-table-content {
max-height: calc(100vh - 800px);
overflow-y: auto;
}
.add-table {
height: 56px;
display: flex;
@ -374,7 +479,7 @@ export default {
}
.content {
border-radius: 6px 6px 6px 6px;
border: 1px solid #D9D9D9;
// border: 1px solid #D9D9D9;
margin-top: 14px;
flex: 1;
// padding: 16px;

@ -10,6 +10,9 @@
<el-button type="text" @click="handleEdit(row)"></el-button>
<el-button type="text" style="color: red" @click="handleDel(row)"></el-button>
</template>
<template #type="{row}">
<span>{{ getTypeName(row.type) }}</span>
</template>
</vxe-grid>
<div style="text-align: center">
<cs-page
@ -26,7 +29,7 @@
<script>
import mixin from '@/views/mixin'
import { queryPromptList } from '@/api/promptManagement'
import { queryPromptList,delPrompt } from '@/api/promptManagement'
export default {
name: 'PromptConfig',
@ -38,13 +41,14 @@ export default {
{ label: '提示词名称', model: 'name', type: 'input' },
{ label: '提示词类型', model: 'type', type: 'select', option: JSON.parse(sessionStorage.getItem('prompt_type')) }
],
promptType: JSON.parse(sessionStorage.getItem('prompt_type')),
//
gridOptions: {
...mixin.data().gridOptions,
columns: [
{ title: 'ID', field: 'id', width: '300px' },
{ title: '序号', type: 'seq', width: 80 },
{ title: '提示词名称', field: 'name', width: '300px' },
{ title: '提示词类型', field: 'type', width: '200px' },
{ title: '提示词类型', field: 'type', slots: { default: 'type' }, width: '200px' },
{ title: '匹配值', field: 'matchNum', width: '200px' },
{ title: '提示词', field: 'prompt' },
{ title: '操作', slots: { default: 'operate' }, width: '150px' }
@ -64,17 +68,30 @@ export default {
this.queryForm.total = res.data.total
})
},
getTypeName(val) {
for (const item of this.promptType) {
if (item.value === val) {
return item.label
}
}
},
//
handleAdd() {
this.$router.push({ path: `/add-prompt` })
},
//
handleEdit(row) {
this.$router.push({ path: `/edit-prompt/${row.id}` })
},
//
handleDel(row) {
// this.$baseConfirm('?', null, async() => {
// const { code, msg } = await deleteModelIndex(row.id)
// code === 200 ? this.$baseMessage.success(msg || '!') : this.$baseMessage.error(msg || '!')
// this.fetchData()
// })
this.$baseConfirm('确定要删除吗?', null, async() => {
const { code, msg } = await delPrompt({
id: row.id
})
code === 200 ? this.$baseMessage.success(msg || '删除成功!') : this.$baseMessage.error(msg || '删除失败!')
this.fetchData()
})
},
//
onSearch(data, callback) {

@ -225,7 +225,6 @@ export default {
//
handleChangeAll() {
const ids = this.$refs.entityTable.getCheckboxRecords().map(item => item.id)
console.log(ids, 8888)
this.$set(this.promptForm, 'entity', ids)
},
//

Loading…
Cancel
Save