Skip to content

Commit

Permalink
Merge pull request #3884 from continuedev/dallin/zero-length-arrays
Browse files Browse the repository at this point in the history
Fix role undefined error
  • Loading branch information
Patrick-Erichsen authored Jan 29, 2025
2 parents c6adc4b + fae83ba commit 7b9ac83
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/llm/countTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,10 @@ function compileChatMessages(

if (
(systemMessage && systemMessage.trim() !== "") ||
msgs?.[0].role === "system"
msgs?.[0]?.role === "system"
) {
let content = "";
if (msgs?.[0].role === "system") {
if (msgs?.[0]?.role === "system") {
content = renderChatMessage(msgs?.[0]);
}
if (systemMessage && systemMessage.trim() !== "") {
Expand Down

0 comments on commit 7b9ac83

Please sign in to comment.