Skip to content

Conversation

jackpeplinski
Copy link

@jackpeplinski jackpeplinski commented Sep 19, 2025

Summary

Added timestamp to messages. Timestamps only display on hover as recommended by @berry-13 on Discord DMs.

Closes Issue #5199.

Design Rationale

I displayed the time and date instead of using a date divider (see Slack example here) because I thought the divider would be obtrusive in an AI chat interface since most users start new threads rather than long-running conversations.

I used millisecond timestamps to give users a rough sense of request latency.

Technical Implementation

  • Optimistic timestamp locking: on SSE message receipt, lockMessageTimestamp immediately sets a timestamp in the messageTimestampState Recoil atom. This gives users an instant, optimistic timestamp while the backend response arrives.
  • Priority-based fallback: useMessageTimestamp prefers the backend’s createdAt field; otherwise it returns the locked Recoil timestamp.

Change Type

  • New feature (non-breaking change which adds functionality)

Testing

  1. Ran test instructions as mentioned in the Contributing Guidelines, except e2e tests which I found out after trying for a while are flaky and I only ran linting on files that I changed with npx eslint $(git diff HEAD~1 HEAD --name-only --diff-filter=ACM | grep -E '\.(js|jsx|ts|tsx)$' | xargs) because npm run lint is not currently run on the whole project due to the number of errors.
  2. Tried sending multiple messages in the same thread, using sibling conversations, and conversation forks. Used separate timer to confirm the rough accuracy of the timestamps. On smaller window sizes, the timestamps display without hovering, mimicking the behaviour of the hover buttons.

Demo

librechat-timestamps.mp4

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • Local unit tests pass with my changes
    (from looking at the existing repo, it seems like pretty much all the files I edited don't have tests, so I wasn't sure if adding them was required)

@jackpeplinski jackpeplinski force-pushed the add-message-timestamps branch 3 times, most recently from 0899ffe to 1edb11e Compare September 23, 2025 02:47
@jackpeplinski jackpeplinski marked this pull request as ready for review September 23, 2025 03:02
@jackpeplinski jackpeplinski marked this pull request as draft September 25, 2025 01:52
@jackpeplinski jackpeplinski marked this pull request as ready for review September 25, 2025 02:54
@jackpeplinski jackpeplinski force-pushed the add-message-timestamps branch 3 times, most recently from 45260fb to f465be9 Compare September 26, 2025 18:12
@danny-avila
Copy link
Owner

If it’s not too much, we are moving away from Recoil since it’s discontinued in favor of jotai, which is already installed/used in the codebase.

@jackpeplinski jackpeplinski force-pushed the add-message-timestamps branch from f465be9 to 5a024fa Compare October 9, 2025 15:35
@danny-avila danny-avila changed the base branch from main to dev October 11, 2025 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: Add a timestamp to each conversation input/output

2 participants