Interface: HistoryConfig
Configuration for chat history persistence. When enabled, threads are persisted and can be restored from the thread list.
Example
const config: ElementsConfig = {
history: {
enabled: true,
showThreadList: true,
},
}Properties
enabled
enabled:
boolean
Whether to enable chat history persistence. When true, threads will be saved and can be loaded from the thread list.
Default
falseshowThreadList?
optionalshowThreadList:boolean
Whether to show the thread list sidebar/panel. Only applicable for widget and sidecar variants. Only applies when history is enabled.
Default
true when history.enabled is trueinitialThreadId?
optionalinitialThreadId:string
Initial thread ID to load when the component mounts. When provided, Elements will automatically load and switch to this thread. Useful for implementing chat sharing via URL parameters.
Example
// Read threadId from URL and pass to config
const searchParams = new URLSearchParams(window.location.search)
const threadId = searchParams.get('threadId')
<GramElementsProvider config={{
history: {
enabled: true,
initialThreadId: threadId ?? undefined,
},
}}>Last updated on