Classify WeChat page refine and MindSpace URL edits as page.generate.
Memind CI / Test, build, and release guards (push) Has been cancelled
Memind CI / Test, build, and release guards (push) Has been cancelled
Fixes Tang-style follow-ups like「页面还不够详细」or linked HTML update requests from falling through to Goose chat and hitting stale providers. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -25,6 +25,23 @@ test('isPageGenerateText matches travel guide requests without explicit 页面',
|
||||
);
|
||||
});
|
||||
|
||||
test('isPageGenerateText matches page refine and MindSpace URL edit requests', () => {
|
||||
assert.equal(
|
||||
isPageGenerateText('页面还不够详细,必须详细到时间节点'),
|
||||
true,
|
||||
);
|
||||
assert.equal(
|
||||
isPageGenerateText('这个页面还不够详细,必须详细到时间节点,把页面更新更详细和完整'),
|
||||
true,
|
||||
);
|
||||
assert.equal(
|
||||
isPageGenerateText(
|
||||
'https://m.tkmind.cn/MindSpace/a70ff537-8908-486e-9b6c-042e07cc25db/public/shengsi-3day-guide.html这个页面还不够详细,必须详细到时间节点,把页面更新更详细和完整',
|
||||
),
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
test('resolveWechatIntentRouterPolicy reads env defaults', () => {
|
||||
const policy = resolveWechatIntentRouterPolicy({
|
||||
MEMIND_WECHAT_INTENT_LLM_ENABLED: '1',
|
||||
|
||||
@@ -21,6 +21,13 @@ export const PAGE_GENERATE_FORMAT_PATTERN =
|
||||
export const PAGE_GENERATE_GUIDE_PATTERN =
|
||||
/(?:帮我.{0,12})?(?:做|写|生成|整理).{0,48}(?:游玩|旅行|旅游)?(?:攻略|指南|行程)(?!.*(?:不要|别|无需).*(?:页面|网页))/iu;
|
||||
|
||||
/** 已有页面的补充/细化(含带 MindSpace URL 的改页请求) */
|
||||
export const PAGE_REFINE_DETAIL_PATTERN =
|
||||
/(?:页面|网页|html|攻略).{0,40}(?:不够详细|不够完整|更详细|详细到|补充|完善|优化)|(?:把|将).{0,16}(?:页面|网页|攻略).{0,32}(?:更新|改|完善|补充|优化|加长)/iu;
|
||||
|
||||
export const PAGE_MINDSPACE_PUBLIC_URL_PATTERN =
|
||||
/(?:https?:\/\/[^\s]+)?\/?mindspace\/[0-9a-f-]{36}\/public\/[\w.-]+\.html/iu;
|
||||
|
||||
export const PAGE_GENERATE_NEGATION_PATTERN =
|
||||
/(?:不要|无需|不用|别|不需要)\s*(?:再\s*)?(?:生成|创建|制作|做|写)\s*(?:任何|一个|新的)?\s*(?:html|页面|网页|page|文件)/iu;
|
||||
|
||||
@@ -43,6 +50,13 @@ export function isPageGenerateText(text) {
|
||||
const normalized = String(text ?? '').trim();
|
||||
if (!normalized) return false;
|
||||
if (PAGE_GENERATE_NEGATION_PATTERN.test(normalized)) return false;
|
||||
if (PAGE_REFINE_DETAIL_PATTERN.test(normalized)) return true;
|
||||
if (
|
||||
PAGE_MINDSPACE_PUBLIC_URL_PATTERN.test(normalized)
|
||||
&& /(?:页面|网页|更新|详细|改|完善|补充)/iu.test(normalized)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return (
|
||||
PAGE_GENERATE_PATTERN.test(normalized)
|
||||
|| PAGE_GENERATE_AFTER_PAGE_PATTERN.test(normalized)
|
||||
|
||||
Reference in New Issue
Block a user