```tsx
import {AiChat, PreDestroyCallback, PreDestroyEventDetails} from '@nlux/react';

export default () => {
    const callback = useCallback<ReadyCallback>(
        (preDestroyDetails: PreDestroyEventDetails) => {
            if (preDestroyDetails.conversationHistory > 0) {
                // Do something with the conversation history before it is destroyed
            }
        }, []
    );

    return (
        <AiChat
            adapter={adapter}
            events={{
                ready: callback,
            }}
        />
    );
};
```
