feat(wechat): channel split with stub-safe page delivery

Introduce wechat/ channel package; never send stub HTML links to service-account users.
This commit was merged in pull request #2.
This commit is contained in:
2026-07-04 05:21:13 +00:00
parent f36e8b9292
commit 2a3579c73a
8 changed files with 413 additions and 24 deletions
+37
View File
@@ -0,0 +1,37 @@
/** WeChat channel intent patterns — not shared with H5 chat-skills routing. */
export const PAGE_GENERATE_PATTERN =
/(?:生成|创建|做|写|帮我.*(?:生成|创建|做|写)).*(?:html|页面|网页|page|文件)/iu;
export const DOCX_DOWNLOAD_PATTERN =
/(?:(?:word|docx|\.docx|\.doc|文档).*(?:下载|链接|导出|给我)|(?:下载|导出|提供|给我).*(?:word|docx|\.docx|\.doc|文档))/iu;
export const TOPIC_RESET_PATTERN =
/^(换(个)?话题|新问题|忽略之前|不管之前|重新开始|reset)$/iu;
export const TOPIC_RESET_LOOSE_PATTERN = /忽略.*之前|不要管.*之前|别管.*之前/u;
export const STATUS_PROBE_PATTERN = /^[?]+$/u;
export const GREETING_PATTERN =
/^(你好|您好|在吗|在不在|嗨|hi|hello|hey)[!!。.\s]*$/iu;
export const CONNECTIVITY_TEST_PATTERN = /^(测试\s*\d*|test\s*\d*)[!!。.\s]*$/iu;
export function isPageGenerateText(text) {
const normalized = String(text ?? '').trim();
if (!normalized) return false;
return PAGE_GENERATE_PATTERN.test(normalized);
}
export function isTopicResetText(text) {
const normalized = String(text ?? '').trim();
if (!normalized) return false;
return TOPIC_RESET_PATTERN.test(normalized) || TOPIC_RESET_LOOSE_PATTERN.test(normalized);
}
export function wantsDocxDownload(text) {
const normalized = String(text ?? '').trim();
if (!normalized) return false;
return DOCX_DOWNLOAD_PATTERN.test(normalized);
}