fix: 修复使用提示音链接时,小爱回答完毕后,仍然重复播放文字提示语的问题

This commit is contained in:
WJG 2024-06-11 20:33:05 +08:00
parent 0ba3b07c5d
commit 6041088fbc
No known key found for this signature in database
GPG Key ID: 258474EF8590014A
2 changed files with 13 additions and 2 deletions

View File

@ -225,7 +225,12 @@ export class AISpeaker extends Speaker {
}
},
async (msg, data) => {
if (data.answer && data.res == null && this.streamResponse) {
if (
data.answer &&
data.res == null &&
!this.audioBeep &&
this.streamResponse
) {
// 回复完毕
await this.response({
text: pickOne(this.onAIReplied)!,

View File

@ -2,7 +2,13 @@ import { randomUUID } from "crypto";
import { openai } from "../src/services/openai";
export async function testOpenAI() {
await testStreamChat();
await testChat();
// await testStreamChat();
}
async function testChat() {
const res = await openai.chat({ user: "地球为什么是圆的?" });
console.log("\nFinal result:\n", res?.content);
}
async function testStreamChat() {