Merge branch 'main' of https://gitlab.com/uniqdev/web/chat-faq
Browse filesFiles changed (3)
- embed.py+1-1
- pages/faq.py+2
- pages/manage_faqs.py+4-2
51 unmodified lines5253545556575851 unmodified lines# Function to save or update the last run time in the log collectiondef update_last_run_time():# now = datetime.datetime.utcnow()current_timestamp = datetime.now().timestamp() * 1000log_collection.replace_one({"key": "vectorize_faq_last_run"},{"key": "vectorize_faq_last_run", "last_run": now},51 unmodified lines5253545556575851 unmodified lines# Function to save or update the last run time in the log collectiondef update_last_run_time():# now = datetime.datetime.utcnow()current_timestamp = int(round(time.time() * 1000)) #datetime.now().timestamp() * 1000log_collection.replace_one({"key": "vectorize_faq_last_run"},{"key": "vectorize_faq_last_run", "last_run": now},
20 unmodified lines21222324252620 unmodified lineselse:filtered_data = faq_data# Display the FAQ listfor _, row in filtered_data.iterrows():with st.expander(row['title']):20 unmodified lines212223242526272820 unmodified lineselse:filtered_data = faq_datast.write(f'filtered {len(filtered_data)} out of {len(faq_data)}')# Display the FAQ listfor _, row in filtered_data.iterrows():with st.expander(row['title']):
3 unmodified lines45678930 unmodified lines404142434445464 unmodified lines51525354555644 unmodified lines1011021031041051061073 unmodified linesfrom dependency import get_manager, load_dbfrom bson.objectid import ObjectIdfrom datetime import datetimecookie_manager = get_manager()auth_state = cookie_manager.get(cookie='auth_state')30 unmodified lines"title": new_title,"questions": new_questions_list,"answer": new_answer,"time_updated": datetime.now().timestamp() * 1000})st.success("New FAQ added successfully!")4 unmodified lineselse:faq_data = faq_all# id = ObjectId('5e26c9f62da44968cc46444c')# result = faq_collection.update_one(# {"_id": id},44 unmodified lines"title": new_title,"questions": new_questions.split("\n"),"answer": new_answer,"time_updated": pd.Timestamp.now().value}})print('updated: ', result.modified_count, new_title)3 unmodified lines4567891030 unmodified lines414243444546474 unmodified lines5253545556575844 unmodified lines1031041051061071081093 unmodified linesfrom dependency import get_manager, load_dbfrom bson.objectid import ObjectIdfrom datetime import datetimeimport timecookie_manager = get_manager()auth_state = cookie_manager.get(cookie='auth_state')30 unmodified lines"title": new_title,"questions": new_questions_list,"answer": new_answer,"time_updated": int(round(time.time() * 1000))})st.success("New FAQ added successfully!")4 unmodified lineselse:faq_data = faq_allst.write(f'filtered {len(faq_data)} out of {len(faq_all)}')# id = ObjectId('5e26c9f62da44968cc46444c')# result = faq_collection.update_one(# {"_id": id},44 unmodified lines"title": new_title,"questions": new_questions.split("\n"),"answer": new_answer,"time_updated": int(round(time.time() * 1000))}})print('updated: ', result.modified_count, new_title)
embed.py+1-1
pages/faq.py+2
pages/manage_faqs.py+4-2