import { useState, useEffect } from 'react'; import { X, Snail, Rocket, SkipForward } from 'lucide-react'; interface WebGPUFallbackDialogProps { isOpen: boolean; onClose: () => void; onUseCPU: () => void; onSkip: () => void; nodeCount: number; } /** * Fun dialog shown when WebGPU isn't available * Lets user choose: CPU fallback (slow) or skip embeddings */ export const WebGPUFallbackDialog = ({ isOpen, onClose, onUseCPU, onSkip, nodeCount, }: WebGPUFallbackDialogProps) => { const [isAnimating, setIsAnimating] = useState(true); const [isVisible, setIsVisible] = useState(false); useEffect(() => { if (isOpen) { // Trigger animation after mount requestAnimationFrame(() => setIsVisible(true)); } else { setIsVisible(false); } }, [isOpen]); if (!isOpen) return null; // Estimate time based on node count (rough: ~50ms per node on CPU) const estimatedMinutes = Math.ceil((nodeCount * 50) / 60000); const isSmallCodebase = nodeCount < 200; return (
{/* Backdrop */}
{/* Dialog */}
{/* Header with scratching emoji */}
{/* Animated emoji */}
setIsAnimating(false)} onClick={() => setIsAnimating(true)} > 🤔

WebGPU said "nope"

Your browser doesn't support GPU acceleration

{/* Content */}

Couldn't create embeddings with WebGPU, so semantic search (Graph RAG) won't be as smart. The graph still works fine though!

Your options:

  • Use CPU — Works but {isSmallCodebase ? 'a bit' : 'way'} slower {nodeCount > 0 && ( (~{estimatedMinutes} min for {nodeCount} nodes) )}
  • Skip it — Graph works, just no AI semantic search
{isSmallCodebase && (

Small codebase detected! CPU should be fine.

)}

💡 Tip: Try Chrome or Edge for WebGPU support

{/* Actions */}
); };