"...git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "ec6f53e29837440da799afe3b51e9d03ef56262a"
Commit 615e9e34 authored by Jun Siang Cheah's avatar Jun Siang Cheah
Browse files

fix: do not error out if OpenAI response has no delta

parent 510afab3
...@@ -36,7 +36,7 @@ async function* openAIStreamToIterator( ...@@ -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);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment