From 1e4670cd262e700e31db9a6dc24b95e13391fd48 Mon Sep 17 00:00:00 2001 From: imbytecat Date: Mon, 2 Mar 2026 01:41:36 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=20AGENTS.md=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=83=AD=E8=AF=8D=E5=8A=9F=E8=83=BD=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加热词功能配置示例 - 说明实现原理和 API 细节 - 更新项目结构,添加 asr/hotwords.go --- AGENTS.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) 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`)