Update modules/studentact/student_activities_v2.py
Browse files
modules/studentact/student_activities_v2.py
CHANGED
|
@@ -399,17 +399,6 @@ def clean_chat_content(content: str) -> str:
|
|
| 399 |
content = re.sub(r'\s+', ' ', content).strip()
|
| 400 |
return content
|
| 401 |
|
| 402 |
-
# Modificar el loop de visualizaci贸n en display_chat_activities:
|
| 403 |
-
for message in chat['messages']:
|
| 404 |
-
role = message.get('role', 'unknown')
|
| 405 |
-
content = clean_chat_content(message.get('content', ''))
|
| 406 |
-
|
| 407 |
-
with st.chat_message(role):
|
| 408 |
-
st.markdown(content)
|
| 409 |
-
|
| 410 |
-
st.divider()
|
| 411 |
-
|
| 412 |
-
|
| 413 |
#################################################################################
|
| 414 |
def display_chat_activities(username: str, t: dict):
|
| 415 |
"""
|
|
@@ -446,7 +435,7 @@ def display_chat_activities(username: str, t: dict):
|
|
| 446 |
# Usar el componente de chat de Streamlit
|
| 447 |
with st.chat_message(role):
|
| 448 |
st.markdown(content)
|
| 449 |
-
|
| 450 |
# Agregar separador entre mensajes
|
| 451 |
st.divider()
|
| 452 |
else:
|
|
@@ -460,23 +449,7 @@ def display_chat_activities(username: str, t: dict):
|
|
| 460 |
logger.error(f"Error mostrando historial del chat: {str(e)}")
|
| 461 |
st.error(t.get('error_chat', 'Error al mostrar historial del chat'))
|
| 462 |
|
| 463 |
-
|
| 464 |
-
# Si necesitas procesar chats fuera de esta funci贸n, crea una nueva funci贸n:
|
| 465 |
-
|
| 466 |
-
def get_formatted_chats(username: str, limit: int = 50) -> list:
|
| 467 |
-
"""Obtiene chats formateados para uso externo"""
|
| 468 |
-
chat_history = get_chat_history(
|
| 469 |
-
username=username,
|
| 470 |
-
analysis_type='sidebar',
|
| 471 |
-
limit=limit
|
| 472 |
-
)
|
| 473 |
-
return [
|
| 474 |
-
{
|
| 475 |
-
'timestamp': chat['timestamp'],
|
| 476 |
-
'messages': chat.get('messages', [])
|
| 477 |
-
}
|
| 478 |
-
for chat in reversed(chat_history)
|
| 479 |
-
] if chat_history else []
|
| 480 |
|
| 481 |
#################################################################################
|
| 482 |
|
|
|
|
| 399 |
content = re.sub(r'\s+', ' ', content).strip()
|
| 400 |
return content
|
| 401 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 402 |
#################################################################################
|
| 403 |
def display_chat_activities(username: str, t: dict):
|
| 404 |
"""
|
|
|
|
| 435 |
# Usar el componente de chat de Streamlit
|
| 436 |
with st.chat_message(role):
|
| 437 |
st.markdown(content)
|
| 438 |
+
|
| 439 |
# Agregar separador entre mensajes
|
| 440 |
st.divider()
|
| 441 |
else:
|
|
|
|
| 449 |
logger.error(f"Error mostrando historial del chat: {str(e)}")
|
| 450 |
st.error(t.get('error_chat', 'Error al mostrar historial del chat'))
|
| 451 |
|
| 452 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 453 |
|
| 454 |
#################################################################################
|
| 455 |
|