Feat(云灵AI):县域AI和平台AI逻辑区分
This commit is contained in:
@@ -3,8 +3,15 @@ import {
|
||||
getCompletionsV3,
|
||||
deleteChatItemByConversationId,
|
||||
// getAnalyzeKeywordsV1,
|
||||
getAnalyzeKeywordsChangeV3
|
||||
getAnalyzeKeywordsChangeV3,
|
||||
getSseCountyAiConfigV1,
|
||||
getCountyAiCompletionsV1,
|
||||
getGiftRecommendOptions
|
||||
} from '@/api/chat/index'
|
||||
import {
|
||||
getExceptionConfig,
|
||||
getBottomNavigationConfigList
|
||||
} from '@/api/public'
|
||||
import {
|
||||
postCartAdd
|
||||
} from '@/api/store'
|
||||
@@ -21,35 +28,7 @@ export const chatMixinsV2 = {
|
||||
token: cookie.get('login_status'),
|
||||
userInfo: cookie.get('userInfo'),
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
bottomTools: [
|
||||
{
|
||||
name: '我要送礼',
|
||||
icon: 'https://resource.xdd618.com/3/20260526/1779781836792_icon-50.png',
|
||||
navType: 'prompt',
|
||||
promptContent: '我要送礼,请给我推荐一些平台的礼品',
|
||||
url: '',
|
||||
giftCardEnabled: 1,
|
||||
display: true
|
||||
},
|
||||
{
|
||||
name: '订单查询',
|
||||
icon: 'https://resource.xdd618.com/3/20260526/1779781836793_icon-51.png',
|
||||
navType: 'prompt',
|
||||
promptContent: '帮我查询我的待发货、待收货订单信息',
|
||||
url: '',
|
||||
giftCardEnabled: 0,
|
||||
display: true
|
||||
},
|
||||
{
|
||||
name: '拍照识图',
|
||||
icon: 'https://resource.xdd618.com/3/20260526/1779781836794_icon-52.png',
|
||||
navType: 'url',
|
||||
promptContent: '',
|
||||
url: '/aiChat/views/imageRecognition',
|
||||
giftCardEnabled: 0,
|
||||
display: true
|
||||
}
|
||||
],
|
||||
bottomTools: [],
|
||||
scrollData: {},
|
||||
scrollTop: 0,
|
||||
isScrollToBottom: false,
|
||||
@@ -63,31 +42,17 @@ export const chatMixinsV2 = {
|
||||
loading: false,
|
||||
chatNumber: '',
|
||||
infoResData: {},
|
||||
chatMessageList: [
|
||||
/*
|
||||
{
|
||||
type: -2,
|
||||
isError: false,
|
||||
showCursor: false,
|
||||
conversationId: '',
|
||||
prompt: '',
|
||||
nodes: '-------------监听 WebSocket 接受到服务器的消息事件',
|
||||
content: '-------------监听 WebSocket 接受到服务器的消息事件',
|
||||
listQuestion: [
|
||||
'监听 WebSocket 接受到服务器的消息事件',
|
||||
'监听 WebSocket 接受到服务器的消息事件',
|
||||
'监听 WebSocket 接受到服务器的消息事件'
|
||||
]
|
||||
}
|
||||
*/
|
||||
],
|
||||
errorMsg: Object.freeze('您提的问题未能理解,云灵思想跑偏啦,重新整理一下问题或者重新提问,让云灵再试试!'),
|
||||
chatMessageList: [],
|
||||
audioAyy: [],
|
||||
isPlayAudio: false,
|
||||
audioContext: null,
|
||||
audioPlayId: '',
|
||||
showGiftBtn: false,
|
||||
buyLoading: false
|
||||
buyLoading: false,
|
||||
exceptionConfig: {
|
||||
model_exception: '您提的问题未能理解,云灵思想跑偏啦,重新整理一下问题或者重新提问,让云灵再试试!',
|
||||
voice_exception: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -137,7 +102,37 @@ export const chatMixinsV2 = {
|
||||
},
|
||||
methods: {
|
||||
createdCallbak() {
|
||||
console.log('页面初始话回调')
|
||||
this.$nextTick(() => {
|
||||
this.scrollToBottomHandle()
|
||||
getExceptionConfig().then(res => {
|
||||
const { success, data } = res
|
||||
if (success) {
|
||||
this.exceptionConfig = data || {}
|
||||
}
|
||||
})
|
||||
// 县域AI没有底部快捷操作和送礼配置
|
||||
if (!this.countyId) {
|
||||
getBottomNavigationConfigList().then(res => {
|
||||
const { success, data } = res
|
||||
if (success) {
|
||||
this.bottomTools = data || []
|
||||
this.bottomTools.forEach(item => {
|
||||
item.display = true
|
||||
})
|
||||
}
|
||||
})
|
||||
getGiftRecommendOptions().then(res => {
|
||||
const { success, data } = res
|
||||
if (success) {
|
||||
this.giftBuyOptions = data || {}
|
||||
}
|
||||
})
|
||||
}
|
||||
this.extraReqFn()
|
||||
})
|
||||
},
|
||||
extraReqFn() {
|
||||
console.log('首页/历史详情页面单独请求接口逻辑')
|
||||
},
|
||||
inputFocusHandle(value) {
|
||||
this.onFocus = value === 1
|
||||
@@ -263,21 +258,49 @@ export const chatMixinsV2 = {
|
||||
})
|
||||
_this.loading = true
|
||||
_this.showCursor = false
|
||||
getSseConfigV1({
|
||||
'chatNumber': _this.chatNumber,
|
||||
prompt
|
||||
}).then(resConfig => {
|
||||
let reqFn = null
|
||||
let postData = {}
|
||||
if (_this.countyId) {
|
||||
reqFn = getSseCountyAiConfigV1
|
||||
postData = {
|
||||
'countyId': _this.countyId,
|
||||
'chatNumber': _this.chatNumber,
|
||||
prompt
|
||||
}
|
||||
} else {
|
||||
reqFn = getSseConfigV1
|
||||
postData = {
|
||||
'chatNumber': _this.chatNumber,
|
||||
prompt
|
||||
}
|
||||
}
|
||||
reqFn(postData).then(resConfig => {
|
||||
const conversationId = resConfig.data.conversationId
|
||||
_this.chatNumber = resConfig.data.chatNumber || ''
|
||||
_this.chatMessageList[_this.chatMessageListLength - 1].showCursor = true
|
||||
_this.chatMessageList[_this.chatMessageListLength - 1].conversationId = conversationId
|
||||
if (conversationId) {
|
||||
_this.initWebSocket(conversationId, () => {
|
||||
getCompletionsV3({
|
||||
conversationId,
|
||||
ws: true,
|
||||
isNoNeedPublicErrorNotification: 1
|
||||
}).then(sseRes => {
|
||||
|
||||
let completionsReqFn = null
|
||||
let completionsPostData = {}
|
||||
if (_this.countyId) {
|
||||
completionsReqFn = getCountyAiCompletionsV1
|
||||
completionsPostData = {
|
||||
conversationId,
|
||||
countyId: _this.countyId,
|
||||
ws: true,
|
||||
isNoNeedPublicErrorNotification: 1
|
||||
}
|
||||
} else {
|
||||
completionsReqFn = getCompletionsV3
|
||||
completionsPostData = {
|
||||
conversationId,
|
||||
ws: true,
|
||||
isNoNeedPublicErrorNotification: 1
|
||||
}
|
||||
}
|
||||
completionsReqFn(completionsPostData).then(sseRes => {
|
||||
console.log(sseRes)
|
||||
// _this.closeWsFn()
|
||||
}).catch(err => {
|
||||
@@ -576,8 +599,8 @@ export const chatMixinsV2 = {
|
||||
},
|
||||
chatErrorSetContent() {
|
||||
this.chatMessageList[this.chatMessageListLength - 1].isError = true
|
||||
this.chatMessageList[this.chatMessageListLength - 1].content = this.errorMsg
|
||||
this.chatMessageList[this.chatMessageListLength - 1].nodes = this.errorMsg
|
||||
this.chatMessageList[this.chatMessageListLength - 1].content = this.exceptionConfig.model_exception
|
||||
this.chatMessageList[this.chatMessageListLength - 1].nodes = this.exceptionConfig.model_exception
|
||||
this.closeWsFn()
|
||||
},
|
||||
closeWsFn() {
|
||||
|
||||
Reference in New Issue
Block a user