import { t } from 'i18next' import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '@/components/ui/dialog' import { Button } from '@/components/ui/button' import { useContextSizeApproval } from '@/hooks/useModelContextApproval' export default function OutOfContextPromiseModal() { const { isModalOpen, modalProps, setModalOpen } = useContextSizeApproval() if (!modalProps) { return null } const { onApprove, onDeny } = modalProps const handleContextLength = () => { onApprove('ctx_len') } const handleContextShift = () => { onApprove('context_shift') } const handleDialogOpen = (open: boolean) => { setModalOpen(open) if (!open) { onDeny() } } return ( {t('outOfContextError.title', 'Out of context error')} {t( 'outOfContextError.description', 'This chat is reaching the AI’s memory limit, like a whiteboard filling up. We can expand the memory window (called context size) so it remembers more, but it may use more of your computer’s memory. We can also truncate the input, which means it will forget some of the chat history to make room for new messages.' )}

{t( 'outOfContextError.increaseContextSizeDescription', 'Do you want to increase the context size?' )}
) }