Files
vibn-frontend/app/api/projects/[projectId]/plan/marketing/route.ts

31 lines
905 B
TypeScript

import { NextResponse } from 'next/server';
import { GeminiLlmClient } from '@/lib/ai/gemini-client';
import { runMarketingPlanning } from '@/lib/ai/marketing-agent';
export async function POST(
_request: Request,
{ params }: { params: Promise<{ projectId: string }> },
) {
try {
const { projectId } = await params;
if (!projectId) {
return NextResponse.json({ error: 'Missing projectId' }, { status: 400 });
}
const llm = new GeminiLlmClient();
const marketingPlan = await runMarketingPlanning(projectId, llm);
return NextResponse.json({ marketingPlan });
} catch (error) {
console.error('[plan/marketing] Failed to generate marketing plan', error);
return NextResponse.json(
{
error: 'Failed to generate marketing plan',
details: error instanceof Error ? error.message : String(error),
},
{ status: 500 },
);
}
}