xiaozhi-esp32-server/docs/guides/voiceprint.md
lapy feb6edb47f fix(westernization): runtime English surface, voiceprint truth, CI gates
Server runtime:
- translate model-visible strings: direct_answer tool schema, web_search
  tool desc/errors/results, call_device tool desc/replies, hass_state
  desc/report strings; they were Chinese text fed to LLMs and devices
- replace Chinese pconline geocoder with ip-api.com (English city names)
- prompt_manager: drop dead Chinese WEEKDAY_MAP, stop forcing lang=zh_CN
  for weather, English fallback location
- delete orphan alibl_endpoint.py (no importers after AliBL removal) and
  dead initialize_voiceprint() calling a nonexistent ASR hook
- translate mcp_server_settings.json descriptors
- test_current_time: assert English weekday/date behavior (upstream test
  still expected Chinese weekdays)

Docs/branding:
- README and docs/guides/voiceprint.md: voiceprint IS implemented via the
  HTTP VoiceprintProvider; document the real protocol (health/identify)
  and privacy notes instead of falsely claiming the feature is missing
- issue templates: English

Ops:
- Dockerfile-server-base: drop Aliyun PyPI mirror from published image
- LICENSE: keep xinnan-tech copyright notice alongside downstream (MIT)
- CI: run westernization_audit as a gate; make smoke test failure fatal
- westernization.md: point python verification at the real pytest layout
2026-10-11 13:13:07 +01:00

78 lines
3.3 KiB
Markdown

# 🎤 Voiceprint Recognition
Voiceprint recognition is **implemented** in this build through the built-in
`VoiceprintProvider` (`main/xiaozhi-server/core/utils/voiceprint_provider.py`).
It runs in parallel with ASR: each audio segment is sent both to ASR and to an
external voiceprint HTTP service, and the identified speaker is injected into
the LLM context for personalized responses.
> Note: the server does **not** ship a voiceprint model. You must run any
> voiceprint service that speaks the HTTP protocol below. The community
> [voiceprint-api](https://github.com/xinnan-tech/voiceprint-api) project is
> one compatible implementation (it uses ModelScope's 3D-Speaker models), but
> any service exposing the same endpoints and key scheme works.
## 🎯 What is Voiceprint Recognition?
Voiceprint recognition is a biometric technology that identifies users by their
unique voice characteristics. It allows Xiaozhi to:
- **Identify users** by their voice patterns
- **Provide personalized responses** based on who is speaking
- **Enable access control** through voice authentication
- **Support multi-user environments** with different user profiles
## ⚙️ Configuration
Enable it in `config.yaml` (single-module) or via the control console:
```yaml
voiceprint:
# Voiceprint service address with your API key
url: http://192.168.1.100:8005/voiceprint/health?key=abcd
# Speakers: speaker_id,name,description
speakers:
- "test1,John,John is a programmer"
- "test2,Jane,Jane is a product manager"
# Optional: identification similarity threshold (default 0.4)
similarity_threshold: 0.4
```
The service URL is parsed for a `key` query parameter, which is sent as the
service's API key. If `url` or `speakers` is missing, voiceprint recognition
stays disabled and a warning is logged.
## 🛠️ Service Protocol
The built-in provider expects an HTTP service exposing:
- `GET /voiceprint/health?key=<key>` — health probe; expects
`{"status": "healthy"}` (cached after the first success).
- `POST /voiceprint/identify` — multipart form with the WAV audio and the API
key; the service replies with the best-matching speaker id and a similarity
score (scores below `similarity_threshold` are treated as unknown).
Speaker voice vectors are enrolled out-of-band by the service itself; the
server only sends audio and reads back identifications. See the original
[voiceprint-api](https://github.com/xinnan-tech/voiceprint-api) README for a
reference implementation of these endpoints.
## ⚖️ Privacy and Compliance
Voiceprints are biometric data (GDPR special category in the EU, BIPA in
Illinois, etc.). Before enabling:
- Run the voiceprint service **locally**; do not send family audio to third
parties without a processor agreement.
- Obtain explicit consent from every enrolled speaker and document retention
and deletion procedures.
- Keep `similarity_threshold` conservative; misidentification feeds the wrong
persona into the LLM context.
## 📚 Related Documentation
- **[Voice Interaction](../features/voice-interaction.md)** — Basic voice recognition and synthesis
- **[Integrations](../features/integrations.md)** — Third-party service integrations
- **[Configuration](../configuration/basic-setup.md)** — System configuration
👉 **[Next: Available Features →](../features/voice-interaction.md)**