fix(wechat): treat report page follow-ups as session continuation
Memind CI / Test, build, and release guards (push) Has been cancelled
Memind CI / Test, build, and release guards (push) Has been cancelled
Phrases like "解读详细报告,做成页面" now bind to the in-session report context instead of behaving like a brand-new page topic. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+1
-1
@@ -391,7 +391,7 @@ test('WeChat session page continuation covers retry, edit, and poem edits', () =
|
|||||||
classifyWechatIntent({ msgType: 'text', agentText: '解读详细报告,做成页面' }),
|
classifyWechatIntent({ msgType: 'text', agentText: '解读详细报告,做成页面' }),
|
||||||
'解读详细报告,做成页面',
|
'解读详细报告,做成页面',
|
||||||
),
|
),
|
||||||
false,
|
true,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,15 @@ export const PAGE_CONTENT_EDIT_PATTERN =
|
|||||||
const PAGE_LINK_MISSING_RETRY_PATTERN =
|
const PAGE_LINK_MISSING_RETRY_PATTERN =
|
||||||
/(?:页面|链接|新闻页|新闻页面|html).{0,16}(?:没有生成|没生成|未生成|没发|未发)/iu;
|
/(?:页面|链接|新闻页|新闻页面|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) {
|
export function isWechatPageLinkRetryText(text) {
|
||||||
const normalized = String(text ?? '').trim();
|
const normalized = String(text ?? '').trim();
|
||||||
return Boolean(normalized && PAGE_LINK_MISSING_RETRY_PATTERN.test(normalized));
|
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 (isWechatImmediateContextPageCreate(wechatIntent, normalized)) return true;
|
||||||
if (wechatIntent?.kind === 'page.generate' && isWechatPageEditText(normalized)) return true;
|
if (wechatIntent?.kind === 'page.generate' && isWechatPageEditText(normalized)) return true;
|
||||||
if (wechatIntent?.kind === 'chat.general' && isWechatContentEditFollowup(normalized)) return true;
|
if (wechatIntent?.kind === 'chat.general' && isWechatContentEditFollowup(normalized)) return true;
|
||||||
|
if (isWechatReportPageFollowup(wechatIntent, normalized)) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,3 +37,12 @@ test('WeChat page continuation rejects full new-topic page requests', () => {
|
|||||||
assert.equal(intent.kind, 'page.generate');
|
assert.equal(intent.kind, 'page.generate');
|
||||||
assert.equal(isWechatSessionPageContinuation(intent, intent.topic), false);
|
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);
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user