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:
+21
-3
@@ -1,5 +1,9 @@
|
||||
import { detectQueryGuard } from './intent-query-guard.mjs';
|
||||
import { parseScheduleIntent, shouldUseScheduleAssistant } from './schedule-intent.mjs';
|
||||
import {
|
||||
parseScheduleIntent,
|
||||
shouldUseScheduleAssistant,
|
||||
tryResolveTimedReminderIntent,
|
||||
} from './schedule-intent.mjs';
|
||||
import {
|
||||
isScheduledTaskIntent,
|
||||
parseScheduledTaskIntent,
|
||||
@@ -8,10 +12,12 @@ import {
|
||||
|
||||
function detectAmbiguity(text) {
|
||||
const compact = String(text ?? '').replace(/\s+/g, '');
|
||||
const notifyCue = /(?:提醒我|设置提醒|设个?提醒|闹钟|叫我)/u.test(compact);
|
||||
const notifyCue =
|
||||
/(?:提醒我|设置提醒|设个?提醒|闹钟|闹铃|叫我|到点提醒|提醒一下)/u.test(compact)
|
||||
|| /(?:设置|设|加|添加|创建|安排|定)(?:一个|个|一下)?(?:每天|每日|天天)?(?:.{0,40})?提醒/u.test(compact);
|
||||
const actCue = /(?:生成|制作|创建|做|执行|推送|发送|整理).{0,12}(?:页面|日报|报告|摘要)/u.test(compact);
|
||||
if (notifyCue && actCue) return true;
|
||||
if (notifyCue && /(?:自动|生成)/u.test(compact)) return true;
|
||||
if (notifyCue && /(?:自动|生成)/u.test(compact) && actCue) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -64,6 +70,18 @@ export function classifyUserIntent(text, { now = Date.now(), timezone = 'Asia/Sh
|
||||
if (shouldUseScheduledTaskAutomation(text)) {
|
||||
return { layer: 'L2', kind: 'scheduled_task', action: 'agent_automation', detail: schedTask };
|
||||
}
|
||||
|
||||
const timedFallback = tryResolveTimedReminderIntent(text, { now, timezone });
|
||||
if (timedFallback?.action === 'create_timed_reminder') {
|
||||
return {
|
||||
layer: 'L1',
|
||||
kind: 'timed_reminder',
|
||||
action: timedFallback.action,
|
||||
detail: timedFallback,
|
||||
clarify: timedFallback.needsClarification ?? [],
|
||||
};
|
||||
}
|
||||
|
||||
if (shouldUseScheduleAssistant(text)) {
|
||||
const multiTime = (String(text).match(/[0-9零一二两三四五六七八九十]{1,3}(?:点|:|:)/gu) ?? []).length > 1;
|
||||
return { layer: multiTime ? 'L3' : 'L1', kind: 'agent_schedule', action: 'agent_schedule' };
|
||||
|
||||
Reference in New Issue
Block a user