Gemini Image Generation in Workshop Chat #19
Reference in New Issue
Block a user
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?
What & Why
Timmy can currently only respond with text. Enabling image generation via Gemini lets visitors ask Timmy to create visuals (concept art, diagrams, illustrations) as part of their Workshop sessions. Opens a new category of creative work and makes the 'capable AI agent' persona credible.
Done looks like
/api/gemini/generate-image)Out of scope
Tasks
media_type: "image"and route to Gemini image path.job_mediatable (job_id, media_type, data, created_at, expires_at) with 7-day expiry./api/jobs/:id/mediato serve the image; include URL in job completion WebSocket event.Relevant files
artifacts/api-server/src/routes/gemini.tsartifacts/api-server/src/lib/agent.tsartifacts/api-server/src/routes/jobs.tsartifacts/api-server/src/lib/pricing.tsthe-matrix/js/ui.jsthe-matrix/js/session.jsPR created: http://143.198.27.163:3000/replit/timmy-tower/pulls/110
Implemented all 4 tasks from the issue:
detectImageRequest()regex matches draw/illustrate/visualize/create an image of etc.; image jobs flagged withmedia_type: "image"during evaljob_mediatable (migration 0010) stores base64 image data with 7-day TTL; works for both standalone jobs and session requestsGET /api/jobs/:id/mediaserves job images;GET /api/sessions/:id/requests/:requestId/mediaserves session request images; URLs included in job completion events and session responsesmediaType: imagein responses, fetches from mediaUrl, renders inline with styled container and download buttonBonus: Image pricing uses a flat rate (default $0.04 via
IMAGE_GENERATION_FLAT_RATE_USD); estimate endpoint returns image-specific pricing; Gemini stub mode returns placeholder PNG when credentials are absent.