diff --git a/public/scripts/openai.js b/public/scripts/openai.js index c02fb62b5..4a16b5458 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -1417,7 +1417,7 @@ class Message { this.role = role; this.content = content; - if (typeof this.content === 'string') { + if (typeof this.content === 'string' && this.content.length > 0) { this.tokens = tokenHandler.count({ role: this.role, content: this.content }); } else { this.tokens = 0;