From b4646da18722ec58306edf471c6072f1e8850ab2 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 29 Jan 2024 11:13:48 +0200 Subject: [PATCH] Fix logprobs parser on NovelAI non-streaming --- public/scripts/logprobs.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/scripts/logprobs.js b/public/scripts/logprobs.js index bca886227..2f0636a0e 100644 --- a/public/scripts/logprobs.js +++ b/public/scripts/logprobs.js @@ -374,6 +374,11 @@ function withVirtualWhitespace(text, span) { * @param {string | null} continueFrom - for 'continue' generations, the prompt */ export function saveLogprobsForActiveMessage(logprobs, continueFrom) { + if (!logprobs) { + // non-streaming APIs could return null data + return; + } + convertTokenIdLogprobsToText(logprobs); const msgId = chat.length - 1;