From b6842aecd0558d9326b144b374c9cec21d4af8e6 Mon Sep 17 00:00:00 2001
From: Adeel Ahmad
Date: Sun, 18 Oct 2026 07:24:15 +0000
Subject: [PATCH] feat(speakers): let an owner turn voice recognition off for a
namespace
Co-Authored-By: Claude Opus 5.5
Claude-Session: https://claude.ai/code/session_01QFUNzy1QZy5HhKAyJxTAYJ
---
README.md | 2 +-
changelog.d/voices-off.md | 3 +
docs/processing.md | 7 ++
docs/requirements.md | 1 +
fastapi_backend/app/api/v1/routes/speakers.py | 19 ++++-
fastapi_backend/app/domain/speakers.py | 34 ++++++++
fastapi_backend/app/schemas/speakers.py | 13 ++-
fastapi_backend/tests/api/test_voice_mode.py | 66 +++++++++++++++
nextjs-frontend/app/openapi-client/index.ts | 6 ++
nextjs-frontend/app/openapi-client/sdk.gen.ts | 22 +++++
.../app/openapi-client/types.gen.ts | 48 +++++++++++
.../components/speakers/speakers-page.tsx | 4 +-
.../components/speakers/voice-mode.tsx | 67 +++++++++++++++
nextjs-frontend/openapi.json | 82 +++++++++++++++++++
14 files changed, 370 insertions(+), 4 deletions(-)
create mode 100644 changelog.d/voices-off.md
create mode 100644 fastapi_backend/tests/api/test_voice_mode.py
create mode 100644 nextjs-frontend/components/speakers/voice-mode.tsx
diff --git a/README.md b/README.md
index f551b674f..c34cb8d45 100644
--- a/README.md
+++ b/README.md
@@ -163,7 +163,7 @@ listed under [In progress](#in-progress), and what comes next under [Planned](#p
([Web clipper](docs/web-clipper.md), [setting it up](docs/web-clipper.md#setting-it-up),
[the assistant in your browser](docs/browser-assistant.md); [checks](docs/requirements.md#clip-from-the-browser))
- **Understand it.** Transcription, which can expect the names your namespace knows (off by default), people
- recognised by voice (long recordings go to a speech provider in pieces that fit its limits), text on screen and in scans, faces (off by default), NSFW pictures flagged by a model on your own
+ recognised by voice (an owner can keep voices to each recording instead; long recordings go to a speech provider in pieces that fit its limits), text on screen and in scans, faces (off by default), NSFW pictures flagged by a model on your own
server (off by default, per namespace), low quality images enhanced before they're read (off by default), entities
and topics in a knowledge graph you can explore, query with Cypher or
SPARQL, and see as it was at any version, where every source, sensor, person and agent is a node linked to what it
diff --git a/changelog.d/voices-off.md b/changelog.d/voices-off.md
new file mode 100644
index 000000000..12e830419
--- /dev/null
+++ b/changelog.d/voices-off.md
@@ -0,0 +1,3 @@
+- **Voice recognition off, per namespace.** An owner can turn off People › Recognise voices across recordings: voices
+ are still told apart in each recording, but no voiceprint is kept and the namespace's voiceprints are deleted
+ ([People and namespaces](docs/processing.md#people-and-namespaces)).
diff --git a/docs/processing.md b/docs/processing.md
index d3f7fe96d..e4470b15d 100644
--- a/docs/processing.md
+++ b/docs/processing.md
@@ -195,6 +195,13 @@ as the same person (and unlink them), and with `speakers.cross_namespace: sugges
as dashed edges and People lists them with how alike the voices are. Saying a suggested pair is "not the same", in one
namespace or across two, removes the suggestion for good.
+**Voice recognition off.** Voiceprints are biometric data. An owner can turn off People › Recognise voices across
+recordings for their namespace (`PUT /api/v1/namespaces//voices/mode {"mode": "separate"}`; `GET /speakers` says
+which is on as `voices`). Voices are then still told apart inside each recording, but no voiceprint is kept and nobody
+is matched across recordings or namespaces. Turning it off deletes the namespace's voiceprints (each person's, each
+appearance's and those kept for undoing a merge) and the matches waiting for review, and is audited as `voices.mode`;
+names, transcripts and who spoke when stay. Turning it back on recognises people in recordings diarized after that.
+
## Knowledge graph
Nodes are people and named things. Edges are:
diff --git a/docs/requirements.md b/docs/requirements.md
index 07d79110b..0fcb54870 100644
--- a/docs/requirements.md
+++ b/docs/requirements.md
@@ -196,6 +196,7 @@ request, to another check that proves the same thing; loosening a requirement or
| Transcription that expects the names the namespace knows (custom vocabulary, named people, defined entities, names people fixed), off by default | [test_speech.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/domain/test_speech.py) `test_the_namespaces_own_names_go_to_the_engine` |
| Transcription by a local engine (SenseVoice, Whisper), run in CI | No check yet ([#486](https://github.com/adeelahmad/lense/issues/486)) |
| People recognised by voice; long recordings sent to a speech provider in pieces that fit its limits | [test_voices.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/domain/test_voices.py) `test_match_suggest_merge_undo_link`; [test_speech.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/domain/test_speech.py) `test_a_long_recording_goes_in_pieces_and_comes_back_whole`, `test_a_piece_too_large_to_send_is_halved` |
+| An owner turns voice recognition off for a namespace: voices told apart in each recording only, its voiceprints deleted | [test_voice_mode.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/api/test_voice_mode.py) `test_voices_can_be_told_apart_without_being_recognised` |
| Text on screen and in scans | [test_video.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/api/test_video.py) `test_shots_text_search_chat_and_iiif`; [test_documents.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/api/test_documents.py) `test_scans_and_images_are_read_by_ocr`; [test_ocr.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/api/test_ocr.py) `test_a_video_read_by_doctr_and_without_it` |
| Faces, off by default | [test_video.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/api/test_video.py) `test_people_on_screen`, `test_shots_text_search_chat_and_iiif`; [test_video.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/domain/test_video.py) `test_face_modes` |
| NSFW pictures flagged by a model on your own server, off by default, per namespace | [test_nsfw.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/api/test_nsfw.py) `test_off_by_default_nothing_is_fetched_or_classified`, `test_a_namespace_classifies_flags_blurs_and_hides`; [nsfw.test.tsx](https://github.com/adeelahmad/lense/blob/main/nextjs-frontend/__tests__/nsfw.test.tsx) |
diff --git a/fastapi_backend/app/api/v1/routes/speakers.py b/fastapi_backend/app/api/v1/routes/speakers.py
index 78efff231..a4413bcf9 100644
--- a/fastapi_backend/app/api/v1/routes/speakers.py
+++ b/fastapi_backend/app/api/v1/routes/speakers.py
@@ -20,6 +20,7 @@
SpeakerPair,
SpeakerRecording,
SpeakerRename,
+ VoiceMode,
)
router = APIRouter(tags=["speakers"])
@@ -98,10 +99,26 @@ def list_speakers(ns: str, acl: Acl, user: CurrentUser, db: Db, cfg: Cfg) -> Spe
if nid in (x["asp"], x["bsp"])
]
return SpeakerDirectory.model_validate(
- {"speakers": spk.list_speakers(db, nid), "merges": merges, "links": links, "cross": _cross(db, cfg, nid, set(acl.roles))}
+ {
+ "speakers": spk.list_speakers(db, nid),
+ "merges": merges,
+ "links": links,
+ "cross": _cross(db, cfg, nid, set(acl.roles)),
+ "voices": spk.voice_mode(db, nid),
+ }
)
+@router.put("/namespaces/{name}/voices/mode")
+def set_namespace_voice_mode(name: str, body: VoiceMode, user: Writer, acl: Acl, db: Db) -> Ok:
+ """Recognise voices across the namespace's recordings (the default), or only tell them apart in each one
+ (separate), which deletes its voiceprints and the matches waiting for review. Owners only."""
+ nid = acl.namespace(name, "manage")
+ spk.set_voice_mode(db, nid, body.mode, user.email)
+ auth.audit(db, user.as_audit(), "voices.mode", name, {"mode": body.mode})
+ return Ok()
+
+
@router.get("/speakers/{sid}/recordings")
def list_speaker_recordings(sid: int, acl: Acl, user: CurrentUser, db: Db) -> list[SpeakerRecording]:
acl.need(speaker_space(db, sid))
diff --git a/fastapi_backend/app/domain/speakers.py b/fastapi_backend/app/domain/speakers.py
index b174367cb..456de9c87 100644
--- a/fastapi_backend/app/domain/speakers.py
+++ b/fastapi_backend/app/domain/speakers.py
@@ -3,6 +3,10 @@
Speaker ids belong to one namespace and are never merged across namespaces. Across
namespaces the archive only records links: ones you declare, and (optionally) voice
matches it suggests as graph edges.
+
+A namespace's owner can turn voice recognition off (`voice_mode` separate): voices are still told apart inside each
+recording, but no voiceprint is kept and nobody is matched across recordings. Turning it off deletes the namespace's
+voiceprints and the matches waiting for review.
"""
from __future__ import annotations
@@ -184,6 +188,33 @@ def voice_print(signal, segs, embed, seconds=60):
# ---------- the namespace registry ----------
R = store.R
+VOICE_MODES = ("recognize", "separate")
+
+
+def voice_mode(db, nid):
+ """recognize (the default: voiceprints kept, people matched across recordings) or separate (told apart in each
+ recording only)."""
+ return (db.one("SELECT voices_mode FROM $s", s=R("space", int(nid))) or {}).get("voices_mode") or "recognize"
+
+
+def set_voice_mode(db, nid, mode, user=None):
+ """Recognise voices across recordings, or only tell them apart in each one. Separate deletes the namespace's
+ voiceprints (people's, each appearance's and those kept for undoing a merge) and its suggested matches: there is
+ nothing left to match with. Recognising again starts from the recordings diarized after it."""
+ if mode not in VOICE_MODES:
+ raise ValueError(f"voice mode is one of {', '.join(VOICE_MODES)}")
+ db.q("UPDATE $s MERGE $p", s=R("space", int(nid)), p={"voices_mode": mode, "voices_set_by": user, "voices_set_at": store.now()})
+ if mode == "separate":
+ db.run(
+ [
+ "UPDATE speaker SET embedding = NONE, n_obs = 0 WHERE space = $s",
+ "UPDATE appearance SET embedding = NONE WHERE space = $s",
+ "DELETE suggestion WHERE space = $s",
+ # the voiceprints kept for undoing a merge too
+ "UPDATE merge SET snapshot.speaker.embedding = NONE, snapshot.dst.embedding = NONE WHERE space = $s",
+ ],
+ s=int(nid),
+ )
def _vec(v):
@@ -316,6 +347,9 @@ def diarize_one(db, cfg, rid, log=print):
vp = voice_print(sig, g, emb, cfg["speakers"]["sample_seconds"])
if vp is not None:
prints[l] = vp
+ keep = voice_mode(db, r["space"]) == "recognize"
+ if not keep: # told apart in this recording only: no voiceprint kept, nobody matched
+ prints = {}
ids = match(db, cfg, r["space"], prints) if prints else {}
for l in groups:
if l not in ids:
diff --git a/fastapi_backend/app/schemas/speakers.py b/fastapi_backend/app/schemas/speakers.py
index 63d40ec74..b22453f6c 100644
--- a/fastapi_backend/app/schemas/speakers.py
+++ b/fastapi_backend/app/schemas/speakers.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import Any
+from typing import Any, Literal
from pydantic import Field
@@ -69,6 +69,17 @@ class SpeakerDirectory(ResponseModel):
description="likely the same person in another shared namespace you can read (speakers.cross_namespace: suggest), "
"best first; not linked, and not marked as different",
)
+ voices: Literal["recognize", "separate"] = Field(
+ "recognize",
+ description="recognize: voiceprints kept and people matched across recordings; separate: voices told apart in "
+ "each recording only (PUT /namespaces/{name}/voices/mode)",
+ )
+
+
+class VoiceMode(RequestModel):
+ mode: Literal["recognize", "separate"] = Field(
+ description="recognize, or separate: voices told apart in each recording only, the namespace's voiceprints deleted"
+ )
class SpeakerRecording(ResponseModel):
diff --git a/fastapi_backend/tests/api/test_voice_mode.py b/fastapi_backend/tests/api/test_voice_mode.py
new file mode 100644
index 000000000..35be68d1b
--- /dev/null
+++ b/fastapi_backend/tests/api/test_voice_mode.py
@@ -0,0 +1,66 @@
+"""Voice recognition per namespace (speakers.voice_mode): on by default; off, voices are told apart in each recording
+only, and the namespace's voiceprints are deleted."""
+
+from __future__ import annotations
+
+import numpy as np
+
+from app.domain import ingest, speakers, store
+from tests.helpers import login, make_user, unit
+
+R = store.R
+
+
+def _recording(db, nid, n):
+ rid = db.next_id("recording")
+ db.q(
+ "CREATE $r CONTENT $d", r=R("recording", rid), d={"space": nid, "fingerprint": f"fp{n}", "status": "transcribed", "source": "audio"}
+ )
+ segs = [{"t0": 0, "t1": 1000, "text": "hello"}, {"t0": 1000, "t1": 2000, "text": "hi"}]
+ db.q("INSERT INTO segment $s", s=ingest.segment_rows(rid, nid, segs))
+ for i, who in enumerate(("A", "B")):
+ db.q("UPDATE segment SET provider_speaker = $p WHERE recording = $r AND idx = $i", p=who, r=rid, i=i)
+ return rid
+
+
+def test_voices_can_be_told_apart_without_being_recognised(client, db, cfg, monkeypatch):
+ rng = np.random.default_rng(5)
+ prints = {"A": unit(rng.normal(size=192)), "B": unit(rng.normal(size=192))}
+ monkeypatch.setattr(ingest, "audio_path", lambda *a, **k: "unused.wav")
+ monkeypatch.setattr(ingest, "decode", lambda *a, **k: np.zeros(16000, dtype=np.float32))
+ monkeypatch.setattr(speakers, "get_embedder", lambda cfg, log=None: object())
+ monkeypatch.setattr(speakers, "voice_print", lambda sig, g, emb, s: (prints[g[0]["provider_speaker"]], 30.0))
+ nid = store.ns_id(db, "pods")
+
+ def who(rid):
+ return sorted(db.values("SELECT VALUE speaker FROM appearance WHERE recording = $r", r=rid))
+
+ first, second = _recording(db, nid, 1), _recording(db, nid, 2)
+ speakers.diarize_one(db, cfg, first, log=lambda *a: None)
+ speakers.diarize_one(db, cfg, second, log=lambda *a: None)
+ assert who(first) == who(second) # recognised: the same two people
+ assert db.values("SELECT VALUE embedding FROM speaker WHERE space = $s AND embedding != NONE", s=nid)
+
+ make_user(db, "own@x.io", "owner password 1", roles={"pods": "owner"})
+ make_user(db, "ed@x.io", "editor password 1", roles={"pods": "editor"})
+ ho, he = login(client, "own@x.io", "owner password 1"), login(client, "ed@x.io", "editor password 1")
+ assert client.get("/api/v1/speakers", params={"ns": "pods"}, headers=ho).json()["voices"] == "recognize"
+ url = "/api/v1/namespaces/pods/voices/mode"
+ assert client.put(url, headers=he, json={"mode": "separate"}).status_code == 403 # owners only
+ assert client.put(url, headers=ho, json={"mode": "never"}).status_code == 422
+ assert client.put(url, headers=ho, json={"mode": "separate"}).status_code == 200
+ assert client.get("/api/v1/speakers", params={"ns": "pods"}, headers=ho).json()["voices"] == "separate"
+ assert db.values("SELECT VALUE embedding FROM speaker WHERE space = $s AND embedding != NONE", s=nid) == []
+ assert db.values("SELECT VALUE embedding FROM appearance WHERE space = $s AND embedding != NONE", s=nid) == []
+ assert db.one("SELECT detail FROM audit_log WHERE action = 'voices.mode'")["detail"] == {"mode": "separate"}
+
+ third = _recording(db, nid, 3)
+ speakers.diarize_one(db, cfg, third, log=lambda *a: None)
+ assert len(who(third)) == 2 and not set(who(third)) & set(who(first)) # told apart, matched with nobody
+ assert db.values("SELECT VALUE embedding FROM speaker WHERE space = $s AND embedding != NONE", s=nid) == []
+
+ assert client.put(url, headers=ho, json={"mode": "recognize"}).status_code == 200
+ fourth, fifth = _recording(db, nid, 4), _recording(db, nid, 5)
+ speakers.diarize_one(db, cfg, fourth, log=lambda *a: None)
+ speakers.diarize_one(db, cfg, fifth, log=lambda *a: None)
+ assert who(fourth) == who(fifth) # recognising again, from then on
diff --git a/nextjs-frontend/app/openapi-client/index.ts b/nextjs-frontend/app/openapi-client/index.ts
index c806080de..03180d21b 100644
--- a/nextjs-frontend/app/openapi-client/index.ts
+++ b/nextjs-frontend/app/openapi-client/index.ts
@@ -3569,6 +3569,11 @@ export type {
SetNamespaceFacesModeErrors,
SetNamespaceFacesModeResponse,
SetNamespaceFacesModeResponses,
+ SetNamespaceVoiceModeData,
+ SetNamespaceVoiceModeError,
+ SetNamespaceVoiceModeErrors,
+ SetNamespaceVoiceModeResponse,
+ SetNamespaceVoiceModeResponses,
SetPolicyData,
SetPolicyError,
SetPolicyErrors,
@@ -4339,6 +4344,7 @@ export type {
VoiceInfoResponse,
VoiceInfoResponses,
VoiceList,
+ VoiceMode,
VoiceOption,
Watch,
WatchCreate,
diff --git a/nextjs-frontend/app/openapi-client/sdk.gen.ts b/nextjs-frontend/app/openapi-client/sdk.gen.ts
index 37c981320..4ef2da8bf 100644
--- a/nextjs-frontend/app/openapi-client/sdk.gen.ts
+++ b/nextjs-frontend/app/openapi-client/sdk.gen.ts
@@ -1717,6 +1717,9 @@ import type {
SetNamespaceFacesModeData,
SetNamespaceFacesModeErrors,
SetNamespaceFacesModeResponses,
+ SetNamespaceVoiceModeData,
+ SetNamespaceVoiceModeErrors,
+ SetNamespaceVoiceModeResponses,
SetPolicyData,
SetPolicyErrors,
SetPolicyResponses,
@@ -7852,6 +7855,25 @@ export class Speakers {
});
}
+ /**
+ * Set Namespace Voice Mode
+ *
+ * Recognise voices across the namespace's recordings (the default), or only tell them apart in each one
+ * (separate), which deletes its voiceprints and the matches waiting for review. Owners only.
+ */
+ public static setNamespaceVoiceMode(
+ options: Options,
+ ): RequestResult {
+ return (options.client ?? client).put({
+ url: "/api/v1/namespaces/{name}/voices/mode",
+ ...options,
+ headers: {
+ "Content-Type": "application/json",
+ ...options.headers,
+ },
+ });
+ }
+
/**
* List Speaker Recordings
*/
diff --git a/nextjs-frontend/app/openapi-client/types.gen.ts b/nextjs-frontend/app/openapi-client/types.gen.ts
index c350e91af..4513629a4 100644
--- a/nextjs-frontend/app/openapi-client/types.gen.ts
+++ b/nextjs-frontend/app/openapi-client/types.gen.ts
@@ -25754,6 +25754,12 @@ export type SpeakerDirectory = {
* likely the same person in another shared namespace you can read (speakers.cross_namespace: suggest), best first; not linked, and not marked as different
*/
cross?: Array;
+ /**
+ * Voices
+ *
+ * recognize: voiceprints kept and people matched across recordings; separate: voices told apart in each recording only (PUT /namespaces/{name}/voices/mode)
+ */
+ voices?: "recognize" | "separate";
[key: string]: unknown;
};
@@ -29008,6 +29014,18 @@ export type VoiceList = {
[key: string]: unknown;
};
+/**
+ * VoiceMode
+ */
+export type VoiceMode = {
+ /**
+ * Mode
+ *
+ * recognize, or separate: voices told apart in each recording only, the namespace's voiceprints deleted
+ */
+ mode: "recognize" | "separate";
+};
+
/**
* VoiceOption
*/
@@ -40070,6 +40088,36 @@ export type ListSpeakersResponses = {
export type ListSpeakersResponse = ListSpeakersResponses[keyof ListSpeakersResponses];
+export type SetNamespaceVoiceModeData = {
+ body: VoiceMode;
+ path: {
+ /**
+ * Name
+ */
+ name: string;
+ };
+ query?: never;
+ url: "/api/v1/namespaces/{name}/voices/mode";
+};
+
+export type SetNamespaceVoiceModeErrors = {
+ /**
+ * Validation Error
+ */
+ 422: HttpValidationError;
+};
+
+export type SetNamespaceVoiceModeError = SetNamespaceVoiceModeErrors[keyof SetNamespaceVoiceModeErrors];
+
+export type SetNamespaceVoiceModeResponses = {
+ /**
+ * Successful Response
+ */
+ 200: Ok;
+};
+
+export type SetNamespaceVoiceModeResponse = SetNamespaceVoiceModeResponses[keyof SetNamespaceVoiceModeResponses];
+
export type ListSpeakerRecordingsData = {
body?: never;
path: {
diff --git a/nextjs-frontend/components/speakers/speakers-page.tsx b/nextjs-frontend/components/speakers/speakers-page.tsx
index 58229fcb5..bae5faf60 100644
--- a/nextjs-frontend/components/speakers/speakers-page.tsx
+++ b/nextjs-frontend/components/speakers/speakers-page.tsx
@@ -10,6 +10,7 @@ import { useNamespaceSpeakers } from "@/components/speakers/parts";
import { lastHeard, reviewPairs } from "@/components/speakers/derive";
import { Registry } from "@/components/speakers/registry";
import { ReviewQueue } from "@/components/speakers/review";
+import { VoiceMode } from "@/components/speakers/voice-mode";
import { Banner } from "@/components/ui/banner";
import { Button } from "@/components/ui/button";
import { Select } from "@/components/ui/field";
@@ -26,7 +27,7 @@ export function SpeakersPage() {
const params = useSearchParams();
const router = useRouter();
const pathname = usePathname();
- const { namespaces, namespace: topNs } = useArchive();
+ const { namespaces, namespace: topNs, can } = useArchive();
const ns =
params.get("ns") && namespaces.some((n) => n.name === params.get("ns"))
? params.get("ns")!
@@ -141,6 +142,7 @@ export function SpeakersPage() {
Voiceprints are built from clean audio (Settings → Voice IDs). People without one are still matched, less
reliably.
+
)}
{dir.data && ns && tab === "review" && }
diff --git a/nextjs-frontend/components/speakers/voice-mode.tsx b/nextjs-frontend/components/speakers/voice-mode.tsx
new file mode 100644
index 000000000..825dafa1e
--- /dev/null
+++ b/nextjs-frontend/components/speakers/voice-mode.tsx
@@ -0,0 +1,67 @@
+"use client";
+
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { useState } from "react";
+
+import { Speakers } from "@/app/openapi-client";
+import { Button } from "@/components/ui/button";
+import { Dialog } from "@/components/ui/dialog";
+import { Switch } from "@/components/ui/field";
+import { useToast } from "@/components/ui/toast";
+import { data, useApiClient } from "@/lib/api/browser";
+
+/**
+ * Whether the namespace recognises voices across its recordings (owners switch it). Turning it off deletes the
+ * namespace's voiceprints, which can't be undone, so that one asks first; turning it back on doesn't.
+ */
+export function VoiceMode({ ns, mode, canManage }: { ns: string; mode: "recognize" | "separate"; canManage: boolean }) {
+ const client = useApiClient();
+ const qc = useQueryClient();
+ const toast = useToast();
+ const [asking, setAsking] = useState(false);
+ const save = useMutation({
+ mutationFn: (to: "recognize" | "separate") =>
+ data(Speakers.setNamespaceVoiceMode({ client, path: { name: ns }, body: { mode: to } })),
+ onSuccess: (_, to) => {
+ void qc.invalidateQueries({ queryKey: ["speakers", ns] });
+ setAsking(false);
+ toast({
+ title: to === "separate" ? "Voices are told apart in each recording only" : "Voices are recognised again",
+ tone: "green",
+ });
+ },
+ onError: (e: Error) => toast({ title: "Couldn’t change voice recognition", body: e.message, tone: "red" }),
+ });
+ return (
+
+ (on ? save.mutate("recognize") : setAsking(true))}
+ label="Recognise voices across recordings"
+ />
+
+ {mode === "recognize"
+ ? "Each person’s voiceprint is kept so they’re found again in new recordings."
+ : "Voices are told apart in each recording, but no voiceprint is kept and nobody is matched across recordings."}
+ {!canManage && " Owners of this namespace can change it."}
+
+
+ );
+}
diff --git a/nextjs-frontend/openapi.json b/nextjs-frontend/openapi.json
index f5120647c..245e06a9e 100644
--- a/nextjs-frontend/openapi.json
+++ b/nextjs-frontend/openapi.json
@@ -16785,6 +16785,59 @@
}
}
},
+ "/api/v1/namespaces/{name}/voices/mode": {
+ "put": {
+ "tags": [
+ "speakers"
+ ],
+ "summary": "Set Namespace Voice Mode",
+ "description": "Recognise voices across the namespace's recordings (the default), or only tell them apart in each one\n(separate), which deletes its voiceprints and the matches waiting for review. Owners only.",
+ "operationId": "set_namespace_voice_mode",
+ "parameters": [
+ {
+ "name": "name",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "title": "Name"
+ }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/VoiceMode"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Successful Response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Ok"
+ }
+ }
+ }
+ },
+ "422": {
+ "description": "Validation Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/HTTPValidationError"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
"/api/v1/speakers/{sid}/recordings": {
"get": {
"tags": [
@@ -80431,6 +80484,16 @@
"type": "array",
"title": "Cross",
"description": "likely the same person in another shared namespace you can read (speakers.cross_namespace: suggest), best first; not linked, and not marked as different"
+ },
+ "voices": {
+ "type": "string",
+ "enum": [
+ "recognize",
+ "separate"
+ ],
+ "title": "Voices",
+ "description": "recognize: voiceprints kept and people matched across recordings; separate: voices told apart in each recording only (PUT /namespaces/{name}/voices/mode)",
+ "default": "recognize"
}
},
"additionalProperties": true,
@@ -85949,6 +86012,25 @@
],
"title": "VoiceList"
},
+ "VoiceMode": {
+ "properties": {
+ "mode": {
+ "type": "string",
+ "enum": [
+ "recognize",
+ "separate"
+ ],
+ "title": "Mode",
+ "description": "recognize, or separate: voices told apart in each recording only, the namespace's voiceprints deleted"
+ }
+ },
+ "additionalProperties": false,
+ "type": "object",
+ "required": [
+ "mode"
+ ],
+ "title": "VoiceMode"
+ },
"VoiceOption": {
"properties": {
"id": {