Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎉 Automatic alt text for cloudflare images #4261

Merged
merged 2 commits into from
Dec 6, 2024

Conversation

ikesau
Copy link
Member

@ikesau ikesau commented Dec 6, 2024

automatic.alt.text.mp4

Changes:

  • New API route, admin UI, and helper function to generate alt text for an image from OpenAI
  • Makes alt text nullable in the DB
  • Fixes some other issues with the CF images migration

@ikesau ikesau requested a review from rakyi December 6, 2024 00:01
@ikesau ikesau self-assigned this Dec 6, 2024
border: 1px solid #ccc;
width: 100%;
&.ImageIndexPage__alt-text-editor--should-autosize {
field-sizing: content;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only supported in chrome as of now, but I think that's the browser most of the authors use.

@owidbot
Copy link
Contributor

owidbot commented Dec 6, 2024

Quick links (staging server):

Site Dev Site Preview Admin Wizard Docs

Login: ssh owid@staging-site-cloudflare-images-alt-text

SVG tester:

Number of differences (default views): 0 ✅
Number of differences (all views): 0 ✅

Edited: 2024-12-06 00:13:41 UTC
Execution time: 1.42 seconds

Copy link
Contributor

@rakyi rakyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool feature! 🙂

I'm not sure how important it is to fix/improve the state synchronization with useEffect.

console.error(
`Error fetching GPT alt text for image ${imageId}`,
error
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of scope of this PR, but it's unfortunate if we currently have to effectively log the error twice to surface/log it properly. This shouldn't be necessary, in general.

adminSiteClient/ImagesIndexPage.tsx Outdated Show resolved Hide resolved
@ikesau ikesau merged commit c7193b2 into cloudflare-images Dec 6, 2024
11 of 14 checks passed
@ikesau ikesau deleted the cloudflare-images-alt-text branch December 6, 2024 22:24
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.

3 participants