diff --git a/ee/tabby-webserver/src/service/answer.rs b/ee/tabby-webserver/src/service/answer.rs index 3813d7016283..ef190686d226 100644 --- a/ee/tabby-webserver/src/service/answer.rs +++ b/ee/tabby-webserver/src/service/answer.rs @@ -172,14 +172,14 @@ impl AnswerService { let chunk = match chunk { Ok(chunk) => chunk, Err(err) => { - if let OpenAIError::StreamError(content) = err { + if let OpenAIError::StreamError(content) = &err { if content == "Stream ended" { break; } - } else { - error!("Failed to get chat completion chunk: {:?}", err); } - break; + error!("Failed to get chat completion chunk: {:?}", err); + yield Err(anyhow!("Failed to get chat completion chunk: {:?}", err).into()); + return; } };