fix FormData headers for voice recording uploads
This commit is contained in:
@@ -344,7 +344,10 @@ async function requestRVCResponse(src: Attachment, pitch?: number): Promise<Node
|
||||
logInfo(`[bot] Got audio file: ${srcbuf.byteLength} bytes`);
|
||||
|
||||
const fd = new FormData();
|
||||
fd.append('input_audio', readFileSync(tmpFileName), 'voice-message.ogg');
|
||||
fd.append('input_audio', readFileSync(tmpFileName), {
|
||||
filename: 'voice-message.ogg',
|
||||
contentType: 'audio/ogg',
|
||||
});
|
||||
fd.append('modelpath', 'model.pth');
|
||||
fd.append('f0_up_key', pitch ?? 0);
|
||||
|
||||
@@ -352,6 +355,7 @@ async function requestRVCResponse(src: Attachment, pitch?: number): Promise<Node
|
||||
logInfo(`[bot] Requesting RVC response for ${src.id}`);
|
||||
const res = await fetch(rvcEndpoint, {
|
||||
method: 'POST',
|
||||
headers: fd.getHeaders(),
|
||||
body: fd,
|
||||
});
|
||||
const resContents = await res.blob();
|
||||
|
||||
Reference in New Issue
Block a user