diff --git a/public/scripts/openai.js b/public/scripts/openai.js index 7a4c35dcb..e3924d273 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -1106,7 +1106,7 @@ class ChatCompletion { this.validateMessageCollection(collection); this.checkTokenBudget(collection, collection.identifier); - if (position) { + if (null !== position && -1 !== position) { this.messages.collection[position] = collection; } else { this.messages.collection.push(collection);