fix(schedule): harden reminder utterance routing for WeChat ITL
Memind CI / Test, build, and release guards (push) Successful in 3m43s
Memind CI / Test, build, and release guards (push) Successful in 3m43s
Expand ASR normalization and colloquial reminder parsing so simple timed reminders route to L1 confirm cards instead of the agent, and disable schedule-guard false failures when ITL is enabled. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Normalize WeChat / ASR schedule utterances before intent parsing.
|
||||
* Keeps raw user text for display; use this for matching only.
|
||||
*/
|
||||
export function normalizeScheduleUtterance(text) {
|
||||
return String(text ?? '')
|
||||
.replace(/[\uFF10-\uFF19]/g, (ch) => String.fromCharCode(ch.charCodeAt(0) - 0xff10 + 0x30))
|
||||
.replace(/:/g, ':')
|
||||
.replace(/([0-9]{1,2}|[零一二两三四五六七八九十]{1,3})\s*([::])\s*/gu, '$1$2')
|
||||
.replace(/([::])\s*([0-9]{1,2})/gu, '$1$2')
|
||||
.replace(/([0-9]{1,2})\s*(点|:|:)/gu, '$1$2')
|
||||
.trim();
|
||||
}
|
||||
|
||||
/** True when user is trying to set a reminder/alarm (not automation/digest). */
|
||||
export function hasReminderSetupCue(compact) {
|
||||
if (!compact) return false;
|
||||
if (/(?:生成|制作|创建|做|执行|推送|发送|整理).{0,12}(?:页面|日报|报告|摘要)/u.test(compact)) {
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
/(?:提醒我|到点提醒|提醒一下|闹钟|闹铃|叫我|记得提醒)/u.test(compact)
|
||||
|| /(?:加个|添加|创建|安排)(?:一个|个)?提醒/u.test(compact)
|
||||
|| /(?:设置|设|加|添加|创建|安排|定)(?:一个|个|一下)?(?:每天|每日|天天)?(?:.{0,40})?提醒/u.test(compact)
|
||||
|| /(?:定|设)个?(?:闹钟|闹铃)/u.test(compact)
|
||||
|| /^定时提醒/u.test(compact)
|
||||
|| /(?:待办|代办|带办|代拜)提醒/u.test(compact)
|
||||
|| /备忘提醒/u.test(compact)
|
||||
);
|
||||
}
|
||||
|
||||
export function isWeeklyScheduleCue(compact) {
|
||||
return /(?:每周|每个周|星期[一二三四五六日天]|周[一二三四五六日天])/u.test(compact);
|
||||
}
|
||||
Reference in New Issue
Block a user