完善模式卡片、NFC及多设备控制流程

This commit is contained in:
minghanchen
2026-09-01 16:18:57 +08:00
parent ca26259e63
commit cbf230182d
15 changed files with 1092 additions and 191 deletions
+1 -1
View File
@@ -139,4 +139,4 @@ def test_main_parsed_control_panel_renders_validated_infrared_operations() -> No
assert 'frameLabel: "GSCU1B TCP"' in console
assert "已解析控制指令" in console
assert 'li[data-can-channel="IR"]' in styles
assert "console-v2.js?v=delivery-state-49" in html
assert "console-v2.js?v=delivery-state-50" in html
@@ -437,7 +437,19 @@ def test_mode_editor_renders_readable_commands_with_expandable_mqtt_sequences()
assert 'source: "published"' in app
assert 'source: flow?.control_transport === "wireless_mqtt" ? "projected" : "can"' in app
assert "function_configs: functionConfigs" in app
assert "execution_steps: executionSteps" in app
assert "execution_steps: []" in app
assert "requestNaturalLanguageControl(instruction" in app
assert 'executionMode: "dry_run"' in app
assert 'clientType: "mode_editor_compile"' in app
assert "previewOnly: true" in app
assert "function executeSavedModeProfile(mode)" in app
assert "/api/mode-profiles/${encodeURIComponent(mode.id)}/execute" in app
assert '$("#utterance").value = mode.name || mode.id;' in app
assert 'const savedModeExecution = result.orchestration_route === "saved_mode_command_flow";' in app
assert "`${result.mode_profile.name}执行完成`" in app
assert "生成指令" in html
assert ">执行</span></button>" not in html
assert ".mode-editor-command-card" in styles
assert ".mode-editor-command-meta" in styles
+10 -7
View File
@@ -970,7 +970,7 @@ class SelfExtensionTests(unittest.TestCase):
["failed"],
)
def test_submitted_emit_without_ack_continues_complete_infrared_plan(self) -> None:
def test_power_on_then_white_waits_800ms_and_continues_without_ack(self) -> None:
service = SelfExtensionService(SimulationGateway())
catalog = [
{
@@ -984,7 +984,7 @@ class SelfExtensionTests(unittest.TestCase):
}
for capability_id, action, slot in (
("light-on", "打开", 1),
("light-green", "切换到绿色", 4),
("light-white", "切换到白色", 6),
)
]
@@ -1009,16 +1009,18 @@ class SelfExtensionTests(unittest.TestCase):
"execute_gateway",
side_effect=submit_without_ack,
) as execute_gateway,
patch("cognitive_agent.application.self_extension.time.sleep"),
patch(
"cognitive_agent.application.self_extension.time.sleep"
) as sleep,
):
result = service.execute_peripheral_plan_request(
"开启闪光灯,颜色设置为绿色",
"启动闪烁灯,颜色设置为白色",
{
"provider_used": "infrared_local_rules",
"summary": "打开闪光灯并切换为绿色",
"summary": "启动闪烁灯并切换为白色",
"steps": [
{"kind": "peripheral", "capability_id": "light-on"},
{"kind": "peripheral", "capability_id": "light-green"},
{"kind": "peripheral", "capability_id": "light-white"},
],
},
catalog,
@@ -1027,11 +1029,12 @@ class SelfExtensionTests(unittest.TestCase):
)
self.assertEqual(execute_gateway.call_count, 2)
sleep.assert_called_once_with(0.8)
self.assertEqual(result["status"], "succeeded")
self.assertEqual(result["sequence"]["emit_count"], 2)
self.assertEqual(
[item["telemetry"]["slot"] for item in result["operation_results"]],
[1, 4],
[1, 6],
)
self.assertEqual(
[
+1
View File
@@ -187,6 +187,7 @@ def test_frontend_two_stage_contract_and_source_badges() -> None:
assert "本地规则命令已执行;云端补充失败" in app
assert 'class="v2-can-command-source"' in console
assert 'item.parseSource === "direct_control" ? "设备控件"' in console
assert 'item.parseSource === "saved_mode_command_flow" ? "模式卡片"' in console
assert 'item.parseSource === "local_rule" ? "本地规则" : "云端模型"' in console
assert 'item.deliveryLabel' in console
assert 'data-delivery-state="${escapeHtml(item.deliveryState)}"' in console