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.

needs-verification
UI Path
Chat > Audio
Component
useVoiceRecorder
Source Refs
4
Tests
0

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.ts
  • frontend/src/components/chat/ChatView.tsx
  • frontend/src/lib/chatApi.ts
  • backend/app/api/routes/chat.py
  • backend/app/api/routes/chat_voice.py
  • backend/app/core/transcription.py

State, API, And Backend Contracts

Stores

  • None recorded.

API And Backend

  • frontend/src/lib/chatApi.ts appends project_id to the voice transcription FormData.
  • frontend/src/hooks/useVoiceRecorder.ts trims 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.py and backend/app/api/routes/chat_voice.py reject blank or unauthorized project ids before returning dummy or real transcription responses.

Architecture Notes

  • The feature is mounted through frontend/src/hooks/useVoiceRecorder.ts and 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.py sends the created E2E project id to /api/chat/voice-transcribe without a fallback placeholder.
  • tests/simulation/scenarios/77-voice-transcription.mjs posts a project-scoped FormData request and expects the route to fail on missing audio only after accepting the project scope.
  • tests/simulation/scenarios/78-real-time-voice.mjs seeds the active project in browser storage before checking microphone controls.
  • tests/test_project_scope_contracts.py prevents regression to placeholder project ids in voice and simulation harness checks.

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.