fix(wechat): guard bare page-continuation follow-ups from session loss and memory drift
Memind CI / Test, build, and release guards (push) Failing after 3s

Prevent chat-to-page flows like writing a poem then saying "做成页面吧" from opening
a fresh session without carried content, failing with a vague error, or letting Memory
page-template preferences replace the immediate topic.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-02 18:49:42 +08:00
parent 55100f8945
commit c7dcc5d002
5 changed files with 439 additions and 7 deletions
+9
View File
@@ -14,6 +14,7 @@ export function buildPageGenerateAgentPrompt(
wantsDocx = false,
imagePolicy = null,
preferImmediateContext = false,
carriedSessionContent = '',
} = {},
) {
const topic = String(intent?.agentText ?? intent?.displayText ?? '').trim();
@@ -41,6 +42,13 @@ export function buildPageGenerateAgentPrompt(
'',
].join('\n')
: '';
const carriedSessionBlock = String(carriedSessionContent ?? '').trim()
? [
'【待排版正文(来自上一轮会话,必须以此为主题,禁止改用 Memory 或其他任务)】',
String(carriedSessionContent).trim(),
'',
].join('\n')
: '';
const coverExample = imageBlock
? '<本轮 generate_image 返回的 asset.htmlSrc>'
: 'assets/hero.jpg';
@@ -62,6 +70,7 @@ export function buildPageGenerateAgentPrompt(
docxBlock,
imageBlock,
immediateContextBlock,
carriedSessionBlock,
pageDataBlock,
'步骤(必须全部完成):',
pageDataTask