diff --git a/common/js/customer-service.js b/common/js/customer-service.js index cd68ed5..d721e53 100644 --- a/common/js/customer-service.js +++ b/common/js/customer-service.js @@ -471,13 +471,11 @@ export class CustomerService { const shopInfo = this.vm.shopInfo || {}; const config = this.getPlatformConfig(); - if (config?.type === 'aikefu') { - return shopInfo.aiAgentimg || ''; - } else if (config?.type === 'wxwork' || config?.type === 'qyweixin') { - return shopInfo.aiAgentimg || ''; - } else if (config?.type === 'third') { - return ''; + // 优先使用指定的智能客服头像 + if (config?.type === 'aikefu' || config?.type === 'wxwork' || config?.type === 'qyweixin') { + return '/static/images/image_460671319773954.png'; } + return shopInfo.kefuimg || this.vm.$util?.getDefaultImage()?.kefu || ''; } diff --git a/pages_goods/_components/goods-detail-view/goods-detail-view.vue b/pages_goods/_components/goods-detail-view/goods-detail-view.vue index 73d9686..6702fda 100644 --- a/pages_goods/_components/goods-detail-view/goods-detail-view.vue +++ b/pages_goods/_components/goods-detail-view/goods-detail-view.vue @@ -4,7 +4,7 @@ - 🤖 + @@ -511,4 +511,9 @@ export default { .ai-chat-float-btn .iconfont { font-size: 40rpx; } + +.ai-chat-float-btn .ai-avatar-icon { + width: 100%; + height: 100%; +} \ No newline at end of file diff --git a/pages_tool/ai-chat/ai-chat-message.vue b/pages_tool/ai-chat/ai-chat-message.vue index 80a1044..95ab7fe 100644 --- a/pages_tool/ai-chat/ai-chat-message.vue +++ b/pages_tool/ai-chat/ai-chat-message.vue @@ -50,8 +50,14 @@ - - + + + 🤖 @@ -412,18 +418,25 @@ export default { streamContent: '', isStreaming: false, // 固定AI头像 - aiAvatar: '/static/images/ai-avatar.png', + aiAvatar: '/static/images/image_460671319773954.png', // 本地用户头像(优先使用缓存,无缓存则用默认图) localUserAvatar: '', // 默认头像路径 defaultAvatar: '/static/images/default-avatar.png', // 头像选择弹窗控制 - showAvatarSelector: false, // 头像选择弹窗控制 + showAvatarSelector: false, // 头像选择弹窗控制 // 新增:用户昵称相关 localUserNickname: '', // 当前用户昵称 defaultNickname: '我', // 默认昵称 showNicknameEditor: false, // 昵称编辑弹窗控制 tempNickname: '', // 昵称编辑临时值 + // AI头像配置(可配置,方便后续更换) + // 支持两种方式: + // 1. 使用图片URL:设置为图片链接字符串 + // 2. 使用emoji:设置为空字符串或null,将显示默认的🤖 + aiAvatarUrl: '/static/images/image_460671319773954.png', + // AI头像错误状态 + avatarError: false, // Dify API相关 currentConversationId: null, @@ -1435,6 +1448,11 @@ async loadChatHistoryIfExist() { this.$emit('input-change', e.detail.value) }, + // 处理头像加载失败 + handleAvatarError() { + this.avatarError = true + }, + // 选择图片 selectImage() { uni.chooseImage({ @@ -1622,6 +1640,7 @@ $radius-lg: 36rpx; display: flex; align-items: center; justify-content: center; + position: relative; &:hover { transform: scale(1.03); @@ -1637,6 +1656,19 @@ $radius-lg: 36rpx; font-size: 56rpx; line-height: 1; } + + .avatar-fallback { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + font-size: 56rpx; + background-color: $bg-card; + } } .message-content {