diff --git a/README.md b/README.md index 7e8a3a4..a0fd4bf 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,9 @@ #### 安装教程 + + + 1. xxxx 2. xxxx 3. xxxx 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..a5f6d29 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,63 @@ 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 + } + }) + }, + prizeItemClickHandle() { + this.$yrouter.push({ path: '/pkg-video/views/lottery' }) + }, 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..4963bf6 100644 --- a/aiChat/views/history.vue +++ b/aiChat/views/history.vue @@ -100,6 +100,121 @@ + + + + + + + + {{ productItem.name }} + + + + {{ productItem.price }} + + 立即查看 + + + + + + + + {{ hotel.hotelTypeName }} + + + + + {{ hotel.name }} + + + {{ hotel.description || '' }} + + + + + + + + + + {{ ich.name }} + + + {{ ich.description || '' }} + + + + + + + + + + {{ qianxian.name }} + + + + + + + + + + + + + - - 遮罩层,用于监听实体键返回 + + 遮罩层,用于监听实体键返回 + + + + + + + + + + {{ weatherData.tem }} + + + + + + + {{ weatherData.city }} + + + {{ weatherData.wea }}  {{ weatherData.tem2 }}℃~{{ weatherData.tem1 }}℃ + + + 今日风向:{{ weatherData.win }} + 紫外线指数:{{ weatherData.uvIndex }}  {{ weatherData.uvDescription }} + + + + 无法获取天气信息 + + + + 加载中... + + + + + {{ holidayData.lunarCalendar }} + {{ holidayData.date.substr(5).replace('-', '/') }} {{ weekDayArr[holidayData.weekDay] }} + + {{ holidayData.yearTips }}年/{{ holidayData.chineseZodiac }} + + + + {{ holidayData.suit }} + + + + + + {{ holidayData.avoid }} + + + + 重新生成 + 拷贝 + + + + + + + + {{ productItem.name }} + + + + {{ productItem.price }} + + 立即查看 + + + + + + + + {{ hotel.hotelTypeName }} + + + + + {{ hotel.name }} + + + {{ hotel.description || '' }} + + + + + + + + + + {{ ich.name }} + + + {{ ich.description || '' }} + + + + + + + + + + {{ qianxian.name }} + + + + + + + + + + + + + - + { + this.loadData() + }) + }, + loadData() { + getAiSystemInfoTopic().then(res => { + const { success, data } = res + if (success) { + this.topicList = data || [] + } + }) + if (this.cityName) { + this.weatherDataLoading = true + getWeatherData({ + cityName: this.cityName + }).then(res => { const { success, data } = res if (success) { - this.topicList = data || [] + this.weatherData = data } + this.weatherIsLoad = true + this.weatherDataLoading = false + }).catch(() => { + this.weatherDataLoading = false + this.weatherIsLoad = false }) + } + getHolidayData().then(res => { + const { success, data } = res + if (success) { + this.holidayData = data + } }) }, // 创建新会话 @@ -304,6 +530,7 @@ export default { this.loading = false this.getConfigLoading = false this.chatMessageList = [] + this.loadData() }, clickBackHandle() { if (!this.chatNumber) { @@ -372,7 +599,7 @@ export default { display: flex; align-items: center; justify-content: space-between; - padding: 60rpx 40rpx; + padding: 0 40rpx; .guide-left { .avatar { display: block; diff --git a/api/chat/index.js b/api/chat/index.js index 67a89c2..e8fc49b 100644 --- a/api/chat/index.js +++ b/api/chat/index.js @@ -12,6 +12,16 @@ export function getCompletionsV2(params) { return request.get('/v1/chat/sse/completions2', params, { login: true }) } +// 通过关键字-搜索列表 +export function getAnalyzeKeywordsV1(data) { + return request.post('/v1/chat/analyzeKeywords', data, { login: true }) +} + +// 通过关键字-搜索列表-换一换 +export function getAnalyzeKeywordsChangeV1(data) { + return request.post('/v1/chat/aiSearch', data, { login: true }) +} + export function deleteChatItemByConversationId(id) { return request.delete('/v1/chat/message/' + id, {}, { login: true }) } @@ -27,3 +37,11 @@ export function historyChatMessage(params) { export function deleteChatListByType(type) { return request.delete('/v1/chat/type/' + type, {}, { login: true }) } + +export function getWeatherData(params) { + return request.get('/v1/chat/weatherData', params, { login: true }) +} + +export function getHolidayData(params) { + return request.get('/v1/chat/holidayData', params, { login: true }) +} diff --git a/assets/css/aiChat.less b/assets/css/aiChat.less index e7c3176..52971c3 100644 --- a/assets/css/aiChat.less +++ b/assets/css/aiChat.less @@ -488,6 +488,7 @@ page { } } .bottom-btns { + position: relative; display: flex; justify-content: flex-start; padding: 20rpx 0 0 0; @@ -510,6 +511,13 @@ page { margin: 0 6rpx 0 0; } } + .item2 { + position: absolute; + bottom: 0; + right: 0; + margin: 0; + color: transparent; + } } } } @@ -919,4 +927,249 @@ page { 100% { height: 20rpx; } +} +.change-list-wrap { + .list-wrap { + display: flex; + flex-wrap: nowrap; + width: 100%; + flex-shrink: 0; + padding: 40rpx 0; + overflow-x: auto; + .product-item { + position: relative; + width: 240rpx; + margin: 0 24rpx 0 0; + border-radius: 20rpx; + background-color: #fff; + box-shadow: 0rpx 6rpx 12rpx rgba(0,0,0,0.16); + &:last-child { + margin: 0; + } + .img { + position: relative; + z-index: 2; + display: block; + width: 240rpx; + height: 240rpx; + border-radius: 20rpx; + } + .product-info { + padding: 12rpx; + .name { + height: 34rpx; + font-size: 24rpx; + color: #333; + line-height: 34rpx; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + transition: all linear 0.2s; + } + .name2 { + font-weight: bold; + } + .price-wrap { + display: flex; + align-items: center; + justify-content: space-between; + margin-top: 12rpx; + .price { + color: #C52733; + font-size: 24rpx; + font-weight: bold; + .txt { + font-size: 16rpx; + } + } + .btn { + height: 30rpx; + padding: 0 12rpx; + border-radius: 16rpx; + color: #fff; + font-size: 22rpx; + background-color: #C52733; + } + } + .desc-wrap { + font-size: 24rpx; + color: #999; + line-height: 34rpx; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } + } + .hotel-type { + position: absolute; + top: 0; + left: 0; + z-index: 5; + height: 40rpx; + padding: 0 24rpx; + border-top-left-radius: 20rpx; + border-bottom-right-radius: 20rpx; + color: #fff; + font-size: 24rpx; + background-color: rgba(0, 0, 0, 0.5); + } + } + } + .prize-list-wrap { + display: block; + .prize-item { + .img { + display: block; + width: 100%; + border-radius: 20rpx; + } + } + } + .change-btn { + display: flex; + align-items: center; + justify-content: center; + padding: 0 0 20rpx 0; + .icon { + display: block; + width: 124rpx; + height: 38rpx; + } + } +} +.weather-holiday-wrap { + display: flex; + align-items: stretch; + justify-content: space-between; + gap: 12px; + padding: 0 24rpx 48rpx 24rpx; + .data-wrap { + flex: 1; + padding: 20rpx; + border-radius: 20rpx; + box-sizing: border-box; + background-color: #fff; + box-shadow: 0rpx 0rpx 20rpx rgba(0,0,0,0.16); + } + .weather-data { + .title { + display: flex; + align-items: center; + color: #3D4CF1; + .icon { + display: block; + width: 100rpx; + height: 100rpx; + margin: 0 12rpx 0 0; + } + .tem-wrap { + display: flex; + align-items: baseline; + } + .tem { + font-size: 70rpx; + line-height: 70rpx; + font-weight: bold; + } + .unit { + font-size: 36rpx; + line-height: 36rpx; + } + } + .loca { + display: flex; + padding: 24rpx 0; + font-size: 26rpx; + line-height: 36rpx; + color: #333; + .addr { + display: flex; + align-items: center; + .icon { + display: block; + width: 24rpx; + height: 24rpx; + margin: 0 4rpx 0 0; + } + } + .tem-range { + padding: 0 0 0 24rpx; + } + } + .content + .content { + padding: 12rpx 0 0 0; + } + .content { + color: #3D4CF1; + font-size: 26rpx; + line-height: 36rpx; + font-weight: bold; + } + .txt-loading { + display: flex; + align-items: center; + justify-content: center; + font-size: 28rpx; + min-height: 200rpx; + } + .no-weather { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100%; + font-size: 26rpx; + color: #999; + line-height: 38rpx; + .img { + display: block; + width: 226rpx; + height: 130rpx; + margin: 0 0 12rpx 0; + } + } + } + .holiday-data { + .title { + display: flex; + font-size: 24rpx; + color: #333; + line-height: 36rpx; + .day { + margin: 0 8rpx 0 0; + color: #3D4CF1; + font-size: 28rpx; + } + } + .desc { + font-size: 24rpx; + color: #333; + line-height: 36rpx; + } + .tip { + display: flex; + flex-wrap: wrap; + padding: 20rpx 0 0 0; + .label { + display: block; + width: 32rpx; + height: 32rpx; + margin: 0 12rpx 0 0; + border-radius: 8rpx; + text-align: center; + line-height: 32rpx; + font-size: 24rpx; + color: #fff; + background-color: #3D4CF1; + } + .label2 { + background-color: #C52733; + } + .content { + width: calc(100% - 44rpx); + margin: -6rpx 0 0 0; + font-size: 24rpx; + } + } + } } \ No newline at end of file diff --git a/components/UserEvaluation.vue b/components/UserEvaluation.vue index 1c1b8fb..41d5704 100644 --- a/components/UserEvaluation.vue +++ b/components/UserEvaluation.vue @@ -31,7 +31,7 @@ @@ -106,6 +106,7 @@ export default { };