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

fix: chat stream returns an error response with a 'data: ' prefix #396

Merged
merged 4 commits into from
Jun 20, 2023

Conversation

liushuangls
Copy link
Contributor

@liushuangls liushuangls commented Jun 20, 2023

Occasionally, OpenAI may return the following error message:

data: {"error":{"message":"The server experienced an error while processing your request. We apologize for the inconvenience!", "type":"server_error", "param":null,"code":null)}

data: [DONE]

In such cases, the stream.Recv() function will return a successful status along with a zero-value response.

@liushuangls liushuangls changed the title fix: chat stream resp has 'data: ' prefix fix: chat stream error response has a 'data: ' prefix Jun 20, 2023
@liushuangls liushuangls changed the title fix: chat stream error response has a 'data: ' prefix fix: chat stream return error response has a 'data: ' prefix Jun 20, 2023
@codecov
Copy link

codecov bot commented Jun 20, 2023

Codecov Report

Merging #396 (abfcd5e) into master (b095938) will increase coverage by 0.05%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #396      +/-   ##
==========================================
+ Coverage   95.26%   95.32%   +0.05%     
==========================================
  Files          17       17              
  Lines         676      684       +8     
==========================================
+ Hits          644      652       +8     
  Misses         22       22              
  Partials       10       10              
Impacted Files Coverage Δ
stream_reader.go 100.00% <100.00%> (ø)

@liushuangls liushuangls changed the title fix: chat stream return error response has a 'data: ' prefix fix: chat stream returns an error response with a 'data: ' prefix Jun 20, 2023
Copy link
Owner

@sashabaranov sashabaranov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thank you!

@sashabaranov sashabaranov merged commit e948150 into sashabaranov:master Jun 20, 2023
3 checks passed
@liushuangls
Copy link
Contributor Author

@sashabaranov Please release it.

@pmilanez
Copy link

+1 for release it, i'm facing this problem and not been able to retry it based on the error

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.

None yet

3 participants