feat: integrate production cockpit AI assistant
This commit is contained in:
@@ -13,15 +13,15 @@ def test_console_contains_ai_assistant_surface():
|
||||
assert 'aria-label="AI助手对话"' in html
|
||||
assert 'placeholder="向 AI助手提问或交代工作"' in html
|
||||
assert 'aria-label="发送消息"' in html
|
||||
assert 'href="/assistant-chat.css?v=codex-assistant-24"' in html
|
||||
assert 'src="/assistant-chat.js?v=codex-assistant-24"' in html
|
||||
assert 'href="/assistant-chat.css?v=codex-assistant-26"' in html
|
||||
assert 'src="/assistant-chat.js?v=codex-assistant-26"' 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-v272"' in service_worker
|
||||
assert '"/assistant-chat.css?v=codex-assistant-24"' in service_worker
|
||||
assert '"/assistant-chat.js?v=codex-assistant-24"' in service_worker
|
||||
assert 'const CACHE_VERSION = "cognitive-agent-pad-v275"' in service_worker
|
||||
assert '"/assistant-chat.css?v=codex-assistant-26"' in service_worker
|
||||
assert '"/assistant-chat.js?v=codex-assistant-26"' in service_worker
|
||||
|
||||
|
||||
def test_codex_frontend_uses_one_streaming_endpoint_and_agent_work_events():
|
||||
@@ -44,6 +44,30 @@ def test_codex_frontend_uses_one_streaming_endpoint_and_agent_work_events():
|
||||
assert "confirmation" not in script.lower()
|
||||
|
||||
|
||||
def test_unsupported_control_suggestions_are_clickable_accessible_and_deduplicated():
|
||||
script = (ROOT / "apps/web-console/assistant-chat.js").read_text(encoding="utf-8")
|
||||
css = (ROOT / "apps/web-console/assistant-chat.css").read_text(encoding="utf-8")
|
||||
|
||||
assert 'event.type === "control.suggestions"' in script
|
||||
assert "event.suggestions || event.recommended_commands" in script
|
||||
assert "function normalizeControlSuggestions(rawSuggestions)" in script
|
||||
assert "seenCommands.has(commandKey)" in script
|
||||
assert "MAX_CONTROL_SUGGESTIONS = 4" in script
|
||||
assert "function appendControlSuggestions(message, rawSuggestions)" in script
|
||||
assert 'message.article?.classList.add("assistant-message-control-suggestions")' in script
|
||||
assert 'group.setAttribute("role", "group")' in script
|
||||
assert 'group.setAttribute("aria-label", "可以尝试的其他控制指令")' in script
|
||||
assert 'button.type = "button"' in script
|
||||
assert 'button.setAttribute("aria-label", `执行控制指令:${suggestion.label}`)' in script
|
||||
assert "submitSuggestedCommand(suggestion.command, group, button)" in script
|
||||
assert "setSuggestionGroupPending(group, button, true)" in script
|
||||
assert "await submitAssistant(command)" in script
|
||||
assert ".assistant-control-suggestions" in css
|
||||
assert ".assistant-message-control-suggestions .assistant-message-body" in css
|
||||
assert ".assistant-control-suggestion:focus-visible" in css
|
||||
assert ".assistant-control-suggestion.is-sending" in css
|
||||
|
||||
|
||||
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(
|
||||
@@ -137,7 +161,13 @@ def test_assistant_mode_creation_previews_then_saves_to_the_compact_mode_strip()
|
||||
assert action_label in assistant
|
||||
|
||||
assert "tryModeDraft?.({ ...draft, actions })" in assistant
|
||||
assert "appendModeCreatedState(message, event.payload.mode_profile)" in assistant
|
||||
assert '["mode_profile_create", "mode_profile_update"].includes(' in assistant
|
||||
assert "appendModeCreatedState(message, event.payload.mode_profile, {" in assistant
|
||||
assert (
|
||||
'updated: event.payload.orchestration_route === "mode_profile_update"'
|
||||
in assistant
|
||||
)
|
||||
assert "refreshModeProfiles?.(" in assistant
|
||||
assert "revealModeProfile?.(String(profile.id), { focus: true })" in assistant
|
||||
assert "function revealModeProfile(modeProfileId" in app
|
||||
assert "refreshModeProfiles" in app
|
||||
@@ -258,7 +288,7 @@ def test_voice_input_supports_direct_manual_capture_and_background_wake_standby(
|
||||
assistant = (ROOT / "apps/web-console/assistant-chat.js").read_text(encoding="utf-8")
|
||||
|
||||
assert 'aria-label="开始语音输入"' in html
|
||||
assert 'const DEFAULT_WAKE_WORD = "你好,双十一"' in script
|
||||
assert 'const DEFAULT_WAKE_WORD = "你好,小迪"' in script
|
||||
assert 'new Set(["arming", "armed", "capturing", "finalizing"])' in script
|
||||
assert "async function startManualDictation()" in script
|
||||
assert "async function startWakeStandby({ automatic = true } = {})" in script
|
||||
|
||||
Reference in New Issue
Block a user