fix(qoder): increase timeouts for reasoning models and improve stream handling

This commit is contained in:
decolua
2026-06-08 09:17:33 +07:00
parent 51cbe65c15
commit 137a25e9ac
4 changed files with 21 additions and 8 deletions
+4 -4
View File
@@ -184,7 +184,7 @@ export function createDisconnectAwareStream(transformStream, streamController, o
* @param {TransformStream} transformStream - Transform stream for SSE
* @param {object} streamController - Stream controller from createStreamController
*/
export function pipeWithDisconnect(providerResponse, transformStream, streamController, onAbortTerminal = null) {
export function pipeWithDisconnect(providerResponse, transformStream, streamController, onAbortTerminal = null, stallTimeoutMs = STREAM_STALL_TIMEOUT_MS) {
let stallTimer = null;
let chunkCount = 0;
let totalBytes = 0;
@@ -198,10 +198,10 @@ export function pipeWithDisconnect(providerResponse, transformStream, streamCont
clearStall();
stallTimer = setTimeout(() => {
stallTimer = null;
dbg(tag, `STALL TIMEOUT ${STREAM_STALL_TIMEOUT_MS}ms | chunks=${chunkCount} | bytes=${totalBytes} | sinceLast=${Date.now() - lastChunkAt}ms`);
dbg(tag, `STALL TIMEOUT ${stallTimeoutMs}ms | chunks=${chunkCount} | bytes=${totalBytes} | sinceLast=${Date.now() - lastChunkAt}ms`);
streamController.handleError?.(new Error("stream stall timeout"));
streamController.abort?.();
}, STREAM_STALL_TIMEOUT_MS);
}, stallTimeoutMs);
};
// Wrap controller so every termination path clears the stall timer.
@@ -218,7 +218,7 @@ export function pipeWithDisconnect(providerResponse, transformStream, streamCont
};
armStall();
dbg(tag, `pipe start | stallTimeout=${STREAM_STALL_TIMEOUT_MS}ms`);
dbg(tag, `pipe start | stallTimeout=${stallTimeoutMs}ms`);
const upstreamTap = new TransformStream({
transform(chunk, controller) {