docs: 更新 AGENTS.md 添加热词功能说明
- 添加热词功能配置示例 - 说明实现原理和 API 细节 - 更新项目结构,添加 asr/hotwords.go
This commit is contained in:
33
AGENTS.md
33
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`)
|
||||
|
||||
Reference in New Issue
Block a user