diff --git a/apiserver/plane/app/views/external/base.py b/apiserver/plane/app/views/external/base.py index de886bff811..6090c6bd17d 100644 --- a/apiserver/plane/app/views/external/base.py +++ b/apiserver/plane/app/views/external/base.py @@ -78,7 +78,7 @@ def post(self, request, slug, project_id): ) text, error = get_gpt_response(task, request.data.get("prompt", False), OPENAI_API_KEY, GPT_ENGINE) - if error: + if not text and error: return Response( {"error": "An internal error has occurred."}, status=status.HTTP_500_INTERNAL_SERVER_ERROR, @@ -120,7 +120,7 @@ def post(self, request, slug): ) text, error = get_gpt_response(task, request.data.get("prompt", False), OPENAI_API_KEY, GPT_ENGINE) - if error: + if not text and error: return Response( {"error": "An internal error has occurred."}, status=status.HTTP_500_INTERNAL_SERVER_ERROR,