fix: restore mode clicks and compose seat-aware assistant scenes
This commit is contained in:
@@ -25,6 +25,8 @@ from collections.abc import Set as AbstractSet
|
||||
from dataclasses import dataclass
|
||||
from typing import Any
|
||||
|
||||
from cognitive_agent.application.semantic_ir import resolve_scene_seat_scopes
|
||||
|
||||
MAX_PLAN_BYTES = 24 * 1024
|
||||
MAX_PLAN_REQUESTS = 12
|
||||
MAX_PLAN_PARAMETERS = 12
|
||||
@@ -39,6 +41,9 @@ SCENE_COMPOSABLE_CAPABILITIES = frozenset(
|
||||
"seat.set_legrest_extension",
|
||||
"seat.set_ventilation",
|
||||
"seat.set_heating",
|
||||
"seat.set_driver_ventilation_native",
|
||||
"seat.set_driver_heating_native",
|
||||
"seat.set_driver_massage_native",
|
||||
"climate.set_power",
|
||||
"climate.set_temperature",
|
||||
"climate.set_fan_level",
|
||||
@@ -1085,6 +1090,7 @@ def guard_assistant_plan(
|
||||
fallback_intents: Sequence[Mapping[str, Any]] = (),
|
||||
trusted_local: Mapping[str, Any] | None = None,
|
||||
allow_scene_composition: bool = False,
|
||||
scene_scope_utterance: str | None = None,
|
||||
) -> GuardedAssistantPlan:
|
||||
"""Authorize a Codex plan against the server-owned unresolved text.
|
||||
|
||||
@@ -1153,6 +1159,10 @@ def guard_assistant_plan(
|
||||
parser_claims.update(_intent_claims(intent))
|
||||
local_keys = _resolved_keys(trusted_local or {})
|
||||
non_execution = bool(_NON_EXECUTION_PATTERN.search(text))
|
||||
scene_seat_scopes = (
|
||||
resolve_scene_seat_scopes(text if scene_scope_utterance is None else scene_scope_utterance)
|
||||
if allow_scene_composition else None
|
||||
)
|
||||
|
||||
accepted: list[dict[str, Any]] = []
|
||||
rejected: list[dict[str, str]] = []
|
||||
@@ -1204,6 +1214,24 @@ def guard_assistant_plan(
|
||||
}
|
||||
)
|
||||
continue
|
||||
if (
|
||||
allow_scene_composition
|
||||
and domain == "seat"
|
||||
and scene_seat_scopes is not None
|
||||
and (
|
||||
"unsupported" in scene_seat_scopes
|
||||
or {"front_left": "driver", "front_right": "passenger"}.get(
|
||||
target_scope, target_scope
|
||||
) not in scene_seat_scopes
|
||||
)
|
||||
):
|
||||
rejected.append(
|
||||
{
|
||||
"field": f"requests[{index}].target_scope",
|
||||
"question": "场景座椅动作超出了用户明确指定的座位范围,已拒绝生成该功能模式。",
|
||||
}
|
||||
)
|
||||
continue
|
||||
request_text = _relevant_text(capability, text)
|
||||
if non_execution or (
|
||||
not allow_scene_composition
|
||||
|
||||
Reference in New Issue
Block a user