Skip to content

fix(openai): always include content field in streaming responses#8697

Closed
localai-bot wants to merge 1 commit intomudler:masterfrom
localai-bot:task_8546_fix
Closed

fix(openai): always include content field in streaming responses#8697
localai-bot wants to merge 1 commit intomudler:masterfrom
localai-bot:task_8546_fix

Conversation

@localai-bot
Copy link
Contributor

Description

This fixes issue #8546 where agentic coding tools (VS Code with Kilo Code, Roo Code, Zed) show empty chat responses.

The Problem

When using LocalAI with agentic coding tools, the models would generate responses but clients would show empty chat. The issue was in the streaming response handling where the content field was only included when deltaContent was non-empty:

if deltaContent != "" {
    delta.Content = &deltaContent
}

This caused the JSON response to omit the content field entirely when content was empty, which agentic tools interpret as an empty response.

The Fix

Always set the content field in streaming responses, even when empty. This ensures the JSON includes the content field with an empty string, which clients can properly interpret.

Related

Signed commits

  • Yes, I signed my commits

@netlify
Copy link

netlify bot commented Mar 1, 2026

Deploy Preview for localai ready!

Name Link
🔨 Latest commit 9f629ce
🔍 Latest deploy log https://app.netlify.com/projects/localai/deploys/69a591c120e6da0008d23b0b
😎 Deploy Preview https://deploy-preview-8697--localai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@localai-bot
Copy link
Contributor Author

Updates pushed with signed-off commit. This fix ensures the field is always present in streaming responses, even when empty, which resolves issue #8546 where agentic coding tools show empty responses.

@localai-bot
Copy link
Contributor Author

Pushed updates with properly signed-off commit. DCO check should now pass. Returning to IN_REVIEW.

@localai-bot
Copy link
Contributor Author

Pushed updates based on feedback/CI. Returning to IN_REVIEW.

This fixes issue mudler#8546 where agentic coding tools (VS Code with Kilo Code,
Roo Code, Zed) show empty chat responses. The issue is that when deltaContent
is empty, the content field was not being set in the JSON response, causing
agentic tools to interpret the response as empty.

The fix ensures the content field is always present in streaming responses,
even when empty, following the OpenAI API specification for proper client
compatibility.

Signed-off-by: team-coding-agent-1 <team-coding-agent-1@localai>
Signed-off-by: localai-bot <localai-bot@users.noreply.github.com>
@localai-bot
Copy link
Contributor Author

Rebased on upstream/master and pushed updates. Returning to IN_REVIEW.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants