fix device run time
This commit is contained in:
@@ -43,7 +43,7 @@ const Diagnostics = () => {
|
||||
)} */}
|
||||
|
||||
|
||||
<h1>Diagnostics</h1>
|
||||
<h1>Device Data</h1>
|
||||
|
||||
<div className='samples-container'>
|
||||
<table id="samples-table">
|
||||
@@ -56,7 +56,7 @@ const Diagnostics = () => {
|
||||
<tr key={index} className='samples-table-tr'>
|
||||
<td>{sample.deviceId}</td>
|
||||
<td>{sample.deviceData || 'NA'}</td>
|
||||
<td>{moment(sample.testTime).format('HH:mm:ss')}</td>
|
||||
<td>{moment(sample.runTime).format('HH:mm:ss')}</td>
|
||||
</tr>
|
||||
))}
|
||||
</table>
|
||||
|
||||
@@ -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) {
|
||||
<div>
|
||||
<div style={{ height: '500px', overflowY: 'scroll', border: '1px solid #ccc' }} ref={scrollRef}>
|
||||
{messages.map((message, index) => (
|
||||
<div className={message.sender === 'user' ? 'user-message' : 'other-message'}>
|
||||
<div key={index} className={message.sender === 'user' ? 'user-message' : 'other-message'}>
|
||||
{message.sender === 'gemini' && isTyping ? (
|
||||
<div className="typing-animation">Gemini is typing...</div>
|
||||
) : (
|
||||
@@ -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' }}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user