Integrate xAI Grok image generation into build pipeline for article hero images #37
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
scripts/gen-placeholder.tsexists as a stopgap but the intended solution is xAI Grok image generation. There is no integration between the article build pipeline and the xAI image API.Correct approach
Use xAI's grok-imagine-image model to auto-generate hero images for new articles during build:
hero.srcpath but no file found atpublic/This replaces the manual
gen-placeholder.tsapproach.Resources
grok-image-generationskill{ "model": "grok-imagine-image", "prompt": "...", "n": 1 }Suggested fix
Create a
scripts/generate-hero-images.tsthat:public/<hero.src>as WebPNo automated hero image generation in build pipelineto Integrate xAI Grok image generation into build pipeline for article hero imagesImplemented in commit
cec9db6. Createdscripts/gen-hero-images.tswhich uses yaml frontmatter parsing and xAI grok-imagine-image API to generate missing hero images. Addedimages:generatescript to package.json and wired it into the build pipeline after generate-sitemap. The script scans all articles, skips existing hero files, generates prompts from article metadata, calls the xAI API with 1.5s rate limiting, and saves WebP outputs to public/. Verified it runs cleanly — 12 articles scanned, all existing heroes detected.