From f36f9ce992021c3b58810affdf9471cc29d93f33 Mon Sep 17 00:00:00 2001 From: ZF sun <34314687@qq.com> Date: Tue, 26 May 2026 15:02:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20AI=E6=99=BA=E8=83=BD=E5=AE=A2=E6=9C=8D?= =?UTF-8?q?=E9=A6=96=E6=AC=A1=E4=BD=BF=E7=94=A8=E6=98=BE=E7=A4=BAfallbackW?= =?UTF-8?q?elcome=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 将 config.welcome 改为 config.welcome_info 匹配后端返回字段 2. 修复语言包路径错误:将 () 从 data() 移到 onLoad() 中 - 原因:data() 执行时 getCurrentPages() 返回的是上一个页面 3. 添加调试日志用于排查 API 返回值 --- common/js/ai-service.js | 2 ++ pages_tool/ai-chat/ai-chat-message.vue | 5 ++++- pages_tool/ai-chat/index.vue | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/common/js/ai-service.js b/common/js/ai-service.js index 40d0cae..559470b 100644 --- a/common/js/ai-service.js +++ b/common/js/ai-service.js @@ -547,8 +547,10 @@ export default { ...params, async: false, }); + console.log('[AI Service] getServiceConfig response:', JSON.stringify(response)); return response.data; } catch (error) { + console.error('[AI Service] getServiceConfig error:', error); return null; } }, diff --git a/pages_tool/ai-chat/ai-chat-message.vue b/pages_tool/ai-chat/ai-chat-message.vue index 5540d4f..5180319 100644 --- a/pages_tool/ai-chat/ai-chat-message.vue +++ b/pages_tool/ai-chat/ai-chat-message.vue @@ -646,10 +646,13 @@ export default { // 1. 尝试从 API 获取远程欢迎语 try { const config = await aiService.getServiceConfig() + console.log('[AI Chat] API getServiceConfig 返回:', JSON.stringify(config)) if (config) { - const welcomeInfo = config.welcome + const welcomeInfo = config.welcome_info + console.log('[AI Chat] welcomeInfo:', JSON.stringify(welcomeInfo)) const remoteText = welcomeInfo?.welcome || '' const isEnabled = welcomeInfo?.is_enabled + console.log('[AI Chat] remoteText:', remoteText, 'isEnabled:', isEnabled) if (remoteText && isEnabled !== 0 && isEnabled !== false) { welcomeText = remoteText isMarkdown = true diff --git a/pages_tool/ai-chat/index.vue b/pages_tool/ai-chat/index.vue index c6156d1..eec6ff9 100644 --- a/pages_tool/ai-chat/index.vue +++ b/pages_tool/ai-chat/index.vue @@ -86,7 +86,7 @@ export default { data() { return { initialMessages: [], - fallbackWelcome: this.$lang('fallbackWelcome'), + fallbackWelcome: '', // --- 系统导航栏/状态栏相关 --- navBarHeight: 44, // uni-page-head 系统导航栏,默认高度为44px @@ -125,6 +125,8 @@ export default { }, async onLoad(options) { + this.fallbackWelcome = this.$lang('fallbackWelcome'); + // ✅ 修改:取消权限校验,允许所有客服类型访问此页面 // const hasAccess = this.checkAccessPermission(); // if (!hasAccess) {