mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
More null checks for llamacpp logprobs parser
This commit is contained in:
@ -1039,11 +1039,13 @@ export function parseTextgenLogprobs(token, logprobs) {
|
||||
return { token, topLogprobs: candidates };
|
||||
}
|
||||
case LLAMACPP: {
|
||||
/** @type {Record<string, number>[]} */
|
||||
if (!logprobs?.length) {
|
||||
return null;
|
||||
}
|
||||
const candidates = logprobs[0].probs.map(x => [x.tok_str, x.prob]);
|
||||
const candidates = logprobs?.[0]?.probs?.map(x => [x.tok_str, x.prob]);
|
||||
if (!candidates) {
|
||||
return null;
|
||||
}
|
||||
return { token, topLogprobs: candidates };
|
||||
}
|
||||
default:
|
||||
|
Reference in New Issue
Block a user