Skip to content

Commit

Permalink
fix issue when loading old conversations
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsrolf committed Nov 2, 2023
1 parent fdb5720 commit 7b17476
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions minichain/message_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,13 @@ def sort_by_timestamp(items):
return sorted(items, key=lambda x: datetime_or_str_to_datetime(x.meta['timestamp']))

import datetime as dt
def get_default_meta():
return {
def get_default_meta(chat_summary=None):
meta = {
"timestamp": dt.datetime.now(),
}
if chat_summary is not None:
meta["_chat_summary"] = chat_summary
return meta

class Message():
def __init__(self,
Expand All @@ -137,7 +140,7 @@ def __init__(self,
shared=None):
self.shared = shared
self.chat = chat or {}
self.meta = get_default_meta()
self.meta = get_default_meta(chat)
self.meta.update(meta or {})
self.path = path or ['Trash']
if message_id is None:
Expand Down

0 comments on commit 7b17476

Please sign in to comment.