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:
The
ThreadListManager object. For more information on how to get this object, see useThreadListManager.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.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:
By configuring these hooks with your service functions, you integrate your application’s data operations (like saving to or loading from the database) to enable persistent chat experiences.
For a detailed walkthrough of implementing service functions with a Firebase backend, see: