Refactor(云灵AI):1、使用新模型逻辑对接;2、订单查询

This commit is contained in:
lifizer
2026-04-13 15:33:59 +08:00
parent 2f5b17da92
commit 2f5bb204bb
12 changed files with 1614 additions and 235 deletions
+133 -205
View File
@@ -37,131 +37,57 @@
conversationId: '123'
})">播放</button> -->
<block v-if="chatMessageListLength < 1">
<view class="home-focus-wrap">
<view class="focus-guide-wrap">
<view class="guide-left">
<image
:src="webUrl + '/aiChat/logo-01.gif'"
class="avatar"
mode="widthFix"
/>
</view>
<view class="guide-right">
<view class="trangle" />
<view class="title">{{ settingInfo.helloMessageTitle }}</view>
<view class="content">{{ settingInfo.helloMessageContent }}</view>
</view>
</view>
</view>
<view v-if="weatherData.city && holidayData.suit" class="weather-holiday-wrap">
<view class="weather-data data-wrap">
<block v-if="!weatherDataLoading">
<view v-if="weatherIsLoad">
<!-- 各种天气对应的图标
https://yikeapi.com/help/wea
https://yikeapi.com/help/tianqiimg -->
<view class="title">
<image
:src="webUrl + '/aiChat/weather/' + weatherData.wea_img +'.png'"
class="icon"
mode="widthFix"
/>
<view class="tem-wrap">
<view class="tem">{{ weatherData.tem }}</view>
<view class="unit">℃</view>
</view>
</view>
<view class="loca">
<view class="addr">
<image
:src="webUrl + '/aiChat/addr.png'"
class="icon"
mode="widthFix"
/>
{{ weatherData.city }}
</view>
<view class="tem-range">
{{ weatherData.wea }}&nbsp;&nbsp;{{ weatherData.tem2 }}℃~{{ weatherData.tem1 }}℃
</view>
</view>
<view class="content">今日风向:{{ weatherData.win }}</view>
<view class="content">紫外线指数:{{ weatherData.uvIndex }}&nbsp;&nbsp;{{ weatherData.uvDescription }}</view>
</view>
<view v-else class="no-weather">
<view class="home-wrap">
<view class="home-focus-wrap">
<view class="focus-guide-wrap">
<view class="guide-left">
<image
:src="webUrl + '/aiChat/weather/no-weather.png'"
class="img"
:src="webUrl + '/aiChat/logo-01.gif'"
class="avatar"
mode="widthFix"
/>
<view>无法获取天气信息</view>
</view>
</block>
<block v-else>
<view class="txt-loading">加载中...</view>
</block>
<view class="guide-right">
<view class="title">{{ settingInfo.helloMessageTitle }}</view>
<view class="content">{{ settingInfo.helloMessageContent }}</view>
</view>
</view>
</view>
<view v-if="holidayData.suit" class="holiday-data data-wrap">
<view class="topic-wrap">
<view class="title">
<view class="day">{{ holidayData.lunarCalendar }}</view>
<view>{{ holidayData.date.substr(5).replace('-', '/') }}&nbsp;{{ weekDayArr[holidayData.weekDay] }}</view>
</view>
<view class="desc">{{ holidayData.yearTips }}年/{{ holidayData.chineseZodiac }}</view>
<view class="tip">
<view class="label">宜</view>
<view class="content">
{{ holidayData.suit }}
</view>
</view>
<view class="tip">
<view class="label label2">忌</view>
<view class="content">
{{ holidayData.avoid }}
</view>
</view>
</view>
</view>
<view class="topic-wrap">
<view class="title">
<image
:src="webUrl + '/aiChat/icon-01.png'"
class="icon"
mode="widthFix"
/>
<view class="txt">#大家都在问</view>
<image
:src="webUrl + '/aiChat/icon-01.png'"
class="icon"
mode="widthFix"
/>
</view>
<view class="list-wrap">
<view
:style="{
'width': animationWidth,
'animation': animationStr
}"
class="list-cont"
>
<view
v-for="(item, index) in topicList"
:key="index"
class="list-item"
@click="topicItemClickHandle(item.title)"
>
<view class="title-left">大家都在问</view>
<view class="title-right" @click="loadData">
<image
v-if="item.isHot"
:src="webUrl + '/aiChat/hot.png'"
:src="webUrl + '/aiChat/icon-53.png'"
class="icon"
mode="widthFix"
/>
{{ item.title }}
换一换
</view>
</view>
<view class="list-wrap">
<view class="list-cont">
<view
v-for="(item, index) in topicList"
:key="index"
class="list-item"
@click="topicItemClickHandle(item.title)"
>
<image
v-if="item.isHot"
:src="webUrl + '/aiChat/hot.png'"
class="icon"
mode="widthFix"
/>
{{ item.title }}
</view>
</view>
</view>
</view>
</view>
</block>
<view class="chat-wrap">
<view v-if="chatMessageListLength > 0" class="chat-list-wrap">
<view v-if="chatMessageListLength > 0" class="chat-wrap">
<view class="chat-list-wrap">
<view
v-for="(item, index) in chatMessageList"
:key="index"
@@ -267,7 +193,12 @@
</view>
<!-- 换一换 -->
<view
v-if="!item.showCursor && item.nodes && item.nodes.length && !item.isError && item.showMoreInfo.show"
v-if="!item.showCursor &&
item.nodes &&
item.nodes.length &&
!item.isError &&
(item.showMoreInfo.show || item.orderList.length > 0)
"
class="change-list-wrap"
>
<view v-if="item.showMoreInfo.showType === '特产商品'" class="list-wrap">
@@ -371,7 +302,19 @@
/>
</view>
</view>
<view v-if="item.showMoreInfo.showType !== '优惠活动'" class="change-btn">
<view v-if="item.orderList.length > 0" class="order-list-wrap">
<view
v-for="(order, orderIndex) in item.orderList"
:key="orderIndex"
class="order-item-wrap"
>
<order-item
:item="order"
@viewOrderTrack="viewOrderTrackHandle"
/>
</view>
</view>
<view v-if="item.showMoreInfo.showType !== '优惠活动' && item.orderList.length === 0" class="change-btn">
<image
:src="webUrl + '/aiChat/icon-change.png'"
class="icon"
@@ -380,6 +323,7 @@
/>
</view>
</view>
<!-- 建议提问 -->
<view
v-if="index === (chatMessageListLength - 1) && item.listQuestion.length > 0"
class="suggestion-wrap"
@@ -420,25 +364,40 @@
}"
class="page-to-bottom"
>
<view
v-if="chatNumber"
class="new-chat"
@click="createNewHandle"
>
<view class="container">
<view
v-if="chatNumber"
class="new-chat"
@click="createNewHandle"
>
<image
:src="webUrl + '/aiChat/icon-54.png'"
class="btn-icon"
mode="widthFix"
/>
开启新对话
</view>
<image
:src="webUrl + '/aiChat/icon-05.png'"
class="btn-icon"
v-if="chatMessageListLength > 0 && !isScrollToBottom && !loading"
:src="webUrl + '/aiChat/down.png'"
class="icon"
mode="widthFix"
@click="scrollToBottomHandle"
/>
开启新对话
<view
v-for="(item, index) in bottomTools"
:key="index"
class="bottom-tool-item"
@click="bottomToolClickHandle(item)"
>
<image
:src="webUrl + '/aiChat/' + item.icon + '.png'"
class="tool-icon"
mode="widthFix"
/>
{{ item.text }}
</view>
</view>
<image
v-if="chatMessageListLength > 0 && !isScrollToBottom && !loading"
:src="webUrl + '/aiChat/down.png'"
class="icon"
mode="widthFix"
@click="scrollToBottomHandle"
/>
</view>
<bottom-send
ref="bottomSend"
@@ -458,32 +417,25 @@
</template>
<script>
import { chatMixins } from '../mixins/chatMixins.js'
import { chatMixinsV2 } from '../mixins/chatMixinsV2.js'
import {
getAiSystemInfoSetting,
getAiSystemInfoTopic
} from '@/api/public'
import {
getWeatherData,
getHolidayData
} from '@/api/chat/index'
import AiHistoryList from '../components/historyList'
import BottomSend from '../components/bottomSend.vue'
import OrderItem from '../components/orderItem.vue'
export default {
name: 'AiChatIndexPage',
components: {
AiHistoryList,
BottomSend
BottomSend,
OrderItem
},
mixins: [chatMixins],
mixins: [chatMixinsV2],
data() {
return {
cityName: '',
weatherDataLoading: false,
weatherIsLoad: true,
weatherData: {},
holidayData: {},
weekDayArr: Object.freeze(['', '周一', '周二', '周三', '周四', '周五', '周六', '周日']),
animationWidth: '150%',
animationStr: '',
settingInfo: {},
@@ -521,29 +473,7 @@ export default {
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.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
this.topicList = (data || []).slice(0, 3)
}
})
},
@@ -625,43 +555,39 @@ export default {
opacity: 0.0;
}
}
.home-wrap {
display: flex;
flex-direction: column;
justify-content: space-between;
height: calc(100vh - 220rpx);
padding: 0 0 220rpx 0;
box-sizing: border-box;
}
.focus-guide-wrap {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 40rpx;
flex-direction: column;
.guide-left {
.avatar {
display: block;
width: 267rpx;
height: 530rpx;
width: 230rpx;
height: 404rpx;
}
}
.guide-right {
position: relative;
padding: 30rpx;
margin: 0 0 0 40rpx;
border-radius: 20rpx;
width: 100%;
padding: 30rpx 0;
font-size: 28rpx;
background-color: #fff;
box-shadow: 0rpx 12rpx 30rpx rgba(0,0,0,0.1);
.trangle {
position: absolute;
bottom: 120rpx;
left: -15rpx;
width: 30rpx;
height: 30rpx;
background-color: #fff;
box-shadow: -30rpx 12rpx 30rpx rgba(0,0,0,0.1);
transform: rotate(45deg);
}
text-align: center;
.title {
width: 110%;
font-weight: bold;
font-size: 34rpx;
}
.content {
padding: 30rpx 0 0 0;
color: #999;
color: #3D4CF0;
}
}
}
@@ -670,17 +596,17 @@ export default {
.title {
display: flex;
align-items: center;
justify-content: center;
.txt {
width: 186rpx;
height: 46rpx;
margin: 0 20rpx;
border-radius: 24rpx;
text-align: center;
line-height: 46rpx;
color: #fff;
font-size: 28rpx;
background-color: #3D4CF1;
justify-content: space-between;
padding: 0 24rpx;
color: #3D4CF0;
font-size: 28rpx;
.title-left {
font-size: 32rpx;
font-weight: bold;
}
.title-right {
display: flex;
align-items: center;
}
.icon {
display: flex;
@@ -690,26 +616,20 @@ export default {
}
.list-wrap {
width: 100%;
margin: 60rpx 0 0 0;
padding: 40rpx 0 0 0;
overflow-x: hidden;
.list-cont {
display: flex;
flex-wrap: wrap;
width: 750 * 1.5rpx;
padding: 0 0 0 24rpx;
padding: 0 24rpx;
box-sizing: border-box;
// animation: translateXSwiper 10s infinite linear alternate;
.list-item {
display: flex;
align-items: center;
height: 48rpx;
padding: 0 18rpx;
margin: 0 30rpx 30rpx 0;
border-radius: 24rpx;
padding: 12rpx 18rpx;
margin: 0 0 24rpx 0;
border-radius: 12rpx;
border: 1rpx solid #ddd;
font-size: 28rpx;
color: #666;
background: rgba(255,255,255,0.39);
box-shadow: 0rpx 6rpx 12rpx rgba(0,0,0,0.1);
.icon {
display: block;
width: 24rpx;
@@ -720,6 +640,14 @@ export default {
}
}
}
.order-list-wrap {
width: 100%;
padding: 24rpx 0;
box-sizing: border-box;
.order-item-wrap + .order-item-wrap {
margin: 24rpx 0 0 0;
}
}
@keyframes translateXSwiper {
0% {
transform: translateX(0);