mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add default role for Message class if not set.
This commit is contained in:
@ -1758,6 +1758,11 @@ class Message {
|
|||||||
this.role = role;
|
this.role = role;
|
||||||
this.content = content;
|
this.content = content;
|
||||||
|
|
||||||
|
if (!this.role) {
|
||||||
|
console.log(`Message role not set, defaulting to 'system' for identifier '${this.identifier}'`);
|
||||||
|
this.role = 'system';
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof this.content === 'string' && this.content.length > 0) {
|
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 {
|
||||||
|
Reference in New Issue
Block a user