Skip to content

feat: Gemini infographic generation service (Task 4 — Imagen 4 Fast)#627

Merged
codercatdev merged 1 commit intodevfrom
feat/gemini-infographics-clean
Mar 5, 2026
Merged

feat: Gemini infographic generation service (Task 4 — Imagen 4 Fast)#627
codercatdev merged 1 commit intodevfrom
feat/gemini-infographics-clean

Conversation

@codercatdev
Copy link
Contributor

Task 4: Gemini Infographic Generation Service

Replaces closed PR #626 (which had a scope violation — included @research's gemini-research.ts from sandbox contamination).

Single file: lib/services/gemini-infographics.ts (~280 lines)

API Surface

Function Purpose
generateInfographic(request, model?) Generate a single infographic image via Imagen
generateInfographicBatch(requests, options?) Generate multiple infographics with per-item error handling
generateInfographicsForTopic(topic, briefing?) Main entry point for Sprint 3 — reads instructions from contentConfig.infographicInstructions, generates all infographics with deterministic seeds
buildInfographicPrompt(topic, style?) Build a brand-consistent prompt from a topic string

Config Integration

  • Model: pipelineConfig.infographicModel (default: imagen-4-fast, $0.02/image)
  • Instructions: contentConfig.infographicInstructions (default: 5 blueprint-style prompts)
  • Both use getConfigValue() with env var fallbacks

Key Features

  • Deterministic seeds from topic + index hash — same topic always produces same seeds for brand consistency
  • Fault isolation — each image in its own try/catch, failures collected in errors array
  • Lazy SDK initGoogleGenAI client created on first use, not at import time
  • Blueprint-style defaults — 5 hand-drawn/whiteboard prompts matching the CodingCat.dev brand spec
  • 16:9 aspect ratio default — matches video pipeline output

Cost

$0.02/image × 5 instructions = **$0.10 per topic**

Types Exported

InfographicResult, InfographicRequest, InfographicBatchOptions, InfographicBatchResult

Scope

✅ Only lib/services/gemini-infographics.ts — no other files touched.

New service lib/services/gemini-infographics.ts (~280 lines):
- generateInfographic() for single image generation
- generateInfographicBatch() for batch with per-item error handling
- generateInfographicsForTopic() reads instructions from contentConfig
- buildInfographicPrompt() for brand-consistent prompts
- Deterministic seeds from topic+index for brand consistency
- Reads model from pipelineConfig.infographicModel (default: imagen-4-fast)
- ~$0.02/image, ~$0.10 for 5 infographics per topic
@vercel
Copy link

vercel bot commented Mar 5, 2026

Deployment failed with the following error:

Resource is limited - try again in 8 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/alex-pattersons-projects?upgradeToPro=build-rate-limit

@codercatdev codercatdev merged commit d698231 into dev Mar 5, 2026
0 of 2 checks passed
@codercatdev codercatdev deleted the feat/gemini-infographics-clean branch March 5, 2026 19:25
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.

1 participant