From 8b78e8a596b939034c37b5add6fa464838ebac46 Mon Sep 17 00:00:00 2001 From: James Sumners Date: Mon, 20 Nov 2023 11:51:38 -0500 Subject: [PATCH] address feedback --- test/lib/openai-mock-server.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/lib/openai-mock-server.js b/test/lib/openai-mock-server.js index f99f31976f..5d34b91fcf 100644 --- a/test/lib/openai-mock-server.js +++ b/test/lib/openai-mock-server.js @@ -80,6 +80,7 @@ function handler(req, res) { const outStream = new Readable({ read() { if (i < parts.length) { + const content = (parts.length - 1) === i ? parts[i] : `${parts[i]} ` const chunk = JSON.stringify({ id: 'chatcmpl-8MzOfSMbLxEy70lYAolSwdCzfguQZ', object: 'chat.completion.chunk', @@ -90,7 +91,7 @@ function handler(req, res) { { index: 0, finish_reason: null, - delta: { role: 'assistant', content: parts[i] } + delta: { role: 'assistant', content } } ] })