From 76cb34fd06ffe126afa8fd0e401aed9d699092d9 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 28 Feb 2025 10:25:36 +0200 Subject: [PATCH] Fix logprobs menu on empty chats --- public/scripts/logprobs.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/scripts/logprobs.js b/public/scripts/logprobs.js index 17c0584a3..0314375c1 100644 --- a/public/scripts/logprobs.js +++ b/public/scripts/logprobs.js @@ -496,9 +496,13 @@ function getMessageHash(message) { /** * getActiveMessageLogprobData returns the logprobs data for the active chat * message. - * @returns {MessageLogprobData || null} + * @returns {MessageLogprobData|null} */ function getActiveMessageLogprobData() { + if (chat.length === 0) { + return null; + } + const hash = getMessageHash(chat[chat.length - 1]); return state.messageLogprobs.get(hash) || null; }