improve servings parsing and AI failure logging

This commit is contained in:
vabene1111
2025-11-11 14:44:09 +01:00
parent bd2e9cc3d9
commit 748b91bb8a
2 changed files with 10 additions and 11 deletions

View File

@@ -2562,6 +2562,13 @@ class AiImportView(APIView):
'msg': "Error parsing AI results. Response Text:\n\n" + response_text
}
return Response(RecipeFromSourceResponseSerializer(context={'request': request}).to_representation(response), status=status.HTTP_400_BAD_REQUEST)
except Exception:
traceback.print_exc()
response = {
'error': True,
'msg': "Error processing AI results. Response Text:\n\n" + response_text + "\n\n" + traceback.format_exc()
}
return Response(RecipeFromSourceResponseSerializer(context={'request': request}).to_representation(response), status=status.HTTP_400_BAD_REQUEST)
else:
response = {
'error': True,