AIdeaText commited on
Commit
442ed20
verified
1 Parent(s): 3b42fa1

Update modules/semantic/semantic_agent_interaction.py

Browse files
modules/semantic/semantic_agent_interaction.py CHANGED
@@ -12,7 +12,7 @@ from io import BytesIO
12
 
13
  # Local imports
14
  from ..utils.widget_utils import generate_unique_key
15
- from ..database.semantic_mongo_db import store_semantic_interaction
16
 
17
  logger = logging.getLogger(__name__)
18
 
@@ -292,22 +292,21 @@ def get_fallback_response(lang_code):
292
  3. How could you explore the relationships between key concepts further?"""
293
 
294
  def store_conversation(username, text, metrics, graph_data, conversation):
295
- """
296
- Store the conversation in the database.
297
- """
298
  try:
299
- result = store_semantic_interaction(
300
  username=username,
301
- text=text,
302
- metrics=metrics,
303
- graph_data=graph_data,
304
- conversation=conversation
 
 
 
305
  )
306
-
307
- logger.info(f"Conversation stored successfully: {result}")
308
  return result
309
  except Exception as e:
310
- logger.error(f"Error storing conversation: {str(e)}")
311
  return False
312
 
313
  def display_semantic_chat(text, metrics, graph_data, lang_code, t):
 
12
 
13
  # Local imports
14
  from ..utils.widget_utils import generate_unique_key
15
+ from ..database.semantic_mongo_db import store_chat_history
16
 
17
  logger = logging.getLogger(__name__)
18
 
 
292
  3. How could you explore the relationships between key concepts further?"""
293
 
294
  def store_conversation(username, text, metrics, graph_data, conversation):
 
 
 
295
  try:
296
+ result = store_chat_history(
297
  username=username,
298
+ messages=conversation,
299
+ analysis_type='semantic_analysis',
300
+ metadata={
301
+ 'text_sample': text[:500],
302
+ 'key_concepts': metrics.get('key_concepts', []),
303
+ 'graph_available': bool(graph_data)
304
+ }
305
  )
306
+ logger.info(f"Conversaci贸n sem谩ntica guardada: {result}")
 
307
  return result
308
  except Exception as e:
309
+ logger.error(f"Error almacenando conversaci贸n sem谩ntica: {str(e)}")
310
  return False
311
 
312
  def display_semantic_chat(text, metrics, graph_data, lang_code, t):