Skip to content

Commit f8107a7

Browse files
committed
cast client timestamp to datetime for ingestion
1 parent 388e0f3 commit f8107a7

File tree

1 file changed

+3
-3
lines changed
  • A2rchi/interfaces/chat_app

1 file changed

+3
-3
lines changed

A2rchi/interfaces/chat_app/app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def insert_timing(self, message_id, timestamps):
259259
self.cursor, self.conn = None, None
260260

261261

262-
def __call__(self, message: List[str], conversation_id: int, is_refresh: bool, server_received_msg_ts: datetime, client_msg_ts: float, client_timeout: float):
262+
def __call__(self, message: List[str], conversation_id: int, is_refresh: bool, server_received_msg_ts: datetime, client_sent_msg_ts: float, client_timeout: float):
263263
"""
264264
Execute the chat functionality.
265265
"""
@@ -301,7 +301,7 @@ def __call__(self, message: List[str], conversation_id: int, is_refresh: bool, s
301301

302302
# guard call to LLM; if timestamp from message is more than timeout secs in the past;
303303
# return error=True and do not generate response as the client will have timed out
304-
if server_received_msg_ts.timestamp() - client_msg_ts > client_timeout:
304+
if server_received_msg_ts.timestamp() - client_sent_msg_ts > client_timeout:
305305
return None, None, None, True
306306

307307
# run chain to get result; limit users to 1000 queries per conversation; refreshing browser starts new conversation
@@ -437,7 +437,7 @@ def get_chat_response(self):
437437

438438
# store timing info for this message
439439
timestamps['server_received_msg_ts'] = server_received_msg_ts
440-
timestamps['client_sent_msg_ts'] = client_sent_msg_ts
440+
timestamps['client_sent_msg_ts'] = datetime.fromtimestamp(client_sent_msg_ts)
441441
self.chat.insert_timing(message_ids[-1], timestamps)
442442

443443
# otherwise return A2rchi's response to client

0 commit comments

Comments
 (0)