The useChatState hook is used for chat-based interaction with agents from your React application.

To initialize, you need to call the hook from inside your React component, passing the required arguments.

Arguments

client
Client
required

Your Scoopika client, initialized using @scoopika/client.

agent
Agent
required

Your Scoopika agent, initialized using @scoopika/client.

options
Object

Configuration options for the state:

  • session_id: The session ID for the current state. For more on sessions, see this page
  • scroll: A custom function to scroll to the bottom of the page while the agent is generating a response in real-time.