AnnasBlackHat commited on
Commit
89f6f6b
1 Parent(s): a664901

fix time updated

Browse files
Files changed (3) hide show
  1. embed.py +1 -1
  2. pages/faq.py +2 -0
  3. pages/manage_faqs.py +4 -2
embed.py CHANGED
@@ -52,7 +52,7 @@ def get_last_run_time():
52
  # Function to save or update the last run time in the log collection
53
  def update_last_run_time():
54
  # now = datetime.datetime.utcnow()
55
- current_timestamp = datetime.now().timestamp() * 1000
56
  log_collection.replace_one(
57
  {"key": "vectorize_faq_last_run"},
58
  {"key": "vectorize_faq_last_run", "last_run": now},
 
52
  # Function to save or update the last run time in the log collection
53
  def update_last_run_time():
54
  # now = datetime.datetime.utcnow()
55
+ current_timestamp = int(round(time.time() * 1000)) #datetime.now().timestamp() * 1000
56
  log_collection.replace_one(
57
  {"key": "vectorize_faq_last_run"},
58
  {"key": "vectorize_faq_last_run", "last_run": now},
pages/faq.py CHANGED
@@ -21,6 +21,8 @@ if search_term:
21
  else:
22
  filtered_data = faq_data
23
 
 
 
24
  # Display the FAQ list
25
  for _, row in filtered_data.iterrows():
26
  with st.expander(row['title']):
 
21
  else:
22
  filtered_data = faq_data
23
 
24
+ st.write(f'filtered {len(filtered_data)} out of {len(faq_data)}')
25
+
26
  # Display the FAQ list
27
  for _, row in filtered_data.iterrows():
28
  with st.expander(row['title']):
pages/manage_faqs.py CHANGED
@@ -4,6 +4,7 @@ from pymongo import MongoClient
4
  from dependency import get_manager, load_db
5
  from bson.objectid import ObjectId
6
  from datetime import datetime
 
7
 
8
  cookie_manager = get_manager()
9
  auth_state = cookie_manager.get(cookie='auth_state')
@@ -40,7 +41,7 @@ with st.sidebar:
40
  "title": new_title,
41
  "questions": new_questions_list,
42
  "answer": new_answer,
43
- "time_updated": datetime.now().timestamp() * 1000
44
  })
45
  st.success("New FAQ added successfully!")
46
 
@@ -51,6 +52,7 @@ if search_term:
51
  else:
52
  faq_data = faq_all
53
 
 
54
  # id = ObjectId('5e26c9f62da44968cc46444c')
55
  # result = faq_collection.update_one(
56
  # {"_id": id},
@@ -101,7 +103,7 @@ def save_edit(index):
101
  "title": new_title,
102
  "questions": new_questions.split("\n"),
103
  "answer": new_answer,
104
- "time_updated": pd.Timestamp.now().value
105
  }}
106
  )
107
  print('updated: ', result.modified_count, new_title)
 
4
  from dependency import get_manager, load_db
5
  from bson.objectid import ObjectId
6
  from datetime import datetime
7
+ import time
8
 
9
  cookie_manager = get_manager()
10
  auth_state = cookie_manager.get(cookie='auth_state')
 
41
  "title": new_title,
42
  "questions": new_questions_list,
43
  "answer": new_answer,
44
+ "time_updated": int(round(time.time() * 1000))
45
  })
46
  st.success("New FAQ added successfully!")
47
 
 
52
  else:
53
  faq_data = faq_all
54
 
55
+ st.write(f'filtered {len(faq_data)} out of {len(faq_all)}')
56
  # id = ObjectId('5e26c9f62da44968cc46444c')
57
  # result = faq_collection.update_one(
58
  # {"_id": id},
 
103
  "title": new_title,
104
  "questions": new_questions.split("\n"),
105
  "answer": new_answer,
106
+ "time_updated": int(round(time.time() * 1000))
107
  }}
108
  )
109
  print('updated: ', result.modified_count, new_title)