Skip to content

Commit

Permalink
Add support for non-standard OpenAI responses sent by llama.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
lmg-anon committed Dec 26, 2024
1 parent c3daede commit 47f7190
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mikupad.html
Original file line number Diff line number Diff line change
Expand Up @@ -2223,7 +2223,7 @@
};
}
} else {
const { choices } = await res.json();
const { content, choices } = await res.json();
if (choices?.[0].logprobs?.tokens) {
const logprobs = choices?.[0].logprobs;
const chunks = Object.values(logprobs.tokens).map((token, i) => {
Expand Down Expand Up @@ -2252,6 +2252,8 @@
}
} else if (choices?.[0].text) {
yield { content: choices[0].text };
} else if (content) { // llama.cpp specific?
yield { content: content };
}
}
}
Expand Down

0 comments on commit 47f7190

Please sign in to comment.