Fix logprobs menu on empty chats

76cb34fd06ffe126afa8fd0e401aed9d699092d9

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +5 -1Showing whitespace changes
public/scripts/logprobs.js+5 -1
@@ -496,9 +496,13 @@ function getMessageHash(message) {
496496/**
497497 * getActiveMessageLogprobData returns the logprobs data for the active chat
498498 * message.
499499 * @returns {MessageLogprobData || null}
500500 */
501501function getActiveMessageLogprobData() {
502+ if (chat.length === 0) {
503+ return null;
504+ }
505+
502506 const hash = getMessageHash(chat[chat.length - 1]);
503507 return state.messageLogprobs.get(hash) || null;
504508}