|
|
@@ -5,7 +5,7 @@
|
|
|
<view class="nav-back" @click="goBack">
|
|
|
<text class="nav-back-icon">‹</text>
|
|
|
</view>
|
|
|
- <text class="nav-title">{{ isNutrition ? '精准营养助手' : (isHealthCoach ? 'AI 健康教练' : 'AI 家庭助手') }}</text>
|
|
|
+ <text class="nav-title">{{ isNutrition ? '精准营养助手' : (isHealthCoach ? 'AI 健康教练' : (isButler ? 'AI 健康管家' : 'AI 家庭助手')) }}</text>
|
|
|
<view class="nav-actions">
|
|
|
<view class="mascot-badge" v-if="mascotCode && !isNutrition" @click="showConversations = !showConversations">
|
|
|
<text class="mascot-badge-icon">{{ mascotIcon }}</text>
|
|
|
@@ -39,7 +39,7 @@
|
|
|
<view class="message-list-inner">
|
|
|
<view class="welcome-card" v-if="messages.length === 0 && !sending">
|
|
|
<view class="welcome-icon">{{ mascotIcon || (isNutrition ? '🥗' : (isHealthCoach ? '💡' : '🤖')) }}</view>
|
|
|
- <text class="welcome-title">{{ isNutrition ? '你好!我是精准营养助手' : (isHealthCoach ? '你好!我是AI健康教练' : ('你好!我是' + (mascotName || '家庭助手'))) }}</text>
|
|
|
+ <text class="welcome-title">{{ isNutrition ? '你好!我是精准营养助手' : (isHealthCoach ? '你好!我是AI健康教练' : (isButler ? '你好!我是AI健康管家' : ('你好!我是' + (mascotName || '家庭助手')))) }}</text>
|
|
|
<text class="welcome-desc">{{ welcomeSubtitle }}</text>
|
|
|
<view class="welcome-suggestions">
|
|
|
<view class="welcome-suggestion" v-if="!isNutrition && !isHealthCoach" @click="quickQuestion('小明最近任务完成怎么样?')">
|
|
|
@@ -74,6 +74,18 @@
|
|
|
<text class="suggestion-icon">🔍</text>
|
|
|
<text class="suggestion-text">怎么知道孩子是什么体质?</text>
|
|
|
</view>
|
|
|
+ <view class="welcome-suggestion" v-if="isButler" @click="quickQuestion('我家孩子肠道菌群怎么样?')">
|
|
|
+ <text class="suggestion-icon">🦠</text>
|
|
|
+ <text class="suggestion-text">我家孩子肠道菌群怎么样?</text>
|
|
|
+ </view>
|
|
|
+ <view class="welcome-suggestion" v-if="isButler" @click="quickQuestion('怎么改善孩子挑食问题?')">
|
|
|
+ <text class="suggestion-icon">🥗</text>
|
|
|
+ <text class="suggestion-text">怎么改善孩子挑食问题?</text>
|
|
|
+ </view>
|
|
|
+ <view class="welcome-suggestion" v-if="isButler" @click="quickQuestion('需要补充什么营养素?')">
|
|
|
+ <text class="suggestion-icon">💊</text>
|
|
|
+ <text class="suggestion-text">需要补充什么营养素?</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -84,7 +96,7 @@
|
|
|
</view>
|
|
|
<!-- AI 回复 -->
|
|
|
<view class="message message-ai" v-if="msg.answer">
|
|
|
-<view class="message-avatar">{{ isHealthCoach ? '🎯' : (mascotIcon || '🤖') }}</view>
|
|
|
+<view class="message-avatar">{{ isHealthCoach ? '🎯' : (isButler ? '🏥' : (mascotIcon || '🤖')) }}</view>
|
|
|
<view class="message-bubble ai-bubble">
|
|
|
<text class="ai-answer-text">{{ msg.answer }}</text>
|
|
|
<!-- 推荐卡片 -->
|
|
|
@@ -140,7 +152,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { aiSendMessage, aiGetConversations, aiGetMessages, aiDeleteConversation, aiSendNutritionMessage, aiSendHealthCoachMessage } from '../../utils/api.js'
|
|
|
+import { aiSendMessage, aiGetConversations, aiGetMessages, aiDeleteConversation, aiSendNutritionMessage, aiSendHealthCoachMessage, aiSendHealthButlerMessage } from '../../utils/api.js'
|
|
|
import BaseEmpty from '../../components/BaseEmpty.vue'
|
|
|
import AITaskCard from '../../components/AITaskCard.vue'
|
|
|
|
|
|
@@ -173,6 +185,9 @@ export default {
|
|
|
isHealthCoach: function() {
|
|
|
return this.mode === 'health'
|
|
|
},
|
|
|
+ isButler: function() {
|
|
|
+ return this.mode === 'butler'
|
|
|
+ },
|
|
|
welcomeSubtitle: function() {
|
|
|
if (this.isNutrition) {
|
|
|
return '我可以基于菌群检测报告,为你提供个性化的营养建议和推荐'
|
|
|
@@ -180,6 +195,9 @@ export default {
|
|
|
if (this.isHealthCoach) {
|
|
|
return '陪伴孩子健康成长,用提问帮你找到答案'
|
|
|
}
|
|
|
+ if (this.isButler) {
|
|
|
+ return '专属健康管家,基于知识库提供个性化健康建议'
|
|
|
+ }
|
|
|
if (this.fromPage) {
|
|
|
var pageNames = {
|
|
|
'pages/body/index': '身',
|
|
|
@@ -327,8 +345,19 @@ export default {
|
|
|
lastMsg.recommendations = data.recommendations || []
|
|
|
lastMsg.tasks = data.tasks || []
|
|
|
}
|
|
|
+ } else if (this.mode === 'butler') {
|
|
|
+ // 传递 childId 让健康管家能加载家庭上下文
|
|
|
+ var butlerParams = Object.assign({}, params)
|
|
|
+ butlerParams.childId = uni.getStorageSync('currentChildId') || null
|
|
|
+ res = await aiSendHealthButlerMessage(butlerParams)
|
|
|
+ data = res.data || {}
|
|
|
+ const butlerLastMsg = this.messages[this.messages.length - 1]
|
|
|
+ if (butlerLastMsg) {
|
|
|
+ butlerLastMsg.answer = data.answer || ''
|
|
|
+ butlerLastMsg.recommendations = data.recommendations || []
|
|
|
+ butlerLastMsg.tasks = data.tasks || []
|
|
|
+ }
|
|
|
} else {
|
|
|
- res = await aiSendMessage(params)
|
|
|
data = res.data || {}
|
|
|
const lastMsg = this.messages[this.messages.length - 1]
|
|
|
if (lastMsg) {
|