mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add error handling to openai message counting
This commit is contained in:
@ -689,7 +689,7 @@ function prepareOpenAIMessages({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const chat = chatCompletion.getChat();
|
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];
|
return [chat, false];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user