Merge branch 'feature/goose-v149-local-canary'
Memind CI / Test, build, and release guards (push) Has been cancelled

This commit is contained in:
john
2026-09-09 22:01:45 +08:00
129 changed files with 54037 additions and 97 deletions
+34 -1
View File
@@ -92,6 +92,22 @@ const PAGE_GENERATION_INTENT_PATTERNS = [
/(?:把|更新|修改|改).{0,24}[\w-]+\.html/u,
];
/** 与 wechat/intent/patterns.mjs 对齐:用户口头要攻略/行程/线路图,但未说「页面」 */
const PAGE_GENERATION_IMPLICIT_CONTENT_PATTERNS = [
/(?:帮我.{0,12})?(?:做|写|生成|整理|出).{0,48}(?:游玩|旅行|旅游)?(?:攻略|指南|行程)(?!.*(?:不要|别|无需).*(?:页面|网页))/u,
/(?:我要|我想|想要|需要).{0,16}(?:做|来|一个|一份|个)?.{0,24}(?:游玩|旅行|旅游)?(?:攻略|指南|行程|线路图|路线图|行程图|行程表)/u,
/(?:帮我|给我).{0,12}(?:做|生成|制作|出).{0,24}(?:线路图|路线图|行程图|行程表)/u,
/(?:旅游|旅行|游玩)(?:攻略|指南|行程|线路)/u,
];
/** 纯咨询/问答式表达,不应误判为要生成页面 */
const PAGE_GENERATION_IMPLICIT_QUESTION_PATTERNS = [
/(?:怎么|如何|怎样).{0,16}(?:写|做|规划|安排)/u,
/(?:有什么|有哪些|什么|哪些).{0,20}(?:推荐|建议|好玩|值得)/u,
/(?:推荐|介绍).{0,12}(?:一下|下)?(?:有什么|哪些)/u,
/^(?:看看|了解|打听|咨询)/u,
];
const PRODUCT_CAMPAIGN_INTENT_PATTERNS = [
/(?:商品|购买|下单|种草|带货|促销|上架|SKU|店铺|电商)/u,
/(?:https?:\/\/|taobao|tmall|jd\.com|商品链接|购买链接|购买按钮)/iu,
@@ -166,10 +182,27 @@ export function isExcelAnalysisIntent(text) {
return EXCEL_ANALYSIS_INTENT_PATTERNS.some((pattern) => pattern.test(normalized));
}
export function isStructuredTravelItineraryIntent(text) {
const normalized = String(text ?? '').trim();
if (!normalized || normalized.length < 80) return false;
const dayRouteLines = normalized.match(
/(?:^|\n)\s*(?:\*\*)?(?:\d{1,2}[./、月]\d{1,2}|Day\s*\d+|第\s*[一二三四五六七八九十\d]+\s*天)(?:\*\*)?\s*.+(?:➜|→|->|—||-{1,2}>)/gmu,
) ?? [];
if (dayRouteLines.length >= 2) return true;
const stayLines = normalized.match(
/(?:^|\n)\s*(?:\*\*)?(?:\d{1,2}[./、月]\d{1,2}|Day\s*\d+|第\s*[一二三四五六七八九十\d]+\s*天)(?:\*\*)?\s*.+(?:住|宿|酒店|蒙古包|农家院)/gmu,
) ?? [];
return stayLines.length >= 2;
}
export function isPageGenerationIntent(text) {
const normalized = String(text ?? '').trim();
if (!normalized) return false;
return PAGE_GENERATION_INTENT_PATTERNS.some((pattern) => pattern.test(normalized));
if (PAGE_GENERATION_INTENT_PATTERNS.some((pattern) => pattern.test(normalized))) return true;
if (isStructuredTravelItineraryIntent(normalized)) return true;
const implicitMatch = PAGE_GENERATION_IMPLICIT_CONTENT_PATTERNS.some((pattern) => pattern.test(normalized));
if (!implicitMatch) return false;
return !PAGE_GENERATION_IMPLICIT_QUESTION_PATTERNS.some((pattern) => pattern.test(normalized));
}
const GENERIC_PAGE_REQUEST_FILLER_RE =