Closed nickanderson closed 7 months ago
Thanks for opening an issue on this, Nick! This is because we're storing the datetime of the message in UTC in the backend. We'll need to parse the DT in the client's time zone when rendering..
Really, it's related to timezone?
The timestamp of the original query gets changed to the timestamp of the final response. You can see it was 16:10 in the first screenshot then in the last screenshot you can see that it had changed to match the timestamp of the last response (21:19).
I guess that huge jump can be accounted for by a timezone different, but the timestamp displayed for my query shouldn't change.
Here it is highlighted:
The difference is due to the way in which the message is rendering. When it's first rendered in the UI, it's using new Date()
, which will automatically use the local time zone. When you refresh it and come back to the chat session, it's loading it from the database and using new Date(chat_log.created)
, which is going to be in the timezone for UTC.
The timestamp being correct the first time is kind of like an illusion, you could say. We just need to let the JS function now that the timestamp of that created
field is UTC and it should correct the rendering. This would be the same issue in both desktop/chat.html and the web chat.html.
Will get this fixed in the next release! Thanks for reporting.
Ah I get it. Thanks.
On Mon, Apr 15, 2024, 4:06 PM sabaimran @.***> wrote:
The difference is due to the way in which the message is rendering. When it's first rendered in the UI, it's using new Date(), which will automatically use the local time zone. When you refresh it and come back to the chat session, it's loading it from the database and using new Date(chat_log.created), which is going to be in the timezone for UTC.
The timestamp being correct the first time is kind of like an illusion, you could say. We just need to let the JS function now that the timestamp of that created field is UTC and it should correct the rendering. This would be the same issue in both desktop/chat.html and the web chat.html.
Will get this fixed in the next release! Thanks for reporting.
— Reply to this email directly, view it on GitHub https://github.com/khoj-ai/khoj/issues/694#issuecomment-2057808760, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABRREGONHEN7TZY7KZMWBLY5Q6L5AVCNFSM6AAAAABGBFMDNGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJXHAYDQNZWGA . You are receiving this because you authored the thread.Message ID: @.***>
Describe the bug
When I send a query in chat my query is timestamped, the response from Khoj comes back eventually (much later) but the timestamp of the response matches the timestamp when I sent my initial query. And, actually when I come back to the chat conversation, the timestamp of my original query changed.
To Reproduce
Send a query to chat, wait for a response and compare the timestamps of the original message sent to the timestamp of the response in the Chat UI.
Screenshots
Initial query:
While response is streaming:
After response is complete (and re-visit the conversation because no timestamp is shown on the response until then (or maybe until next query is sent): Notice: The timestamp on my initial query has changed to match the timestamp of the response.
Platform
If self-hosted
Additional context
Logs