feat(n7web): enhance control workflows and status feedback

This commit is contained in:
Miayui
2026-09-16 12:52:07 +08:00
parent 84a3cd73bb
commit 0e4328f548
45 changed files with 7317 additions and 1001 deletions
@@ -1850,7 +1850,7 @@ class AssistantCapabilityCatalog:
]
if not peripherals:
return CapabilityAnswer(
"工程支持通过 NFC 绑定并学习红外外设;当前没有同时满足“已启用且对应 NFC 卡在场”的可执行外设能力。",
"工程支持通过 NFC 绑定并学习红外外设;当前没有同时满足“已学习、已启用且保留有效 NFC 绑定”的可执行外设能力。",
"peripherals",
)
labels = [
@@ -2321,7 +2321,9 @@ class AssistantCapabilityCatalog:
try:
nfc = dict(self._nfc_provider()) if self._nfc_provider else {}
except Exception: # noqa: BLE001 - optional NFC reader may be offline
return [], "unavailable"
# The reader only reports current presence. Durable bindings remain
# callable even while the reader is offline or no card is present.
nfc = {}
card = nfc.get("card") if isinstance(nfc.get("card"), Mapping) else {}
active_uid = _normalized_nfc_uid(card.get("uid")) if isinstance(card, Mapping) else ""
peripherals: list[dict[str, object]] = []
@@ -2350,7 +2352,7 @@ class AssistantCapabilityCatalog:
active_uid and card_uid and active_uid == card_uid
),
"assistant_callable": bool(
learned and enabled and active_uid and card_uid and active_uid == card_uid
learned and enabled and card_uid
),
}
)