mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
fix: 适配无oicq&icqq;删除存储的azure语音
This commit is contained in:
parent
1bfb4d7d6b
commit
d5e3d52d43
2 changed files with 33 additions and 17 deletions
11
apps/chat.js
11
apps/chat.js
|
|
@ -8,6 +8,7 @@ import { BingAIClient } from '@waylaidwanderer/chatgpt-api'
|
|||
import SydneyAIClient from '../utils/SydneyAIClient.js'
|
||||
import { PoeClient } from '../utils/poe/index.js'
|
||||
import AzureTTS from '../utils/tts/microsoft-azure.js'
|
||||
import fs from 'fs'
|
||||
import {
|
||||
render, renderUrl,
|
||||
getMessageById,
|
||||
|
|
@ -987,7 +988,7 @@ export class chatgpt extends plugin {
|
|||
}
|
||||
try {
|
||||
try {
|
||||
let sendable = await uploadRecord(wav)
|
||||
let sendable = await uploadRecord(wav, Config.ttsMode === 'azure')
|
||||
if (sendable) {
|
||||
await e.reply(sendable)
|
||||
} else {
|
||||
|
|
@ -1002,6 +1003,14 @@ export class chatgpt extends plugin {
|
|||
logger.error(err)
|
||||
await this.reply('合成语音发生错误~')
|
||||
}
|
||||
if (Config.ttsMode === 'azure' && Config.azureTTSKey) {
|
||||
// 清理文件
|
||||
try {
|
||||
fs.unlinkSync(wav)
|
||||
} catch (err) {
|
||||
logger.warn(err)
|
||||
}
|
||||
}
|
||||
} else if (userSetting.usePicture || (Config.autoUsePicture && response.length > Config.autoUsePictureThreshold)) {
|
||||
// todo use next api of chatgpt to complete incomplete respoonse
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue