Conversation
Real-time conversation display component with message history and text input
The Conversation component displays real-time conversation history between users and AI assistants. It automatically integrates with the Pipecat Client SDK to show messages, connection states, and provides smooth scrolling behavior.
import { Conversation } from "@pipecat-ai/voice-ui-kit";
<div className="h-96 border rounded-lg">
<Conversation />
</div>| Prop | Type | Default |
|---|---|---|
classNames? | { container?: string; message?: string; messageContent?: string; role?: string; time?: string; thinking?: string; } | {} |
noAutoscroll? | boolean | false |
reverseOrder? | boolean | false |
assistantLabel? | string | "assistant" |
clientLabel? | string | "user" |
systemLabel? | string | "system" |
functionCallLabel? | string | "function call" |
functionCallRenderer? | (functionCall: FunctionCallData) => React.ReactNode | undefined |
noFunctionCalls? | boolean | false |
botOutputRenderers? | Record<string, (content: string, metadata: { spoken: string; unspoken: string }) => React.ReactNode> | undefined |
aggregationMetadata? | Record<string, { displayMode?: 'inline' | 'block'; isSpoken?: boolean }> | undefined |
noTextInput? | boolean | false |
textRenderMode? | "karaoke" | "captions" | "instant" | "karaoke" |
Connection States
The component displays different UI based on connection state:
- No messages, connecting: Shows "Connecting to agent..." message
- No messages, not connected: Shows "Not connected to agent" message with description
- No messages, connected: Shows "Waiting for messages..." message
- Has messages: Displays message list with scrolling
Scrolling Behavior
The component implements smart scrolling:
- Automatically scrolls to the target edge when new messages arrive (bottom in normal mode, top in reverse mode)
- Only scrolls if the user is already at the target edge (doesn't interrupt reading)
- Tracks scroll position to determine if user is at the edge
- Respects
noAutoscrollprop to disable automatic scrolling entirely
Function Calls
When the LLM invokes a function (tool use), function call entries appear as separate items in the conversation timeline. Each entry shows the function name and a status indicator, with arguments and results collapsed by default using a collapsible UI.
Function call display requires @pipecat-ai/client-js >= 1.6.0 and corresponding transport versions (@pipecat-ai/daily-transport >= 1.6.0 or @pipecat-ai/small-webrtc-transport >= 1.9.0).
To disable function call rendering while still capturing the data in the store, set noFunctionCalls={true}.
To customize how function calls are rendered, use the functionCallRenderer prop:
<Conversation
functionCallRenderer={(fc) => {
switch (fc.function_name) {
case "get_weather":
return <WeatherCard functionCall={fc} />;
default:
return <FunctionCallContent functionCall={fc} />;
}
}}
/>Integration
The Conversation component uses:
usePipecatConversationhook to get messages from the conversation storeusePipecatClientTransportStateto determine connection stateMessageContainerandMessageContentcomponents to render individual messagesFunctionCallContentcomponent to render function call entriesTextInputcomponent for user input
It must be used within:
PipecatClientProvidercontext (for transport state and conversation state)
Changelog
- v0.10.0
ConversationProvideris no longer required. Conversation state is now provided byPipecatClientProviderfrom@pipecat-ai/client-react.
- v0.9.0
- Added
textRenderModeswitch for bot message display.
- Added
- v0.8.2
- Backdate injected messages during an active bot response so karaoke ordering stays stable.
- Backdate mid-turn function calls to preserve the karaoke cursor.
- Karaoke highlighting now handles non-ASCII text and punctuation correctly.
- v0.8.1
- Optimized the conversation rendering pipeline.
- Improved turn detection and karaoke highlighting.
- v0.8.0
- Added
reverseOrderprop. - Added function-call rendering:
noFunctionCalls,functionCallLabel, andfunctionCallRendererprops. ConversationMessage.rolenow includesfunction_call.
- Added
- v0.7.2
- Fixed long bot messages getting truncated when the bot stopped speaking mid-turn.
- v0.7.0
- Added
botOutputRenderersprop to customize rendering by aggregation type. Conversationbuilding now usesBotOutputevents when the server supports them; a warning is shown otherwise.
- Added
- v0.6.0
- Added
noTextInputprop to hide text input controls.
- Added
- v0.4.0
- Fixed component layout in some configurations.
- v0.3.0
- Restructured conversation message types to introduce parts for better transcription handling.
- Added programmatic message injection via
injectMessage. - Message rendering now supports both string content and React components.