Fixed crash when top_logprobs is empty. (#4680) Co-authored-by: user <user@exmaple.com>

19c4aea25ab4621a2a194646a82bbc989a7804e5

DeclineThyself <FallenHaze@tutamail.com>

Signed
1 files changed, +1 -1Ignore whitespace
public/scripts/openai.js+1 -1
@@ -2748,7 +2748,7 @@ function parseOpenAIChatLogprobs(logprobs) {
27482748 /** @type {(x: { token: string, logprob: number }) => [string, number]} */
27492749 const toTuple = (x) => [x.token, x.logprob];
27502750
27512751 return content.map(({ token, logprob, top_logprobs = [] }) => {
27522752 // Add the chosen token to top_logprobs if it's not already there, then
27532753 // convert to a list of [token, logprob] pairs
27542754 const chosenTopToken = top_logprobs.some((top) => token === top.token);