ResetChat
The ResetChat
component provides a user interface element to reset the current conversation with the AI shopping assistant. It starts a new conversation by calling the resetChat
function from the useShoppingAssistant
hook, which initializes a fresh conversation session.
Overview
The ResetChat
component is a simple but essential utility component that allows users to start over with a clean conversation state. When triggered, it creates a new conversation ID and clears the current chat history, giving users a fresh start with the shopping assistant.
Usage
import { UnbxdShoppingAssistantWrapper } from "@unbxd-ui/react-shopping-assistant-hooks";
import { ResetChat, Chat } from "@unbxd-ui/react-shopping-assistant-components";
function ShoppingAssistantApp() {
return (
<UnbxdShoppingAssistantWrapper
siteKey="YOUR_SITE_KEY"
apiKey="YOUR_API_KEY"
>
<div className="chat-interface">
<ResetChat />
</div>
</UnbxdShoppingAssistantWrapper>
);
}
Props
- A custom component to render the reset button or interface element.
- The component receives an
onClick
function prop that triggers the conversation reset. - Use this to customize the appearance and behavior of the reset control.
- Default Value:
const defaultResetChatComponent = ({onClick}) => {
return (
<div className="reset-chat-component" onClick={onClick}>
Reset Chat
</div>
);
};