优化后端和前端
This commit is contained in:
@@ -154,6 +154,44 @@ class Ch1DefaultTargetTests(unittest.TestCase):
|
||||
"front_right",
|
||||
)
|
||||
|
||||
def test_driver_and_passenger_window_aliases_map_to_the_correct_side(self) -> None:
|
||||
cases = (
|
||||
("打开主驾车窗", "front_left", "window.set_motion", {"motion": "open"}),
|
||||
("打开主驾驶的车窗", "front_left", "window.set_motion", {"motion": "open"}),
|
||||
("打开副驾车窗", "front_right", "window.set_motion", {"motion": "open"}),
|
||||
("打开副驾驶的车窗", "front_right", "window.set_motion", {"motion": "open"}),
|
||||
("把副驾车窗开到35%", "front_right", "window.set_position", {"position_pct": 35}),
|
||||
)
|
||||
for index, (utterance, target, capability, parameters) in enumerate(cases):
|
||||
with self.subTest(utterance=utterance):
|
||||
result = self.service.process(
|
||||
utterance,
|
||||
provider="local",
|
||||
conversation_id=f"conv-window-occupant-alias-{index}",
|
||||
execution_mode="dry_run",
|
||||
)
|
||||
|
||||
self.assertEqual(result["status"], "succeeded")
|
||||
self.assertEqual(set(result["function_configs"]), {"native_window"})
|
||||
operation = result["function_configs"]["native_window"]["spec"][
|
||||
"operations"
|
||||
][0]
|
||||
self.assertEqual(operation["target"]["zone"], target)
|
||||
self.assertEqual(operation["capability"], capability)
|
||||
self.assertEqual(operation["parameters"], parameters)
|
||||
|
||||
def test_window_target_does_not_leak_from_a_later_seat_subject(self) -> None:
|
||||
parsed = merge_native_can_intent({}, "打开副驾车窗和主驾座椅通风")
|
||||
windows = [
|
||||
action
|
||||
for action in parsed["native_can_actions"]
|
||||
if action["capability"] == "window.set_motion"
|
||||
]
|
||||
|
||||
self.assertEqual(len(windows), 1)
|
||||
self.assertEqual(windows[0]["target"], "front_right")
|
||||
self.assertEqual(windows[0]["parameters"], {"motion": "open"})
|
||||
|
||||
def test_group_or_non_driver_seat_scope_is_not_treated_as_unscoped(self) -> None:
|
||||
for index, utterance in enumerate(
|
||||
("打开前排座椅加热", "打开后排座椅加热", "打开所有座椅加热")
|
||||
|
||||
Reference in New Issue
Block a user