rjwignar / AIChefBot

Your AI-Powered Recipe Generator
https://ai-chef-bot.vercel.app
3 stars 0 forks source link

FINAL: Extract Image Generation Into new API Route #199

Closed rjwignar closed 6 months ago

rjwignar commented 6 months ago

This is an updated iteration of #192 that updates the loading screen animation when recipe generation is complete but the app is waiting for images to be generated.

These changes fix #189 (Extract generateRecipeImages() call into separate API route).

Changes from #192

When working on #192 I tried to implement the suggestion described in https://github.com/rjwignar/AIChefBot/pull/192#discussion_r1562468623: image

Problems with #192

My implementation of these suggestions added complications, such as considerations for caching recipes before/after recipe generation (resulting in 2 caching actions), and introduced UI bugs that would require complicated solutions.

Proposed Solution

This PR implements the alternative I proposed in https://github.com/rjwignar/AIChefBot/pull/192#discussion_r1563630807: image.

@kpunno's GENERATE_IMAGES env variable proposed in https://github.com/rjwignar/AIChefBot/pull/188, when finalized, can then be used to control whether to generate recipe images. When image generation is skipped, the loading animation will stop rendering and the recipe card list will be rendered instead.

When recipes are generated but we're awaiting images, the "Loading" message is replaced with "Almost ready" to let the user know their recipes are almost ready. We can update this message in the future. Preview available below: updatedLoadingScreenLoop

I based this branch off of 2fbce4c9426fee82ee928900f3bdf64fef6c362e, meaning this PR shares the same first 9 commits as #192. The Edge runtime support was already tested and reviewed in #192 The 2 new commits involve UI changes involving the loading animation. These changes can be tested by checking out my branch on your local machine.

vercel[bot] commented 6 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ai-chef-bot ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 15, 2024 2:10pm
ai-chef-bot-2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 15, 2024 2:10pm