fix: token speed disappear on complete

This commit is contained in:
Louis 2024-12-19 12:10:14 +07:00
parent b81b008a93
commit 5b9c1fc668
No known key found for this signature in database
GPG Key ID: 44FA9F4D33C37DE2
2 changed files with 5 additions and 6 deletions

View File

@ -264,6 +264,9 @@ export default function ModelHandler() {
if (updatedMessage) {
deleteMessage(message.id)
addNewMessage(updatedMessage)
setTokenSpeed((prev) =>
prev ? { ...prev, message: updatedMessage.id } : undefined
)
}
})()

View File

@ -4,11 +4,7 @@ import { isToday } from './datetime'
test("should return only time for today's timestamp", () => {
const today = new Date()
const timestamp = today.getTime()
const expectedTime = `${today.toLocaleDateString(undefined, {
day: '2-digit',
month: 'short',
year: 'numeric',
})}, ${today.toLocaleTimeString(undefined, {
const expectedTime = `${today.toLocaleTimeString(undefined, {
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
@ -24,5 +20,5 @@ test('should return N/A for undefined timestamp', () => {
test("should return true for today's timestamp", () => {
const today = new Date()
const timestamp = today.setHours(0, 0, 0, 0)
expect(isToday(timestamp)).toBe(true)
expect(isToday(timestamp / 1000)).toBe(true)
})