指令问题修复

This commit is contained in:
andy
2026-09-17 11:03:19 +08:00
parent a3505f3921
commit 6eeaee07d4
40 changed files with 395 additions and 59 deletions

View File

@@ -189,7 +189,7 @@ test('versioned sanitized gold corpus replays deterministically', async () => {
const corpus = JSON.parse(await readFile(
new URL('../../samples/business-parser-gold-corpus.json', import.meta.url), 'utf8'
));
assert.equal(corpus.version, 'ltjt-program-parser-v1.0.12');
assert.equal(corpus.version, 'ltjt-program-parser-v1.0.13');
assert.ok(corpus.cases.length >= 28);
for (const candidate of corpus.cases) {
const parse = () => parseProgramInput({
@@ -313,6 +313,31 @@ test('passenger TSV rejects duplicate leaders or a leader without both name and
}
});
test('independent room updates accept DBL shorthand without dropping other intentions', async () => {
for (const target of [
'房间数更改为 12 标+2 大', '用房数量改为12标+2大床',
'房型数量修改为12TWN+2DBL', '房间调整为12标间+2大床房'
]) {
const result = await parseProgramInput({ rawText: `独立团信息修改\n预订客户测试客户\n出发日期2026-09-16\n目标修改${target}`, receivedAt });
assert.equal(result.status, 'agent_parse_passed', JSON.stringify(result));
assert.deepEqual((result.operation as any).data.updates.actions, [
{ target: 'rooms.TWN', operation: 'set', value: 12 },
{ target: 'rooms.DBL', operation: 'set', value: 2 }
]);
}
const combined = await parseProgramInput({ rawText: '独立团信息修改\n预订客户测试客户\n出发日期2026-09-16\n目标修改房间数更改为12标+2大成人更改为28', receivedAt });
assert.equal(combined.status, 'agent_parse_passed');
assert.equal((combined.operation as any).data.updates.actions[2].value, 28);
for (const target of ['房间数更改为12', '房间数更改为12标+2大楼', '房间数更改为12标+2大+1DBL', '大床房数改为-1', '房间数更改为12标+2大DBL改为3']) {
const result = await parseProgramInput({ rawText: `独立团信息修改\n预订客户测试客户\n出发日期2026-09-16\n目标修改${target}`, receivedAt });
assert.notEqual(result.status, 'agent_parse_passed', target);
assert.equal(result.operation, null);
}
const clear = await parseProgramInput({ rawText: '独立团信息修改\n预订客户测试客户\n出发日期2026-09-16\n目标修改大床房数更改为0', receivedAt });
assert.equal(clear.status, 'agent_parse_passed');
assert.deepEqual((clear.operation as any).data.updates.actions, [{ target: 'rooms.DBL', operation: 'set', value: 0 }]);
});
test('independent headcount distributions keep occupied and non-occupied children distinct', async () => {
const parseHeadcount = (value: string) => parseProgramInput({
rawText: routeCases[14].input.replace(