fix: support conversational mode draft updates

This commit is contained in:
vee
2026-09-07 23:59:42 +08:00
parent 6b2b644ee6
commit f0a248ede3
19 changed files with 2326 additions and 109 deletions
+33
View File
@@ -43,6 +43,10 @@ from cognitive_agent.application.codex_assistant import ( # noqa: E402
CodexVehicleToolError,
)
from cognitive_agent.application.gesture_bridge import GestureCapabilityBridge # noqa: E402
from cognitive_agent.application.mode_profile_intent import ( # noqa: E402
normalize_mode_profile_name,
parse_mode_profile_update,
)
from cognitive_agent.application.seat_service import SeatDemoService # noqa: E402
from cognitive_agent.application.self_extension import ( # noqa: E402
ExtensionIntegrationError,
@@ -1657,6 +1661,25 @@ class SeatDemoHandler(BaseHTTPRequestHandler):
if payload.get("reasoning_effort") is not None
else "low"
)
mode_profile_draft_context = payload.get("mode_profile_draft_context")
parsed_mode_update = parse_mode_profile_update(
message,
expected_mode_name=(
mode_profile_draft_context.get("name")
if isinstance(mode_profile_draft_context, Mapping)
else None
),
)
matching_mode_profile_draft_context = (
dict(mode_profile_draft_context)
if isinstance(mode_profile_draft_context, Mapping)
and parsed_mode_update is not None
and normalize_mode_profile_name(parsed_mode_update[0])
== normalize_mode_profile_name(
mode_profile_draft_context.get("name")
)
else None
)
common_arguments: dict[str, object] = {
"utterance": message,
# Codex has already converted an implicit request into one explicit
@@ -1672,6 +1695,15 @@ class SeatDemoHandler(BaseHTTPRequestHandler):
"hardware_access_bypass": self._hardware_access_bypass_allowed(),
"reasoning_effort": reasoning_effort,
"control_transport": str(payload.get("control_transport") or "wired_can"),
**(
{
"mode_profile_draft_context": (
matching_mode_profile_draft_context
)
}
if matching_mode_profile_draft_context is not None
else {}
),
}
capability_catalog = self._assistant_capability_catalog()
capability_snapshot = capability_catalog.snapshot()
@@ -1783,6 +1815,7 @@ class SeatDemoHandler(BaseHTTPRequestHandler):
control_terms=capability_catalog.control_terms(capability_snapshot),
query_capabilities=capability_catalog.query,
authoritative_answer=fast_answer.answer if fast_answer else None,
mode_profile_draft_context=mode_profile_draft_context,
)
except HardwareAccessRequiredError as exc:
self.vehicle_display_sync.update_task(