|
@@ -22,7 +22,7 @@
|
|
|
{{ item.type === 1 ? 'AI助手' : '游客' }}
|
|
|
<template v-if="item.type === 1">
|
|
|
<v-btn
|
|
|
- v-if="item.content?.sql"
|
|
|
+ v-if="item.content.sql"
|
|
|
class="ml-3"
|
|
|
small
|
|
|
elevation="0"
|
|
@@ -59,12 +59,12 @@
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
<div>
|
|
|
- {{ item.content.summary }}
|
|
|
+ {{ item.content.response }}
|
|
|
</div>
|
|
|
<div v-if="item.showSnackbar" class="pa-3 blue-grey lighten-3 mt-3">
|
|
|
{{ item.content.sql }}
|
|
|
</div>
|
|
|
- <div class="mt-3" v-if="item.content.columns.length">
|
|
|
+ <div class="mt-3" v-if="item.content.records && item.content.records.columns.length">
|
|
|
<div>
|
|
|
<v-menu
|
|
|
v-model="item.showMenu"
|
|
@@ -85,7 +85,7 @@
|
|
|
<div class="pa-3">
|
|
|
<v-autocomplete
|
|
|
v-model="item.model.typeAxis"
|
|
|
- :items="item.content.columns"
|
|
|
+ :items="item.content.records.columns"
|
|
|
class="mb-3"
|
|
|
outlined
|
|
|
dense
|
|
@@ -95,7 +95,7 @@
|
|
|
|
|
|
<v-autocomplete
|
|
|
v-model="item.model.dataAxis"
|
|
|
- :items="item.content.columns"
|
|
|
+ :items="item.content.records.columns"
|
|
|
class="mb-3"
|
|
|
outlined
|
|
|
dense
|
|
@@ -124,7 +124,7 @@
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th
|
|
|
- v-for="header in item.content.columns"
|
|
|
+ v-for="header in item.content.records.columns"
|
|
|
:key="header"
|
|
|
class="text-left"
|
|
|
>{{ header }}</th>
|
|
@@ -132,11 +132,11 @@
|
|
|
</thead>
|
|
|
<tbody>
|
|
|
<tr
|
|
|
- v-for="(row, index) in item.content.rows"
|
|
|
+ v-for="(row, index) in item.content.records.rows"
|
|
|
:key="index"
|
|
|
>
|
|
|
<td
|
|
|
- v-for="header in item.content.columns"
|
|
|
+ v-for="header in item.content.records.columns"
|
|
|
:key="header"
|
|
|
class="text-left"
|
|
|
>{{ row[header] }}</td>
|
|
@@ -178,7 +178,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="pa-3 chart-content-chat-btn">
|
|
|
- <div class="send d-flex align-center justify-center">
|
|
|
+ <div class="send">
|
|
|
<div class="send-box">
|
|
|
<v-textarea
|
|
|
v-model="question"
|
|
@@ -196,6 +196,22 @@
|
|
|
<v-icon>mdi-send</v-icon>
|
|
|
</v-btn>
|
|
|
</div>
|
|
|
+ <div>
|
|
|
+ <v-chip-group
|
|
|
+ active-class="primary--text"
|
|
|
+ column
|
|
|
+ v-model="routingMode"
|
|
|
+ >
|
|
|
+ <v-chip
|
|
|
+ v-for="chip in chips"
|
|
|
+ :key="chip.value"
|
|
|
+ small
|
|
|
+ :value="chip.value"
|
|
|
+ >
|
|
|
+ {{ chip.text }}
|
|
|
+ </v-chip>
|
|
|
+ </v-chip-group>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- <v-dialog
|
|
@@ -242,10 +258,16 @@ import {
|
|
|
submitTrainingCorrect,
|
|
|
submitTrainingError
|
|
|
} from '@/api/dataChart'
|
|
|
+import { mapGetters } from 'vuex'
|
|
|
export default {
|
|
|
name: 'dataChartEditChat',
|
|
|
data () {
|
|
|
return {
|
|
|
+ routingMode: undefined,
|
|
|
+ chips: [
|
|
|
+ { text: '聊天模式', value: 'chat_direct' },
|
|
|
+ { text: '数据库模式', value: 'database_direct' }
|
|
|
+ ],
|
|
|
loading: false,
|
|
|
disabled: false,
|
|
|
question: '',
|
|
@@ -260,10 +282,14 @@ export default {
|
|
|
'赣州分公司下,餐饮类档口的日均订单量是多少?'
|
|
|
]
|
|
|
}
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ conversationId: undefined
|
|
|
// trueData: false
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(['userInfo'])
|
|
|
+ },
|
|
|
methods: {
|
|
|
handleKeyCode (event) {
|
|
|
if (event.keyCode === 13) {
|
|
@@ -310,8 +336,14 @@ export default {
|
|
|
this.items.push(ask)
|
|
|
this.question = ''
|
|
|
try {
|
|
|
- const { data } = await getAsk({ question })
|
|
|
+ const { data } = await getAsk({
|
|
|
+ question,
|
|
|
+ user_id: this.userInfo.id,
|
|
|
+ routing_mode: this.routingMode,
|
|
|
+ conversation_id: this.conversationId
|
|
|
+ })
|
|
|
ask.content = data
|
|
|
+ this.conversationId = data.conversation_id
|
|
|
this.scrollToBottom()
|
|
|
} catch (error) {
|
|
|
ask.content = error.message
|