fix: 初步适配铃音语音

This commit is contained in:
ikechan8370 2023-11-04 11:49:36 +08:00
parent 7cc22e487a
commit 61d3b48781
2 changed files with 22 additions and 16 deletions

View file

@ -39,7 +39,7 @@ if (module) {
// import { pcm2slk } from 'node-silk'
let errors = {}
async function uploadRecord (recordUrl, ttsMode = 'vits-uma-genshin-honkai') {
async function uploadRecord (recordUrl, ttsMode = 'vits-uma-genshin-honkai', ignoreEncode = false) {
let recordType = 'url'
let tmpFile = ''
if (ttsMode === 'azure') {
@ -48,6 +48,9 @@ async function uploadRecord (recordUrl, ttsMode = 'vits-uma-genshin-honkai') {
recordType = 'buffer'
tmpFile = `data/chatgpt/tts/tmp/${crypto.randomUUID()}.wav`
}
if (ignoreEncode) {
return segment.record(recordUrl)
}
let result
if (pcm2slk) {
result = await getPttBuffer(recordUrl, Bot.config.ffmpeg_path)