refactor: simplify parse ingredients code
This commit is contained in:
@@ -36,4 +36,12 @@ const recipeSchema = z.object({
|
||||
notes: z.array(z.string()).describe("Optional notes about the recipe"),
|
||||
});
|
||||
|
||||
const noRecipeSchema = z.object({
|
||||
errorMessages: z.array(z.string()).describe(
|
||||
"List of error messages, if no recipe was found",
|
||||
),
|
||||
});
|
||||
|
||||
export const recipeResponseSchema = z.union([recipeSchema, noRecipeSchema]);
|
||||
|
||||
export default recipeSchema;
|
||||
|
||||
Reference in New Issue
Block a user