import { AnimatePresence, motion } from 'framer-motion'; import type { LlmErrorAlertType } from '~/types/actions'; import { classNames } from '~/utils/classNames'; interface Props { alert: LlmErrorAlertType; clearAlert: () => void; } export default function LlmErrorAlert({ alert, clearAlert }: Props) { const { title, description, provider, errorType } = alert; const getErrorIcon = () => { switch (errorType) { case 'authentication': return 'i-ph:key-duotone'; case 'rate_limit': return 'i-ph:clock-duotone'; case 'quota': return 'i-ph:warning-circle-duotone'; default: return 'i-ph:warning-duotone'; } }; const getErrorMessage = () => { switch (errorType) { case 'authentication': return `Authentication failed with ${provider}. Please check your API key.`; case 'rate_limit': return `Rate limit exceeded for ${provider}. Please wait before retrying.`; case 'quota': return `Quota exceeded for ${provider}. Please check your account limits.`; default: return 'An error occurred while processing your request.'; } }; return (
{title}

{getErrorMessage()}

{description && (
Error Details: {description}
)}
); }