From f25483bbb738474d97860da7cad4e446736f5fdb Mon Sep 17 00:00:00 2001 From: lifizer <913626195@qq.com> Date: Mon, 12 May 2025 15:48:02 +0800 Subject: [PATCH] =?UTF-8?q?Feat(AI):=E5=85=B3=E9=94=AE=E8=AF=8D=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=8C=B9=E9=85=8D=E7=9B=B8=E5=85=B3=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 5f835afd8b309eebaf25da8cd8f478079f013dca) --- aiChat/components/bottomSend.vue | 8 +++ aiChat/mixins/chatMixins.js | 100 ++++++++++++++++++++++++++++- aiChat/views/history.vue | 101 +++++++++++++++++++++++++++++ aiChat/views/index.vue | 107 ++++++++++++++++++++++++++++++- api/chat/index.js | 10 +++ assets/css/aiChat.less | 107 +++++++++++++++++++++++++++++++ 6 files changed, 428 insertions(+), 5 deletions(-) diff --git a/aiChat/components/bottomSend.vue b/aiChat/components/bottomSend.vue index 0b1132e..f7d1af4 100644 --- a/aiChat/components/bottomSend.vue +++ b/aiChat/components/bottomSend.vue @@ -120,6 +120,14 @@ export default { webUrl: this.$VUE_APP_RESOURCES_URL, // 输入模式:input-键盘,sound-语音 inputModel: 'input', + /** + * 端午节送礼攻略 + * 丽江逛吃攻略 + * 云南非遗有哪些? + * 怎么申请地理标志保护产品? + * 想找个像《去有风的地方》那样的治愈县城 + * 云南有哪些小众县城适合旅居? + */ prompt: '', recordManager: null, // 录音权限是否开通 diff --git a/aiChat/mixins/chatMixins.js b/aiChat/mixins/chatMixins.js index 4303c94..7018ffe 100644 --- a/aiChat/mixins/chatMixins.js +++ b/aiChat/mixins/chatMixins.js @@ -1,7 +1,9 @@ import { getSseConfigV1, getCompletionsV2, - deleteChatItemByConversationId + deleteChatItemByConversationId, + getAnalyzeKeywordsV1, + getAnalyzeKeywordsChangeV1 } from '@/api/chat/index' import { VUE_APP_API_URL } from '@/config' import settings from '@/config/baseSetting.js' @@ -104,10 +106,21 @@ export const chatMixins = { copyContentHandle(data) { uni.setClipboardData({ data, - success: () => + success: () => { uni.showToast({ title: '已复制' }) + } + }) + }, + copyMoreInfoHandle(item) { + uni.setClipboardData({ + data: JSON.stringify(item.showMoreInfo), + success: () => { + uni.showToast({ + title: '已复制' + }) + } }) }, shareHandle() { @@ -181,7 +194,8 @@ export const chatMixins = { conversationId: '', prompt, listQuestion: [], - type: -2 + type: -2, + showMoreInfo: {} }) _this.loading = true _this.showCursor = false @@ -207,6 +221,32 @@ export const chatMixins = { _this.chatErrorSetContent() }) }) + getAnalyzeKeywordsV1({ + 'chatNumber': _this.chatNumber, + conversationId, + prompt + }).then(keywordRes => { + if (keywordRes.success) { + const keywordResData = keywordRes.data + const show = (keywordResData.searchArtworks || + keywordResData.searchDiscount || + keywordResData.searchGoods || + keywordResData.searchLandmark || + keywordResData.searchTowns || + keywordResData.searchTravelGuide + ) && (keywordResData.resultItems && keywordResData.resultItems.length > 0) + _this.chatMessageList[_this.chatMessageListLength - 1].showMoreInfo = keywordResData + _this.chatMessageList[_this.chatMessageListLength - 1].showMoreInfo.show = show + // 展示类型 + _this.chatMessageList[_this.chatMessageListLength - 1].showMoreInfo.showType = '' + if (show && keywordResData.resultItems) { + keywordResData.resultItems.map(resItem => { + _this.chatMessageList[_this.chatMessageListLength - 1].showMoreInfo.showType = resItem.type + }) + } + console.log(_this.chatMessageList[_this.chatMessageListLength - 1]) + } + }) } else { _this.chatErrorSetContent() } @@ -215,6 +255,60 @@ export const chatMixins = { _this.chatErrorSetContent() }) }, + analyzeKeywordsChangeHandle(conversationId, showMoreInfo) { + getAnalyzeKeywordsChangeV1({ + conversationId, + ...showMoreInfo + }).then(res => { + const { success, data } = res + if (success) { + let resultItems = [] + let idx = -1 + this.chatMessageList.map((item, index) => { + if (item.conversationId === conversationId) { + resultItems = data.resultItems || [] + idx = index + } + }) + if (idx > -1) { + this.$set(this.chatMessageList[idx].showMoreInfo, 'resultItems', resultItems) + this.$forceUpdate() + } + } + }) + }, + productItemClickHandle(item) { + this.$yrouter.push({ + path: '/pages/shop/GoodsCon/index', + query: { + id: item.id + } + }) + }, + hotelItemClickHandle(item) { + this.$yrouter.push({ + path: '/pagesInn/inn/innHome', + query: { + id: item.id + } + }) + }, + ichItemClickHandle(item) { + this.$yrouter.push({ + path: '/pkg_product/views/heritage/details', + query: { + id: item.id + } + }) + }, + qianxianItemClickHandle(item) { + this.$yrouter.push({ + path: '/pkg_product/views/famousQianxianShop', + query: { + id: item.id + } + }) + }, chatErrorSetContent() { this.chatMessageList[this.chatMessageListLength - 1].isError = true this.chatMessageList[this.chatMessageListLength - 1].content = this.errorMsg diff --git a/aiChat/views/history.vue b/aiChat/views/history.vue index 34c4e39..fa775b2 100644 --- a/aiChat/views/history.vue +++ b/aiChat/views/history.vue @@ -100,6 +100,107 @@ + + + + + + + + {{ productItem.name }} + + + + {{ productItem.price }} + + 立即查看 + + + + + + + + 手工体验 + + + + + {{ hotel.name }} + + + {{ hotel.description || '' }} + + + + + + + + + + {{ ich.name }} + + + {{ ich.description || '' }} + + + + + + + + + + {{ qianxian.name }} + + + + + + + + - - 遮罩层,用于监听实体键返回 + + 遮罩层,用于监听实体键返回 + 重新生成 + 拷贝 + + + + + + + + {{ productItem.name }} + + + + {{ productItem.price }} + + 立即查看 + + + + + + + + 手工体验 + + + + + {{ hotel.name }} + + + {{ hotel.description || '' }} + + + + + + + + + + {{ ich.name }} + + + {{ ich.description || '' }} + + + + + + + + + + {{ qianxian.name }} + + + + + + + +