File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ setupVoiceRecognition(micBtn, async (transcript) => {
40
40
const wrapper = document . createElement ( "div" ) ;
41
41
wrapper . innerHTML = cardHTML ;
42
42
messages . appendChild ( wrapper ) ;
43
- scrollToBottom ( ) ;
43
+ setTimeout ( ( ) => scrollToBottom ( ) , 0 ) ;
44
44
return ;
45
45
}
46
46
@@ -134,8 +134,10 @@ setupVoiceRecognition(micBtn, async (transcript) => {
134
134
const cardBlock = document . createElement ( "div" ) ;
135
135
cardBlock . innerHTML = cards ;
136
136
messages . appendChild ( cardBlock ) ;
137
+ setTimeout ( ( ) => scrollToBottom ( ) , 50 ) ;
137
138
} else {
138
139
handleAIReply ( reply ) ;
140
+ setTimeout ( ( ) => scrollToBottom ( ) , 50 ) ;
139
141
}
140
142
141
143
} catch ( err ) {
@@ -149,13 +151,16 @@ setupVoiceRecognition(micBtn, async (transcript) => {
149
151
speakWithTTS ( text ) ;
150
152
renderVoiceMessage ( "bot" , null , "Lyra mengirim voice note" ) ;
151
153
resetVoiceFlag ( ) ;
154
+ setTimeout ( ( ) => scrollToBottom ( ) , 50 ) ;
152
155
return ;
153
156
}
154
157
if ( isVoiceMode ) {
155
158
speakWithTTS ( text ) ;
156
159
renderVoiceMessage ( "bot" , null , "Lyra mengirim voice note" ) ;
160
+ setTimeout ( ( ) => scrollToBottom ( ) , 50 ) ;
157
161
} else {
158
162
addMessage ( "bot" , text ) ;
163
+ setTimeout ( ( ) => scrollToBottom ( ) , 50 ) ;
159
164
}
160
165
}
161
166
You can’t perform that action at this time.
0 commit comments