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>;isLoadingThread: Signal <boolean>;isReceiving: Signal <boolean>;isRunningToolCalls: Signal <boolean>;isSavingThread: 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;threadLoadError: Signal <
| {
error: string;
stacktrace?: string;
}
| undefined
>;threadSaveError: Signal <
| {
error: string;
stacktrace?: string;
}
| undefined
>;}@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, tool calls, and thread load/save.
Signal<boolean>Indicates whether a thread load request is in flight.
Signal<boolean>Indicates whether the chat is currently receiving tokens.
Signal<boolean>Indicates whether the chat is running tool calls.
Signal<boolean>Indicates whether a thread save request is in flight.
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.
Signal<{
error: string;
stacktrace?: string;
} | undefined>Thread loading error, if present.
Signal<{
error: string;
stacktrace?: string;
} | undefined>Thread saving error, if present.