From 1c4bd50a0e1e3c8e17c1ba1910d57fcd0466aa47 Mon Sep 17 00:00:00 2001 From: johnd0e <1838643+johnd0e@users.noreply.github.com> Date: Thu, 26 Dec 2024 21:43:33 +0100 Subject: [PATCH] Minor (debug) --- src/worker.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/worker.mjs b/src/worker.mjs index 45b2719..bd1e8ff 100644 --- a/src/worker.mjs +++ b/src/worker.mjs @@ -428,7 +428,8 @@ async function toOpenAiStream (chunk, controller) { })); data = { candidates }; } - const cand = data.candidates[0]; // !!untested with candidateCount>1 + const cand = data.candidates[0]; + console.assert(data.candidates.length === 1, "Unexpected candidates count: %d", data.candidates.length); cand.index = cand.index || 0; // absent in new -002 models response if (!this.last[cand.index]) { controller.enqueue(transform(data, false, "first"));