Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSEFormatException: Invalid sse format! ': ping #97

Closed
jialiu-github opened this issue Mar 5, 2024 · 1 comment
Closed

SSEFormatException: Invalid sse format! ': ping #97

jialiu-github opened this issue Mar 5, 2024 · 1 comment
Assignees

Comments

@jialiu-github
Copy link
Contributor

error message: "2024-03-05 10:07:20,046 [1749283] SEVERE - #cc.unitmesh.devti.util.LLMCoroutineScope - java.io.IOException: com.theokanning.openai.service.SSEFormatException: Invalid sse format! ': ping - 2024-03-05 02:07:20.310586'
java.lang.RuntimeException: java.io.IOException: com.theokanning.openai.service.SSEFormatException: Invalid sse format! ': ping - 2024-03-05 02:07:20.310586'"

Ide version: 232

phodal added a commit that referenced this issue Mar 5, 2024
Previously, the response body callback would crash when encountering an empty line followed by a non-null SSE instance, or when receiving a "ping" event. This commit adds a check to handle both scenarios gracefully by ignoring the "ping" events and resetting the SSE instance when an empty line is received. This ensures the stability and reliability of the response handling logic.
phodal added a commit that referenced this issue Mar 5, 2024
Refactored the Server Sent Event (SSE) parsing logic to handle edge cases better and make code cleaner. The new approach fixes #16 which involved adding checks on whether incoming events were `"ping":` or just starting with `":"` followed by "ping". It also added functionality to clear chat window before showing new messages while creating a new conversation using NewChatAction component. Made this change because it enhances user experience by providing smoother interaction between server push notifications and client display of those notifications. Modified these files accordingly as per suggestions from SonarLint analysis.
@phodal phodal self-assigned this Mar 5, 2024
@phodal
Copy link
Member

phodal commented Mar 5, 2024

Notes: SSE-Starlette support for ping event

sysid/sse-starlette#16

@phodal phodal closed this as completed Mar 5, 2024
phodal added a commit that referenced this issue Mar 5, 2024
Previously, the SSE parser did not correctly handle empty lines and comments, which could lead to parsing errors. This commit addresses the issue by skipping empty lines and treating lines starting with `:` as comments, as per the SSE format specification. This change ensures that the SSE parser is more robust and adheres to the standard.
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

No branches or pull requests

2 participants