Represents the reactive chat resource, including current messages and control methods.
API
interface ChatResourceRef<Tools extends Chat.AnyTool> extends Resource<Chat.Message<string, Tools>[]> {lastAssistantMessage: Signal <
Chat.AssistantMessage <string, Tools> | undefined
>;reload: () => boolean;sendMessage: (message: Chat.UserMessage) => void;stop: (clearStreamingMessage?: boolean) => void;}ChatResourceRef
@typeToolsChat.AnyToollastAssistantMessage
Signal<Chat.AssistantMessage<string, Tools> | undefined>The last assistant message for the chat.
reload
() => booleanRemove the last assistant response and re-send the previous user message. Returns true if a reload was performed.
sendMessage
(message: Chat.UserMessage) => voidSend a new user message to the chat.
stop
(clearStreamingMessage?: boolean) => voidStops any currently-streaming message.