fix(wechat): honor explicit page generation negation
Memind CI / Test, build, and release guards (pull_request) Successful in 2m56s

This commit is contained in:
john
2026-07-21 23:40:29 +08:00
parent c2e2209344
commit efbbe69e2c
2 changed files with 19 additions and 0 deletions
+15
View File
@@ -6,6 +6,7 @@ import {
resolveWechatImageGenerationPolicy,
WECHAT_PAGE_THUMBNAIL_MODE,
} from './image-generation-policy.mjs';
import { classifyWechatIntent } from './intent/classifier.mjs';
test('service-account page always requires a fresh thumbnail without forcing body images', () => {
const policy = resolveWechatImageGenerationPolicy({
@@ -47,3 +48,17 @@ test('standalone image intent gets an inline_image tool contract', () => {
assert.match(instruction, /purpose=`inline_image`/);
assert.match(instruction, /idempotency_key=wechat-msg-1-image/);
});
test('explicitly declining a page keeps standalone image generation out of page flow', () => {
const text = '请生成一张雨夜橘猫插画,只生成图片,不要生成页面';
const intent = classifyWechatIntent({ msgType: 'text', agentText: text });
assert.equal(intent.kind, 'chat.general');
const policy = resolveWechatImageGenerationPolicy({
text,
isPageGenerate: intent.kind === 'page.generate',
requireFreshPageThumbnail: true,
});
assert.equal(policy.pageThumbnailMode, 'auto');
assert.equal(policy.standaloneImageMode, 'required');
});