Skip to content

ChatWindow

A draggable, resizable floating chat window — or, below {@link CHAT_WINDOW_MOBILE_QUERY}, a full-screen sheet. It lazy-loads react-rnd (an optional dependency, so consumers of just the inner never pull it) and renders the existing beneath a drag-handle header with thread switching, a context-badge row and optional tool preferences.

Source

import { ChatWindow } from "@flanksource/clicky-ui/ai";

No dedicated Storybook demo is available for this component yet.

The props table documents the component-specific surface. Standard DOM attributes inherited from React, such as className, event handlers, and accessibility attributes, may also be accepted when the component’s prop type extends a native element.

Prop Type Default Description
chat Partial<ChatProps> — Props forwarded to the inner <Chat>. The window manages `threadId` and merges attached context / tool preferences into `body` on top of these.
contextTypeConfig ContextTypeConfig — Maps context item `type` to an icon/colour for the badge row.
defaultToolPolicy enum ask Initial mode assigned to tools when they first load. Defaults to "ask".
headerExtras ReactNode — Extra controls rendered in the header, e.g. a <ContextMeter mode="gauge"/> gauge.
panel* ChatWindowState — —
renderContextPicker (…) => ReactNode — Optional app-owned entity/document picker rendered beside context badges.
runtimesApi string | null null Backend runtime catalog endpoint. Null uses the built-in runtime families without probing host availability.
sessionsApi string | null /api/chat/sessions Canonical Captain session endpoint used for list/create/get/delete and approval resolution, or null to disable persistence. Defaults to "/api/chat/sessions".
threadsSource ThreadSource — Inject the thread list/delete directly instead of fetching `sessionsApi` (e.g. an app that loads conversations via its own client). Shows the picker regardless of `sessionsApi`.
title ReactNode Assistant Header title shown when the thread picker is disabled.
toolRenderers ToolRenderAdapter[] | ToolRenderRegistry — Domain tool input/output renderers forwarded to the inner <Chat>. Host adapters match before the built-in heuristics.
tools ToolMeta[] — When provided, a tool-preferences popover is shown and forwarded as `body.toolPreferences`. Tools default to "ask" (approval required); the user can switch any tool to On/Auto/Off from the popover.
toolsApi string | null /api/chat/tools Backend tool catalog endpoint. Defaults to "/api/chat/tools"; null disables fetching.