基于 AI 的语音转文字与自我学习系统。
Voice Agent 是一款智能语音转文字(STT)工具,集成 LLM 语义校正和自我学习进化能力。通过持续学习用户纠正,系统能够不断优化转写准确率,尤其擅长处理中文技术语境和专业术语。
- 多 STT 引擎支持:faster-whisper(默认)、Vosk 模型
- LLM 语义校正:基于 MiniMax API 智能纠正同音错字和专业术语
- 自我学习系统:从用户反馈中学习,自动积累纠错知识
- 上下文感知:理解技术语境,避免误纠正(如"建仓库"中的"建"不会被错误替换为"push")
voice-agent/
├── scripts/
│ ├── cli.py # 命令行入口
│ ├── config.py # 配置管理
│ ├── transcriber.py # STT 转录引擎
│ ├── corrector.py # LLM 语义校正
│ ├── recorder.py # 音频录制
│ ├── data/ # 学习数据
│ │ ├── glossary.json # 术语库
│ │ ├── corrections.json # 纠错记录
│ │ ├── context.json # 上下文状态
│ │ └── stats.json # 统计信息
│ └── learning/ # 自我学习模块
│ ├── glossary.py # 术语管理器
│ ├── corrector_learner.py # 纠错学习器
│ ├── context_enhancer.py # 上下文增强器
│ └── models.py # 数据模型
├── models/ # STT 模型目录
└── docs/ # 研究文档
- Python 3.11+
- Windows / Linux / macOS
pip install faster-whisper PyAV pydub在项目根目录创建 .env 文件:
# MiniMax API(用于 LLM 校正)
MINIMAX_API_KEY=your_api_key_here
# STT 提供者:fasterwhisper / vosk
VOICE_STT_PROVIDER=fasterwhisper
# faster-whisper 模型大小:tiny / small / medium / large
FASTER_WHISPER_MODEL=medium
# 模型存放目录(可选)
# VOICE_MODEL_DIR=/path/to/modelsfaster-whisper(首次使用自动下载):
from faster_whisper import WhisperModel
model = WhisperModel("medium", device="cpu", compute_type="int8")Vosk(可选):
# 下载中文模型到 models/ 目录
wget https://alphacephei.com/vosk/models/vosk-model-cn-kaldi-multicn-0.15.zip
unzip vosk-model-cn-kaldi-multicn-0.15.zip -d models/# 命令行模式
python scripts/cli.py
# 转录音频文件
python scripts/cli.py transcribe audio.wav
# 实时录音转录(空格键开始/结束)
python scripts/cli.py record| 提供者 | 配置键 | 说明 |
|---|---|---|
| faster-whisper | VOICE_STT_PROVIDER=fasterwhisper |
默认,推荐本地部署 |
| Vosk | VOICE_STT_PROVIDER=vosk |
需要下载模型 |
系统内置以下校正规则:
- 同音错字修正:
派森→Python、昆虫→昆仑 - 专业术语还原:
open claw→OpenClaw、Fasper→Fast - 中文技术语境保留:中文"建"在 GitHub 仓库语境下保持中文,不替换为英文
系统会自动记录用户纠正的案例,用于后续自动学习:
- 每次 LLM 校正后,用户可以纠正
- 系统记录
original(STT 输出)和corrected(LLM 校正结果) auto_learn()定期分析高频错误 pattern,自动更新术语库
python scripts/cli.py [command] [options]
Commands:
transcribe <file> 转录音频文件
record 实时录音转录(空格键控制)
correct <text> 仅校正文本
status 显示系统状态
Options:
--model <name> 指定 STT 模型
--no-correct 跳过 LLM 校正
--output <file> 输出到文件
- 主站博客:https://kunpeng-ai.com
- GitHub 组织:https://github.com/kunpeng-ai-research
- OpenClaw 官方:https://openclaw.ai
欢迎分享、引用与改进。
- 发现问题:欢迎提 Issue
- 有改进建议:欢迎提 Pull Request
- 维护者:鲲鹏AI探索局
MIT