diff --git a/docs/todo.md b/docs/todo.md index 2c9fffa..f67be1f 100644 --- a/docs/todo.md +++ b/docs/todo.md @@ -13,9 +13,9 @@ ## 💪 优化 - 优化 unWakeUp 小爱的流程,增加指令间的执行间隔,降低 ROM 端无响应问题的出现概率。https://github.com/idootop/mi-gpt/issues/32 -- 优化 debug 日志输出,添加 wakeUp、unWakeUp、env 等关键流程和核心数据的打印。 +- ✅ 优化 debug 日志输出,添加 wakeUp、unWakeUp、env 等关键流程和核心数据的打印。 -## 📒 文档 FAQ +## 📒 文档 - ✅ 优化关于小米账号安全验证相关的提示语和使用说明。https://github.com/idootop/mi-gpt/issues/22#issuecomment-2150535622 - ✅ 优化关于 Azure OpenAI 配置的说明。https://github.com/idootop/mi-gpt/issues/7 @@ -34,7 +34,6 @@ - ✅ 添加关于 OpenAI gpt4 模型不存在的相关说明 - ✅ 添加关于唤醒小爱、唤醒词、唤醒模式的说明和注意事项。 - ✅ 添加关于 playingCommand 的详细说明,默认不需要配置。 -- 添加常见小爱音箱型号的支持情况和参数列表。 ## ❤️ 感谢 @@ -54,3 +53,7 @@ - 支持火山引擎 TTS 和音色切换能力 - 开放 System Prompt 自定义能力 - 添加更详细的使用和配置视频教程 + +## 💪 优化 + +- 添加常见小爱音箱型号的支持情况和参数列表。 diff --git a/src/services/speaker/base.ts b/src/services/speaker/base.ts index 096e35e..a51bb9b 100644 --- a/src/services/speaker/base.ts +++ b/src/services/speaker/base.ts @@ -126,7 +126,15 @@ export class BaseSpeaker { if (this.debug) { const d: any = this.MiIOT!.account?.device; this.logger.debug( - "当前设备信息:", + "配置参数:", + jsonEncode(this.config, { prettier: true }) + ); + this.logger.debug( + "环境变量:", + jsonEncode(process.env, { prettier: true }) + ); + this.logger.debug( + "设备信息:", jsonEncode( { name: d?.name, @@ -141,10 +149,16 @@ export class BaseSpeaker { } wakeUp() { + if (this.debug) { + this.logger.debug("wakeUp"); + } return this.MiIOT!.doAction(...this.wakeUpCommand); } async unWakeUp() { + if (this.debug) { + this.logger.debug("unWakeUp"); + } // 通过 TTS 不发音文本,使小爱退出唤醒状态 await this.MiNA!.pause(); await this.MiIOT!.doAction(...this.ttsCommand, kAreYouOK); @@ -208,6 +222,9 @@ export class BaseSpeaker { if (replyText.length < 1) { // 播放开始提示音 if (playSFX && this.audioBeep) { + if (this.debug) { + this.logger.debug("开始播放提示音"); + } await this.MiNA!.play({ url: this.audioBeep }); } // 在播放 TTS 语音之前,先取消小爱音箱的唤醒状态,防止将 TTS 语音识别成用户指令 @@ -232,6 +249,9 @@ export class BaseSpeaker { if (replyText.length > 0) { // 播放结束提示音 if (playSFX && this.audioBeep) { + if (this.debug) { + this.logger.debug("结束播放提示音"); + } await this.MiNA!.play({ url: this.audioBeep }); } } @@ -289,6 +309,9 @@ export class BaseSpeaker { this.logger.log("🔊 " + (ttsText ?? audio)); // 播放开始提示音 if (playSFX && this.audioBeep) { + if (this.debug) { + this.logger.debug("开始播放提示音(inner)"); + } await this.MiNA!.play({ url: this.audioBeep }); } // 在播放 TTS 语音之前,先取消小爱音箱的唤醒状态,防止将 TTS 语音识别成用户指令 @@ -343,6 +366,9 @@ export class BaseSpeaker { } // 播放结束提示音 if (playSFX && this.audioBeep) { + if (this.debug) { + this.logger.debug("结束播放提示音(inner)"); + } await this.MiNA!.play({ url: this.audioBeep }); } // 保持唤醒状态