diff --git a/public/scripts/logprobs.js b/public/scripts/logprobs.js index fa7ff0d15..17c0584a3 100644 --- a/public/scripts/logprobs.js +++ b/public/scripts/logprobs.js @@ -519,14 +519,14 @@ function convertTokenIdLogprobsToText(input) { const tokenizerId = getTokenizerBestMatch(api); - // Flatten unique token IDs across all logprobs + /** @type {any[]} Flatten unique token IDs across all logprobs */ const tokenIds = Array.from(new Set(input.flatMap(logprobs => logprobs.topLogprobs.map(([token]) => token).concat(logprobs.token), ))); // Submit token IDs to tokenizer to get token text, then build ID->text map // noinspection JSCheckFunctionSignatures - mutates input in-place - const { chunks } = decodeTextTokens(tokenizerId, tokenIds.map(parseInt)); + const { chunks } = decodeTextTokens(tokenizerId, tokenIds); const tokenIdText = new Map(tokenIds.map((id, i) => [id, chunks[i]])); // Fixup logprobs data with token text