import { Readable, Writable } from 'svelte/store'; import { M as Message, C as CreateMessage, U as UseChatOptions } from './types-f862f74a.js'; type UseChatHelpers = { /** Current messages in the chat */ messages: Readable; /** The error object of the API request */ error: Readable; /** * Append a user message to the chat list. This triggers the API call to fetch * the assistant's response. */ append: (message: Message | CreateMessage) => Promise; /** * Reload the last AI chat response for the given chat history. If the last * message isn't from the assistant, it will request the API to generate a * new response. */ reload: () => Promise; /** * Abort the current request immediately, keep the generated tokens if any. */ stop: () => void; /** * Update the `messages` state locally. This is useful when you want to * edit the messages on the client, and then trigger the `reload` method * manually to regenerate the AI response. */ setMessages: (messages: Message[]) => void; /** The current value of the input */ input: Writable; /** Form submission handler to automattically reset input and append a user message */ handleSubmit: (e: any) => void; /** Whether the API request is in progress */ isLoading: Writable; }; declare function useChat({ api, id, initialMessages, initialInput, sendExtraMessageFields, onResponse, onFinish, onError, headers, body }?: UseChatOptions): UseChatHelpers; export { CreateMessage, Message, UseChatHelpers, UseChatOptions, useChat };