Treat WeChat travel-guide requests as page.generate and re-sync Kimi before Goose fallback.
Memind CI / Test, build, and release guards (push) Failing after 4m15s
Memind CI / Test, build, and release guards (push) Failing after 4m15s
Fixes Tang-style「做攻略」messages missing the 页面 keyword from entering Cursor, and forces provider refresh before DeepSeek/Kimi fallback after Cursor failures. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -12,6 +12,18 @@ import {
|
|||||||
createWechatIntentRouterConfigService,
|
createWechatIntentRouterConfigService,
|
||||||
defaultsFromEnv,
|
defaultsFromEnv,
|
||||||
} from './wechat-intent-router-config.mjs';
|
} from './wechat-intent-router-config.mjs';
|
||||||
|
import { isPageGenerateText } from './wechat/intent/patterns.mjs';
|
||||||
|
|
||||||
|
test('isPageGenerateText matches travel guide requests without explicit 页面', () => {
|
||||||
|
assert.equal(
|
||||||
|
isPageGenerateText('帮我做一个嵊泗 3 天 2 晚的游玩攻略吧,可能'),
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
isPageGenerateText('现帮我做一个嵊泗 3 天 2 晚的游玩攻略页面,'),
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test('resolveWechatIntentRouterPolicy reads env defaults', () => {
|
test('resolveWechatIntentRouterPolicy reads env defaults', () => {
|
||||||
const policy = resolveWechatIntentRouterPolicy({
|
const policy = resolveWechatIntentRouterPolicy({
|
||||||
|
|||||||
@@ -3001,6 +3001,7 @@ export function createWechatMpService({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!reply) {
|
if (!reply) {
|
||||||
|
await ensureSessionProvider(sessionId, user.userId, { intentKind: wechatIntent.kind });
|
||||||
reply = await executeSessionReply(
|
reply = await executeSessionReply(
|
||||||
(pathname, init) => fetchForSession(sessionId, pathname, init),
|
(pathname, init) => fetchForSession(sessionId, pathname, init),
|
||||||
sessionId,
|
sessionId,
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ export const PAGE_GENERATE_NEWS_PATTERN =
|
|||||||
export const PAGE_GENERATE_FORMAT_PATTERN =
|
export const PAGE_GENERATE_FORMAT_PATTERN =
|
||||||
/按照.{0,32}格式.{0,32}(?:页面|网页|html)/iu;
|
/按照.{0,32}格式.{0,32}(?:页面|网页|html)/iu;
|
||||||
|
|
||||||
|
/** 用户口头说「做攻略/行程」但未显式说「页面」——服务号仍应走 page.generate + Cursor */
|
||||||
|
export const PAGE_GENERATE_GUIDE_PATTERN =
|
||||||
|
/(?:帮我.{0,12})?(?:做|写|生成|整理).{0,48}(?:游玩|旅行|旅游)?(?:攻略|指南|行程)(?!.*(?:不要|别|无需).*(?:页面|网页))/iu;
|
||||||
|
|
||||||
export const PAGE_GENERATE_NEGATION_PATTERN =
|
export const PAGE_GENERATE_NEGATION_PATTERN =
|
||||||
/(?:不要|无需|不用|别|不需要)\s*(?:再\s*)?(?:生成|创建|制作|做|写)\s*(?:任何|一个|新的)?\s*(?:html|页面|网页|page|文件)/iu;
|
/(?:不要|无需|不用|别|不需要)\s*(?:再\s*)?(?:生成|创建|制作|做|写)\s*(?:任何|一个|新的)?\s*(?:html|页面|网页|page|文件)/iu;
|
||||||
|
|
||||||
@@ -44,6 +48,7 @@ export function isPageGenerateText(text) {
|
|||||||
|| PAGE_GENERATE_AFTER_PAGE_PATTERN.test(normalized)
|
|| PAGE_GENERATE_AFTER_PAGE_PATTERN.test(normalized)
|
||||||
|| PAGE_GENERATE_NEWS_PATTERN.test(normalized)
|
|| PAGE_GENERATE_NEWS_PATTERN.test(normalized)
|
||||||
|| PAGE_GENERATE_FORMAT_PATTERN.test(normalized)
|
|| PAGE_GENERATE_FORMAT_PATTERN.test(normalized)
|
||||||
|
|| PAGE_GENERATE_GUIDE_PATTERN.test(normalized)
|
||||||
|| isWechatPageRetryText(normalized)
|
|| isWechatPageRetryText(normalized)
|
||||||
|| isWechatPageEditText(normalized)
|
|| isWechatPageEditText(normalized)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user