Skip to content

Add response timestamp to API and display in chat UI#60

Open
mateenasadaf wants to merge 2 commits intovirtualcell:mainfrom
mateenasadaf:gsoc/add-response-timestamp
Open

Add response timestamp to API and display in chat UI#60
mateenasadaf wants to merge 2 commits intovirtualcell:mainfrom
mateenasadaf:gsoc/add-response-timestamp

Conversation

@mateenasadaf
Copy link
Copy Markdown

@mateenasadaf mateenasadaf commented Mar 24, 2026

Overview

As part of getting familiar with the VCell-AI codebase, I made two small
improvements — one on the backend and one on the frontend.


Changes

Backend — backend/app/routes/llms_router.py

  • Added a timestamp field to the /query endpoint response
  • The timestamp is in UTC ISO-8601 format (e.g. 2025-03-24T10:45:00+00:00)
  • Used datetime.now(timezone.utc) instead of datetime.utcnow() to avoid
    naive datetime bugs when the server and client are in different timezones
  • Added thorough docstrings to all four endpoints explaining their purpose,
    arguments, and return values

Frontend — frontend/components/ChatBox.tsx

  • Added a small time label beneath each message bubble (e.g. "02:34 PM")
  • User messages show the time in text-blue-200 (right-aligned)
  • Assistant messages show the time in text-slate-400 (left-aligned)
  • When the backend returns a timestamp, it is used directly so the displayed
    time reflects when the server generated the response, not when the client
    received it — with a graceful fallback to new Date() for compatibility
  • Added inline comments throughout explaining all major logic blocks

Why these changes?

  • The timestamp makes it easy to see when each response was produced,
    which helps with debugging and gives users a better sense of response times
  • The comments make the codebase easier to onboard into for new contributors

Testing

  • No existing functionality was changed — both changes are purely additive
  • The frontend falls back gracefully if the backend does not return a timestamp

@mateenasadaf mateenasadaf changed the title Improve validation in /query endpoint to handle empty conversation history feat: add response timestamp to API and display in chat UI Mar 24, 2026
@mateenasadaf mateenasadaf changed the title feat: add response timestamp to API and display in chat UI Add response timestamp to API and display in chat UI Mar 24, 2026
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.

1 participant