More null checks for llamacpp logprobs parser

4232f6c5f45ce82985781207b0493e781ef41bf8

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

1 files changed, +4 -2Showing whitespace changes
public/scripts/textgen-settings.js+4 -2
@@ -1039,11 +1039,13 @@ export function parseTextgenLogprobs(token, logprobs) {
10391039 return { token, topLogprobs: candidates };
10401040 }
10411041 case LLAMACPP: {
1042- /** @type {Record<string, number>[]} */
10431042 if (!logprobs?.length) {
10441043 return null;
10451044 }
10461045 const candidates = logprobs?.[0]?.probs?.map(x => [x.tok_str, x.prob]);
1046+ if (!candidates) {
1047+ return null;
1048+ }
10471049 return { token, topLogprobs: candidates };
10481050 }
10491051 default: