feat: OpenAI Custom Headers/Params and Debug Page (#4227)

Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
Michael Genson
2024-09-23 04:04:36 -05:00
committed by GitHub
parent 7c274de778
commit ea1f727a8b
20 changed files with 277 additions and 17 deletions

View File

@@ -487,7 +487,13 @@ class OpenAIRecipeService(RecipeServiceBase):
if translate_language:
message += f" Please translate the recipe to {translate_language}."
response = await openai_service.get_response(prompt, message, images=openai_images, force_json_response=True)
try:
response = await openai_service.get_response(
prompt, message, images=openai_images, force_json_response=True
)
except Exception as e:
raise Exception("Failed to call OpenAI services") from e
try:
openai_recipe = OpenAIRecipe.parse_openai_response(response)
recipe = self._convert_recipe(openai_recipe)