fix(schedule): harden reminder utterance routing for WeChat ITL
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:
john
2026-08-24 18:02:19 +08:00
parent 2319c9c808
commit 9dfafb99ca
10 changed files with 319 additions and 26 deletions
+13 -1
View File
@@ -2,18 +2,30 @@ export function looksLikeScheduleConfirmation(text) {
const compact = String(text ?? '').replace(/\s+/g, '');
if (!compact) return false;
if (/(没有|没能|未能|无法|不能|失败|需要你|请补充|请告诉)/.test(compact)) return false;
return /(已经|已|现在).{0,12}(设置|安排|记录|加上|添加|创建).{0,12}(待办|提醒|日程|安排|闹钟)|设置好了|已经设置好了|已经加上/.test(
return /(已经|已|现在).{0,12}(设置|安排|记录|加上|添加|创建).{0,12}(待办|提醒|日程|安排|闹钟|闹铃)|设置好了|已经设置好了|已经加上/.test(
compact,
);
}
export function rewriteScheduleConfirmationWhenItlEnabled(replyText, { enabled = false } = {}) {
if (!enabled || !looksLikeScheduleConfirmation(replyText)) return replyText;
return [
'这类提醒需要你先确认卡片后才会写入。',
'请直接发完整安排(例如「每天18点提醒打卡」),我会先发确认卡片;回复「确认」后再生效。',
].join('\n');
}
export async function guardScheduleConfirmationReply({
replyText,
scheduleService,
userId,
sourceMessageId,
logger,
intentTransactionEnabled = false,
}) {
if (intentTransactionEnabled) {
return rewriteScheduleConfirmationWhenItlEnabled(replyText, { enabled: true });
}
if (!scheduleService || !looksLikeScheduleConfirmation(replyText)) return replyText;
const messageId = String(sourceMessageId ?? '').trim();
if (!messageId || typeof scheduleService.listItemsBySourceMessage !== 'function') {