ThreadRuntime
useThreadRuntime
Get the thread runtime object:
ThreadRuntime
path:
The selector for the thread runtime.
composer:
The thread composer runtime.
getState:
Gets a snapshot of the thread state.
append:
Append a new message to the thread.
startRun:
subscribe:
cancelRun:
getModelContext:
getModelConfig:
export:
import:
getMesssageByIndex:
getMesssageById:
stopSpeaking:
unstable_on:
useThread
Access the thread state directly:
ThreadState
threadId:
The thread ID.
metadata:
The thread metadata.
isDisabled:
Whether the thread is disabled. Disabled threads cannot receive new messages.
isRunning:
Whether the thread is running. A thread is considered running when there is an active stream connection to the backend.
capabilities:
The capabilities of the thread, such as whether the thread supports editing, branch switching, etc.
messages:
The messages in the currently selected branch of the thread.
suggestions:
Follow up message suggestions to show the user.
extras:
Custom extra information provided by the runtime.
speech:
useThreadMessages
Work with the messages within a thread:
ThreadMessagesState
messages:
The messages in the thread.
useThreadViewport
Manage thread viewport state (e.g., scrolling):
ThreadViewportState
isAtBottom:
Whether the thread is at the bottom.
scrollToBottom:
A function to scroll to the bottom.
onScrollToBottom:
A function to subscribe to scroll to bottom events.