Skip to content

Commit 47f7190

Browse files
committed
Add support for non-standard OpenAI responses sent by llama.cpp
1 parent c3daede commit 47f7190

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mikupad.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -2223,7 +2223,7 @@
22232223
};
22242224
}
22252225
} else {
2226-
const { choices } = await res.json();
2226+
const { content, choices } = await res.json();
22272227
if (choices?.[0].logprobs?.tokens) {
22282228
const logprobs = choices?.[0].logprobs;
22292229
const chunks = Object.values(logprobs.tokens).map((token, i) => {
@@ -2252,6 +2252,8 @@
22522252
}
22532253
} else if (choices?.[0].text) {
22542254
yield { content: choices[0].text };
2255+
} else if (content) { // llama.cpp specific?
2256+
yield { content: content };
22552257
}
22562258
}
22572259
}

0 commit comments

Comments
 (0)