mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-15 18:20:37 +08:00
fix(ai_handler): improve empty streaming response validation logic
This commit is contained in:
@ -459,8 +459,10 @@ class LiteLLMAIHandler(BaseAiHandler):
|
|||||||
get_logger().error(f"Error handling streaming response: {e}")
|
get_logger().error(f"Error handling streaming response: {e}")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
if not full_response:
|
if not full_response and finish_reason is None:
|
||||||
get_logger().warning("Streaming response resulted in empty content")
|
get_logger().warning("Streaming response resulted in empty content with no finish reason")
|
||||||
raise openai.APIError("Empty streaming response received")
|
raise openai.APIError("Empty streaming response received without proper completion")
|
||||||
|
elif not full_response and finish_reason:
|
||||||
|
get_logger().debug(f"Streaming response resulted in empty content but completed with finish_reason: {finish_reason}")
|
||||||
|
|
||||||
return full_response, finish_reason
|
return full_response, finish_reason
|
||||||
|
Reference in New Issue
Block a user