Skip to content

Commit

Permalink
Throw error in SSE event stream
Browse files Browse the repository at this point in the history
  • Loading branch information
lmg-anon authored Dec 16, 2024
1 parent d99de77 commit 8f56183
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mikupad.html
Original file line number Diff line number Diff line change
Expand Up @@ -1606,6 +1606,9 @@
break;
}
const json = JSON.parse(data);
if (json.error?.message) {
throw new Error(json.error.message);
}
// Both Chrome and Firefox suck at debugging
// text/event-stream, so make it easier by logging events
if (window.logSSEEvents) {
Expand Down Expand Up @@ -2017,6 +2020,7 @@
function openaiConvertOptions(options, endpoint){
const isOpenAI = endpoint.toLowerCase().includes("openai.com");
const isTogetherAI = endpoint.toLowerCase().includes("together.xyz");
const isOpenRouter = endpoint.toLowerCase().includes("openrouter.ai");
const swapOption = (lhs, rhs) => {
if (lhs in options) {
options[rhs] = options[lhs];
Expand Down

0 comments on commit 8f56183

Please sign in to comment.