From 538e3fc256f5878bb046a412f26ec2c27bd48a8e Mon Sep 17 00:00:00 2001 From: John Wang Date: Thu, 27 Jul 2023 16:14:45 +0800 Subject: [PATCH] fix: return message error in blocking mode (#657) --- api/services/completion_service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/services/completion_service.py b/api/services/completion_service.py index ac669997f7..6b8ee520eb 100644 --- a/api/services/completion_service.py +++ b/api/services/completion_service.py @@ -390,8 +390,8 @@ class CompletionService: result = json.loads(result) if result.get('error'): cls.handle_error(result) - - return cls.get_message_response_data(result.get('data')) + if 'data' in result: + return cls.get_message_response_data(result.get('data')) except ValueError as e: if e.args[0] != "I/O operation on closed file.": # ignore this error raise CompletionStoppedError()