Represents the reactive chat resource, including current messages and control methods.
API
interface ChatResourceRef<Tools extends Chat.AnyTool> extends Resource<Chat.Message<string, Tools>[]> {generatingError: Signal <
Error | undefined
>;isGenerating: Signal <boolean>;isLoading: Signal <boolean>;isReceiving: Signal <boolean>;isRunningToolCalls: Signal <boolean>;isSending: Signal <boolean>;lastAssistantMessage: Signal <
Chat.AssistantMessage <string, Tools> | undefined
>;reload: () => boolean;sendingError: Signal <
Error | undefined
>;sendMessage: (message: Chat.UserMessage) => void;setMessages: (messages: Chat.Message<string, Tools>[]) => void;stop: (clearStreamingMessage?: boolean) => void;}@typeToolsChat.AnyToolSignal<Error | undefined>Error emitted during generation frames.
Signal<boolean>Indicates whether the chat is currently generating assistant output.
Signal<boolean>Aggregate loading flag across transport, generation, and tool calls.
Signal<boolean>Indicates whether the chat is currently receiving tokens.
Signal<boolean>Indicates whether the chat is running tool calls.
Signal<boolean>Indicates whether the chat is currently sending a user message.
Signal<Chat.AssistantMessage<string, Tools> | undefined>The last assistant message for the chat.
() => booleanRemove the last assistant response and re-send the previous user message. Returns true if a reload was performed.
Signal<Error | undefined>Transport/request error before generation frames arrive.
(message: Chat.UserMessage) => voidSend a new user message to the chat.
(messages: Chat.Message<string, Tools>[]) => voidReplace the current chat message history.
(clearStreamingMessage?: boolean) => voidStops any currently-streaming message.