Update modules/database.py
Browse files- modules/database.py +16 -3
modules/database.py
CHANGED
|
@@ -234,9 +234,22 @@ def store_semantic_result(username, text, network_diagram):
|
|
| 234 |
return False
|
| 235 |
|
| 236 |
###############################################################################################################
|
| 237 |
-
def
|
| 238 |
-
|
| 239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 240 |
|
| 241 |
###############################################################################################################
|
| 242 |
def store_chat_history(username, messages):
|
|
|
|
| 234 |
return False
|
| 235 |
|
| 236 |
###############################################################################################################
|
| 237 |
+
def store_discourse_analysis_result(username, text, graph1, graph2):
|
| 238 |
+
try:
|
| 239 |
+
analysis_document = {
|
| 240 |
+
'username': username,
|
| 241 |
+
'timestamp': datetime.utcnow(),
|
| 242 |
+
'text': text,
|
| 243 |
+
'graph1': graph1,
|
| 244 |
+
'graph2': graph2,
|
| 245 |
+
'analysis_type': 'discourse'
|
| 246 |
+
}
|
| 247 |
+
result = analysis_collection.insert_one(analysis_document)
|
| 248 |
+
logger.info(f"An谩lisis discursivo guardado con ID: {result.inserted_id} para el usuario: {username}")
|
| 249 |
+
return True
|
| 250 |
+
except Exception as e:
|
| 251 |
+
logger.error(f"Error al guardar el an谩lisis discursivo para el usuario {username}: {str(e)}")
|
| 252 |
+
return False
|
| 253 |
|
| 254 |
###############################################################################################################
|
| 255 |
def store_chat_history(username, messages):
|