Feat(云灵AI):送礼逻辑对接
This commit is contained in:
@@ -6,7 +6,8 @@ import {
|
||||
getAnalyzeKeywordsChangeV3,
|
||||
getSseCountyAiConfigV1,
|
||||
getCountyAiCompletionsV1,
|
||||
getGiftRecommendOptions
|
||||
getGiftRecommendOptions,
|
||||
getGiftRecommendPrompt
|
||||
} from '@/api/chat/index'
|
||||
import {
|
||||
getExceptionConfig,
|
||||
@@ -795,24 +796,43 @@ export const chatMixinsV2 = {
|
||||
}
|
||||
},
|
||||
finishGiftSteps() {
|
||||
let promptStr = '我想送礼'
|
||||
const selectedSteps = []
|
||||
this.giftBuyOptions.forEach(step => {
|
||||
if (step.type === 'option_card') {
|
||||
const selectedIds = this.giftSelections[step.id] || []
|
||||
if (selectedIds.length > 0) {
|
||||
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') {
|
||||
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
|
||||
this.streamReq({
|
||||
prompt: promptStr,
|
||||
init: 0
|
||||
})
|
||||
console.log(selectedSteps)
|
||||
uni.showLoading()
|
||||
getGiftRecommendPrompt(selectedSteps).then(res => {
|
||||
const { success, data } = res
|
||||
if (success) {
|
||||
this.showGiftSteps = false
|
||||
this.streamReq({
|
||||
prompt: data.prompt || '我想送礼',
|
||||
init: 0
|
||||
})
|
||||
}
|
||||
}).finally(() => {
|
||||
uni.hideLoading()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user