fix: restore mode clicks and compose seat-aware assistant scenes
This commit is contained in:
@@ -21,6 +21,7 @@ from cognitive_agent.application.assistant_plan_guard import (
|
||||
)
|
||||
from cognitive_agent.application.mode_profile_intent import (
|
||||
normalize_mode_profile_name,
|
||||
parse_mode_profile_create,
|
||||
parse_mode_profile_detail_query,
|
||||
)
|
||||
from cognitive_agent.generated.can_semantic_protocol import CAN0_SUPPORTED_CAPABILITIES
|
||||
@@ -428,6 +429,9 @@ _MODE_CAPABILITY_LABELS = {
|
||||
"seat.set_legrest_extension": "座椅腿托伸展",
|
||||
"seat.set_heating": "座椅加热",
|
||||
"seat.set_ventilation": "座椅通风",
|
||||
"seat.set_driver_ventilation_native": "座椅通风",
|
||||
"seat.set_driver_heating_native": "座椅加热",
|
||||
"seat.set_driver_massage_native": "座椅按摩",
|
||||
"seat.start_dynamic_mode": "座椅动态模式",
|
||||
"climate.set_power": "空调",
|
||||
"climate.set_temperature": "空调温度",
|
||||
@@ -575,6 +579,21 @@ def _mode_operation_text(raw: Mapping[str, object]) -> str:
|
||||
}:
|
||||
target_label = ""
|
||||
subject = f"{target_label}{label}"
|
||||
if capability in {"seat.set_driver_ventilation_native", "seat.set_driver_heating_native"}:
|
||||
if parameters.get("state") == "off":
|
||||
return f"{subject}关闭"
|
||||
level = {1: "高档", 2: "低档"}.get(parameters.get("level", 2), "")
|
||||
return f"{subject}开启{level}"
|
||||
if capability == "seat.set_driver_massage_native":
|
||||
if parameters.get("action") == "off":
|
||||
return f"{subject}关闭"
|
||||
if parameters.get("action") == "strength":
|
||||
strength = {1: "轻柔", 2: "中等", 3: "较强"}.get(parameters.get("strength"), "")
|
||||
return f"{subject}设为{strength}力度"
|
||||
mode = {
|
||||
"wave": "波浪", "pulse": "脉冲", "stretch": "舒展", "slack": "舒缓", "relax": "放松",
|
||||
}.get(str(parameters.get("mode") or ""), "")
|
||||
return f"{subject}设为{mode}模式"
|
||||
if set(parameters) == {"state"}:
|
||||
return f"{subject}{values[0]}"
|
||||
if capability == "roof.set_shade_position" and parameters.get("position_pct") in {0, 100}:
|
||||
@@ -1750,6 +1769,11 @@ class AssistantCapabilityCatalog:
|
||||
normalized = "".join(text.lower().split())
|
||||
if not normalized:
|
||||
return None
|
||||
# A creation request can contain both a device and the noun 功能模式.
|
||||
# That noun is not evidence that the user is asking about capabilities.
|
||||
# Use the guarded intent parser, so genuine questions remain answerable.
|
||||
if parse_mode_profile_create(text) is not None:
|
||||
return None
|
||||
catalog = snapshot or self.snapshot()
|
||||
unsupported_control = _unsupported_control_answer(
|
||||
_canonical_control_text(text),
|
||||
|
||||
Reference in New Issue
Block a user