useThreadManager and useThreadListManager hooks with your app’s persistence logic.
useThreadManager
A Thread is a single conversation session, maintaining its own history and context. The ThreadManager, obtained via the useThreadManager hook, controls its state and actions.
Key configurations:
ThreadListManager
The
ThreadListManager object. For more information on how to get this object, see useThreadListManager.function
Load all messages for a specific thread.
function
Save message updates (e.g., after a form submission).
string
A backend endpoint (e.g.,
"/api/chat"). Thesys GenUI SDK does a POST request to this endpoint with the following three arguments in the request body. If you need to pass additional arguments, use the processMessage function.
Provide either processMessage or apiUrl.function
A custom function for more control over sending messages and receiving AI responses. Provide either
processMessage or apiUrl.The useThreadManager hook uses the Response object from this function to handle streaming updates to the UI.
useThreadListManager
The Thread List displays multiple conversation threads, typically in a sidebar. The ThreadListManager, from the useThreadListManager hook, manages this list.
Key configurations:
function
Fetch all thread list.
function
Create a new thread when the user sends the first message.
function
Delete a specific thread.
function
Update a thread’s metadata, like its title.
function
UI Callback function: called when a user selects a thread from the list.
function
UI Callback function: called to prepare for a new conversation.