feat: 完善 N7 智能座舱交互与控制链路
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
@@ -11,6 +12,16 @@ from cognitive_agent.infrastructure.llm.openai_responses import OpenAIIntentErro
|
||||
|
||||
class SeatServiceIntegrationTests(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.memory_environment = patch.dict(
|
||||
os.environ,
|
||||
{
|
||||
"COGNITIVE_AGENT_DRIVER_SEAT_MEMORY_PATH": str(
|
||||
REPOSITORY_ROOT / "tests" / "fixtures" / "driver_seat_memory.json"
|
||||
)
|
||||
},
|
||||
)
|
||||
self.memory_environment.start()
|
||||
self.addCleanup(self.memory_environment.stop)
|
||||
self.service = SeatDemoService(REPOSITORY_ROOT)
|
||||
self.temporary_directory = tempfile.TemporaryDirectory()
|
||||
self.addCleanup(self.temporary_directory.cleanup)
|
||||
@@ -32,6 +43,26 @@ class SeatServiceIntegrationTests(unittest.TestCase):
|
||||
for event in result["trace_events"]:
|
||||
self.assertEqual(self.service.contracts.validate(event), [])
|
||||
|
||||
def test_explicit_legrest_height_does_not_execute_the_seat_height_axis(self) -> None:
|
||||
result = self.service.preview_native_can(
|
||||
"副驾腿托高度调到50%",
|
||||
provider="local",
|
||||
execution_mode="dry_run",
|
||||
conversation_id="conv-legrest-height-regression",
|
||||
)
|
||||
|
||||
self.assertEqual(result["status"], "succeeded")
|
||||
actions = result["intent_ir"]["spec"]["actions"]
|
||||
self.assertEqual(len(actions), 1)
|
||||
self.assertEqual(actions[0]["capability"], "seat.set_legrest_height")
|
||||
self.assertEqual(actions[0]["parameters"], {"position_pct": 50})
|
||||
self.assertEqual(
|
||||
result["actuator_state"]["passenger"]["position"]["legrest_height"][
|
||||
"position_pct"
|
||||
],
|
||||
50,
|
||||
)
|
||||
|
||||
def test_dynamic_mode_runs_until_explicit_natural_language_stop(self) -> None:
|
||||
conversation_id = "conv-dynamic-stop"
|
||||
started = self.service.process(
|
||||
|
||||
Reference in New Issue
Block a user