Do not act as if forEach can iterate beyond the chat array

This commit is contained in:
Grzegorz Gidel
2023-04-28 12:06:31 +02:00
parent 303e183cda
commit d625f1386e
2 changed files with 5 additions and 5 deletions

View File

@ -198,7 +198,7 @@ function generateOpenAIPromptCache(charPersonality, topAnchorDepth, anchorTop, b
item = `[${name2} is ${personalityAndAnchor}]\n${item}`;
}
}
if (i >= openai_msgs.length - 1 && openai_msgs.length > bottomAnchorThreshold && $.trim(item).substr(0, (name1 + ":").length) == name1 + ":") {//For add anchor in end
if (i === openai_msgs.length - 1 && openai_msgs.length > bottomAnchorThreshold && $.trim(item).substr(0, (name1 + ":").length) == name1 + ":") {//For add anchor in end
item = anchorBottom + "\n" + item;
}