|
@@ -83,7 +83,7 @@ import { Container, Main, Avatar, Badge, Button, Input, Divider, Drawer } from '
|
|
import AsideView from '@/components/aside/'
|
|
import AsideView from '@/components/aside/'
|
|
import MessageList from '@/components/MessageList'
|
|
import MessageList from '@/components/MessageList'
|
|
import { mapState, mapMutations, mapActions, mapGetters } from 'vuex'
|
|
import { mapState, mapMutations, mapActions, mapGetters } from 'vuex'
|
|
-import { getChartGroupInfo, robotInfo, createChatSession, getUserList, getMessageCount, closeChatSession, getWebSocketNode, aiChatFindAnswer, customerEval, joinChartGroup, createChartGroup, guessWantAsk } from '@/api/modules/'
|
|
|
|
|
|
+import { getChartGroupInfo, robotInfo, createChatSession, getUserList, getMessageCount, closeChatSession, getWebSocketNode, robotFindAnswer, customerEval, joinChartGroup, createChartGroup, guessWantAsk } from '@/api/modules/'
|
|
import { getLink, debounce, removeHtmlStyle, setTrack } from '@/utils/'
|
|
import { getLink, debounce, removeHtmlStyle, setTrack } from '@/utils/'
|
|
import CommunicateBook from '@/components/communicateBook/index'
|
|
import CommunicateBook from '@/components/communicateBook/index'
|
|
import GroupInfo from '@/components/group-info/'
|
|
import GroupInfo from '@/components/group-info/'
|
|
@@ -897,27 +897,27 @@ export default {
|
|
this.onTurnPeople(question.replace(/\s+/g, ''), '')
|
|
this.onTurnPeople(question.replace(/\s+/g, ''), '')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- // const { data } = await robotFindAnswer({
|
|
|
|
- // question: question,
|
|
|
|
- // type: type,
|
|
|
|
- // robotEntId: this.other.userId
|
|
|
|
- // })
|
|
|
|
- // const content = data && data.answer ? data.answer : this.excuse.unknown // 有答案取答案,没答案取未知问题说辞
|
|
|
|
- const { data, error_msg: msg, error_code: code } = await aiChatFindAnswer({
|
|
|
|
- prompt: question,
|
|
|
|
- history: this.historyQuestion,
|
|
|
|
- href: location.origin
|
|
|
|
|
|
+ const { data, error_code: code } = await robotFindAnswer({
|
|
|
|
+ question: question,
|
|
|
|
+ type: type,
|
|
|
|
+ robotEntId: this.other.userId
|
|
})
|
|
})
|
|
|
|
+ const content = data && data.answer ? data.answer : this.excuse.unknown // 有答案取答案,没答案取未知问题说辞
|
|
|
|
+ // const { data, error_msg: msg, error_code: code } = await aiChatFindAnswer({
|
|
|
|
+ // prompt: question,
|
|
|
|
+ // history: this.historyQuestion,
|
|
|
|
+ // href: location.origin
|
|
|
|
+ // })
|
|
this.historyQuestion.push(question)
|
|
this.historyQuestion.push(question)
|
|
if (code === 0) {
|
|
if (code === 0) {
|
|
- const content = data?.reply ? data?.reply : msg
|
|
|
|
|
|
+ // const content = data?.reply ? data?.reply : msg
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
const apiParams = {
|
|
const apiParams = {
|
|
ownType: 2,
|
|
ownType: 2,
|
|
title: '机器人自动回复',
|
|
title: '机器人自动回复',
|
|
content: content,
|
|
content: content,
|
|
item: 8,
|
|
item: 8,
|
|
- itemType: data?.reply ? 8 : 4, // 有答案的即为知识库内容标识为8,无答案为未知问题说辞标识为4
|
|
|
|
|
|
+ itemType: data?.answer ? 8 : 4, // 有答案的即为知识库内容标识为8,无答案为未知问题说辞标识为4
|
|
sendId: this.other.sessionId, // 发送人标识(客服发送信息时该值为会话标识,用户聊天时该值不传)
|
|
sendId: this.other.sessionId, // 发送人标识(客服发送信息时该值为会话标识,用户聊天时该值不传)
|
|
type: 1,
|
|
type: 1,
|
|
link: '',
|
|
link: '',
|
|
@@ -998,9 +998,9 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 保存并发送公共方法
|
|
// 保存并发送公共方法
|
|
- async onSendCommon ({ apiParams, socketParams }, isSend = true) {
|
|
|
|
|
|
+ async onSendCommon ({ apiParams, socketParams }, isSend = true, isSkip = false) {
|
|
await this.robotOvertimeReply()
|
|
await this.robotOvertimeReply()
|
|
- this.setSendCopy({ apiParams, socketParams }, isSend = true)
|
|
|
|
|
|
+ this.setSendCopy({ apiParams, socketParams }, isSend = true, null, isSkip)
|
|
// 用户跟用户聊、群聊 不需要查询聊天状态 return
|
|
// 用户跟用户聊、群聊 不需要查询聊天状态 return
|
|
if (this.other.userType >= 2) return
|
|
if (this.other.userType >= 2) return
|
|
const storage = this.userSessionBadge
|
|
const storage = this.userSessionBadge
|
|
@@ -1011,7 +1011,7 @@ export default {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- async setSendCopy ({ apiParams, socketParams }, isSend = true, num) {
|
|
|
|
|
|
+ async setSendCopy ({ apiParams, socketParams }, isSend = true, num, isSkip = false) {
|
|
// isSend:是否通过websocket发送消息
|
|
// isSend:是否通过websocket发送消息
|
|
if (!apiParams.content) return
|
|
if (!apiParams.content) return
|
|
const { error_code: code, data } = await this.saveMessageAction(apiParams)
|
|
const { error_code: code, data } = await this.saveMessageAction(apiParams)
|
|
@@ -1040,7 +1040,7 @@ export default {
|
|
} catch (error) {}
|
|
} catch (error) {}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (apiParams.fool === 1) {
|
|
|
|
|
|
+ if (apiParams.fool === 1 && !isSkip) {
|
|
this.robotAutoReply(content)
|
|
this.robotAutoReply(content)
|
|
}
|
|
}
|
|
if (num === 1) {
|
|
if (num === 1) {
|
|
@@ -1069,7 +1069,7 @@ export default {
|
|
this.getUserListLastMsg(rUserId, contentType, removeHtmlStyle(content), time)
|
|
this.getUserListLastMsg(rUserId, contentType, removeHtmlStyle(content), time)
|
|
},
|
|
},
|
|
// 发送、存储文本消息
|
|
// 发送、存储文本消息
|
|
- onSendMsg (content, data) {
|
|
|
|
|
|
+ onSendMsg (content, data, skip = false) {
|
|
let type = 1
|
|
let type = 1
|
|
if (data) {
|
|
if (data) {
|
|
type = data?.type
|
|
type = data?.type
|
|
@@ -1107,7 +1107,7 @@ export default {
|
|
sessionId: this.other.sessionId
|
|
sessionId: this.other.sessionId
|
|
}
|
|
}
|
|
this.msgVal = ''
|
|
this.msgVal = ''
|
|
- this.onSendCommon({ apiParams, socketParams })
|
|
|
|
|
|
+ this.onSendCommon({ apiParams, socketParams }, true, true)
|
|
},
|
|
},
|
|
// 发送、存储图片消息
|
|
// 发送、存储图片消息
|
|
onUploadImage (data) {
|
|
onUploadImage (data) {
|
|
@@ -1422,8 +1422,9 @@ export default {
|
|
},
|
|
},
|
|
// 选择联想问题发送客服
|
|
// 选择联想问题发送客服
|
|
chooseQuestion (item) {
|
|
chooseQuestion (item) {
|
|
- const { question } = item
|
|
|
|
- this.onSendMsg(removeHtmlStyle(question))
|
|
|
|
|
|
+ const { question, answer } = item
|
|
|
|
+
|
|
|
|
+ this.onSendMsg(removeHtmlStyle(question), null, true)
|
|
// 埋点
|
|
// 埋点
|
|
setTrack({
|
|
setTrack({
|
|
id: 'c_social',
|
|
id: 'c_social',
|
|
@@ -1435,6 +1436,32 @@ export default {
|
|
try {
|
|
try {
|
|
this.$refs.chartInput.$refs?.quillEditorRef.setRangeIndex()
|
|
this.$refs.chartInput.$refs?.quillEditorRef.setRangeIndex()
|
|
} catch (error) { }
|
|
} catch (error) { }
|
|
|
|
+
|
|
|
|
+ // 自动回复答案
|
|
|
|
+ if (answer) {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ const apiParams = {
|
|
|
|
+ ownType: 2,
|
|
|
|
+ title: '猜你想问-自动回复',
|
|
|
|
+ content: answer,
|
|
|
|
+ item: 8,
|
|
|
|
+ itemType: 4, // 机器人信息
|
|
|
|
+ sendId: this.other.sessionId, // 发送人标识(客服发送信息时该值为会话标识,用户聊天时该值不传)
|
|
|
|
+ type: 1,
|
|
|
|
+ link: '',
|
|
|
|
+ fool: 2
|
|
|
|
+ }
|
|
|
|
+ const socketParams = {
|
|
|
|
+ type: 27,
|
|
|
|
+ rUserId: this.other.userId,
|
|
|
|
+ rUserType: this.other.userType,
|
|
|
|
+ contentType: 1,
|
|
|
|
+ headImg: this.autoUserInfo.img,
|
|
|
|
+ nickName: this.autoUserInfo.name
|
|
|
|
+ }
|
|
|
|
+ this.onSendCommon({ apiParams, socketParams }, true)
|
|
|
|
+ }, 200)
|
|
|
|
+ }
|
|
},
|
|
},
|
|
onCustomerText (val) {
|
|
onCustomerText (val) {
|
|
this.isTrick = true // 选中列表话术则跳过联想
|
|
this.isTrick = true // 选中列表话术则跳过联想
|