Skip to content

Commit

Permalink
fix: sometimes openai stream will stop but it's not failure
Browse files Browse the repository at this point in the history
  • Loading branch information
plateaukao committed Nov 22, 2024
1 parent 1bb64f6 commit d0d7562
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class ConfigManager(
var gptUserPromptForWebPage by StringPreference(
sp,
K_GPT_USER_PROMPT_WEB_PAGE,
"Summarize in 300 words:"
"Summarize in 50 words:"
)
var imageApiKey by StringPreference(sp, K_IMAGE_API_KEY, "")
var gptModel by StringPreference(sp, K_GPT_MODEL, "gpt-3.5-turbo")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ class OpenAiRepository : KoinComponent {

override fun onFailure(eventSource: EventSource, t: Throwable?, response: Response?) {
super.onFailure(eventSource, t, response)
failureAction()
if(response?.code == 200) {
doneAction()
this@OpenAiRepository.eventSource = null
} else {
failureAction()
}
}
})
}
Expand Down

0 comments on commit d0d7562

Please sign in to comment.