feat(n7web): enhance control workflows and status feedback
This commit is contained in:
@@ -3,25 +3,35 @@ from __future__ import annotations
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
WEB = ROOT / "apps" / "web-console"
|
||||
|
||||
|
||||
def vue_shell() -> str:
|
||||
return (WEB / "src" / "App.vue").read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def test_console_contains_ai_assistant_surface():
|
||||
html = (ROOT / "apps/web-console/index.html").read_text(encoding="utf-8")
|
||||
assert 'id="assistantTranscript"' in html
|
||||
assert 'id="assistantMessages"' in html
|
||||
assert "你好,我是 AI助手。你可以向我提问" in html
|
||||
assert 'aria-label="AI助手对话"' in html
|
||||
assert 'placeholder="向 AI助手提问或交代工作"' in html
|
||||
assert 'aria-label="发送消息"' in html
|
||||
assert 'href="/assistant-chat.css?v=codex-assistant-29"' in html
|
||||
assert 'src="/assistant-chat.js?v=codex-assistant-33"' in html
|
||||
html = (WEB / "index.html").read_text(encoding="utf-8")
|
||||
template = vue_shell()
|
||||
vite_entry = (WEB / "src" / "main.js").read_text(encoding="utf-8")
|
||||
assert 'id="assistantTranscript"' in template
|
||||
assert 'id="assistantMessages"' in template
|
||||
assert "你好,我是 AI助手。你可以向我提问" in template
|
||||
assert 'aria-label="AI助手对话"' in template
|
||||
assert 'placeholder="向 AI助手提问或交代工作"' in template
|
||||
assert 'aria-label="发送消息"' in template
|
||||
assert 'import "../assistant-chat.css";' in vite_entry
|
||||
assert 'src="/assistant-chat.js?v=codex-assistant-34"' in html
|
||||
|
||||
|
||||
def test_codex_assistant_assets_are_versioned_together_in_the_service_worker():
|
||||
service_worker = (ROOT / "apps/web-console/service-worker.js").read_text(encoding="utf-8")
|
||||
assert 'const CACHE_VERSION = "cognitive-agent-pad-v305"' in service_worker
|
||||
assert (
|
||||
'const CACHE_VERSION = "cognitive-agent-pad-v315-vue-vite"'
|
||||
in service_worker
|
||||
)
|
||||
assert '"/assistant-chat.css?v=codex-assistant-29"' in service_worker
|
||||
assert '"/assistant-chat.js?v=codex-assistant-33"' in service_worker
|
||||
assert '"/assistant-chat.js?v=codex-assistant-34"' in service_worker
|
||||
|
||||
|
||||
def test_codex_frontend_uses_one_streaming_endpoint_and_agent_work_events():
|
||||
@@ -90,6 +100,18 @@ def test_validated_controls_are_mirrored_into_a_compact_assistant_card():
|
||||
assert "appendDispatchedControls(message, event.payload)" in script
|
||||
assert "function announceModeExecution(" in script
|
||||
assert "announceModeExecution," in script
|
||||
assert "function beginModeExecution(" in script
|
||||
assert "function completeModeExecution(" in script
|
||||
assert "appendDispatchedControls(message, modeExecutionPreviewResult(profile))" in script
|
||||
assert "beginModeExecution," in script
|
||||
assert "completeModeExecution," in script
|
||||
assert "const operationByRef = new Map()" in script
|
||||
assert 'deliveryState: "submitting"' in script
|
||||
assert 'deliveryLabel: "正在下发"' in script
|
||||
assert '"seat.set_cushion_tilt": "坐盆"' in script
|
||||
assert '"seat.set_backrest_recline": "靠背"' in script
|
||||
assert '"seat.set_legrest_height": "腿托"' in script
|
||||
assert '"seat.set_legrest_extension": "腿托"' in script
|
||||
assert '"ambient_light.set_illumination": "氛围灯颜色与亮度"' in script
|
||||
assert '.replaceAll("_", "-")' in script
|
||||
assert ".assistant-dispatched-controls > summary" in css
|
||||
@@ -98,6 +120,29 @@ def test_validated_controls_are_mirrored_into_a_compact_assistant_card():
|
||||
assert ".assistant-dispatched-controls[open]" in css
|
||||
|
||||
|
||||
def test_saved_mode_execution_opens_with_pending_flow_before_http_completion():
|
||||
app = (ROOT / "apps/web-console/app.js").read_text(encoding="utf-8")
|
||||
flow = app.split(
|
||||
"async function executeSavedModeProfile", 1
|
||||
)[1].split("function applyModeCommand", 1)[0]
|
||||
|
||||
begin_index = flow.index("assistant?.beginModeExecution?.(mode")
|
||||
request_index = flow.index("await postControlPhase(")
|
||||
assert begin_index < request_index
|
||||
assert "assistant.completeModeExecution(assistantModeHandle, mode, payload" in flow
|
||||
assert "assistant.completeModeExecution(assistantModeHandle, mode, null" in flow
|
||||
|
||||
|
||||
def test_seat_control_cards_name_the_controlled_seat_component():
|
||||
console = (ROOT / "apps/web-console/console-v2.js").read_text(encoding="utf-8")
|
||||
|
||||
assert '"seat.set_cushion_tilt": ["副驾座椅坐盆调节"' in console
|
||||
assert 'backrest: "主驾座椅靠背调节"' in console
|
||||
assert 'basin: "主驾座椅坐盆调节"' in console
|
||||
assert 'legrest: "主驾座椅腿托调节"' in console
|
||||
assert 'horizontal: "主驾座椅前后调节"' in console
|
||||
|
||||
|
||||
def test_codex_request_keeps_trusted_vehicle_context_without_legacy_model_routing():
|
||||
script = (ROOT / "apps/web-console/assistant-chat.js").read_text(encoding="utf-8")
|
||||
request_body = script.split("function requestBody(message)", 1)[1].split(
|
||||
@@ -332,7 +377,7 @@ def test_assistant_composer_grows_to_a_cap_then_scrolls_its_own_content():
|
||||
|
||||
|
||||
def test_assistant_composer_keeps_the_microphone_visible_and_aligned():
|
||||
html = (ROOT / "apps/web-console/index.html").read_text(encoding="utf-8")
|
||||
html = vue_shell()
|
||||
css = (ROOT / "apps/web-console/assistant-chat.css").read_text(encoding="utf-8")
|
||||
assert 'id="speechDictationButton"' in html
|
||||
assert 'data-lucide="mic"' in html
|
||||
@@ -345,7 +390,7 @@ def test_assistant_composer_keeps_the_microphone_visible_and_aligned():
|
||||
|
||||
|
||||
def test_voice_input_supports_direct_manual_capture_and_background_wake_standby():
|
||||
html = (ROOT / "apps/web-console/index.html").read_text(encoding="utf-8")
|
||||
html = vue_shell()
|
||||
script = (ROOT / "apps/web-console/speech-input.js").read_text(encoding="utf-8")
|
||||
assistant = (ROOT / "apps/web-console/assistant-chat.js").read_text(encoding="utf-8")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user