|
@@ -210,7 +210,7 @@
|
|
<v-icon>mdi-send</v-icon>
|
|
<v-icon>mdi-send</v-icon>
|
|
</v-btn>
|
|
</v-btn>
|
|
</div>
|
|
</div>
|
|
- <div v-if="!react">
|
|
|
|
|
|
+ <!-- <div v-if="!react">
|
|
<v-chip-group
|
|
<v-chip-group
|
|
active-class="primary--text"
|
|
active-class="primary--text"
|
|
column
|
|
column
|
|
@@ -225,7 +225,7 @@
|
|
{{ chip.text }}
|
|
{{ chip.text }}
|
|
</v-chip>
|
|
</v-chip>
|
|
</v-chip-group>
|
|
</v-chip-group>
|
|
- </div>
|
|
|
|
|
|
+ </div> -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -247,11 +247,11 @@ export default {
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
- routingMode: undefined,
|
|
|
|
- chips: [
|
|
|
|
- { text: '聊天模式', value: 'chat_direct' },
|
|
|
|
- { text: '数据库模式', value: 'database_direct' }
|
|
|
|
- ],
|
|
|
|
|
|
+ // routingMode: undefined,
|
|
|
|
+ // chips: [
|
|
|
|
+ // { text: '聊天模式', value: 'chat_direct' },
|
|
|
|
+ // { text: '数据库模式', value: 'database_direct' }
|
|
|
|
+ // ],
|
|
loading: false,
|
|
loading: false,
|
|
disabled: false,
|
|
disabled: false,
|
|
question: '',
|
|
question: '',
|
|
@@ -303,18 +303,17 @@ export default {
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
// 先关闭现有连接
|
|
// 先关闭现有连接
|
|
this.stopSSE()
|
|
this.stopSSE()
|
|
- const query = this.react
|
|
|
|
- ? {
|
|
|
|
- question: encodeURIComponent(ask.question),
|
|
|
|
- user_id: this.userInfo.id,
|
|
|
|
- conversation_id: this.conversationId
|
|
|
|
- }
|
|
|
|
- : {
|
|
|
|
- question: encodeURIComponent(ask.question),
|
|
|
|
- user_id: this.userInfo.id,
|
|
|
|
- routing_mode: this.routingMode,
|
|
|
|
- conversation_id: this.conversationId
|
|
|
|
- }
|
|
|
|
|
|
+ const query = {
|
|
|
|
+ question: encodeURIComponent(ask.question),
|
|
|
|
+ user_id: this.userInfo.id,
|
|
|
|
+ conversation_id: this.conversationId
|
|
|
|
+ }
|
|
|
|
+ // : {
|
|
|
|
+ // question: encodeURIComponent(ask.question),
|
|
|
|
+ // user_id: this.userInfo.id,
|
|
|
|
+ // // routing_mode: this.routingMode,
|
|
|
|
+ // conversation_id: this.conversationId
|
|
|
|
+ // }
|
|
const queryStr = Object.keys(query).reduce((acc, key) => {
|
|
const queryStr = Object.keys(query).reduce((acc, key) => {
|
|
if (query[key] === undefined) {
|
|
if (query[key] === undefined) {
|
|
return acc
|
|
return acc
|
|
@@ -464,24 +463,28 @@ export default {
|
|
this.abortController = null
|
|
this.abortController = null
|
|
}
|
|
}
|
|
this.items.splice(1, this.items.length - 1, ...data.messages.map(e => {
|
|
this.items.splice(1, this.items.length - 1, ...data.messages.map(e => {
|
|
- if (e.role === 'user') {
|
|
|
|
|
|
+ if (e.role === 'assistant' || e.role === 'ai') {
|
|
|
|
+ if (!this.react) {
|
|
|
|
+ e.metadata.response = e.content
|
|
|
|
+ }
|
|
|
|
+
|
|
return {
|
|
return {
|
|
- type: 2,
|
|
|
|
- user: '游客',
|
|
|
|
- content: e.content
|
|
|
|
|
|
+ type: 1,
|
|
|
|
+ content: this.react ? e.content : e.metadata,
|
|
|
|
+ showSnackbar: false,
|
|
|
|
+ dataValidation: false,
|
|
|
|
+ question: e.content, // 记录当前问题
|
|
|
|
+ showMenu: false,
|
|
|
|
+ model: {
|
|
|
|
+ dataAxis: null,
|
|
|
|
+ typeAxis: null
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return {
|
|
return {
|
|
- type: 1,
|
|
|
|
- content: e.metadata,
|
|
|
|
- showSnackbar: false,
|
|
|
|
- dataValidation: false,
|
|
|
|
- question: e.content, // 记录当前问题
|
|
|
|
- showMenu: false,
|
|
|
|
- model: {
|
|
|
|
- dataAxis: null,
|
|
|
|
- typeAxis: null
|
|
|
|
- }
|
|
|
|
|
|
+ type: 2,
|
|
|
|
+ user: '游客',
|
|
|
|
+ content: e.content
|
|
}
|
|
}
|
|
}))
|
|
}))
|
|
}
|
|
}
|