diff --git a/src/components/Diagnostics.js b/src/components/Diagnostics.js index 86e2d61..ef449be 100644 --- a/src/components/Diagnostics.js +++ b/src/components/Diagnostics.js @@ -43,7 +43,7 @@ const Diagnostics = () => { )} */} -

Diagnostics

+

Device Data

@@ -56,7 +56,7 @@ const Diagnostics = () => { - + ))}
{sample.deviceId} {sample.deviceData || 'NA'}{moment(sample.testTime).format('HH:mm:ss')}{moment(sample.runTime).format('HH:mm:ss')}
diff --git a/src/components/Gemini.js b/src/components/Gemini.js index 68b4de3..694bfaa 100644 --- a/src/components/Gemini.js +++ b/src/components/Gemini.js @@ -76,26 +76,28 @@ function Gemini(props) { { text: data.response, sender: 'gemini' }, ]); - if (scrollRef.current) { - // alert(scrollRef.current.scrollHeight) - scrollRef.current.scrollTop = scrollRef.current.scrollHeight; - } - }, 1000); // You can adjust the delay as needed + // if (scrollRef.current) { + // // alert(scrollRef.current.scrollHeight) + // scrollRef.current.scrollTop = scrollRef.current.scrollHeight; + // } + }, 10); // You can adjust the delay as needed } }); // Sort the messages by createTime before updating the state // loadedMessages.sort((a, b) => a.createTime - b.createTime); setMessages(loadedMessages); + } catch (error) { + console.error('Error loading chat history:', error); + } - // Scroll to the bottom + + setTimeout(() => { if (scrollRef.current) { // alert(scrollRef.current.scrollHeight) scrollRef.current.scrollTop = scrollRef.current.scrollHeight; } - } catch (error) { - console.error('Error loading chat history:', error); - } + }, 1000); }; loadChatHistory(); @@ -140,7 +142,7 @@ function Gemini(props) { if (scrollRef.current) { scrollRef.current.scrollTop = scrollRef.current.scrollHeight; } - }, 1000); // You can adjust the delay as needed + }, 10); // You can adjust the delay as needed } }); @@ -153,7 +155,7 @@ function Gemini(props) {
{messages.map((message, index) => ( -
+
{message.sender === 'gemini' && isTyping ? (
Gemini is typing...
) : ( @@ -169,6 +171,11 @@ function Gemini(props) { type="text" value={newMessage} onChange={(e) => setNewMessage(e.target.value)} + // onKeyDown={(e) => { + // if (e.key === 'Enter') { + // handleSendMessage(); + // } + // }} placeholder="Type your message..." style={{ marginRight: '8px', padding: '8px', fontSize: '16px', width: '50vw' }} />