feat: 命中测试
This commit is contained in:
parent
89a74dd862
commit
6c2a6673df
@ -231,6 +231,21 @@ const putChatVote: (
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命中测试列表
|
||||||
|
* @param application_id
|
||||||
|
* @param loading
|
||||||
|
* @query { query_text: string, top_number: number, similarity: number }
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const getApplicationHitTest: (
|
||||||
|
application_id: string,
|
||||||
|
data: any,
|
||||||
|
loading?: Ref<boolean>
|
||||||
|
) => Promise<Result<Array<any>>> = (application_id, data, loading) => {
|
||||||
|
return get(`${prefix}/${application_id}/hit_test`, data, loading)
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
getAllAppilcation,
|
getAllAppilcation,
|
||||||
getApplication,
|
getApplication,
|
||||||
@ -246,5 +261,6 @@ export default {
|
|||||||
putAccessToken,
|
putAccessToken,
|
||||||
postAppAuthentication,
|
postAppAuthentication,
|
||||||
getProfile,
|
getProfile,
|
||||||
putChatVote
|
putChatVote,
|
||||||
|
getApplicationHitTest
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 770 KiB |
@ -50,6 +50,18 @@ const applicationRouter = {
|
|||||||
},
|
},
|
||||||
component: () => import('@/views/application/CreateAndSetting.vue')
|
component: () => import('@/views/application/CreateAndSetting.vue')
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'hit-test',
|
||||||
|
name: 'AppHitTest',
|
||||||
|
meta: {
|
||||||
|
icon: 'app-hit-test',
|
||||||
|
title: '命中测试',
|
||||||
|
active: 'hit-test',
|
||||||
|
parentPath: '/application/:id',
|
||||||
|
parentName: 'ApplicationDetail'
|
||||||
|
},
|
||||||
|
component: () => import('@/views/hit-test/index.vue')
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'log',
|
path: 'log',
|
||||||
name: 'Log',
|
name: 'Log',
|
||||||
|
|||||||
@ -37,18 +37,18 @@ const datasetRouter = {
|
|||||||
},
|
},
|
||||||
component: () => import('@/views/document/index.vue')
|
component: () => import('@/views/document/index.vue')
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// path: 'hit-test',
|
path: 'hit-test',
|
||||||
// name: 'HitTest',
|
name: 'DatasetHitTest',
|
||||||
// meta: {
|
meta: {
|
||||||
// icon: 'app-hit-test',
|
icon: 'app-hit-test',
|
||||||
// title: '命中测试',
|
title: '命中测试',
|
||||||
// active: 'hit-test',
|
active: 'hit-test',
|
||||||
// parentPath: '/dataset/:id',
|
parentPath: '/dataset/:id',
|
||||||
// parentName: 'DatasetDetail'
|
parentName: 'DatasetDetail'
|
||||||
// },
|
},
|
||||||
// component: () => import('@/views/hit-test/index.vue')
|
component: () => import('@/views/hit-test/index.vue')
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
path: 'setting',
|
path: 'setting',
|
||||||
name: 'DatasetSetting',
|
name: 'DatasetSetting',
|
||||||
|
|||||||
@ -126,5 +126,8 @@ onMounted(() => {
|
|||||||
color: var(--app-text-color);
|
color: var(--app-text-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
:deep(.el-divider__text) {
|
||||||
|
background: var(--app-layout-bg-color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -8,14 +8,14 @@
|
|||||||
</h3>
|
</h3>
|
||||||
</template>
|
</template>
|
||||||
<div class="hit-test__main p-16" v-loading="loading">
|
<div class="hit-test__main p-16" v-loading="loading">
|
||||||
<div class="question-title clearfix">
|
<div class="question-title clearfix" v-if="questionTitle">
|
||||||
<div class="avatar">
|
<div class="avatar">
|
||||||
<AppAvatar>
|
<AppAvatar>
|
||||||
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
|
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
|
||||||
</AppAvatar>
|
</AppAvatar>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h4 class="text break-all">111111</h4>
|
<h4 class="text break-all">{{ questionTitle }}</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-scrollbar>
|
<el-scrollbar>
|
||||||
@ -41,9 +41,25 @@
|
|||||||
:showIcon="false"
|
:showIcon="false"
|
||||||
@click="editParagraph(item)"
|
@click="editParagraph(item)"
|
||||||
>
|
>
|
||||||
|
<div class="active-button primary">{{ (item.similarity * 100).toFixed(2) }}%</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="footer-content flex-between">
|
<div class="footer-content flex-between">
|
||||||
<span> {{ numberFormat(item?.content.length) || 0 }} 个 字符 </span>
|
<el-text>
|
||||||
|
<el-icon>
|
||||||
|
<Document />
|
||||||
|
</el-icon>
|
||||||
|
{{ item?.document_name }}
|
||||||
|
</el-text>
|
||||||
|
<div v-if="item.trample_num || item.star_num">
|
||||||
|
<span v-if="item.star_num">
|
||||||
|
<AppIcon iconName="app-like-color"></AppIcon>
|
||||||
|
{{ item.star_num }}
|
||||||
|
</span>
|
||||||
|
<span v-if="item.trample_num" class="ml-4">
|
||||||
|
<AppIcon iconName="app-oppose-color"></AppIcon>
|
||||||
|
{{ item.trample_num }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</CardBox>
|
</CardBox>
|
||||||
@ -53,7 +69,7 @@
|
|||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <ParagraphDialog ref="ParagraphDialogRef" :title="title" @refresh="refresh" /> -->
|
<ParagraphDialog ref="ParagraphDialogRef" :title="title" @refresh="refresh" />
|
||||||
</LayoutContainer>
|
</LayoutContainer>
|
||||||
<div class="hit-test__operate p-24 pt-0">
|
<div class="hit-test__operate p-24 pt-0">
|
||||||
<el-popover :visible="popoverVisible" placement="top-start" :width="560" trigger="click">
|
<el-popover :visible="popoverVisible" placement="top-start" :width="560" trigger="click">
|
||||||
@ -121,17 +137,13 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, ref, onMounted, computed } from 'vue'
|
import { reactive, ref, onMounted, computed } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import documentApi from '@/api/document'
|
|
||||||
import paragraphApi from '@/api/paragraph'
|
|
||||||
import datasetApi from '@/api/dataset'
|
import datasetApi from '@/api/dataset'
|
||||||
// import ParagraphDialog from './component/ParagraphDialog.vue'
|
import applicationApi from '@/api/application'
|
||||||
import { numberFormat } from '@/utils/utils'
|
import ParagraphDialog from '@/views/paragraph/component/ParagraphDialog.vue'
|
||||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
|
||||||
import useStore from '@/stores'
|
|
||||||
const { paragraph } = useStore()
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const {
|
const {
|
||||||
params: { id, documentId }
|
params: { id }
|
||||||
} = route as any
|
} = route as any
|
||||||
|
|
||||||
const ParagraphDialogRef = ref()
|
const ParagraphDialogRef = ref()
|
||||||
@ -144,9 +156,19 @@ const formInline = reactive({
|
|||||||
top_number: 5
|
top_number: 5
|
||||||
})
|
})
|
||||||
const popoverVisible = ref(false)
|
const popoverVisible = ref(false)
|
||||||
|
const questionTitle = ref('')
|
||||||
|
|
||||||
const isDisabledChart = computed(() => !inputValue.value)
|
const isDisabledChart = computed(() => !inputValue.value)
|
||||||
|
|
||||||
|
const isApplication = computed(() => {
|
||||||
|
const { meta } = route as any
|
||||||
|
return meta?.activeMenu.includes('application')
|
||||||
|
})
|
||||||
|
const isDataset = computed(() => {
|
||||||
|
const { meta } = route as any
|
||||||
|
return meta?.activeMenu.includes('dataset')
|
||||||
|
})
|
||||||
|
|
||||||
function editParagraph(row: any) {
|
function editParagraph(row: any) {
|
||||||
title.value = '分段详情'
|
title.value = '分段详情'
|
||||||
ParagraphDialogRef.value.open(row)
|
ParagraphDialogRef.value.open(row)
|
||||||
@ -170,9 +192,19 @@ function getHitTestList() {
|
|||||||
similarity: formInline.similarity / 100,
|
similarity: formInline.similarity / 100,
|
||||||
top_number: formInline.top_number
|
top_number: formInline.top_number
|
||||||
}
|
}
|
||||||
|
if (isDataset.value) {
|
||||||
datasetApi.getDatasetHitTest(id, obj, loading).then((res) => {
|
datasetApi.getDatasetHitTest(id, obj, loading).then((res) => {
|
||||||
paragraphDetail.value = res.data
|
paragraphDetail.value = res.data
|
||||||
|
questionTitle.value = inputValue.value
|
||||||
|
inputValue.value = ''
|
||||||
})
|
})
|
||||||
|
} else if (isApplication.value) {
|
||||||
|
applicationApi.getApplicationHitTest(id, obj, loading).then((res) => {
|
||||||
|
paragraphDetail.value = res.data
|
||||||
|
questionTitle.value = inputValue.value
|
||||||
|
inputValue.value = ''
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function refresh(data: any) {
|
function refresh(data: any) {
|
||||||
|
|||||||
@ -122,7 +122,7 @@ defineExpose({
|
|||||||
background: var(--app-layout-bg-color);
|
background: var(--app-layout-bg-color);
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
.el-divider__text {
|
:deep(.el-divider__text) {
|
||||||
background: var(--app-layout-bg-color);
|
background: var(--app-layout-bg-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,12 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8" class="border-l p-24">
|
<el-col :span="8" class="border-l p-24">
|
||||||
<!-- 关联问题 -->
|
<!-- 关联问题 -->
|
||||||
<ProblemComponent :problemId="problemId" ref="ProblemRef" />
|
<ProblemComponent
|
||||||
|
:problemId="problemId"
|
||||||
|
:docId="document_id"
|
||||||
|
:datasetId="dataset_id"
|
||||||
|
ref="ProblemRef"
|
||||||
|
/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<template #footer v-if="!problemId">
|
<template #footer v-if="!problemId">
|
||||||
@ -69,12 +74,16 @@ const loading = ref(false)
|
|||||||
const problemId = ref('')
|
const problemId = ref('')
|
||||||
const detail = ref<any>({})
|
const detail = ref<any>({})
|
||||||
const isEdit = ref(false)
|
const isEdit = ref(false)
|
||||||
|
const document_id = ref('')
|
||||||
|
const dataset_id = ref('')
|
||||||
|
|
||||||
watch(dialogVisible, (bool) => {
|
watch(dialogVisible, (bool) => {
|
||||||
if (!bool) {
|
if (!bool) {
|
||||||
problemId.value = ''
|
problemId.value = ''
|
||||||
detail.value = {}
|
detail.value = {}
|
||||||
isEdit.value = false
|
isEdit.value = false
|
||||||
|
document_id.value = ''
|
||||||
|
dataset_id.value = ''
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -83,6 +92,8 @@ const open = (data: any) => {
|
|||||||
detail.value.title = data.title
|
detail.value.title = data.title
|
||||||
detail.value.content = data.content
|
detail.value.content = data.content
|
||||||
problemId.value = data.id
|
problemId.value = data.id
|
||||||
|
document_id.value = data.document_id
|
||||||
|
dataset_id.value = data.dataset_id
|
||||||
} else {
|
} else {
|
||||||
isEdit.value = true
|
isEdit.value = true
|
||||||
}
|
}
|
||||||
@ -92,7 +103,13 @@ const submitHandle = async () => {
|
|||||||
if (await paragraphFormRef.value?.validate()) {
|
if (await paragraphFormRef.value?.validate()) {
|
||||||
if (problemId.value) {
|
if (problemId.value) {
|
||||||
paragraph
|
paragraph
|
||||||
.asyncPutParagraph(id, documentId, problemId.value, paragraphFormRef.value?.form, loading)
|
.asyncPutParagraph(
|
||||||
|
dataset_id.value,
|
||||||
|
documentId || document_id.value,
|
||||||
|
problemId.value,
|
||||||
|
paragraphFormRef.value?.form,
|
||||||
|
loading
|
||||||
|
)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
emit('refresh', res.data)
|
emit('refresh', res.data)
|
||||||
isEdit.value = false
|
isEdit.value = false
|
||||||
|
|||||||
@ -37,7 +37,9 @@ import { useRoute } from 'vue-router'
|
|||||||
import paragraphApi from '@/api/paragraph'
|
import paragraphApi from '@/api/paragraph'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
problemId: String
|
problemId: String,
|
||||||
|
docId: String,
|
||||||
|
datasetId: String
|
||||||
})
|
})
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
@ -68,7 +70,7 @@ function delProblemHandle(item: any, index: number) {
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
if (item.id) {
|
if (item.id) {
|
||||||
paragraphApi
|
paragraphApi
|
||||||
.delProblem(id, documentId, props.problemId || '', item.id)
|
.delProblem(props.datasetId || id, documentId || props.docId, props.problemId || '', item.id)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
getProblemList()
|
getProblemList()
|
||||||
})
|
})
|
||||||
@ -84,7 +86,7 @@ function delProblemHandle(item: any, index: number) {
|
|||||||
function getProblemList() {
|
function getProblemList() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
paragraphApi
|
paragraphApi
|
||||||
.getProblem(id, documentId, props.problemId || '')
|
.getProblem(props.datasetId || id, documentId || props.docId, props.problemId || '')
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
problemList.value = res.data
|
problemList.value = res.data
|
||||||
loading.value = false
|
loading.value = false
|
||||||
@ -108,7 +110,7 @@ function addProblemHandle(val: string) {
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
if (props.problemId) {
|
if (props.problemId) {
|
||||||
paragraphApi
|
paragraphApi
|
||||||
.postProblem(id, documentId, props.problemId, obj)
|
.postProblem(props.datasetId || id, documentId || props.docId, props.problemId, obj)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
getProblemList()
|
getProblemList()
|
||||||
problemValue.value = ''
|
problemValue.value = ''
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user