Feat(云灵AI):县域AI和平台AI逻辑区分

This commit is contained in:
lifizer
2026-06-02 10:50:02 +08:00
parent 758d3a2127
commit e05ceb0f68
9 changed files with 311 additions and 231 deletions
+17 -4
View File
@@ -365,6 +365,7 @@
</view>
</view>
<view
v-if="!countyId"
:class="{
'focus': onFocus
}"
@@ -411,6 +412,7 @@
ref="bottomSend"
:loading="loading"
:keyboard-height="keyboardHeight"
:voice-exception="exceptionConfig.voice_exception"
@send="streamReq"
@history="historyViewHandle"
@focus="inputFocusHandle"
@@ -418,10 +420,12 @@
<AiHistoryList
ref="historyView"
:status-bar-height="statusBarHeight"
:county-id="countyId"
form-module="history"
@enter-history="audioStopHandle"
/>
<ProductWindow
v-if="!countyId"
ref="attrWindow"
:attr="attr"
:cart-num="cart_num"
@@ -445,7 +449,8 @@ import BottomSend from '../components/bottomSend.vue'
import OrderItem from '../components/orderItem.vue'
import ProductWindow from '@/components/ProductWindow'
import {
historyChatMessage
historyChatMessage,
getCountyAiHistoryChatMessage
} from '@/api/chat/index'
import { formatAiMsgContent } from '../utils/aiChat'
export default {
@@ -459,19 +464,27 @@ export default {
mixins: [chatMixinsV2, goCartMixin],
data() {
return {
pageTitle: ''
pageTitle: '',
countyId: ''
}
},
onLoad(options) {
this.chatNumber = options.chatNumber
this.pageTitle = options.title
this.pageTitle = options.title || ''
this.countyId = options.countyId || ''
this.pageTitle = this.pageTitle.length > 8 ? (this.pageTitle.substring(0, 8) + '...') : this.pageTitle
this.init()
},
methods: {
init() {
this.loading = true
historyChatMessage({
let reqFn = null
if (this.countyId) {
reqFn = getCountyAiHistoryChatMessage
} else {
reqFn = historyChatMessage
}
reqFn({
chatNumber: this.chatNumber
}).then(res => {
const { success, data = [] } = res
+121 -155
View File
@@ -40,12 +40,20 @@
conversationId: '123'
})">播放</button> -->
<block v-if="chatMessageListLength < 1">
<view class="home-wrap">
<view
:class="{
'county-home-wrap': !!countyId
}"
class="home-wrap"
>
<view class="home-focus-wrap">
<view class="focus-guide-wrap">
<view class="guide-left">
<image
:src="webUrl + '/aiChat/logo-transition.png'"
:class="{
'county-avatar': !!countyId
}"
class="avatar avatar-bounce"
mode="widthFix"
/>
@@ -99,7 +107,8 @@
</swiper-item>
</swiper>
</view> -->
<view v-if="!showGiftSteps" class="topic-wrap">
<!-- 大家都在问 -->
<view v-if="!showGiftSteps && !countyId" class="topic-wrap">
<view class="title">
<view class="title-left">大家都在问</view>
<view class="title-right" @click="loadData('click')">
@@ -133,6 +142,24 @@
</view>
</view>
</view>
<!-- 县域 -->
<view v-if="!showGiftSteps && countyId" class="county-tools-wrap">
<view class="list-cont">
<view
v-for="(item, index) in countyTools"
:key="index"
class="list-item"
@click="countyToolItemClickHandle(item)"
>
<image
:src="item.icon"
class="icon"
mode="widthFix"
/>
<view class="name">{{ item.name }}</view>
</view>
</view>
</view>
<!-- 在这里实现送礼步骤 -->
<view v-if="showGiftSteps" class="gift-steps-wrap">
<view class="gift-step-title">{{ giftBuyOptions[currentGiftStepIndex].title }}</view>
@@ -518,6 +545,7 @@
</view>
</view>
<view
v-if="!countyId"
:class="{
'focus': onFocus
}"
@@ -567,6 +595,7 @@
ref="bottomSend"
:loading="loading"
:keyboard-height="keyboardHeight"
:voice-exception="exceptionConfig.voice_exception"
@send="streamReq"
@add="createNewHandle"
@history="historyViewHandle"
@@ -575,9 +604,11 @@
<AiHistoryList
ref="historyView"
:status-bar-height="statusBarHeight"
:county-id="countyId"
@enter-history="audioStopHandle"
/>
<ProductWindow
v-if="!countyId"
ref="attrWindow"
:attr="attr"
:cart-num="cart_num"
@@ -600,6 +631,9 @@ import {
getAiSystemInfoSetting,
getAiSystemInfoTopic
} from '@/api/public'
import {
getCountyAiDetail
} from '@/api/chat/index'
import AiHistoryList from '../components/historyList'
import BottomSend from '../components/bottomSend.vue'
import OrderItem from '../components/orderItem.vue'
@@ -616,6 +650,7 @@ export default {
data() {
return {
cityName: '',
countyId: '',
animationWidth: '150%',
animationStr: '',
settingInfo: {},
@@ -626,153 +661,13 @@ export default {
currentGiftStepIndex: 0,
giftSelections: {},
giftBudget: '',
giftBuyOptions: [
{
"id": 1,
"sort": 1,
"title": "礼品是送给谁的呢?",
"type": "option_card",
"status": 1,
"createTime": 1779777608000,
"updateTime": 1779850697000,
"options": [
{
"id": 1,
"configId": 1,
"optionName": "送长辈",
"sort": 1,
"createTime": 1779777924000
},
{
"id": 2,
"configId": 1,
"optionName": "送朋友",
"sort": 2,
"createTime": 1779777924000
},
{
"id": 3,
"configId": 1,
"optionName": "送同事",
"sort": 3,
"createTime": 1779777924000
},
{
"id": 4,
"configId": 1,
"optionName": "送亲戚",
"sort": 4,
"createTime": 1779777924000
},
{
"id": 5,
"configId": 1,
"optionName": "送爱人",
"sort": 5,
"createTime": 1779777924000
},
{
"id": 6,
"configId": 1,
"optionName": "送领导",
"sort": 6,
"createTime": 1779777924000
}
]
},
{
"id": 2,
"sort": 2,
"title": "有什么特别的场合吗?",
"type": "option_card",
"status": 1,
"createTime": 1779777608000,
"updateTime": 1779789421000,
"options": [
{
"id": 11,
"configId": 2,
"optionName": "生日",
"sort": 1,
"createTime": 1779789420000
},
{
"id": 12,
"configId": 2,
"optionName": "节日",
"sort": 2,
"createTime": 1779789420000
},
{
"id": 13,
"configId": 2,
"optionName": "乔迁",
"sort": 3,
"createTime": 1779789420000
},
{
"id": 14,
"configId": 2,
"optionName": "感谢",
"sort": 4,
"createTime": 1779789420000
}
]
},
{
"id": 3,
"sort": 3,
"title": "对礼品类型有什么偏好?",
"type": "option_card",
"status": 1,
"createTime": 1779777608000,
"updateTime": 1779789393000,
"options": [
{
"id": 7,
"configId": 3,
"optionName": "特色礼盒",
"sort": 1,
"createTime": 1779789393000
},
{
"id": 8,
"configId": 3,
"optionName": "商务",
"sort": 2,
"createTime": 1779789393000
},
{
"id": 9,
"configId": 3,
"optionName": "茶叶",
"sort": 3,
"createTime": 1779789393000
},
{
"id": 10,
"configId": 3,
"optionName": "精美实惠",
"sort": 4,
"createTime": 1779789393000
}
]
},
{
"id": 4,
"sort": 4,
"title": "预算大概在什么范围?",
"type": "price_input",
"status": 1,
"createTime": 1779777608000,
"updateTime": 1779777608000,
"options": []
}
]
giftBuyOptions: [],
countyTools: []
}
},
onLoad(options) {
this.cityName = options.cityName || ''
this.countyId = options.countyId || ''
},
onShow() {
// 1-新对话,2-我要送礼
@@ -792,18 +687,31 @@ export default {
}
},
methods: {
createdCallbak() {
extraReqFn() {
this.$nextTick(() => {
this.scrollToBottomHandle()
getAiSystemInfoSetting().then(res => {
const { success, data } = res
if (success) {
this.settingInfo = data
this.animationWidth = `${data.systemTopicDivMaxWidth * 750}rpx`
this.animationStr = `TranslateXSwiper-${data.systemTopicDivMaxWidth * 10} ${data.systemTopicDivScrollDuration}s infinite linear alternate`
}
})
this.loadData()
if (this.countyId) {
getCountyAiDetail({
countyId: this.countyId
}).then(res => {
const { success, data } = res
if (success) {
this.settingInfo.helloMessageTitle = data.title || ''
this.settingInfo.helloMessageContent = data.introduction || ''
this.countyTools = data.modules || []
}
})
} else {
getAiSystemInfoSetting().then(res => {
const { success, data } = res
if (success) {
this.settingInfo = data
this.animationWidth = `${data.systemTopicDivMaxWidth * 750}rpx`
this.animationStr = `TranslateXSwiper-${data.systemTopicDivMaxWidth * 10} ${data.systemTopicDivScrollDuration}s infinite linear alternate`
}
})
this.loadData()
}
})
},
loadData(type = '') {
@@ -881,6 +789,19 @@ export default {
} else {
this.createNewHandle()
}
},
countyToolItemClickHandle(item) {
if (item.moduleType === 'prompt') {
this.streamReq({
prompt: item.promptContent,
init: 0
})
}
if (item.moduleType === 'url') {
uni.navigateTo({
url: item.url
})
}
}
}
}
@@ -937,6 +858,9 @@ export default {
display: block;
width: 430rpx;
}
.county-avatar {
width: 360rpx;
}
.avatar-bounce {
animation: bounce 2s infinite ease-in-out;
}
@@ -1032,4 +956,46 @@ export default {
}
}
.county-home-wrap {
justify-content: flex-start;
.guide-right {
.content {
color: #666;
}
}
}
.county-tools-wrap {
width: 100%;
padding: 40rpx 0 0 0;
.list-cont {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
width: 100%;
padding: 0 60rpx;
box-sizing: border-box;
.list-item {
display: flex;
align-items: center;
flex-direction: column;
width: 28%;
padding: 20rpx 0 12rpx 0;
margin: 0 0 24rpx 0;
border-radius: 12rpx;
background-color: #fff;
box-shadow: 0 0 12rpx rgba(0, 0, 0, 0.1);
.icon {
display: block;
width: 60rpx;
height: 60rpx;
margin: 0 8rpx 0 0;
}
.name {
padding: 8rpx 0 0 0;
font-size: 28rpx;
color: #333;
}
}
}
}
</style>