chainlit icon indicating copy to clipboard operation
chainlit copied to clipboard

Feature Request: Optional Message Timestamps in the UI

Open Sanady opened this issue 1 week ago • 0 comments
trafficstars

Is your feature request related to a problem? Please describe. When reviewing conversations, debugging latency, or correlating messages with server logs/telemetry, it’s hard to tell when a message was sent/received because timestamps aren’t visible in the UI. This makes it harder to:

  • Reproduce timing bugs and measure round-trip latency.
  • Align conversation events with backend logs and traces.
  • Demonstrate product behavior in demos or audits where exact times matter.
  • Collaborate across time zones where “a few minutes ago” isn’t precise enough.

Describe the solution you'd like Add an optional setting to display per-message timestamps in the UI.

Proposed UX

  • A user setting (e.g., gear menu ➝ “Show message timestamps”) that toggles timestamps on/off. Default: off.
  • Each message bubble shows an absolute timestamp near the author (e.g., “2025-11-11 14:03”).
  • Hover tooltip reveals the full ISO 8601 value with seconds + timezone (e.g., 2025-11-11T14:03:27+01:00).
  • Formatting respects the browser locale (via Intl.DateTimeFormat) and a 12/24-hour preference.
  • Allow choosing Absolute, Relative, or Both (e.g., “14:03 (3m ago)”).
  • For streaming messages, timestamp reflects when the message started; optionally show an “edited”/“finalized” indicator if it’s updated.
  • Accessible: timestamps are readable by screen readers and have sufficient contrast.

Proposed config / API (non-breaking)

  • Config (optional):

    # chainlit.toml
    [ui]
    show_message_timestamps = false
    timestamp_mode = "absolute" # "relative" | "both"
    timezone = "auto"           # "auto" (browser) | "UTC"
    
  • Message schema: ensure a createdAt (ISO 8601) exists on all messages. If not supplied by the app, the server populates it.

  • Python SDK (optional): accept created_at on cl.Message(...), otherwise auto-populate on send.

  • Theming: expose a CSS variable/class to style timestamp placement/size.

Acceptance criteria

  • [ ] A user-visible toggle to show/hide timestamps without reloading the app.
  • [ ] Messages display accurate absolute times; hover shows full ISO with timezone.
  • [ ] Locale and 12/24-hour format are respected.
  • [ ] Works for both user and assistant messages, including streamed ones.
  • [ ] No noticeable performance regressions or layout shifts in long chats.
  • [ ] Accessible labels for screen readers.

Describe alternatives you've considered

  • Relying on “relative time” only (“3m ago”) → not precise enough for logs/audits.
  • Day/time separators between message groups → helpful, but still lacks per-message precision.
  • Using browser devtools or custom UI overrides → not feasible for non-developers and inconsistent across environments.

Additional context Primary use cases: debugging latency, mapping events to server traces (e.g., OpenTelemetry), demoing behavior to stakeholders, and audit/compliance screenshots. A first iteration with a simple on/off toggle and absolute timestamps would already solve most pain points; format/locale options can come later behind config.

Sanady avatar Nov 11 '25 10:11 Sanady