You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add image generation tool with Gemini Flash model
Adds a generateImage tool that creates and edits images using Google
Gemini 2.5 Flash Image, with Supabase storage for persistence.
- Tool definition with prompt, aspectRatio, and sourceImageUrl params
- Server-side upload to Supabase storage (per-user/chat paths)
- Compact chat thumbnail (200px max) with always-visible download
- Lightbox preview with download, Escape-to-close, scroll lock
- Blob-based download to handle cross-origin Supabase URLs
- Tool UI registry integration and message persistence mapping
- Chat/research mode prompt routing for image intent
- Schema validation and test coverage
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@@ -125,6 +149,7 @@ You are a fast, efficient AI assistant optimized for quick responses. You have a
125
149
**INTENT ROUTING (check FIRST before anything else):**
126
150
Before starting any search or research, determine the user's primary intent:
127
151
- **BUILD/CREATE request** — the user wants you to build, create, make, generate, or design an interactive app, widget, dashboard, tracker, tool, calculator, visualization, game, demo, timer, or chart → **Skip search entirely.** Go directly to the CANVAS ARTIFACTS section below. CALL the \`createCanvasArtifact\` tool immediately for specific requests, or run the Artifact Intake Protocol for broad/open requests. Do NOT search the web first — the user wants you to write code, not find information.
152
+
- **IMAGE request** — the user wants you to generate, draw, create, illustrate, or visualize an image/picture/photo/illustration → **Call \`generateImage\` tool directly.** Do NOT search first unless the user needs factual reference.
128
153
- **MODIFY/UPDATE request** — the user wants to change, fix, improve, or add to an existing artifact → **Skip search.** If the artifact source code is not in the conversation context, CALL \`readCanvasArtifact\` first. Then CALL \`updateCanvasArtifact\` with the full replacement file set.
129
154
- **RESEARCH-THEN-BUILD request** — the user wants to learn about a topic AND build something based on the findings (e.g., "research React dashboard best practices and then build me one") → Perform the research phase first (search, gather information), then proceed to canvas artifact tools to build the artifact.
130
155
- **FACTUAL/CURRENT-DATA ARTIFACT request** — the user wants to build an artifact that depends on specific entities, freshness, dates, statistics, or other current facts → run a short search phase first, then build the artifact.
@@ -330,7 +355,9 @@ Call the displayTable tool with the comparison data, then continue:
330
355
331
356
End with a synthesizing conclusion that ties the main points together into a clear overall picture.
332
357
333
-
${getCanvasArtifactsPrompt()}`
358
+
${getCanvasArtifactsPrompt()}
359
+
360
+
${getImageGenerationPrompt()}`
334
361
}
335
362
336
363
exportfunctiongetResearchModePrompt(): string{
@@ -660,7 +687,9 @@ Flexible example:
660
687
661
688
Conclude with a brief synthesis that ties together the main insights into a clear overall understanding.
662
689
663
-
${getCanvasArtifactsPrompt()}`
690
+
${getCanvasArtifactsPrompt()}
691
+
692
+
${getImageGenerationPrompt()}`
664
693
}
665
694
666
695
// Export static prompts for backward compatibility
0 commit comments