fix: compose named cockpit modes from capabilities
This commit is contained in:
@@ -14,14 +14,14 @@ def test_console_contains_ai_assistant_surface():
|
||||
assert 'placeholder="向 AI助手提问或交代工作"' in html
|
||||
assert 'aria-label="发送消息"' in html
|
||||
assert 'href="/assistant-chat.css?v=codex-assistant-22"' in html
|
||||
assert 'src="/assistant-chat.js?v=codex-assistant-20"' in html
|
||||
assert 'src="/assistant-chat.js?v=codex-assistant-22"' 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-v269"' in service_worker
|
||||
assert 'const CACHE_VERSION = "cognitive-agent-pad-v271"' in service_worker
|
||||
assert '"/assistant-chat.css?v=codex-assistant-22"' in service_worker
|
||||
assert '"/assistant-chat.js?v=codex-assistant-20"' in service_worker
|
||||
assert '"/assistant-chat.js?v=codex-assistant-22"' in service_worker
|
||||
|
||||
|
||||
def test_codex_frontend_uses_one_streaming_endpoint_and_agent_work_events():
|
||||
@@ -113,20 +113,41 @@ def test_assistant_mode_creation_previews_then_saves_to_the_compact_mode_strip()
|
||||
save_flow = assistant.split(
|
||||
"async function saveModeProfileDraft", 1
|
||||
)[1].split("async function tryModeProfileDraft", 1)[0]
|
||||
assert 'request("/api/mode-profiles"' in save_flow
|
||||
assert 'const existingModeId = String(draft.existing_mode_id || "").trim()' in save_flow
|
||||
assert "encodeURIComponent(existingModeId)" in save_flow
|
||||
assert '"/api/mode-profiles"' in save_flow
|
||||
assert "request(endpoint" in save_flow
|
||||
assert 'method: "POST"' in save_flow
|
||||
for field in ("name", "instruction", "source_request_id", "vehicle_id"):
|
||||
assert field in save_flow
|
||||
assert "response.ok" in save_flow
|
||||
assert "refreshModeProfiles?.(payload.mode_profile?.id)" in save_flow
|
||||
assert "appendModeCreatedState(message, payload.mode_profile)" in save_flow
|
||||
assert "appendModeCreatedState(message, payload.mode_profile" in save_flow
|
||||
assert "updated: Boolean(existingModeId)" in save_flow
|
||||
assert "确认更新此模式" in assistant
|
||||
assert "已载入现有功能模式" in assistant
|
||||
for action_label in (
|
||||
"座椅前后位置",
|
||||
"坐垫角度",
|
||||
"靠背角度",
|
||||
"腿托高度",
|
||||
"空调循环",
|
||||
"内循环",
|
||||
):
|
||||
assert action_label in assistant
|
||||
|
||||
assert "tryModeDraft?.(draft)" in assistant
|
||||
assert "tryModeDraft?.({ ...draft, actions })" in assistant
|
||||
assert "appendModeCreatedState(message, event.payload.mode_profile)" in assistant
|
||||
assert "revealModeProfile?.(String(profile.id), { focus: true })" in assistant
|
||||
assert "function revealModeProfile(modeProfileId" in app
|
||||
assert "refreshModeProfiles" in app
|
||||
assert "tryModeDraft" in app
|
||||
assert "const actionSignature = (action) =>" in app
|
||||
assert 'apiRequest("/api/mode-profile-drafts/trial"' in app
|
||||
assert "source_request_id: draft.source_request_id" in app
|
||||
assert "const expectedSignatures = Array.isArray(draft?.actions)" in app
|
||||
assert "signature === actualSignatures[index]" in app
|
||||
assert "|| !sameActions" in app
|
||||
assert 'button.classList.add("just-created")' in app
|
||||
assert 'window.addEventListener("cognitive-agent:request-complete"' in app
|
||||
assert ".assistant-mode-draft" in css
|
||||
|
||||
Reference in New Issue
Block a user