File size: 2,245 Bytes
c863052
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# modules/ui.py

import streamlit as st
from .database import get_student_data
from .morpho_analysis import get_repeated_words_colors, highlight_repeated_words, POS_COLORS, POS_TRANSLATIONS
from .syntax_analysis import visualize_syntax

def display_chat_interface():
    st.markdown("### Chat con AIdeaText")

    # Initialize chat history if it doesn't exist
    if 'chat_history' not in st.session_state:
        st.session_state.chat_history = []

    # Display chat history
    for i, (role, text) in enumerate(st.session_state.chat_history):
        if role == "user":
            st.text_area(f"Tú:", value=text, height=50, key=f"user_message_{i}", disabled=True)
        else:
            st.text_area(f"AIdeaText:", value=text, height=50, key=f"bot_message_{i}", disabled=True)

    # User input field
    user_input = st.text_input("Escribe tu mensaje aquí:")

    if st.button("Enviar"):
        if user_input:
            # Add user message to history
            st.session_state.chat_history.append(("user", user_input))
            
            # Get chatbot response (esta función debe estar definida en otro lugar)
            response = get_chatbot_response(user_input)
            
            # Add chatbot response to history
            st.session_state.chat_history.append(("bot", response))
            
            # Clear input field
            st.experimental_rerun()

def display_student_progress(student_data):
    st.success("Datos obtenidos exitosamente")
    
    # Mostrar estadísticas generales
    st.subheader("Estadísticas generales")
    st.write(f"Total de entradas: {student_data['entries_count']}")
    
    # Mostrar gráfico de conteo de palabras
    st.subheader("Conteo de palabras por categoría")
    st.bar_chart(student_data['word_count'])
    
    # Mostrar entradas recientes
    st.subheader("Entradas recientes")
    for entry in student_data['entries'][:5]:  # Mostrar las 5 entradas más recientes
        st.text_area(f"Entrada del {entry['timestamp']}", entry['text'], height=100)

def display_text_analysis_interface(nlp_models, lang_code):
    # Aquí va tu lógica actual para la interfaz de análisis de texto
    # ...

# Puedes agregar más funciones de UI según sea necesario