Skip to content

Commit aa7b982

Browse files
committed
fixed the message rendering
1 parent c59533d commit aa7b982

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

src/components/AnimatedStatusIcon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const AnimatedStatusIcon: React.FC<AnimatedStatusIconProps> = ({
111111
return {
112112
animationType: 'sequential' as const,
113113
colors: '#60A5FA', // Blue
114-
animationSpeed: 100,
114+
animationSpeed: 1000,
115115
};
116116
} else {
117117
// When call is not active, show rotating circle

src/components/VapiWidget.tsx

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ const VapiWidget: React.FC<VapiWidgetProps> = ({
127127
!showTranscript &&
128128
vapi.voice.isCallActive &&
129129
(mode === 'voice' || mode === 'hybrid');
130-
const showingEmptyState = !vapi.voice.isCallActive;
130+
const showingEmptyState = mode === 'voice' && !vapi.voice.isCallActive;
131131

132132
if (isEmpty || hideTranscript || showingEmptyState) {
133133
return {
@@ -203,6 +203,12 @@ const VapiWidget: React.FC<VapiWidgetProps> = ({
203203
}
204204

205205
setChatInput('');
206+
207+
if (mode === 'chat' || mode === 'hybrid') {
208+
setTimeout(() => {
209+
inputRef.current?.focus();
210+
}, 100);
211+
}
206212
};
207213

208214
const handleFloatingButtonClick = () => {
@@ -254,11 +260,16 @@ const VapiWidget: React.FC<VapiWidgetProps> = ({
254260
};
255261

256262
const renderConversationArea = () => {
257-
if (vapi.voice.isCallActive) {
258-
const shouldShowTranscript =
259-
showTranscript || mode === 'chat' || mode === 'hybrid';
263+
// Chat mode: always show conversation messages
264+
if (mode === 'chat') {
265+
return renderConversationMessages();
266+
}
260267

261-
if (shouldShowTranscript) {
268+
// Hybrid mode: show messages when call is not active, respect showTranscript when active
269+
if (mode === 'hybrid') {
270+
if (!vapi.voice.isCallActive) {
271+
return renderConversationMessages();
272+
} else if (showTranscript) {
262273
return renderConversationMessages();
263274
} else {
264275
return (
@@ -276,6 +287,29 @@ const VapiWidget: React.FC<VapiWidgetProps> = ({
276287
}
277288
}
278289

290+
// Voice mode: respect showTranscript when call is active
291+
if (mode === 'voice') {
292+
if (vapi.voice.isCallActive) {
293+
if (showTranscript) {
294+
return renderConversationMessages();
295+
} else {
296+
return (
297+
<AnimatedStatusIcon
298+
size={150}
299+
connectionStatus={vapi.voice.connectionStatus}
300+
isCallActive={vapi.voice.isCallActive}
301+
isSpeaking={vapi.voice.isSpeaking}
302+
isTyping={vapi.chat.isTyping}
303+
volumeLevel={vapi.voice.volumeLevel}
304+
baseColor={colors.accentColor}
305+
colors={colors.accentColor}
306+
/>
307+
);
308+
}
309+
}
310+
}
311+
312+
// Default: show empty conversation
279313
return (
280314
<EmptyConversation
281315
mode={mode}

0 commit comments

Comments
 (0)