Skip to main content

Message Components

Message display related components: ConversationList, Conversation, Subtitle.

ConversationList

Conversation history list component, automatically subscribes to conversation changes.

Basic Usage

import {PilotKit, ConversationList} from '@bdky/aaas-pilot-kit-react-widget';
import '@bdky/aaas-pilot-kit-react-widget/styles.css';

function App() {
return (
<PilotKit {...props}>
<ConversationList />
</PilotKit>
);
}

Responsive Adaptation

📱 See Responsive Adaptation Guide

FeaturePCMobile
Conversation DisplayShow all historyShow only the latest one
Close ButtonVisibleHidden
Scroll Follow ButtonVisibleHidden
PositionAbsolute positioning on the leftRelative positioning

Props

PropertyTypeDefaultDescription
variant'auto' | 'mobile' | 'desktop''auto'Display mode
classNamestring-Custom class name
styleCSSProperties-Custom style
autoScrollbooleantrueWhether to auto-scroll to bottom
closablebooleantrueWhether to show close button
closeIconReactNode-Custom close icon
onClose() => void-Close callback
children(props: IConversationRenderProps) => ReactNode-Custom render

Custom Rendering

<ConversationList>
{({conversations, latestConversation}) => (
<div className="my-conversation-list">
{conversations.map(conv => (
<div key={conv.id} className="my-conversation-item">
{conv.type === 'client' ? 'User' : 'AI'}
</div>
))}
</div>
)}
</ConversationList>

Style Customization

Class NameDescription
.apk-conversation-listRoot container
.apk-conversation-list--mobileMobile style
.apk-conversation-list--desktopDesktop style
.apk-conversation-list__innerInner scroll container
.apk-conversation-list__follow-buttonScroll follow button
.apk-conversation-list__icons-wrapperClose button container

Conversation

Single message component, displays message content.

Basic Usage

Usually used with ConversationList, but can also be used independently:

import {Conversation} from '@bdky/aaas-pilot-kit-react-widget';

function CustomList({conversations}) {
return (
<div>
{conversations.map(conv => (
<Conversation
key={conv.id}
conversation={conv}
isLatest={conv === conversations[conversations.length - 1]}
/>
))}
</div>
);
}

Responsive Adaptation

FeaturePCMobile
Border Radius20pxDifferent border radius for different directions
MarginLeft/right 30pxLeft/right 39px
BackgroundSemi-transparentDarker semi-transparent

Props

PropertyTypeDefaultDescription
conversationAnyConversationRequiredConversation object
isLatestbooleanfalseWhether it's the latest one
variant'auto' | 'mobile' | 'desktop''auto'Display mode
classNamestring-Custom class name
styleCSSProperties-Custom style
onComplete(payload) => void-Conversation completion callback
children(props: IConversationContentProps) => ReactNode-Custom render

Custom Rendering

<Conversation conversation={conv}>
{({contents, fullText, type, isCompleted}) => (
<div className={`my-message my-message--${type}`}>
<p>{fullText}</p>
{!isCompleted && <span className="typing">...</span>}
</div>
)}
</Conversation>

Style Customization

Class NameDescription
.apk-conversationRoot container
.apk-conversation--clientUser message
.apk-conversation--aiAI message
.apk-conversation--mobileMobile style
.apk-conversation--desktopDesktop style
.apk-conversation__content-itemContent item
.apk-conversation__content-textText content
.apk-conversation__content-imageImage content
.apk-conversation__content-videoVideo content

Subtitle

Real-time subtitle component, displays the content of the latest conversation.

Basic Usage

import {PilotKit, Subtitle} from '@bdky/aaas-pilot-kit-react-widget';
import '@bdky/aaas-pilot-kit-react-widget/styles.css';

function App() {
return (
<PilotKit {...props}>
<Subtitle showSpeaker />
</PilotKit>
);
}

Expandable Subtitle

const [expanded, setExpanded] = useState(false);

<Subtitle
expandable
expanded={expanded}
onExpand={() => setExpanded(true)}
/>

Props

PropertyTypeDefaultDescription
classNamestring-Custom class name
styleCSSProperties-Custom style
showSpeakerbooleantrueWhether to show speaker
aiSpeakerNamestring'AI'AI speaker name
userSpeakerNamestring'Me'User speaker name
expandablebooleanfalseWhether expandable
expandedbooleanfalseWhether expanded
onExpand() => void-Expand callback
children(props: ISubtitleRenderProps) => ReactNode-Custom render

Custom Rendering

<Subtitle>
{({speakerName, fullText, conversation, isExpanded, toggleExpand}) => (
<div className="my-subtitle">
<span className="speaker">{speakerName}</span>
<p className="text">{fullText}</p>
<button onClick={toggleExpand}>
{isExpanded ? 'Collapse' : 'Expand'}
</button>
</div>
)}
</Subtitle>

Style Customization

Class NameDescription
.apk-subtitleRoot container
.apk-subtitle__wrapperContent wrapper
.apk-subtitle__expand-btnExpand button
.apk-subtitle__textText area
.apk-subtitle__scroll-viewScroll view