mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-28 09:50:14 +01:00
Add error handling to openai message counting
This commit is contained in:
parent
011278c533
commit
ce8a71cf53
@ -689,7 +689,7 @@ function prepareOpenAIMessages({
|
||||
}
|
||||
|
||||
const chat = chatCompletion.getChat();
|
||||
openai_messages_count = chat.filter(x => x.role === "user" || x.role === "assistant").length;
|
||||
openai_messages_count = chat.filter(x => x?.role === "user" || x?.role === "assistant")?.length || 0;
|
||||
|
||||
return [chat, false];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user