diff --git a/common/js/ai-service.js b/common/js/ai-service.js index 50a97ea..dc8da67 100644 --- a/common/js/ai-service.js +++ b/common/js/ai-service.js @@ -523,6 +523,9 @@ export default { user: getUserId(), conversation_id: this.getConversationId() || '', attachments: (options && options.attachments) || [], + // PR-BASIC-CONTEXT-TO-WB (2026-09-28): 透传位置/时间/页面上下文 + // 给 WbAgentOsClient 提供 timestamp/timezone/location/page/metadata 等基础元素 + context: (options && options.context) || null, ...getDomainParams() }, header: { @@ -588,6 +591,8 @@ export default { user_id: getUserId(), conversation_id: this.getConversationId() || '', attachments: opts.attachments || [], + // PR-BASIC-CONTEXT-TO-WB (2026-09-28): 透传位置/时间/页面上下文 + context: (opts && opts.context) || null, ...getDomainParams() }) }); @@ -608,7 +613,11 @@ export default { */ async _fallbackToHttp(message, onEvent, onComplete, opts = {}) { try { - const result = await this.sendMessage(message, { attachments: (opts && opts.attachments) || [] }); + const result = await this.sendMessage(message, { + attachments: (opts && opts.attachments) || [], + // PR-BASIC-CONTEXT-TO-WB (2026-09-28): MP HTTP 降级路径同步传递 context + context: (opts && opts.context) || null + }); const content = result && result.content ? result.content : ''; // 阻塞式降级也尝试把后端返回的思考过程/用量透出来, 让小程序在 WS 不可用时仍能显示"思考过程 (N 步)" const fallbackPayload = { @@ -666,6 +675,8 @@ export default { user_id: getUserId(), conversation_id: this.getConversationId() || '', attachments: (opts && opts.attachments) || [], + // PR-BASIC-CONTEXT-TO-WB (2026-09-28): 透传位置/时间/页面上下文 + context: (opts && opts.context) || null, ...getDomainParams() }) }); diff --git a/pages_tool/ai-chat/ai-chat-message.vue b/pages_tool/ai-chat/ai-chat-message.vue index a47a268..b251d2a 100644 --- a/pages_tool/ai-chat/ai-chat-message.vue +++ b/pages_tool/ai-chat/ai-chat-message.vue @@ -42,7 +42,9 @@ + 修复: 显式判断 voiceList / videoList 非空 + attachments 非空 + PR-LOCATION-FILTER (2026-09-28): 位置消息顶层无上述字段, 但有 latitude/longitude, + 单独判断以确保位置气泡不被过滤掉 --> {{ message.content }} + + + + 📍 + + {{ message.name || $lang('ai-chat.index.location') || '位置' }} + {{ message.address }} + {{ message.latitude }}, {{ message.longitude }} + + + + {{ message.content }} + +