mirror of
https://github.com/idootop/mi-gpt.git
synced 2025-04-12 23:27:18 +00:00
fix: 提示语列表为空时不播放提示音
This commit is contained in:
parent
1f7e815df3
commit
46a74d9eaa
|
@ -5,7 +5,7 @@
|
||||||
## 🔥 Hotfix
|
## 🔥 Hotfix
|
||||||
|
|
||||||
- ✅ 修复 MIoT 和 Mina 接口查询到的设备名称不一致的问题。https://github.com/idootop/mi-gpt/issues/62
|
- ✅ 修复 MIoT 和 Mina 接口查询到的设备名称不一致的问题。https://github.com/idootop/mi-gpt/issues/62
|
||||||
- 提示语列表为空,或提示语和提示音链接都为空时,不播放提示音。https://github.com/idootop/mi-gpt/issues/30#issuecomment-2153786207
|
- ✅ 提示语列表为空,或提示语和提示音链接都为空时,不播放提示音。https://github.com/idootop/mi-gpt/issues/30#issuecomment-2153786207
|
||||||
- 修复唤醒模式下,重新匹配唤醒词时,应该走询问 AI 的流程。([issues#25](https://github.com/idootop/mi-gpt/issues/25))
|
- 修复唤醒模式下,重新匹配唤醒词时,应该走询问 AI 的流程。([issues#25](https://github.com/idootop/mi-gpt/issues/25))
|
||||||
- ✅ 修复使用提示音链接时,小爱回答完毕后,仍然重复播放文字提示语的问题。
|
- ✅ 修复使用提示音链接时,小爱回答完毕后,仍然重复播放文字提示语的问题。
|
||||||
- 优化网络请求错误重试策略(消息/播放状态轮询)
|
- 优化网络请求错误重试策略(消息/播放状态轮询)
|
||||||
|
|
|
@ -144,7 +144,10 @@ export class AISpeaker extends Speaker {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 回应
|
// 回应
|
||||||
await this.response({ text: pickOne(this.onEnterAI)!, keepAlive: true });
|
const text = pickOne(this.onEnterAI);
|
||||||
|
if (text) {
|
||||||
|
await this.response({ text, keepAlive: true });
|
||||||
|
}
|
||||||
// 唤醒
|
// 唤醒
|
||||||
await super.enterKeepAlive();
|
await super.enterKeepAlive();
|
||||||
}
|
}
|
||||||
|
@ -153,11 +156,10 @@ export class AISpeaker extends Speaker {
|
||||||
// 退出唤醒状态
|
// 退出唤醒状态
|
||||||
await super.exitKeepAlive();
|
await super.exitKeepAlive();
|
||||||
// 回应
|
// 回应
|
||||||
await this.response({
|
const text = pickOne(this.onExitAI);
|
||||||
text: pickOne(this.onExitAI)!,
|
if (text) {
|
||||||
keepAlive: false,
|
await this.response({ text, keepAlive: false, playSFX: false });
|
||||||
playSFX: false,
|
}
|
||||||
});
|
|
||||||
await this.unWakeUp();
|
await this.unWakeUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,10 +209,10 @@ export class AISpeaker extends Speaker {
|
||||||
private _askAIForAnswerSteps: AnswerStep[] = [
|
private _askAIForAnswerSteps: AnswerStep[] = [
|
||||||
async (msg, data) => {
|
async (msg, data) => {
|
||||||
// 思考中
|
// 思考中
|
||||||
await this.response({
|
const text = pickOne(this.onAIAsking);
|
||||||
audio: this.audioActive,
|
if (text) {
|
||||||
text: pickOne(this.onAIAsking)!,
|
await this.response({ text, audio: this.audioActive });
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
async (msg, data) => {
|
async (msg, data) => {
|
||||||
// 调用 AI 获取回复
|
// 调用 AI 获取回复
|
||||||
|
@ -232,18 +234,19 @@ export class AISpeaker extends Speaker {
|
||||||
this.streamResponse
|
this.streamResponse
|
||||||
) {
|
) {
|
||||||
// 回复完毕
|
// 回复完毕
|
||||||
await this.response({
|
const text = pickOne(this.onAIReplied);
|
||||||
text: pickOne(this.onAIReplied)!,
|
if (text) {
|
||||||
});
|
await this.response({ text });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async (msg, data) => {
|
async (msg, data) => {
|
||||||
if (data.res === "error") {
|
if (data.res === "error") {
|
||||||
// 回答异常
|
// 回答异常
|
||||||
await this.response({
|
const text = pickOne(this.onAIError);
|
||||||
audio: this.audioError,
|
if (text) {
|
||||||
text: pickOne(this.onAIError)!,
|
await this.response({ text, audio: this.audioError });
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async (msg, data) => {
|
async (msg, data) => {
|
||||||
|
|
|
@ -196,6 +196,10 @@ export class BaseSpeaker {
|
||||||
} = options ?? {};
|
} = options ?? {};
|
||||||
options.hasNewMsg ??= this.checkIfHasNewMsg().hasNewMsg;
|
options.hasNewMsg ??= this.checkIfHasNewMsg().hasNewMsg;
|
||||||
|
|
||||||
|
if (!text && !stream && !audio) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const doubaoTTS = process.env.TTS_DOUBAO;
|
const doubaoTTS = process.env.TTS_DOUBAO;
|
||||||
if (!doubaoTTS) {
|
if (!doubaoTTS) {
|
||||||
tts = "xiaoai"; // 没有提供豆包语音接口时,只能使用小爱自带 TTS
|
tts = "xiaoai"; // 没有提供豆包语音接口时,只能使用小爱自带 TTS
|
||||||
|
|
Loading…
Reference in New Issue
Block a user