career-bot / db_service.py
Abhay838's picture
Upload 11 files
e4b11ea verified
raw
history blame contribute delete
528 Bytes
from datetime import datetime, timezone
from config import chat_collection
def record_chat(user_message: str, bot_reply: str):
doc = {
"user_id": "Abhay122",
"user_message": user_message,
"bot_reply": bot_reply,
"timestamp": datetime.now(timezone.utc),
}
try:
chat_collection.insert_one(doc)
return {"recorded": True}
except Exception as e:
print("⚠️ Skipping DB insert (Mongo not available):", e)
return {"recorded": False}