Skip to content

Conversation

@jherr
Copy link

@jherr jherr commented Sep 22, 2025

This adds a dialog that uses Chrome's built-in AI to set the colors, directions, etc.

CleanShot 2025-09-21 at 18 22 08@2x

You need to enable the AI feature using chrome://flags and enabling "Prompt API for Gemini Nano".

@netlify
Copy link

netlify bot commented Sep 22, 2025

Deploy Preview for hd-gradients ready!

Name Link
🔨 Latest commit ab781f8
🔍 Latest deploy log https://app.netlify.com/projects/hd-gradients/deploys/68d0bc5c8ed4b500084c0452
😎 Deploy Preview https://deploy-preview-117--hd-gradients.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@argyleink
Copy link
Owner

swift work! excited to try it

@argyleink
Copy link
Owner

I'm checking the deploy preview in Canary with the experiment enabled, found the button (which is white on white atm) but have this error in my console?

Error initializing AI: NotAllowedError: Requires a user gesture when availability is "downloading" or "downloadable"

Will look deeper, but wanted to share those initial impressions

@argyleink
Copy link
Owner

Fixed it locally, how do you prefer I get that code to you? Here's a summary:

What I changed:
•  Stop creating the model in onMount. We now only check availability there.
•  Added availability state to track 'downloadable' vs 'available'.
•  Added ensureSession(), which:
•  Runs only on a user action.
•  If availability is 'downloadable' or 'downloading', calls LanguageModel.create with a monitor to show download progress.
•  If 'available', creates the session immediately.
•  generateGradient() now calls ensureSession() first, so clicking Generate both satisfies the user-gesture requirement and handles any necessary model download before prompting.

I've got some button fixes too, mostly deleting styles.

@jherr
Copy link
Author

jherr commented Sep 22, 2025

Love it! I kinda figured this was more like a collab type deal. Thanks for joining in on the fun!

@argyleink
Copy link
Owner

it works sometimes 😅

  • transition hints seem to continuously be missed, even tho I added them to the zod schema
  • it hallucinates some invalid colors sometimes

things that feel fixable tho!

@argyleink
Copy link
Owner

jump in the discord and we can DM on it if you want?

argyleink and others added 2 commits September 21, 2025 19:59
but also, this code is looking way more complex than it needs to be
nits n' bobs to your coo pr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants