fix: broaden WeChat session page continuation phrasing
Memind CI / Test, build, and release guards (push) Successful in 2m37s

Recognize retry, HTML page, page edits, and poem content edits as session continuations so delivery skips fresh-thumbnail forcing and retains agent context for multi-turn page work.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-28 16:54:42 +08:00
parent 6307f974cf
commit 7eedda092d
9 changed files with 397 additions and 42 deletions
+19
View File
@@ -17,6 +17,8 @@ import {
loadWechatMpConfig,
maybeAttachPublishedHtmlLink,
isWechatImmediateContextFollowup,
isWechatSessionPageContinuation,
shouldDeliverWechatHtmlArtifacts,
isWechatPageDataTask,
shouldRotateUnlinkedWechatRoute,
shouldRetryHtmlGenerationReply,
@@ -29,6 +31,7 @@ import {
WECHAT_CUSTOMER_TEXT_MAX_BYTES,
} from './wechat-mp.mjs';
import { createChatIntentRouter } from './chat-intent-router.mjs';
import { classifyWechatIntent } from './wechat/intent/classifier.mjs';
import { buildPageGenerateAgentPrompt, buildImmediateContextPageRepairPrompt } from './wechat/prompts/page-generate.mjs';
import { resolveWechatImageGenerationPolicy, WECHAT_PAGE_THUMBNAIL_MODE } from './wechat/image-generation-policy.mjs';
import {
@@ -365,6 +368,22 @@ test('WeChat immediate-context page guard does not match complete page requests'
assert.doesNotMatch(ordinaryPrompt, /write_file 硬门槛/);
});
test('WeChat session page continuation covers retry, edit, and poem edits', () => {
const retry = classifyWechatIntent({ msgType: 'text', agentText: '重试上次页面' });
assert.equal(retry.kind, 'page.generate');
assert.equal(isWechatSessionPageContinuation(retry, '重试上次页面'), true);
const edit = classifyWechatIntent({ msgType: 'text', agentText: '把页面标题改成《七月清晨》' });
assert.equal(edit.kind, 'page.generate');
assert.equal(isWechatSessionPageContinuation(edit, edit.topic), true);
const poemEdit = classifyWechatIntent({ msgType: 'text', agentText: '把诗里第三段改长一点' });
assert.equal(poemEdit.kind, 'chat.general');
assert.equal(isWechatSessionPageContinuation(poemEdit, '把诗里第三段改长一点'), true);
assert.equal(
shouldDeliverWechatHtmlArtifacts(poemEdit, { agentText: '把诗里第三段改长一点' }),
true,
);
});
test('WeChat immediate-context page skips fresh thumbnail requirement', () => {
const policy = resolveWechatImageGenerationPolicy({
text: '把刚才的诗做成页面',