Files

127 lines
7.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Teams Whisper
Local pipeline that records a Microsoft Teams call and turns it into a meeting report:
audio cleanup (ffmpeg) → transcription (faster-whisper CUDA, or OpenVINO NPU) → speaker diarization (sherpa-onnx) → speaker names from Teams events → screen content extraction (Qwen3.6-35B-A3B VLM via llama.cpp) → related Confluence/Jira docs (`twg`, optional) → topic report (HTML/PDF) → cross-meeting memory (bge-m3 embeddings).
Orchestrated by Prefect; everything runs locally. Windows + NVIDIA GPU (fits 4 GB VRAM: MoE experts run on CPU).
## Requirements
| | Minimum | Recommended |
|---|---|---|
| OS | Windows 10/11 x64 | |
| GPU | NVIDIA, 4 GB VRAM, driver R580+ (CUDA 13) | 8–12 GB VRAM |
| RAM | 32 GB: installs only Qwen3.5 4B (fully in VRAM) | 48+ GB: also Qwen3.6 35B-A3B (MoE experts in RAM); pick the LLM in the Web UI header |
| CPU | x64, 6–8 cores (runs the MoE experts) | more cores = faster reports |
| Disk | ~10 GB free (32 GB RAM) / ~35 GB (48+ GB RAM), SSD | NVMe |
| Browser | Chrome or Edge (extension); Edge for PDF export | |
Install logs the detected GPU/VRAM/RAM and aborts without an NVIDIA GPU with 4+ GB VRAM.
Optional: Intel NPU (Core Ultra) for OpenVINO Whisper; `twg` + company proxy for the docs step. Not supported: AMD/Intel-only GPUs, macOS, Linux.
## Install
Click **Install**. It downloads ffmpeg, llama.cpp (CUDA 13), the diarization models, bge-m3 and the Qwen GGUF (~23 GB) into `app/bin` and `app/models`, and pre-builds the `uv` script environments.
## Use
1. Click **Start**: GUI on http://127.0.0.1:18765/, Prefect dashboard on http://127.0.0.1:4200.
2. Click **Extension** to open `app/ext`, then in Chrome/Edge: `chrome://extensions` → Developer mode → **Load unpacked** → select that folder (once).
3. In a Teams web call, click the extension icon → record. On stop, the pipeline runs and the report appears in the GUI.
4. Per rerun: pick a step in the row's dropdown and press **run**. API-only: `POST /run_all?from=audio|report|render` reruns every recording sequentially.
Alternative without the extension (desktop Teams, system loopback + mic): `cd app && uv run meet.py [--screen]`, Ctrl+C to stop.
Data lives in `app/out`. **Reset** deletes models/binaries only, never `app/out`. One folder per meeting, one owner per datum:
```
out/meetings.db live state + search indexes (lines, shots, topics, call events, speaker map, memory)
out/_global/ llm.txt, step_stats.json, transcribe_device.txt, prefect/embed/llama logs
out/<name>/source.<ext> the only video/audio source (removed by "elimina video"; the CLI recorder writes source.wav + source.mp4)
audio.opus transcript.txt (raw whisper) diar_segments.json shots.json + shots/ glossary.json docs.json
report.json (+ .md .html .pdf renders) meta.json (manual title, upload filename) progress.json logs/
```
The speaker-labelled transcript is the `lines` table (names are applied when the report renders); there is no `.spk.txt`. The `speakers` step maps diarization labels to people from Teams events, then re-splits each paragraph where the Teams captions change speaker (diarization merges similar voices, so one paragraph often holds two speakers); talk time in the report comes from those paragraphs. A meeting without `source.<ext>` cannot be re-run at all (`/run` returns 409, the GUI hides the run controls).
Other CLI tools (from `app/`):
- `uv run --script flow.py <name> --from report` — rerun a meeting from a step (`audio transcribe diarize speakers shots docs report memory render title`)
- `uv run --script flow.py <name> --bench-npu` — benchmark NPU vs CUDA and remember the faster one
- `uv run --script memory.py --reindex` — rebuild cross-meeting memory
- `uv run --script review.py <name>` — report quality gate
## API
Base URL `http://127.0.0.1:18765`.
| Method | Path | Params |
|---|---|---|
| GET | `/status` | all recordings + pipeline status |
| GET | `/health` | `ok` when the server is up (the extension checks it before recording) |
| GET | `/report` | `name` → report HTML |
| GET | `/pdf` | `name` → report PDF |
| GET | `/search` | `q` → full-text search over transcripts/topics |
| GET | `/ask` | `q` → answer from cross-meeting memory, with sources (JSON) |
| GET | `/ask_stream` | `q` → same, as NDJSON: `{"sources":[...]}` first, then `{"t":"text piece"}` events as the model writes |
| POST | `/chunk` | `name`, body = webm chunk (append) |
| POST | `/events` | `name`, body = JSON array of Teams call events |
| POST | `/stop` | `name` → finalize recording, start pipeline |
| POST | `/run` | `name`, `from`, `speakers` → accoda la pipeline (una alla volta; 409 se già in coda/esecuzione) |
| POST | `/run_all` | `from` → rerun every recording one at a time, oldest first (API only) |
| POST | `/merge` | `names` = comma list of ≥2 `.webm` recordings of one call → `<first>_merged` (stream copy, events time-shifted), queued |
| POST | `/title` | `name`, body = manual title (empty = clear) |
| POST | `/drop_video` | `name` → delete the source file of a finished meeting (report, transcript, shots stay; reruns then return 409) |
| POST | `/speaker_map` | `name`, body = `{"Speaker 1": "Mario Rossi"}` → re-render |
| POST | `/upload` | `filename`, body = raw audio/video file → new `meet_<timestamp>` meeting (unsupported extension or empty body = 400) |
| POST | `/delete` | `name` → delete a meeting (409 while recording/queued/running) |
| POST | `/crop` | `name`, `start`, `end` (seconds), `inplace=1` optional → trim the source into a new meeting, or replace it in place |
| POST | `/cancel` | `name` → kill the running pipeline |
| POST | `/skip_shots` | `v=1` skip the screen-content step, otherwise clear the flag |
| POST | `/llm` | `shots`, `report` → choose installed models (400 if not installed, only while idle) |
Read-only helpers used by the GUI:
| Method | Path | Params |
|---|---|---|
| GET | `/shot` | `name`, `file` → screenshot JPEG |
| GET | `/video` | `name` → source media (Range supported) |
| GET | `/speakers` | `name` → speaker info |
| GET | `/crop_progress` | `name` → `{"pct": …}` while a crop runs |
### curl
```bash
curl http://127.0.0.1:18765/status
curl "http://127.0.0.1:18765/ask?q=cosa%20abbiamo%20deciso%20sul%20rilascio"
curl -X POST "http://127.0.0.1:18765/run?name=teams_2026-10-28T13-04-04&from=report"
curl -X POST "http://127.0.0.1:18765/speaker_map?name=teams_2026-10-28T13-04-04" -d '{"Speaker 1":"Mario Rossi"}'
```
### Python
```python
import json, urllib.request, urllib.parse
B = "http://127.0.0.1:18765"
status = json.load(urllib.request.urlopen(f"{B}/status"))
ans = json.load(urllib.request.urlopen(f"{B}/ask?q=" + urllib.parse.quote("decisioni sul rilascio")))
urllib.request.urlopen(urllib.request.Request(f"{B}/run?name=teams_2026-10-28T13-04-04&from=report", method="POST"))
```
### JavaScript
```javascript
const B = "http://127.0.0.1:18765"
const status = await (await fetch(`${B}/status`)).json()
const ans = await (await fetch(`${B}/ask?q=${encodeURIComponent("decisioni sul rilascio")}`)).json()
await fetch(`${B}/run?name=teams_2026-10-28T13-04-04&from=report`, { method: "POST" })
```
## Notes
- Ports 18765 (GUI) and 4200 (Prefect) are fixed: the extension's `host_permissions` hardcode 18765.
- `docs.py` uses `twg` and the company proxy; without `twg` the step is skipped.
- PDF export uses Microsoft Edge headless.