From a61369b52a1d50e4e33c3fff20564e6c5ea6b5da Mon Sep 17 00:00:00 2001 From: Grzegorz Gidel Date: Wed, 3 May 2023 19:54:18 +0200 Subject: [PATCH] Avoid an empty line in OpenAI when bottom anchor is empty --- public/scripts/openai.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/scripts/openai.js b/public/scripts/openai.js index ab4da51a1..215fe88b4 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -205,7 +205,9 @@ function generateOpenAIPromptCache(charPersonality, topAnchorDepth, anchorTop, b } } if (i === openai_msgs.length - 1 && openai_msgs.length > bottomAnchorThreshold && msg.role === "user") {//For add anchor in end - item = anchorBottom + "\n" + item; + if (anchorBottom) { + item = anchorBottom + "\n" + item; + } } msg["content"] = item;