Merge pull request #48 from auriti/fix/empty-string-content-delta
fix: handle empty string delta.content in OpenAI streaming
This commit is contained in:
@@ -373,8 +373,9 @@ async function* openaiStreamToAnthropic(
|
||||
for (const choice of chunk.choices ?? []) {
|
||||
const delta = choice.delta
|
||||
|
||||
// Text content
|
||||
if (delta.content) {
|
||||
// Text content — use != null to distinguish absent field from empty string,
|
||||
// some providers send "" as first delta to signal streaming start
|
||||
if (delta.content != null) {
|
||||
if (!hasEmittedContentStart) {
|
||||
yield {
|
||||
type: 'content_block_start',
|
||||
|
||||
Reference in New Issue
Block a user