feat: integrate production cockpit AI assistant
This commit is contained in:
@@ -54,6 +54,65 @@ class ModeProfileRegistryTests(unittest.TestCase):
|
||||
{profile.id for profile in registry.match_text("副驾驶进入零重力模式", vehicle_id="other_vehicle")},
|
||||
)
|
||||
|
||||
def test_user_mode_short_alias_does_not_hijack_device_compounds(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
registry = ModeProfileRegistry(
|
||||
root / "presets",
|
||||
user_root=root / "user-modes",
|
||||
)
|
||||
profile = registry.save_mode(
|
||||
"阅读模式",
|
||||
[
|
||||
{
|
||||
"domain": "interior_light",
|
||||
"capability": "interior_light.set_reading_power",
|
||||
"target_scope": "all",
|
||||
"operation": "set",
|
||||
"parameters": {"state": "on"},
|
||||
}
|
||||
],
|
||||
vehicle_id="denza_n7",
|
||||
)
|
||||
|
||||
for utterance in (
|
||||
"关闭全车阅读灯",
|
||||
"打开阅读灯",
|
||||
"把阅读灯关闭",
|
||||
"阅读灯亮度是多少",
|
||||
):
|
||||
with self.subTest(utterance=utterance):
|
||||
self.assertEqual(
|
||||
registry.match_text(utterance, vehicle_id="denza_n7"),
|
||||
[],
|
||||
)
|
||||
|
||||
for utterance in ("进入阅读模式", "启动阅读", "打开阅读吧"):
|
||||
with self.subTest(utterance=utterance):
|
||||
self.assertEqual(
|
||||
[
|
||||
item.id
|
||||
for item in registry.match_text(
|
||||
utterance,
|
||||
vehicle_id="denza_n7",
|
||||
)
|
||||
],
|
||||
[profile.id],
|
||||
)
|
||||
|
||||
def test_parenthesized_display_name_matches_natural_spoken_form(self) -> None:
|
||||
registry = ModeProfileRegistry(REPOSITORY_ROOT / "config" / "modes")
|
||||
|
||||
matched = registry.match_text(
|
||||
"切换到女王副驾行驶模式",
|
||||
vehicle_id="denza_n7",
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
[profile.id for profile in matched],
|
||||
["queen_passenger_driving"],
|
||||
)
|
||||
|
||||
def test_reference_modes_are_denza_specific(self) -> None:
|
||||
registry = ModeProfileRegistry(REPOSITORY_ROOT / "config" / "modes")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user