mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 22:07:10 +00:00
Merge branch 'ikechan8370:v2' into v2
This commit is contained in:
commit
9723e6db17
92 changed files with 4289 additions and 1073 deletions
|
|
@ -9,7 +9,7 @@ import crypto from 'crypto'
|
|||
import child_process from 'child_process'
|
||||
import { Config } from './config.js'
|
||||
import path from 'path'
|
||||
import { mkdirs } from './common.js'
|
||||
import { mkdirs, getUin } from './common.js'
|
||||
let module
|
||||
try {
|
||||
module = await import('oicq')
|
||||
|
|
@ -41,7 +41,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') {
|
||||
|
|
@ -50,6 +50,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 (Config.ttsHD) {
|
||||
result = await getPttBuffer(recordUrl, Bot.config.ffmpeg_path, false)
|
||||
|
|
@ -144,7 +147,7 @@ async function uploadRecord (recordUrl, ttsMode = 'vits-uma-genshin-honkai') {
|
|||
2: 3,
|
||||
5: {
|
||||
1: Contactable.target,
|
||||
2: Bot.uin,
|
||||
2: getUin(),
|
||||
3: 0,
|
||||
4: hash,
|
||||
5: buf.length,
|
||||
|
|
@ -188,7 +191,7 @@ async function uploadRecord (recordUrl, ttsMode = 'vits-uma-genshin-honkai') {
|
|||
const fid = rsp[11].toBuffer()
|
||||
const b = core.pb.encode({
|
||||
1: 4,
|
||||
2: Bot.uin,
|
||||
2: getUin(),
|
||||
3: fid,
|
||||
4: hash,
|
||||
5: hash.toString('hex') + '.amr',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue