'use client'; import { useEffect, useState } from 'react'; import Link from 'next/link'; import { Header } from '@/components/header'; import { AppLayout } from '@/components/layout'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { apiClient } from '@/lib/api'; import { ImagePlus, Image, Sparkles, Settings, Activity, ArrowRight, CheckCircle2, XCircle } from 'lucide-react'; const features = [ { title: 'Text to Image', description: 'Generate stunning images from text descriptions using Stable Diffusion', icon: ImagePlus, href: '/text2img', color: 'text-blue-500', }, { title: 'Image to Image', description: 'Transform existing images with AI-powered modifications', icon: Image, href: '/img2img', color: 'text-purple-500', }, { title: 'Upscaler', description: 'Enhance and upscale your images for higher quality results', icon: Sparkles, href: '/upscaler', color: 'text-green-500', }, { title: 'Model Management', description: 'Load, unload, and manage your AI models efficiently', icon: Settings, href: '/models', color: 'text-orange-500', }, { title: 'Queue Monitor', description: 'Track and manage your generation jobs in real-time', icon: Activity, href: '/queue', color: 'text-pink-500', }, ]; export default function HomePage() { const [health, setHealth] = useState<'checking' | 'healthy' | 'error'>('checking'); const [systemInfo, setSystemInfo] = useState(null); useEffect(() => { checkHealth(); loadSystemInfo(); }, []); const checkHealth = async () => { try { await apiClient.getHealth(); setHealth('healthy'); } catch (err) { setHealth('error'); } }; const loadSystemInfo = async () => { try { const info = await apiClient.getSystemInfo(); setSystemInfo(info); } catch (err) { console.error('Failed to load system info:', err); } }; return (
{/* Status Banner */}
{health === 'checking' ? ( <>
Checking API status... ) : health === 'healthy' ? ( <> API is running ) : ( <> Cannot connect to API )}
{systemInfo && (
{systemInfo.version && v{systemInfo.version}} {systemInfo.cuda_available !== undefined && ( CUDA: {systemInfo.cuda_available ? 'Available' : 'Not Available'} )}
)} {/* Welcome Section */}

Welcome to SD REST UI

A modern, intuitive interface for Stable Diffusion image generation

{/* Features Grid */}
{features.map((feature) => (
{feature.title}
{feature.description}
))}
{/* Quick Start Guide */} Quick Start Guide Get started with image generation in a few simple steps
1

Load a Model

Navigate to Model Management and load your preferred checkpoint

2

Choose Generation Type

Select Text to Image, Image to Image, or Upscaler

3

Generate & Monitor

Start generation and track progress in the Queue Monitor

{/* API Info */} API Configuration Backend API connection details
API URL:
{process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8080'}
Base Path:
{process.env.NEXT_PUBLIC_API_BASE_PATH || '/api/v1'}
Status:
{health === 'healthy' ? ( Connected ) : health === 'error' ? ( Disconnected ) : ( Checking... )}
); }