Voice-first assistant for chantier reports: Streamlit records French memos, Azure GPT‑4o-mini-transcribe handles STT, a Mistral deployment extracts structured fields, and FastAPI returns an editable report plus DOCX download.
- Frontend: Streamlit app (
frontend/app.py) with a REST client (frontend/services/api.py) that calls the backend. - Backend: FastAPI (
backend/app/main.py) exposes the workflow routes inbackend/app/api/routes/workflow.py. - Services: STT wrapper (
backend/app/services/stt.py), LLM wrapper (backend/app/services/llm.py), template extraction and date normalization (backend/app/services/template.py), report rendering (backend/app/services/report.py), DOCX generation (backend/app/services/docx_generator.py). - Config: central settings in
backend/app/core/config.py; STT temperature is a fixed constant inbackend/app/services/stt.py(kept at 0.0 for deterministic transcripts). - Schemas: Pydantic payloads live in
backend/app/models/schemas.py.
- Python 3.11+
- uv (manages virtualenvs)
- Azure OpenAI deployments for GPT‑4o-mini-transcribe + Mistral
git clone <repo>
cd site-reportercd backend
cp .env.example .env # fill Azure keys, deployments, endpoints
uv synccd ../frontend
echo "BACKEND_URL=http://localhost:8000" > .env
uv syncTo always transcribe the bundled noisy clip instead of live mic input, add to frontend/.env:
echo "DEMO_AUDIO_MODE=true" >> .env
# optional custom file
# echo "DEMO_AUDIO_PATH=/full/path/to/audio.wav" >> .envBy default the app uses frontend/assets/audio_noisy.wav.
# Terminal 1 – FastAPI
cd backend
uv run uvicorn app.main:app --reload
# Terminal 2 – Streamlit dashboard
cd frontend
uv run streamlit run app.pyVisit http://localhost:8501 for the UI, http://localhost:8000/docs for the API explorer.
Base URL http://localhost:8000/api
POST /transcribePOST /report/templatePOST /report/generatePOST /pipeline/autoPOST /report/download/docx
Health probe: GET /health.
- Streamlit records audio and can optionally swap in demo audio (
frontend/assets/audio_noisy.wav). - Audio is base64-encoded and POSTed to
/api/transcribe; Azure GPT-4o-mini-transcribe returns text at temperature 0.0. /api/report/templateasks the Mistral deployment to extract fields; missing dates default to “today” but keep transcript-stated years.- Users can edit fields, then call
/api/report/generatefor plaintext or/api/report/download/docxfor a Word file. /api/pipeline/autochains all steps without human validation.
cd backend
uv run pytest ../tests- Use feature branches, run
ruff check+ tests before pushing. - Keep backend routers under
app/api/routes/and shared services inapp/services/. - Describe manual test steps and Azure dependencies in PRs.