Commit a7f37904 by 前端

优化推流

1 parent a4f652fa
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-02-25 10:30:47
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-03-06 10:02:16
* @LastEditTime: 2024-03-06 16:14:05
* @FilePath: \dj-scrm-wx-work-attachment-psd\src\mixins\socket.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -11,7 +11,7 @@ import { ROLE_LIST, AI_TYPE } from '@/utils/constants'
export default {
data() {
return {
path: window.$fetchConfig.baseURL,
path: window.$fetchConfig.baseURL + (Math.random() + '').slice(2),
isShow: true,
isSend: true,
timer_chat: null,
......@@ -149,6 +149,7 @@ export default {
this.issue = ''
},
close() {
console.log('关闭')
this.socket.close() // 关闭 websocket
},
toBottom() {
......
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-02-26 14:10:00
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-03-06 15:46:16
* @FilePath: \salesgpt-project\src\store\index.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import app from './modules/app'
// import socket from './modules/socket'
// import createPersistedState from "vuex-persistedstate"
Vue.use(Vuex)
const store = new Vuex.Store({
modules: {
app
app,
// socket
},
getters
// plugins: [createPersistedState({
......
const state = {
path: window.$fetchConfig.baseURL,
socket: ''
}
const mutations = {}
const actions = {
connect({ state }) {
state.socket = new WebSocket(this.path)
}
}
export default {
state,
mutations,
actions
}
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-02-23 09:47:18
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-03-06 10:00:11
* @LastEditTime: 2024-03-06 17:16:14
* @FilePath: \dj-scrm-wx-work-attachment-psd\src\views\ai\index.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -53,6 +53,7 @@ export default {
return {
isInput: false,
timer: null,
isStart: true,
identityValue: '',
messageList: [],
roleIndex: -1,
......@@ -81,19 +82,19 @@ export default {
},
summarize(msg) {
if (this.roleIndex > -1) {
this.isStart = false
this.messageList.push(msg)
if (!this.timer)
this.timer = setInterval(() => {
let i = this.messageList.shift()
if (i == '<rdfast stop>') {
i = ''
this.roleIndex++
}
if (this.messageList.length == 0) {
clearInterval(this.timer)
this.timer = null
}
this.$set(this.descList, this.roleIndex, this.descList[this.roleIndex] + i)
this.$set(this.descList, this.identityIndex, this.descList[this.identityIndex] + i)
}, 50)
return
}
......@@ -104,18 +105,23 @@ export default {
this.identityList = matches.length ? matches.map(match => match[1]) : this.roleMsg.replace(/\。/, '').split('、')
for (let i = 0; i < this.identityList.length; i++) {
this.descList.push('')
this.sendMessage(
JSON.stringify({
type: 'roles_generate_desc',
question: `你是一名购车客户你的身份是${this.identityList[i]},请根据你的身份从${CAR_TYPE}里面选一款车型,并描述你的用车意向,大约100字左右`
// question: `你是一名购车客户你的身份是${this.identityList[i]},请根据你的身份描述你的用车意向,大约100字左右`
})
)
}
this.sendIdentity()
} else {
this.roleMsg += msg
}
},
//根据角色切换生成用车意向
sendIdentity() {
this.isStart = true
this.sendMessage(
JSON.stringify({
type: 'roles_generate_desc',
question: `你是一名购车客户你的身份是${this.identityList[this.identityIndex]},请根据你的身份从${CAR_TYPE}里面选一款车型,并描述你的用车意向,大约60字左右`
// question: `你是一名购车客户你的身份是${this.identityList[i]},请根据你的身份描述你的用车意向,大约100字左右`
})
)
},
handleSelectCar(item) {
this.show = true
this.selectCar = item
......@@ -124,11 +130,14 @@ export default {
this.sceneIndex = item
},
handleSelectIdentity(item) {
if (this.messageList.length || this.isStart) return
// if(this.roleIndex<=this.identityList.length) {
// return
// }
this.desc_d = ''
this.identityIndex = item
if (this.descList[this.identityIndex]) return
this.sendIdentity()
},
handleSure() {
const index = CAR_TYPE.findIndex(i => this.descList[this.identityIndex].includes(i))
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!