forked from open-webui/open-webui
fix: do not error out if OpenAI response has no delta
This commit is contained in:
parent
510afab37c
commit
615e9e348f
1 changed files with 1 additions and 1 deletions
|
@ -36,7 +36,7 @@ async function* openAIStreamToIterator(
|
||||||
const data = JSON.parse(line.replace(/^data: /, ''));
|
const data = JSON.parse(line.replace(/^data: /, ''));
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
yield { done: false, value: data.choices[0].delta.content ?? '' };
|
yield { done: false, value: data.choices?.[0]?.delta?.content ?? '' };
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Error extracting delta from SSE event:', e);
|
console.error('Error extracting delta from SSE event:', e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue