Update modules/database.py
Browse files- modules/database.py +15 -0
modules/database.py
CHANGED
@@ -202,3 +202,18 @@ def store_semantic_result(username, text, network_diagram):
|
|
202 |
def store_discourse_semantic_result(username, text, discourse_analysis):
|
203 |
# Implementaci贸n similar a las anteriores
|
204 |
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
def store_discourse_semantic_result(username, text, discourse_analysis):
|
203 |
# Implementaci贸n similar a las anteriores
|
204 |
pass
|
205 |
+
|
206 |
+
###############################################################################################################
|
207 |
+
def store_chat_history(username, messages):
|
208 |
+
try:
|
209 |
+
chat_document = {
|
210 |
+
'username': username,
|
211 |
+
'timestamp': datetime.utcnow(),
|
212 |
+
'messages': messages
|
213 |
+
}
|
214 |
+
result = chat_collection.insert_one(chat_document)
|
215 |
+
logger.info(f"Chat history saved with ID: {result.inserted_id} for user: {username}")
|
216 |
+
return True
|
217 |
+
except Exception as e:
|
218 |
+
logger.error(f"Error saving chat history for user {username}: {str(e)}")
|
219 |
+
return False
|