'use client' import { useState } from 'react' import { useRouter } from 'next/navigation' import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from '@/components/ui/alert-dialog' import { Button } from '@/components/ui/button' import { AlertTriangle, ExternalLink } from 'lucide-react' import { useTranslation } from '@/lib/hooks/use-translation' interface EmbeddingModelChangeDialogProps { open: boolean onOpenChange: (open: boolean) => void onConfirm: () => void oldModelName?: string newModelName?: string } export function EmbeddingModelChangeDialog({ open, onOpenChange, onConfirm, oldModelName, newModelName }: EmbeddingModelChangeDialogProps) { const { t } = useTranslation() const router = useRouter() const [isConfirming, setIsConfirming] = useState(false) const handleConfirmAndRebuild = () => { setIsConfirming(true) onConfirm() // Give a moment for the model to update, then redirect setTimeout(() => { router.push('/advanced') onOpenChange(false) setIsConfirming(false) }, 500) } const handleConfirmOnly = () => { onConfirm() onOpenChange(false) } return (
{t('models.embeddingChangeTitle')}

{t('models.embeddingChangeConfirm') .replace('{from}', oldModelName || '...') .replace('{to}', newModelName || '...')}

{t('models.rebuildRequired')}

{t('models.rebuildReason')}

{t('models.whatHappensNext')}

  • {t('models.step1')}
  • {t('models.step2')}
  • {t('models.step3')}
  • {t('models.step4')}

{t('models.proceedToRebuildPrompt')}

{t('common.cancel')} {t('models.changeAndRebuild')}
) }