Feat(AI):关键词搜索匹配相关模块列表
This commit is contained in:
@@ -120,6 +120,14 @@ export default {
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
// 输入模式:input-键盘,sound-语音
|
||||
inputModel: 'input',
|
||||
/**
|
||||
* 端午节送礼攻略
|
||||
* 丽江逛吃攻略
|
||||
* 云南非遗有哪些?
|
||||
* 怎么申请地理标志保护产品?
|
||||
* 想找个像《去有风的地方》那样的治愈县城
|
||||
* 云南有哪些小众县城适合旅居?
|
||||
*/
|
||||
prompt: '',
|
||||
recordManager: null,
|
||||
// 录音权限是否开通
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -100,6 +100,107 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 换一换 -->
|
||||
<view
|
||||
v-if="item.showMoreInfo.show"
|
||||
class="change-list-wrap"
|
||||
>
|
||||
<view v-if="item.showMoreInfo.showType === '特产商品'" class="list-wrap">
|
||||
<view
|
||||
v-for="(productItem, productIndex) in item.showMoreInfo.resultItems"
|
||||
:key="productIndex"
|
||||
class="product-item"
|
||||
@click="productItemClickHandle(productItem)"
|
||||
>
|
||||
<image
|
||||
:src="productItem.img"
|
||||
class="img"
|
||||
/>
|
||||
<view class="product-info">
|
||||
<view class="name one-t">
|
||||
{{ productItem.name }}
|
||||
</view>
|
||||
<view class="price-wrap">
|
||||
<view class="price">
|
||||
<text class="txt">¥</text>{{ productItem.price }}
|
||||
</view>
|
||||
<view class="btn">立即查看</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.showMoreInfo.showType === '店铺'" class="list-wrap">
|
||||
<view
|
||||
v-for="(hotel, hotelIndex) in item.showMoreInfo.resultItems"
|
||||
:key="hotelIndex"
|
||||
class="product-item"
|
||||
@click="hotelItemClickHandle(hotel)"
|
||||
>
|
||||
<view class="hotel-type">
|
||||
手工体验
|
||||
</view>
|
||||
<image
|
||||
:src="hotel.img"
|
||||
class="img"
|
||||
/>
|
||||
<view class="product-info">
|
||||
<view class="name one-t">
|
||||
{{ hotel.name }}
|
||||
</view>
|
||||
<view class="desc-wrap one-t">
|
||||
{{ hotel.description || '' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.showMoreInfo.showType === '非遗文化'" class="list-wrap">
|
||||
<view
|
||||
v-for="(ich, ichIndex) in item.showMoreInfo.resultItems"
|
||||
:key="ichIndex"
|
||||
class="product-item"
|
||||
@click="ichItemClickHandle(ich)"
|
||||
>
|
||||
<image
|
||||
:src="ich.img"
|
||||
class="img"
|
||||
/>
|
||||
<view class="product-info">
|
||||
<view class="name one-t">
|
||||
{{ ich.name }}
|
||||
</view>
|
||||
<view class="desc-wrap one-t">
|
||||
{{ ich.description || '' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.showMoreInfo.showType === '千县名品'" class="list-wrap">
|
||||
<view
|
||||
v-for="(qianxian, qianxianIndex) in item.showMoreInfo.resultItems"
|
||||
:key="qianxianIndex"
|
||||
class="product-item"
|
||||
@click="qianxianItemClickHandle(qianxian)"
|
||||
>
|
||||
<image
|
||||
:src="qianxian.img"
|
||||
class="img"
|
||||
/>
|
||||
<view class="product-info">
|
||||
<view class="name name2 one-t">
|
||||
{{ qianxian.name }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="change-btn">
|
||||
<image
|
||||
:src="webUrl + '/aiChat/icon-change.png'"
|
||||
class="icon"
|
||||
mode="widthFix"
|
||||
@click="analyzeKeywordsChangeHandle(item.conversationId, item.showMoreInfo)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="index === (chatMessageListLength - 1) && item.listQuestion.length > 0"
|
||||
class="suggestion-wrap"
|
||||
|
||||
+105
-2
@@ -21,8 +21,9 @@
|
||||
:z-index="1"
|
||||
@beforeleave="pageContainerBeforeleave"
|
||||
>
|
||||
<view style="opacity: 0;"></view>
|
||||
遮罩层,用于监听实体键返回
|
||||
<view style="opacity: 0;">
|
||||
遮罩层,用于监听实体键返回
|
||||
</view>
|
||||
</page-container>
|
||||
<view
|
||||
id="fixTbabarBody"
|
||||
@@ -165,9 +166,111 @@
|
||||
/>
|
||||
重新生成
|
||||
</view>
|
||||
<view class="item item2" @click="copyMoreInfoHandle(item)">拷贝</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 换一换 -->
|
||||
<view
|
||||
v-if="item.showMoreInfo.show"
|
||||
class="change-list-wrap"
|
||||
>
|
||||
<view v-if="item.showMoreInfo.showType === '特产商品'" class="list-wrap">
|
||||
<view
|
||||
v-for="(productItem, productIndex) in item.showMoreInfo.resultItems"
|
||||
:key="productIndex"
|
||||
class="product-item"
|
||||
@click="productItemClickHandle(productItem)"
|
||||
>
|
||||
<image
|
||||
:src="productItem.img"
|
||||
class="img"
|
||||
/>
|
||||
<view class="product-info">
|
||||
<view class="name one-t">
|
||||
{{ productItem.name }}
|
||||
</view>
|
||||
<view class="price-wrap">
|
||||
<view class="price">
|
||||
<text class="txt">¥</text>{{ productItem.price }}
|
||||
</view>
|
||||
<view class="btn">立即查看</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.showMoreInfo.showType === '店铺'" class="list-wrap">
|
||||
<view
|
||||
v-for="(hotel, hotelIndex) in item.showMoreInfo.resultItems"
|
||||
:key="hotelIndex"
|
||||
class="product-item"
|
||||
@click="hotelItemClickHandle(hotel)"
|
||||
>
|
||||
<view class="hotel-type">
|
||||
手工体验
|
||||
</view>
|
||||
<image
|
||||
:src="hotel.img"
|
||||
class="img"
|
||||
/>
|
||||
<view class="product-info">
|
||||
<view class="name one-t">
|
||||
{{ hotel.name }}
|
||||
</view>
|
||||
<view class="desc-wrap one-t">
|
||||
{{ hotel.description || '' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.showMoreInfo.showType === '非遗文化'" class="list-wrap">
|
||||
<view
|
||||
v-for="(ich, ichIndex) in item.showMoreInfo.resultItems"
|
||||
:key="ichIndex"
|
||||
class="product-item"
|
||||
@click="ichItemClickHandle(ich)"
|
||||
>
|
||||
<image
|
||||
:src="ich.img"
|
||||
class="img"
|
||||
/>
|
||||
<view class="product-info">
|
||||
<view class="name one-t">
|
||||
{{ ich.name }}
|
||||
</view>
|
||||
<view class="desc-wrap one-t">
|
||||
{{ ich.description || '' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.showMoreInfo.showType === '千县名品'" class="list-wrap">
|
||||
<view
|
||||
v-for="(qianxian, qianxianIndex) in item.showMoreInfo.resultItems"
|
||||
:key="qianxianIndex"
|
||||
class="product-item"
|
||||
@click="qianxianItemClickHandle(qianxian)"
|
||||
>
|
||||
<image
|
||||
:src="qianxian.img"
|
||||
class="img"
|
||||
/>
|
||||
<view class="product-info">
|
||||
<view class="name name2 one-t">
|
||||
{{ qianxian.name }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="change-btn">
|
||||
<image
|
||||
:src="webUrl + '/aiChat/icon-change.png'"
|
||||
class="icon"
|
||||
mode="widthFix"
|
||||
@click="analyzeKeywordsChangeHandle(item.conversationId, item.showMoreInfo)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="index === (chatMessageListLength - 1) && item.listQuestion.length > 0"
|
||||
class="suggestion-wrap"
|
||||
|
||||
Reference in New Issue
Block a user