> **Important:** This system uses `podman` / `sudo podman compose`, not `docker`. Always use `sudo` for podman compose commands — the container runs as root.
## Documentation
Detailed docs live in `doc/`:
-`doc/architecture.md` — data model, background jobs, DB schema
-`doc/api.md` — all HTTP endpoints
-`doc/interfaces.md` — Transcription-API and Ollama request/response details
-`doc/configuration.md` — env vars and runtime settings
All routes are FastAPI endpoints. HTML is returned as server-rendered Python f-strings using Bootstrap 5.3 (CDN) for layout. Inline `<script>` blocks handle client-side interactivity. The `layout()` function wraps every page with the sidebar navigation, topbar, shared CSS, and the global modal/JS helpers (`window.showModal`, `window.uiPrompt`, `window.uiConfirm`, `window.uiSelect`).
- **documents** — stored content; `kind` is either `transcript` (raw transcription output) or `analysis` (LLM result). An analysis document links back to its source via `source_document_id` and `prompt_id`.
- **jobs** — background task queue; `kind` is `upload` or `analysis`; `status` cycles through `queued → running → done|error|cancelled`.
Schema migrations are handled inline in `init_db()` with `ALTER TABLE … ADD COLUMN` wrapped in `try/except`.
### Background job processing
Jobs are processed by a `ThreadPoolExecutor(max_workers=2)`. `enqueue_job()` inserts a row and submits the worker function. Workers check for `cancelled` status at each checkpoint before making external calls.
- **upload job** (`_process_upload_job`): POSTs the audio/video file to `{API_BASE}/transcribe-diarize`, stores `formatted_text` from the response as a `transcript` document.
- **analysis job** (`_process_analysis_job`): POSTs to Ollama's `/api/generate` with the transcript content and selected prompt, stores the response as an `analysis` document. LLM parameters are read from the prompt's own settings if `llm_use_default=0`, otherwise from the `settings` table, falling back to env vars.
- **`API_BASE`** — the `transcribe-diarize` service; accepts audio and video files, returns JSON with `formatted_text`
- **`OLLAMA_BASE_URL`** — Ollama instance for LLM analysis; also queried at `GET /api/tags` for the model list (lazy-loaded on `/settings` and `/prompts` pages)