import { SearchIndexToolType, RecommendToolType, DisplayResultsToolType, CompareProductsToolType, GroupedResultsToolType } from '../../lib/chat'; import type { ChatRenderState, ChatConnectorParams, ChatWidgetDescription } from '../../connectors/chat/connectChat'; import type { WidgetFactory, Hit, TemplateWithBindEvent, BaseHit, Template, IndexUiState } from '../../types'; import type { ChatClassNames, ChatComponentPropsWithContext, ChatEmptyProps, ChatHeaderProps, ChatLayoutOwnProps, ChatMessageActionProps, ChatMessageBase, ChatMessageErrorProps, ChatMessageLoaderPropsWithContext, ChatMessageReasoningComponentProps, ChatMessageTextComponentProps, ChatMessagesProps, ChatMessagesTranslations, ChatPromptProps, ClientSideToolComponentProps, RecordWithObjectID, UserClientSideTool } from 'instantsearch-ui-components'; export { SearchIndexToolType, RecommendToolType, DisplayResultsToolType, CompareProductsToolType, GroupedResultsToolType, }; export type ClientSideToolTemplateData = ClientSideToolComponentProps; export type UserClientSideToolTemplates = Partial<{ layout: TemplateWithBindEvent; }>; type UserClientSideToolWithTemplate = Omit & { templates: UserClientSideToolTemplates; }; type UserClientSideToolsWithTemplate = Record; export type Tool = UserClientSideToolWithTemplate; export type Tools = UserClientSideToolsWithTemplate; export type ChatCSSClasses = Partial; export type ChatLayoutTemplateData = Omit & { templates: { header: () => JSX.Element; messages: () => JSX.Element; prompt: () => JSX.Element; }; }; export type ChatTemplates = BaseHit> = Partial<{ /** * Custom layout template for the chat widget. */ layout: Template; /** * Template to use for each result. This template will receive an object containing a single record. */ item: TemplateWithBindEvent>; /** * Custom loader template for the chat widget. */ loader: Template; /** * Text to display in the loader. Pass a function to label the wait by what * the turn is doing, e.g. `({ phase }) => phase === 'tool' ? 'Searching…' : 'Thinking…'`. */ loaderText: ChatMessagesTranslations['loaderText']; /** * Templates to use for the header. */ header: Partial<{ /** * Template to use for the chat header. */ layout: Template; /** * Optional close icon */ closeIcon: Template; /** * Optional minimize icon */ minimizeIcon?: Template; /** * Optional maximize icon */ maximizeIcon?: Template<{ maximized: boolean; }>; /** * Optional title icon (defaults to sparkles) */ titleIcon?: Template; /** * The title to display in the header */ titleText: string; /** * Accessible label for the minimize button */ minimizeLabelText: string; /** * Accessible label for the maximize button */ maximizeLabelText: string; /** * Accessible label for the close button */ closeLabelText: string; /** * Text for the clear button */ clearLabelText: string; }>; /** * Templates to use for the messages. */ messages: Partial<{ /** * Template to use when there is an error loading messages */ error: Template>; /** * Label for the scroll to bottom button */ scrollToBottomLabelText?: string; /** * Label for the copy to clipboard action */ copyToClipboardLabelText?: string; /** * Label for the regenerate action */ regenerateLabelText?: string; }>; /** * Templates to use for each message. */ message: Partial<{ /** * Label for the message actions */ actionsLabelText?: string; /** * Label for the message container */ messageLabelText?: string; /** * Label for reasoning disclosures */ reasoningLabelText?: string; /** * Retry button text for failed tools */ toolErrorRetryText?: string; }>; /** * Templates to use for the assistant message. */ assistantMessage: Partial<{ /** * Template to use for the assistant message leading content. */ leading: Template; /** * Template to use for assistant message text parts. */ text: Template; /** * Template to use for assistant message reasoning. It replaces the * built-in disclosure rather than enabling reasoning: reasoning renders by * default, and `showReasoning: false` suppresses this template too. */ reasoning: Template; /** * Template to use for the assistant message footer content. */ footer: Template; }>; /** * Templates to use for the user message. */ userMessage: Partial<{ /** * Template to use for the user message leading content. */ leading: Template; /** * Template to use for user message text parts. */ text: Template; /** * Template to use for the user message footer content. */ footer: Template; }>; /** * Templates to use for the prompt. */ prompt: Partial<{ /** * Template to use for the chat prompt. */ layout: Template; /** * Template to use for the prompt header. */ header: Template; /** * Template to use for the prompt footer. */ footer: Template; /** * The label for the textarea */ textareaLabelText: string; /** * The placeholder text for the textarea */ textareaPlaceholderText: string; /** * The tooltip for the submit button when message is empty */ emptyMessageTooltipText: string; /** * The tooltip for the stop button */ stopResponseTooltipText: string; /** * The tooltip for the send button */ sendMessageTooltipText: string; /** * The disclaimer text shown in the footer */ disclaimerText: string; }>; /** * Template to use for the message actions. */ actions: Template>; /** * Template to use for the empty screen shown when there are no messages */ empty?: Template>; /** * Template to use for prompt suggestions. */ suggestions: Template<{ suggestions: string[]; onSuggestionClick: (suggestion: string) => void; }>; }>; type ChatWidgetParams = { /** * CSS Selector or HTMLElement to insert the widget. */ container: string | HTMLElement; /** * Return the URL of the main search page with the `nextUiState`. * This is used to navigate to the main search page when the user clicks on "View all" in the search tool. * * @example (nextUiState) => `/search?${qs.stringify(nextUiState)}` */ getSearchPageURL?: (nextUiState: IndexUiState) => string; /** * Client-side tools to add to the chat */ tools?: UserClientSideToolsWithTemplate; /** * Templates to use for the widget. */ templates?: ChatTemplates; /** * CSS classes to add. */ cssClasses?: ChatCSSClasses; /** * Disable validation that requires either `chatTrigger` or AI mode. */ disableTriggerValidation?: boolean; /** * Whether to render the reasoning an agent sends. `true` by default, so * reasoning that arrives is shown. Pass `false` to suppress it in this * widget. It cannot make an agent send reasoning: whether reasoning reaches * the client at all is the agent's own `sendReasoning` setting. */ showReasoning?: boolean; /** * Where the loader renders: as its own row after the last message * (`messages-end`, the default) or inside the streaming assistant message * (`message-inline`). */ loaderPosition?: ChatMessagesProps['loaderPosition']; /** * Overrides when the loader shows. Receives the turn context plus the * built-in decision as `defaultValue`. */ shouldShowLoader?: ChatMessagesProps['shouldShowLoader']; /** * How long (ms) a renewed loading state must hold before the loader comes back * after having been hidden in the same turn. */ loaderShowDelay?: ChatMessagesProps['loaderShowDelay']; /** * Minimum time (ms) the loader stays on screen once shown, while the turn is * still running. */ loaderMinDuration?: ChatMessagesProps['loaderMinDuration']; }; export type ChatWidget = WidgetFactory; declare const _default: (widgetParams: ChatWidgetParams & ChatConnectorParams) => { $$widgetType: "ais.chat"; $$type: "ais.chat"; dependsOn: "search" | "none"; init(initOptions: import("../../types").InitOptions): void; render(renderOptions: import("../../types").RenderOptions): void; getRenderState(renderState: Partial<{ answers: import("../../types").WidgetRenderState; } & { autocomplete: import("../../types").WidgetRenderState; } & { breadcrumb: { [rootAttribute: string]: import("../../types").WidgetRenderState; }; } & { chat: import("../../types").WidgetRenderState>, ChatConnectorParams>>; } & { clearRefinements: import("../../types").WidgetRenderState; } & { configure: import("../../types").WidgetRenderState; } & { currentRefinements: import("../../types").WidgetRenderState; } & { feeds: import("../../connectors/feeds/connectFeeds").FeedsRenderState; } & { geoSearch: import("../../types").WidgetRenderState, import("../../connectors/geo-search/connectGeoSearch").GeoSearchConnectorParams>; } & { hierarchicalMenu: { [rootAttribute: string]: import("../../types").WidgetRenderState; }; } & { hits: import("../../types").WidgetRenderState, import("../../connectors/hits/connectHits").HitsConnectorParams>; } & { hitsPerPage: import("../../types").WidgetRenderState; } & { infiniteHits: import("../../types").WidgetRenderState, import("../../connectors/infinite-hits/connectInfiniteHits").InfiniteHitsConnectorParams>; } & { menu: { [attribute: string]: import("../../types").WidgetRenderState; }; } & { numericMenu: { [attribute: string]: import("../../types").WidgetRenderState; }; } & { pagination: import("../../types").WidgetRenderState; } & { poweredBy: import("../../types").WidgetRenderState; } & { queryRules: import("../../types").WidgetRenderState; } & { range: { [attribute: string]: import("../../types").WidgetRenderState; }; } & { ratingMenu: { [attribute: string]: import("../../types").WidgetRenderState; }; } & { refinementList: { [attribute: string]: import("../../types").WidgetRenderState; }; } & { relevantSort: import("../../types").WidgetRenderState; } & { searchBox: import("../../types").WidgetRenderState; } & { sortBy: import("../../types").WidgetRenderState; } & { stats: import("../../types").WidgetRenderState; } & { toggleRefinement: { [attribute: string]: import("../../types").WidgetRenderState; }; } & { voiceSearch: import("../../types").WidgetRenderState; } & { analytics: import("../../types").WidgetRenderState, import("../analytics/analytics").AnalyticsWidgetParams>; } & { places: import("../../types").WidgetRenderState, import("../places/places").PlacesWidgetParams>; }>, renderOptions: import("../../types").InitOptions | import("../../types").RenderOptions): import("../../types").IndexRenderState & ChatWidgetDescription["indexRenderState"]; getWidgetRenderState(renderOptions: import("../../types").InitOptions | import("../../types").RenderOptions): import("../../types").WidgetRenderState>, Partial> & ChatConnectorParams>>; dispose(): void; shouldRender(): true; chatInstance: import("../../lib/chat").Chat>; }; export default _default;