[OpenAIComp] Add error handling for empty choices in parsed response
This commit is contained in:
parent
e17e54d921
commit
6ee7d7c96f
1 changed files with 4 additions and 0 deletions
|
|
@ -113,6 +113,10 @@ self.onmessage = async function(event) {
|
||||||
|
|
||||||
for (const parsedLine of parsedLines) {
|
for (const parsedLine of parsedLines) {
|
||||||
const { choices } = parsedLine;
|
const { choices } = parsedLine;
|
||||||
|
if (!choices || choices.length === 0) {
|
||||||
|
taLog.error("No choices found in parsed line: " + JSON.stringify(parsedLine));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const { delta } = choices[0];
|
const { delta } = choices[0];
|
||||||
const { content } = delta;
|
const { content } = delta;
|
||||||
// Update the UI with the new content
|
// Update the UI with the new content
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue