Skip to content

Conversation

@xavierliang
Copy link

This Pull Request addresses an issue where messages were rendered incorrectly when receiving a streaming response from the Gemini CLI. Previously, each data chunk of the response was incorrectly displayed as a new message with its own timestamp.

This update ensures that streaming responses are smoothly and correctly appended to a single message through the following changes:

  • Implemented Stream-Append Logic: Modified the gemini-response event handler to append subsequent data chunks to the last message instead of creating new ones.
  • Corrected Timestamps: Ensured that a single, complete streaming response generates only one timestamp, avoiding the clutter of new timestamps for each data chunk.
  • Handled Error Stream: Integrated the standard error (stderr) from the Gemini CLI into the message stream to ensure error messages are displayed promptly.
  • Ensured Final Consistency: After the streaming response is complete, the session messages are re-fetched to guarantee that the content displayed in the UI is perfectly consistent with the final, complete message.

- Handle stderr from Gemini CLI as part of the standard message stream to ensure errors are displayed.
- Refetch session messages after stream completion to guarantee UI consistency and display the full, correct message.
- Append streaming message chunks to the last message to prevent unwanted newlines.
- Avoid creating new timestamps for each message chunk, ensuring only one timestamp per complete message.
- Modified the `gemini-response` handler to append text chunks to the last message.
- This ensures that streaming updates are rendered correctly within a single message block, preventing unwanted newlines and timestamps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant