Skip to main content

UseChatResult

@gravity-rail/react


@gravity-rail/react / UseChatResult

Interface: UseChatResult

Properties​

error​

error: Error | undefined


isLoading​

isLoading: boolean

True while start is creating the chat / waiting for the greeting.


isStreaming​

isStreaming: boolean


messages​

messages: ChatMessage[]


reset()​

reset: () => void

Discard the current chat and start a fresh one (re-bootstraps the greeting).

Returns​

void


sendMessage()​

sendMessage: (text) => Promise<void>

Parameters​

text​

string

Returns​

Promise<void>


start()​

start: () => Promise<void>

Create the chat and load its greeting + suggestions. Idempotent.

Returns​

Promise<void>


suggestions​

suggestions: string[]

Suggested replies from the latest assistant message (rendered as chips).