Set 0 tokens for prompts with no content
This commit is contained in:
parent
80e286fed2
commit
67c8476cdf
|
@ -1417,7 +1417,7 @@ class Message {
|
||||||
this.role = role;
|
this.role = role;
|
||||||
this.content = content;
|
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 });
|
this.tokens = tokenHandler.count({ role: this.role, content: this.content });
|
||||||
} else {
|
} else {
|
||||||
this.tokens = 0;
|
this.tokens = 0;
|
||||||
|
|
Loading…
Reference in New Issue