mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-12-13 11:25:18 +00:00
fix(ai_handler): improve empty streaming response validation logic
This commit is contained in:
parent
31e25a5965
commit
74df3f8bd5
1 changed files with 5 additions and 3 deletions
|
|
@ -459,8 +459,10 @@ class LiteLLMAIHandler(BaseAiHandler):
|
|||
get_logger().error(f"Error handling streaming response: {e}")
|
||||
raise
|
||||
|
||||
if not full_response:
|
||||
get_logger().warning("Streaming response resulted in empty content")
|
||||
raise openai.APIError("Empty streaming response received")
|
||||
if not full_response and finish_reason is None:
|
||||
get_logger().warning("Streaming response resulted in empty content with no finish reason")
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue