Feat(云灵AI):送礼逻辑对接
This commit is contained in:
@@ -6,7 +6,8 @@ import {
|
|||||||
getAnalyzeKeywordsChangeV3,
|
getAnalyzeKeywordsChangeV3,
|
||||||
getSseCountyAiConfigV1,
|
getSseCountyAiConfigV1,
|
||||||
getCountyAiCompletionsV1,
|
getCountyAiCompletionsV1,
|
||||||
getGiftRecommendOptions
|
getGiftRecommendOptions,
|
||||||
|
getGiftRecommendPrompt
|
||||||
} from '@/api/chat/index'
|
} from '@/api/chat/index'
|
||||||
import {
|
import {
|
||||||
getExceptionConfig,
|
getExceptionConfig,
|
||||||
@@ -795,24 +796,43 @@ export const chatMixinsV2 = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
finishGiftSteps() {
|
finishGiftSteps() {
|
||||||
let promptStr = '我想送礼'
|
const selectedSteps = []
|
||||||
this.giftBuyOptions.forEach(step => {
|
this.giftBuyOptions.forEach(step => {
|
||||||
if (step.type === 'option_card') {
|
if (step.type === 'option_card') {
|
||||||
const selectedIds = this.giftSelections[step.id] || []
|
const selectedIds = this.giftSelections[step.id] || []
|
||||||
if (selectedIds.length > 0) {
|
if (selectedIds.length > 0) {
|
||||||
const selectedNames = step.options.filter(opt => selectedIds.includes(opt.id)).map(opt => opt.optionName)
|
const selectedNames = step.options.filter(opt => selectedIds.includes(opt.id)).map(opt => opt.optionName)
|
||||||
promptStr += `,${step.title.replace('?', '')}:${selectedNames.join('、')}`
|
selectedSteps.push({
|
||||||
|
sort: step.sort,
|
||||||
|
title: step.title,
|
||||||
|
type: step.type,
|
||||||
|
options: selectedNames
|
||||||
|
})
|
||||||
}
|
}
|
||||||
} else if (step.type === 'price_input') {
|
} else if (step.type === 'price_input') {
|
||||||
if (this.giftBudget) {
|
if (this.giftBudget) {
|
||||||
promptStr += `,${step.title.replace('?', '')}:${this.giftBudget}`
|
selectedSteps.push({
|
||||||
|
sort: step.sort,
|
||||||
|
title: step.title,
|
||||||
|
type: step.type,
|
||||||
|
options: [this.giftBudget]
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
this.showGiftSteps = false
|
console.log(selectedSteps)
|
||||||
this.streamReq({
|
uni.showLoading()
|
||||||
prompt: promptStr,
|
getGiftRecommendPrompt(selectedSteps).then(res => {
|
||||||
init: 0
|
const { success, data } = res
|
||||||
|
if (success) {
|
||||||
|
this.showGiftSteps = false
|
||||||
|
this.streamReq({
|
||||||
|
prompt: data.prompt || '我想送礼',
|
||||||
|
init: 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
uni.hideLoading()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,3 +85,7 @@ export function getCountyAiChatList(params) {
|
|||||||
export function getCountyAiHistoryChatMessage(params) {
|
export function getCountyAiHistoryChatMessage(params) {
|
||||||
return request.get('/county-ai/chat/message', params, { login: true })
|
return request.get('/county-ai/chat/message', params, { login: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getGiftRecommendPrompt(data) {
|
||||||
|
return request.post('/ai/gift-recommend/build-prompt', data, { login: true })
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user