|
@@ -2,18 +2,26 @@
|
|
|
<div class="pa-3 white">
|
|
|
<m-filter :option="filter" @search="handleSearch" />
|
|
|
<m-table
|
|
|
+ ref="tableRefs"
|
|
|
+ class="mt-3"
|
|
|
:loading="loading"
|
|
|
:headers="headers"
|
|
|
:items="items"
|
|
|
:total="total"
|
|
|
:page-info="pageInfo"
|
|
|
- :show-select="false"
|
|
|
:is-tools="false"
|
|
|
- @edit="handleEdit"
|
|
|
@delete="handleDelete"
|
|
|
@pageHandleChange="pageHandleChange"
|
|
|
@sort="handleSort"
|
|
|
>
|
|
|
+ <template #navBtn>
|
|
|
+ <v-btn class="buttons" rounded color="primary" @click="handleAddTo()">添加到训练集</v-btn>
|
|
|
+ </template>
|
|
|
+ <template #actions="{ item }">
|
|
|
+ <v-btn color="primary" text @click="handleEdit(item)">编辑</v-btn>
|
|
|
+ <v-btn color="primary" text :disabled="item.is_in_training_data" @click="handleAddTo([item.id])">添加到训练集</v-btn>
|
|
|
+ <v-btn color="error" text @click="handleDelete(item.id)">删除</v-btn>
|
|
|
+ </template>
|
|
|
<template #is_thumb_up="{ item }">
|
|
|
<v-chip :color="item.is_thumb_up ? 'success' : 'error'" small>{{ item.is_thumb_up ? '赞同' : '不赞同' }}</v-chip>
|
|
|
</template>
|
|
@@ -38,7 +46,8 @@ import MTable from '@/components/List/table.vue'
|
|
|
import ModelQaEdit from './modelQaEdit.vue'
|
|
|
import {
|
|
|
getFeedbackList,
|
|
|
- deleteFeedback
|
|
|
+ deleteFeedback,
|
|
|
+ addFeedbackToTraining
|
|
|
} from '@/api/dataChart'
|
|
|
export default {
|
|
|
name: 'model-qa',
|
|
@@ -73,7 +82,7 @@ export default {
|
|
|
headers: [
|
|
|
{ text: '问题', align: 'start', value: 'question' },
|
|
|
{ text: 'sql', align: 'start', value: 'sql' },
|
|
|
- { text: '赞同与否', align: 'center', value: 'is_thumb_up' },
|
|
|
+ { text: '反馈', align: 'center', value: 'is_thumb_up' },
|
|
|
{ text: '是否已加入训练数据', align: 'center', value: 'is_in_training_data' },
|
|
|
{ text: '创建时间', align: 'start', value: 'create_time' },
|
|
|
{ text: '操作', align: 'start', value: 'actions' }
|
|
@@ -116,6 +125,24 @@ export default {
|
|
|
async handleEdit (item) {
|
|
|
this.$refs.modelQaEditRefs.open(item)
|
|
|
},
|
|
|
+ handleAddTo (ids) {
|
|
|
+ console.log(ids)
|
|
|
+ const feedbackIds = ids ?? this.$refs.tableRefs.ids
|
|
|
+ console.log(feedbackIds)
|
|
|
+ if (!feedbackIds.length) {
|
|
|
+ this.$snackbar.warning('请选择需要添加的数据')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$confirm('提示', '是否添加到训练集').then(async _ => {
|
|
|
+ try {
|
|
|
+ await addFeedbackToTraining({ feedback_ids: feedbackIds })
|
|
|
+ this.$snackbar.success('添加成功')
|
|
|
+ this.init()
|
|
|
+ } catch (error) {
|
|
|
+ this.$snackbar.error('添加失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
handleDelete (ids, item) {
|
|
|
this.$confirm('提示', '是否删除该选项')
|
|
|
.then(async () => {
|