From c9b2fcba877c1c68ba4895e8d8a9e450d788e228 Mon Sep 17 00:00:00 2001 From: john Date: Fri, 14 Aug 2026 22:53:00 +0800 Subject: [PATCH] fix(wechat): treat report page follow-ups as session continuation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phrases like "解读详细报告,做成页面" now bind to the in-session report context instead of behaving like a brand-new page topic. Co-authored-by: Cursor --- wechat-mp.test.mjs | 2 +- wechat/intent/page-continuation.mjs | 10 ++++++++++ wechat/wechat-page-continuation.test.mjs | 9 +++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/wechat-mp.test.mjs b/wechat-mp.test.mjs index e2f9f39..0a31bce 100644 --- a/wechat-mp.test.mjs +++ b/wechat-mp.test.mjs @@ -391,7 +391,7 @@ test('WeChat session page continuation covers retry, edit, and poem edits', () = classifyWechatIntent({ msgType: 'text', agentText: '解读详细报告,做成页面' }), '解读详细报告,做成页面', ), - false, + true, ); }); diff --git a/wechat/intent/page-continuation.mjs b/wechat/intent/page-continuation.mjs index 38c50e8..c0f62c7 100644 --- a/wechat/intent/page-continuation.mjs +++ b/wechat/intent/page-continuation.mjs @@ -32,6 +32,15 @@ export const PAGE_CONTENT_EDIT_PATTERN = const PAGE_LINK_MISSING_RETRY_PATTERN = /(?:页面|链接|新闻页|新闻页面|html).{0,16}(?:没有生成|没生成|未生成|没发|未发)/iu; +export const REPORT_PAGE_CONTINUATION_PATTERN = + /(?:解读|分析|说明).{0,12}(?:详细)?(?:报告|化验|检验)|(?:报告|化验|检验).{0,12}(?:解读|做成|生成).{0,8}(?:页面|网页)/iu; + +export function isWechatReportPageFollowup(wechatIntent, text) { + const normalized = String(text ?? '').trim(); + if (!normalized || wechatIntent?.kind !== 'page.generate') return false; + return REPORT_PAGE_CONTINUATION_PATTERN.test(normalized); +} + export function isWechatPageLinkRetryText(text) { const normalized = String(text ?? '').trim(); return Boolean(normalized && PAGE_LINK_MISSING_RETRY_PATTERN.test(normalized)); @@ -69,6 +78,7 @@ export function isWechatSessionPageContinuation(wechatIntent, text) { if (isWechatImmediateContextPageCreate(wechatIntent, normalized)) return true; if (wechatIntent?.kind === 'page.generate' && isWechatPageEditText(normalized)) return true; if (wechatIntent?.kind === 'chat.general' && isWechatContentEditFollowup(normalized)) return true; + if (isWechatReportPageFollowup(wechatIntent, normalized)) return true; return false; } diff --git a/wechat/wechat-page-continuation.test.mjs b/wechat/wechat-page-continuation.test.mjs index 5bdef02..0d6c152 100644 --- a/wechat/wechat-page-continuation.test.mjs +++ b/wechat/wechat-page-continuation.test.mjs @@ -37,3 +37,12 @@ test('WeChat page continuation rejects full new-topic page requests', () => { assert.equal(intent.kind, 'page.generate'); assert.equal(isWechatSessionPageContinuation(intent, intent.topic), false); }); + +test('WeChat page continuation recognizes report interpretation follow-ups', () => { + const intent = classifyWechatIntent({ + msgType: 'text', + agentText: '解读详细报告,做成页面', + }); + assert.equal(intent.kind, 'page.generate'); + assert.equal(isWechatSessionPageContinuation(intent, intent.topic), true); +});