simple mode tool reason (#3984)

* simple mode tool reason

* model config cannot set empty

* perf: read files code

* perf: mongo gridfs chunks

* perf: doc
This commit is contained in:
Archer
2025-03-05 15:55:02 +08:00
committed by archer
parent 32ce032995
commit a345e56508
10 changed files with 92 additions and 22 deletions

View File

@@ -43,13 +43,13 @@ export async function text2Speech({
const readableStream = response.body as unknown as NodeJS.ReadableStream;
readableStream.pipe(res);
let bufferStore = Buffer.from([]);
const chunks: Uint8Array[] = [];
readableStream.on('data', (chunk) => {
bufferStore = Buffer.concat([bufferStore, chunk]);
chunks.push(chunk);
});
readableStream.on('end', () => {
onSuccess({ model, buffer: bufferStore });
onSuccess({ model, buffer: Buffer.concat(chunks) });
});
readableStream.on('error', (e) => {
onError(e);