7eedda092d
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>
40 lines
1.7 KiB
JavaScript
40 lines
1.7 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { classifyWechatIntent } from './intent/classifier.mjs';
|
|
import {
|
|
isWechatSessionPageContinuation,
|
|
isWechatPageRetryText,
|
|
isWechatPageEditText,
|
|
isWechatContentEditFollowup,
|
|
} from './intent/page-continuation.mjs';
|
|
|
|
test('WeChat page continuation detects retry and edit phrasings', () => {
|
|
assert.equal(isWechatPageRetryText('重试上次页面'), true);
|
|
assert.equal(isWechatPageEditText('修改刚才生成的页面,背景改成浅蓝色'), true);
|
|
assert.equal(isWechatContentEditFollowup('把诗里第三段改长一点'), true);
|
|
|
|
const retryIntent = classifyWechatIntent({ msgType: 'text', agentText: '重试上次页面' });
|
|
assert.equal(retryIntent.kind, 'page.generate');
|
|
assert.equal(isWechatSessionPageContinuation(retryIntent, '重试上次页面'), true);
|
|
|
|
const editIntent = classifyWechatIntent({
|
|
msgType: 'text',
|
|
agentText: '把页面标题改成《七月清晨》',
|
|
});
|
|
assert.equal(editIntent.kind, 'page.generate');
|
|
assert.equal(isWechatSessionPageContinuation(editIntent, editIntent.topic), true);
|
|
|
|
const poemEdit = classifyWechatIntent({ msgType: 'text', agentText: '把诗里第三段改长一点' });
|
|
assert.equal(poemEdit.kind, 'chat.general');
|
|
assert.equal(isWechatSessionPageContinuation(poemEdit, '把诗里第三段改长一点'), true);
|
|
});
|
|
|
|
test('WeChat page continuation rejects full new-topic page requests', () => {
|
|
const intent = classifyWechatIntent({
|
|
msgType: 'text',
|
|
agentText: '帮我做一个上海旅游攻略页面',
|
|
});
|
|
assert.equal(intent.kind, 'page.generate');
|
|
assert.equal(isWechatSessionPageContinuation(intent, intent.topic), false);
|
|
});
|