diff --git a/AGENTS.md b/AGENTS.md index 207db04..88431b1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -163,3 +163,36 @@ Per-connection loggers via `slog.With("remote", addr)`. - Config file (`config.yaml`) is gitignored; `config.example.yaml` is committed - `os.UserCacheDir()` for platform-correct cert cache paths - robotgo paste: `KeyDown(modifier)` → delay → `KeyTap("v")` → delay → `KeyUp(modifier)` + +## Hotwords (热词) Feature + +Local hotword management for improved ASR accuracy on specific terms (names, technical vocabulary). + +### Configuration + +```yaml +doubao: + hotwords: + - 张三 + - 李四 + - VoicePaste + - 人工智能 +``` + +### Implementation + +- Hotwords stored locally in `config.yaml` (not tied to cloud provider) +- `BuildHotwordsContext()` converts string array to Doubao API format: + ```json + {"hotwords":[{"word":"张三"},{"word":"李四"}]} + ``` +- Sent via `corpus.context` parameter in `FullClientRequest` +- Hot-reloadable: config changes apply to new connections +- Platform-agnostic design: easy to migrate to other ASR providers + +### Doubao API Details + +- Parameter: `request.corpus.context` (JSON string) +- Limits: 100 tokens (双向流式), 5000 tokens (流式输入) +- Priority: `context` hotwords > `boosting_table_id` (if both present) +- No weight support in `context` mode (unlike `boosting_table_id`)