[OpenAIComp] Add error handling for empty choices in parsed response

This commit is contained in:
mic 2025-06-10 08:09:37 +02:00
parent e17e54d921
commit 6ee7d7c96f

View file

@ -113,6 +113,10 @@ self.onmessage = async function(event) {
for (const parsedLine of parsedLines) {
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 { content } = delta;
// Update the UI with the new content