fix(scheduled-task): reject meta-only phrases in taskSpec parsing
Memind CI / Test, build, and release guards (push) Successful in 7m31s
Memind CI / Test, build, and release guards (push) Successful in 7m31s
Treat hollow requests like「我要做一个定时执行任务」as missing taskSpec so WeChat preflight asks for both schedule and executable content instead of accepting「执行」as a deliverable task description. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -90,3 +90,24 @@ test('isScheduledTaskIntent excludes none', () => {
|
||||
assert.equal(isScheduledTaskIntent({ action: 'create_scheduled_task' }), true);
|
||||
assert.equal(isScheduledTaskIntent({ action: 'none' }), false);
|
||||
});
|
||||
|
||||
test('meta scheduled-task phrases require task_spec clarification', () => {
|
||||
for (const text of [
|
||||
'我要做一个定时执行任务',
|
||||
'定时自动执行任务',
|
||||
'不是待办,定时执行任务',
|
||||
]) {
|
||||
const intent = parseScheduledTaskIntent(text);
|
||||
assert.equal(intent.action, 'create_scheduled_task', text);
|
||||
assert.ok(intent.needsClarification?.includes('task_spec'), text);
|
||||
assert.ok(intent.needsClarification?.includes('schedule'), text);
|
||||
assert.equal(extractScheduledTaskSpec(text), null, text);
|
||||
}
|
||||
});
|
||||
|
||||
test('combined phrase keeps substantive taskSpec after time prefix', () => {
|
||||
const text = '帮我创建一个定时执行任务,23:00执行,搜索今日新闻';
|
||||
const intent = parseScheduledTaskIntent(text);
|
||||
assert.equal(intent.needsClarification, undefined);
|
||||
assert.match(intent.taskSpec, /搜索今日新闻/u);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user