Engineering/AI documentation
Chat Audio Conversation
The chat audio flow records user speech through the browser, sends it to the voice route, and returns transcription or voice-assisted chat input.
Concepts: wcag
Governed audio model settings
Audio transcription uses one explicit AudioModelProfile contract for interview
uploads, microphone chat, and channel audio. Supported provider families are
local_whisper, compatible remote_whisper, and gpt4_diarization. Settings
responses expose capabilities and an opaque credential reference only; secrets
and provider URLs are never returned.
Capability claims are grounded in the runtime/dispatch layer, never in
configuration alone: local_whisper advertises support only when the local
Whisper runtime (and its ffmpeg decode path) is actually available, and
remote_whisper/gpt4_diarization are configuration-only today — no dispatch
adapter exists yet, so they are advertised as unavailable until an adapter
lands. An empty, unsupported, or invalid profile is unavailable: the admin
endpoint returns a typed 503 (error.type=audio_profile_invalid) rather than a
crash, and no audio flow ever falls back to a text/Pi model. Transcripts remain
provisional research source material until review gates pass.
Implementation Summary
The chat audio flow records user speech through the browser, sends it to the voice route with the active project_id, and returns transcription or voice-assisted chat input only inside that project scope.
Frontend Surface
frontend/src/hooks/useVoiceRecorder.tsfrontend/src/components/chat/ChatView.tsxfrontend/src/lib/chatApi.tsbackend/app/api/routes/chat.pybackend/app/api/routes/chat_voice.pybackend/app/core/transcription.py
State, API, And Backend Contracts
Stores
- None recorded.
API And Backend
frontend/src/lib/chatApi.tsappendsproject_idto the voice transcriptionFormData.frontend/src/hooks/useVoiceRecorder.tstrims and validates the project id before transcribing, and stops the recording with a project-selection error when no active project is available.backend/app/api/routes/chat.pyandbackend/app/api/routes/chat_voice.pyreject blank or unauthorized project ids before returning dummy or real transcription responses.
Architecture Notes
- The feature is mounted through
frontend/src/hooks/useVoiceRecorder.tsand the UI navigation path recorded in the inventory. - Voice tests must use the runner's persistent simulation project. They must not fall back to placeholder project ids or the first project visible to a global admin.
- The frontmatter and manifest entries are the durable contract for agents updating this page after code changes.
- When the referenced component, store, route, agent, skill, or test behavior changes, regenerate and validate the feature documentation.
Agents, Skills, LLM, MCP, And Permissions
- No direct agent, skill, LLM, or MCP behavior is asserted beyond the cited source files.
Tests And Verification
tests/e2e_test.pysends the created E2E project id to/api/chat/voice-transcribewithout a fallback placeholder.tests/simulation/scenarios/77-voice-transcription.mjsposts a project-scopedFormDatarequest and expects the route to fail on missing audio only after accepting the project scope.tests/simulation/scenarios/78-real-time-voice.mjsseeds the active project in browser storage before checking microphone controls.tests/test_project_scope_contracts.pyprevents regression to placeholder project ids in voice and simulation harness checks.
Related Features
Related Concepts
Compass Evidence
- Spec/task: CF-SPEC-53 / CF-657
- Inventory source:
docs/features/inventory.json
When To Update
- Update this page whenever the listed UI components, stores, routes, model behavior, permissions, or tests change.
- Regenerate the site and machine manifests with
python scripts/feature_docs.py --seed-missing --generate-site --check.