Spaces:
Runtime error
Runtime error
File size: 831 Bytes
900ee77 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | "use server";
import { auth } from "@/lib/auth";
import { headers } from "next/headers";
import { ShowcaseService } from "../services/showcase.service";
import { revalidatePath } from "next/cache";
export async function triggerAnalysisAction(videoId: string) {
const session = await auth.api.getSession({
headers: await headers()
});
// We allow anonymous triggering for now as per ingestion rules
const userId = session?.user?.id || null;
if (!videoId) return { success: false, error: "Video ID is required" };
console.log(`[triggerAnalysisAction] Triggering analysis for ${videoId}...`);
const result = await ShowcaseService.ingestAndAnalyze(videoId, userId, { skipAnalysis: false });
if (result.success) {
revalidatePath(`/showcase/${videoId}`);
}
return result;
}
|