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'>
|
<div className='samples-container'>
|
||||||
<table id="samples-table">
|
<table id="samples-table">
|
||||||
@@ -56,7 +56,7 @@ const Diagnostics = () => {
|
|||||||
<tr key={index} className='samples-table-tr'>
|
<tr key={index} className='samples-table-tr'>
|
||||||
<td>{sample.deviceId}</td>
|
<td>{sample.deviceId}</td>
|
||||||
<td>{sample.deviceData || 'NA'}</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>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -76,26 +76,28 @@ function Gemini(props) {
|
|||||||
{ text: data.response, sender: 'gemini' },
|
{ text: data.response, sender: 'gemini' },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (scrollRef.current) {
|
// if (scrollRef.current) {
|
||||||
// alert(scrollRef.current.scrollHeight)
|
// // alert(scrollRef.current.scrollHeight)
|
||||||
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
|
// scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
|
||||||
}
|
// }
|
||||||
}, 1000); // You can adjust the delay as needed
|
}, 10); // You can adjust the delay as needed
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Sort the messages by createTime before updating the state
|
// Sort the messages by createTime before updating the state
|
||||||
// loadedMessages.sort((a, b) => a.createTime - b.createTime);
|
// loadedMessages.sort((a, b) => a.createTime - b.createTime);
|
||||||
setMessages(loadedMessages);
|
setMessages(loadedMessages);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error loading chat history:', error);
|
||||||
|
}
|
||||||
|
|
||||||
// Scroll to the bottom
|
|
||||||
|
setTimeout(() => {
|
||||||
if (scrollRef.current) {
|
if (scrollRef.current) {
|
||||||
// alert(scrollRef.current.scrollHeight)
|
// alert(scrollRef.current.scrollHeight)
|
||||||
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
|
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
}, 1000);
|
||||||
console.error('Error loading chat history:', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
loadChatHistory();
|
loadChatHistory();
|
||||||
@@ -140,7 +142,7 @@ function Gemini(props) {
|
|||||||
if (scrollRef.current) {
|
if (scrollRef.current) {
|
||||||
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
|
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>
|
||||||
<div style={{ height: '500px', overflowY: 'scroll', border: '1px solid #ccc' }} ref={scrollRef}>
|
<div style={{ height: '500px', overflowY: 'scroll', border: '1px solid #ccc' }} ref={scrollRef}>
|
||||||
{messages.map((message, index) => (
|
{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 ? (
|
{message.sender === 'gemini' && isTyping ? (
|
||||||
<div className="typing-animation">Gemini is typing...</div>
|
<div className="typing-animation">Gemini is typing...</div>
|
||||||
) : (
|
) : (
|
||||||
@@ -169,6 +171,11 @@ function Gemini(props) {
|
|||||||
type="text"
|
type="text"
|
||||||
value={newMessage}
|
value={newMessage}
|
||||||
onChange={(e) => setNewMessage(e.target.value)}
|
onChange={(e) => setNewMessage(e.target.value)}
|
||||||
|
// onKeyDown={(e) => {
|
||||||
|
// if (e.key === 'Enter') {
|
||||||
|
// handleSendMessage();
|
||||||
|
// }
|
||||||
|
// }}
|
||||||
placeholder="Type your message..."
|
placeholder="Type your message..."
|
||||||
style={{ marginRight: '8px', padding: '8px', fontSize: '16px', width: '50vw' }}
|
style={{ marginRight: '8px', padding: '8px', fontSize: '16px', width: '50vw' }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user