import React, { useEffect, useState } from 'react'; import VideoGenerator from '../components/VideoGenerator'; import { Button } from '../components/ui/button'; import { useToast } from '@/hooks/use-toast'; import { Loader2 } from 'lucide-react'; import { Link } from 'wouter'; export default function VideoGenPage() { const { toast } = useToast(); const [isVideoAvailable, setIsVideoAvailable] = useState(null); const [isLoading, setIsLoading] = useState(true); useEffect(() => { const checkVideoStatus = async () => { try { const response = await fetch('/api/video-status'); if (response.ok) { const { isAvailable } = await response.json(); setIsVideoAvailable(isAvailable); if (!isAvailable) { toast({ title: "Video Generation Unavailable", description: "The video generation service is currently unavailable. You may need to add your Replicate API token.", variant: "destructive", }); } } else { throw new Error('Failed to check video generation status'); } } catch (error) { console.error('Error checking video generation status:', error); setIsVideoAvailable(false); toast({ title: "Service Error", description: "Failed to connect to the video generation service.", variant: "destructive", }); } finally { setIsLoading(false); } }; checkVideoStatus(); }, [toast]); return (

AI Video Generator

{isLoading ? (
Checking service availability...
) : isVideoAvailable ? ( ) : (

Video Generation Unavailable

The video generation service is currently unavailable. This may be due to:

  • Missing or invalid Replicate API token
  • Service outage or rate limiting
  • Network connectivity issues

To use this feature, you need to add a valid Replicate API token with access to the Wan-AI models.

)}
); }