Skip to content

Commit

Permalink
Handle null completion_probabilities correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
lmg-anon authored Dec 16, 2024
1 parent 30cb897 commit d99de77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mikupad.html
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,7 @@
if (!res.ok)
throw new Error(`HTTP ${res.status}`);
for await (const chunk of parseEventStream(res.body)) {
const probs = chunk.completion_probabilities[0]?.probs ?? [];
const probs = chunk.completion_probabilities?.[0]?.probs ?? [];
const prob = probs.find(p => p.tok_str === chunk.content)?.prob;
yield {
content: chunk.content,
Expand Down

0 comments on commit d99de77

Please sign in to comment.