fix FormData headers for voice recording uploads

This commit is contained in:
2026-03-21 11:42:32 -07:00
parent 49f874ce95
commit 809e5adf38

View File

@@ -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();