From 3c862e3dc3b4e105feace70ab8aa4770e26a2830 Mon Sep 17 00:00:00 2001 From: Ben Sully Date: Tue, 17 Oct 2023 16:22:53 +0100 Subject: [PATCH] Check that 'done' is not null in isDoneMessage --- src/llms/openai.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llms/openai.ts b/src/llms/openai.ts index 3a0ee65..c3b919e 100644 --- a/src/llms/openai.ts +++ b/src/llms/openai.ts @@ -233,7 +233,7 @@ export function isContentMessage(message: ChatCompletionsDelta): message is Cont /** Return true if the message is a 'done' message. */ export function isDoneMessage(message: ChatCompletionsDelta): message is DoneMessage { - return 'done' in message; + return 'done' in message && message.done != null; } /** Return true if the response is an error response. */