Don't add items of unknown type to chat completion

This commit is contained in:
Cohee 2023-11-10 01:08:18 +02:00
parent 4e55126606
commit 2f5e7778cc
1 changed files with 1 additions and 2 deletions

View File

@ -1982,8 +1982,7 @@ class ChatCompletion {
const message = { role: item.role, content: item.content, ...(item.name ? { name: item.name } : {}) }; const message = { role: item.role, content: item.content, ...(item.name ? { name: item.name } : {}) };
chat.push(message); chat.push(message);
} else { } else {
this.log(`Item ${item} has an unknown type. Adding as-is`); console.warn('Invalid message in collection', item);
chat.push(item);
} }
} }
return chat; return chat;