From 2f5e7778cc851cec1e1df573c0b49a2aae7e8337 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 10 Nov 2023 01:08:18 +0200 Subject: [PATCH] Don't add items of unknown type to chat completion --- public/scripts/openai.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/scripts/openai.js b/public/scripts/openai.js index d96e851e4..ec5e712bf 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -1982,8 +1982,7 @@ class ChatCompletion { const message = { role: item.role, content: item.content, ...(item.name ? { name: item.name } : {}) }; chat.push(message); } else { - this.log(`Item ${item} has an unknown type. Adding as-is`); - chat.push(item); + console.warn('Invalid message in collection', item); } } return chat;