liumaolin
commited on
Commit
·
de86e54
1
Parent(s):
84faf7d
Update README: clarify instructions, update paths, and refine directory structure documentation
Browse files
README.md
CHANGED
|
@@ -141,9 +141,13 @@ brew install ffmpeg
|
|
| 141 |
5. **安装额外依赖**
|
| 142 |
```bash
|
| 143 |
# 安装 kokoro-onnx
|
|
|
|
|
|
|
| 144 |
pip install kokoro-onnx
|
| 145 |
|
| 146 |
# 重新安装指定版本的 numpy
|
|
|
|
|
|
|
| 147 |
pip install numpy==1.26.4
|
| 148 |
```
|
| 149 |
|
|
@@ -157,19 +161,19 @@ pip install numpy==1.26.4
|
|
| 157 |
|
| 158 |
```bash
|
| 159 |
# 启动语音对话系统 (默认使用中文,沈逸角色)
|
| 160 |
-
uv run
|
| 161 |
# 或
|
| 162 |
-
python
|
| 163 |
|
| 164 |
# 指定语言和角色
|
| 165 |
-
uv run
|
| 166 |
# 或
|
| 167 |
-
python
|
| 168 |
|
| 169 |
# 查看所有可用角色
|
| 170 |
-
uv run
|
| 171 |
# 或
|
| 172 |
-
python
|
| 173 |
```
|
| 174 |
|
| 175 |
**首次运行说明**:
|
|
@@ -182,10 +186,10 @@ python src/VoiceDialogue/main.py --help
|
|
| 182 |
|
| 183 |
```bash
|
| 184 |
# 启动 API 服务器
|
| 185 |
-
python
|
| 186 |
|
| 187 |
# 指定不同端口和启用热重载
|
| 188 |
-
python
|
| 189 |
```
|
| 190 |
|
| 191 |
**API 服务特性**:
|
|
@@ -237,47 +241,78 @@ python src/VoiceDialogue/main.py --mode api --port 9000 --reload
|
|
| 237 |
```text
|
| 238 |
VoiceDialogue/
|
| 239 |
├── src/
|
| 240 |
-
│ └──
|
| 241 |
-
│ ├──
|
| 242 |
-
│ ├──
|
| 243 |
-
│ │ ├──
|
| 244 |
-
│ │
|
| 245 |
-
│
|
| 246 |
-
│ │ ├──
|
| 247 |
-
│ │ ├──
|
| 248 |
-
│ │
|
| 249 |
-
│ ├──
|
| 250 |
-
│ │
|
| 251 |
-
│ ├──
|
| 252 |
-
│ │
|
| 253 |
-
│ ├──
|
| 254 |
-
│ │ ├──
|
| 255 |
-
│ │ └──
|
| 256 |
-
│ ├──
|
| 257 |
-
│ │ ├──
|
| 258 |
-
│ │
|
| 259 |
-
│
|
| 260 |
-
│ │
|
| 261 |
-
│
|
| 262 |
-
│ │ ├──
|
| 263 |
-
│ │
|
| 264 |
-
│
|
| 265 |
-
│ │
|
| 266 |
-
│ │ └──
|
| 267 |
-
│
|
| 268 |
-
│
|
| 269 |
-
├──
|
| 270 |
-
│
|
| 271 |
-
├──
|
| 272 |
-
|
| 273 |
-
│ ├──
|
| 274 |
-
│ ├──
|
| 275 |
-
│ ├──
|
| 276 |
-
│ └──
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 281 |
```
|
| 282 |
|
| 283 |
## 🔧 系统架构
|
|
|
|
| 141 |
5. **安装额外依赖**
|
| 142 |
```bash
|
| 143 |
# 安装 kokoro-onnx
|
| 144 |
+
uv pip install kokoro-onnx
|
| 145 |
+
# 或
|
| 146 |
pip install kokoro-onnx
|
| 147 |
|
| 148 |
# 重新安装指定版本的 numpy
|
| 149 |
+
uv pip install numpy==1.26.4
|
| 150 |
+
# 或
|
| 151 |
pip install numpy==1.26.4
|
| 152 |
```
|
| 153 |
|
|
|
|
| 161 |
|
| 162 |
```bash
|
| 163 |
# 启动语音对话系统 (默认使用中文,沈逸角色)
|
| 164 |
+
uv run main.py
|
| 165 |
# 或
|
| 166 |
+
python main.py
|
| 167 |
|
| 168 |
# 指定语言和角色
|
| 169 |
+
uv run main.py --language en --speaker Heart
|
| 170 |
# 或
|
| 171 |
+
python main.py --language en --speaker Heart
|
| 172 |
|
| 173 |
# 查看所有可用角色
|
| 174 |
+
uv run main.py --help
|
| 175 |
# 或
|
| 176 |
+
python main.py --help
|
| 177 |
```
|
| 178 |
|
| 179 |
**首次运行说明**:
|
|
|
|
| 186 |
|
| 187 |
```bash
|
| 188 |
# 启动 API 服务器
|
| 189 |
+
python main.py --mode api
|
| 190 |
|
| 191 |
# 指定不同端口和启用热重载
|
| 192 |
+
python main.py --mode api --port 9000 --reload
|
| 193 |
```
|
| 194 |
|
| 195 |
**API 服务特性**:
|
|
|
|
| 241 |
```text
|
| 242 |
VoiceDialogue/
|
| 243 |
├── src/
|
| 244 |
+
│ └── voice_dialogue/ # 主要源代码目录
|
| 245 |
+
│ ├── __init__.py # 包初始化文件
|
| 246 |
+
│ ├── cli/ # 命令行界面模块
|
| 247 |
+
│ │ ├── __init__.py
|
| 248 |
+
│ │ └── args.py # 命令行参数解析
|
| 249 |
+
│ ├── api/ # Web API 模块 (FastAPI)
|
| 250 |
+
│ │ ├── __init__.py
|
| 251 |
+
│ │ ├── app.py # FastAPI 应用实例
|
| 252 |
+
│ │ ├── server.py # uvicorn 服务器
|
| 253 |
+
│ │ ├── core/ # API 核心配置
|
| 254 |
+
│ │ ├── routes/ # API 路由
|
| 255 |
+
│ │ │ ├── __init__.py
|
| 256 |
+
│ │ │ ├── asr_routes.py # 语音识别路由
|
| 257 |
+
│ │ │ ├── tts_routes.py # 文本转语音路由
|
| 258 |
+
│ │ │ ├── system_routes.py # 系统管理路由
|
| 259 |
+
│ │ │ └── websocket_routes.py # WebSocket 路由
|
| 260 |
+
│ │ ├── schemas/ # 数据模型
|
| 261 |
+
│ │ ├── dependencies/ # API 依赖项
|
| 262 |
+
│ │ └── middleware/ # 中间件
|
| 263 |
+
│ ├── config/ # 配置管理
|
| 264 |
+
│ │ └── paths.py # 路径配置
|
| 265 |
+
│ ├── core/ # 核心模块
|
| 266 |
+
│ │ ├── constants.py # 全局常量和队列
|
| 267 |
+
│ │ └── launcher.py # 系统启动器
|
| 268 |
+
│ ├── models/ # 数据模型和任务
|
| 269 |
+
│ │ ├── language_model.py # 语言模型定义
|
| 270 |
+
│ │ └── voice_task.py # 语音任务定义
|
| 271 |
+
│ ├── services/ # 服务模块
|
| 272 |
+
│ │ ├── audio/ # 音频处理服务
|
| 273 |
+
│ │ │ ├── capture.py # 回声消除音频捕获
|
| 274 |
+
│ │ │ ├── player.py # 音频播放
|
| 275 |
+
│ │ │ ├── generator.py # TTS 音频生成器
|
| 276 |
+
│ │ │ └── generators/ # TTS 引擎管理
|
| 277 |
+
│ │ ├── speech/ # 语音识别服务
|
| 278 |
+
│ │ │ ├── monitor.py # 语音状态监控
|
| 279 |
+
│ │ │ ├── recognizer.py # ASR 识别服务
|
| 280 |
+
│ │ │ └── recognizers/ # ASR 引擎管理
|
| 281 |
+
│ │ └── text/ # 文本生成服务
|
| 282 |
+
│ │ └── generator.py # LLM 文本生成
|
| 283 |
+
│ └── utils/ # 工具函数
|
| 284 |
+
├── third_party/ # 第三方库
|
| 285 |
+
│ ├── moyoyo_tts/ # GPT-SoVITs TTS 引擎
|
| 286 |
+
│ └── AECAudioRecorder/ # 回声消除音频录制器
|
| 287 |
+
├── electron-app/ # Electron 桌面应用
|
| 288 |
+
│ ├── main.js # Electron 主进程
|
| 289 |
+
│ ├── preload.js # 预加载脚本
|
| 290 |
+
│ ├── loading.html # 加载页面
|
| 291 |
+
│ ├── utils.js # 工具函数
|
| 292 |
+
│ ├── package.json # Electron 依赖配置
|
| 293 |
+
│ ├── assets/ # Electron 资源文件
|
| 294 |
+
│ ├── build/ # 构建配置
|
| 295 |
+
│ └── python-dist/ # Python 分发包
|
| 296 |
+
├── scripts/ # 构建和部署脚本
|
| 297 |
+
│ ├── build.sh # 主构建脚本
|
| 298 |
+
│ ├── build-python.sh # Python 打包脚本
|
| 299 |
+
│ ├── build-electron.sh # Electron 打包脚本
|
| 300 |
+
│ └── clean.sh # 清理脚本
|
| 301 |
+
├── tests/ # 测试文件
|
| 302 |
+
├── docs/ # 文档目录
|
| 303 |
+
├── dist/ # 分发包输出目录
|
| 304 |
+
├── build/ # 构建临时文件
|
| 305 |
+
├── assets/ # 资源文件
|
| 306 |
+
│ ├── models/ # 模型文件存储
|
| 307 |
+
│ ├── audio/ # 音频资源
|
| 308 |
+
│ ├── libraries/ # 库文件
|
| 309 |
+
│ └── www/ # Web资源
|
| 310 |
+
├── main.py # 项目启动入口(简化版)
|
| 311 |
+
├── pyproject.toml # 项目配置文件 (uv/pip)
|
| 312 |
+
├── requirements.txt # Python 依赖
|
| 313 |
+
├── uv.lock # uv 锁定文件
|
| 314 |
+
├── .python-version # Python 版本配置
|
| 315 |
+
└── README.md # 项目说明文档
|
| 316 |
```
|
| 317 |
|
| 318 |
## 🔧 系统架构
|