11import { NextResponse } from "next/server" ;
2- import { generateInfographic } from "@/lib/services/gemini-infographics" ;
2+ import { generateInfographic , generateFromScenePrompts } from "@/lib/services/gemini-infographics" ;
3+ import { getConfigValue } from "@/lib/config" ;
34
4- export const maxDuration = 60 ;
5+ export const maxDuration = 120 ;
6+
7+ export async function GET ( request : Request ) {
8+ const url = new URL ( request . url ) ;
9+ const mode = url . searchParams . get ( "mode" ) || "single" ;
510
6- export async function GET ( ) {
711 try {
8- console . log ( "[test-imagen] Starting test..." ) ;
12+ // Check what model name getConfigValue returns
13+ const configModel = await getConfigValue (
14+ "pipeline_config" , "infographicModel" , "imagen-4.0-fast-generate-001"
15+ ) ;
16+ console . log ( "[test-imagen] Config model:" , configModel ) ;
17+
18+ if ( mode === "config" ) {
19+ return NextResponse . json ( { configModel } ) ;
20+ }
21+
22+ if ( mode === "batch" ) {
23+ // Test the actual generateFromScenePrompts path with 2 prompts
24+ const result = await generateFromScenePrompts (
25+ [
26+ "Infographic 2D architecture style, black background. A simple server rack. Highlighted elements filled with #15b27b." ,
27+ "Infographic 2D architecture style, black background. A cloud with arrows. Highlighted elements filled with #15b27b." ,
28+ ] ,
29+ "Test Topic"
30+ ) ;
31+ return NextResponse . json ( {
32+ success : true ,
33+ horizontal : result . horizontal . length ,
34+ vertical : result . vertical . length ,
35+ errors : result . errors ,
36+ } ) ;
37+ }
38+
39+ // Single test
940 const result = await generateInfographic ( {
1041 prompt : "Infographic 2D architecture style, black background. A simple server rack. Highlighted elements filled with #15b27b." ,
1142 aspectRatio : "16:9" ,
@@ -14,6 +45,7 @@ export async function GET() {
1445 success : true ,
1546 mimeType : result . mimeType ,
1647 imageSize : result . imageBase64 . length ,
48+ configModel,
1749 } ) ;
1850 } catch ( err ) {
1951 console . error ( "[test-imagen] Error:" , err ) ;
0 commit comments