Represents the reactive chat resource, including current messages and control methods.
@interface ChatResourceRef @template Tools @extends {Resource<Chat.Message<string, Tools>[]>} @property {(message: Chat.UserMessage) => void} sendMessage - Send a new user message to the chat. @property {() => boolean} reload - Remove the last assistant response and re-send the previous user message. Returns true if a reload was performed.
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
@type
Tools
Chat.AnyTool