Update modules/ui.py
Browse files- modules/ui.py +10 -6
modules/ui.py
CHANGED
|
@@ -8,10 +8,11 @@ import pandas as pd
|
|
| 8 |
from streamlit_player import st_player # Necesitarás instalar esta librería: pip install streamlit-player
|
| 9 |
from spacy import displacy
|
| 10 |
|
|
|
|
| 11 |
#Importaciones locales
|
| 12 |
#Importaciones locales de autenticación y base de datos
|
| 13 |
from .auth import authenticate_user, register_user, get_user_role
|
| 14 |
-
from .database import get_student_data, store_morphosyntax_result, store_semantic_result
|
| 15 |
|
| 16 |
#Importaciones locales funciones de análisis
|
| 17 |
from .morpho_analysis import generate_arc_diagram, get_repeated_words_colors, highlight_repeated_words, POS_COLORS, POS_TRANSLATIONS
|
|
@@ -395,17 +396,17 @@ def display_discourse_analysis_interface(nlp_models, lang_code):
|
|
| 395 |
def display_chatbot_interface(lang_code):
|
| 396 |
translations = {
|
| 397 |
'es': {
|
| 398 |
-
'title': "AIdeaText - Chatbot
|
| 399 |
'input_placeholder': "Escribe tu mensaje aquí...",
|
| 400 |
'send_button': "Enviar",
|
| 401 |
},
|
| 402 |
'en': {
|
| 403 |
-
'title': "AIdeaText -
|
| 404 |
'input_placeholder': "Type your message here...",
|
| 405 |
'send_button': "Send",
|
| 406 |
},
|
| 407 |
'fr': {
|
| 408 |
-
'title': "AIdeaText - Chatbot
|
| 409 |
'input_placeholder': "Écrivez votre message ici...",
|
| 410 |
'send_button': "Envoyer",
|
| 411 |
}
|
|
@@ -431,6 +432,9 @@ def display_chatbot_interface(lang_code):
|
|
| 431 |
st.markdown(prompt)
|
| 432 |
|
| 433 |
with st.chat_message("assistant"):
|
| 434 |
-
response = get_chatbot_response(st.session_state.chatbot, prompt)
|
| 435 |
st.markdown(response)
|
| 436 |
-
st.session_state.messages.append({"role": "assistant", "content": response})
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
from streamlit_player import st_player # Necesitarás instalar esta librería: pip install streamlit-player
|
| 9 |
from spacy import displacy
|
| 10 |
|
| 11 |
+
|
| 12 |
#Importaciones locales
|
| 13 |
#Importaciones locales de autenticación y base de datos
|
| 14 |
from .auth import authenticate_user, register_user, get_user_role
|
| 15 |
+
from .database import get_student_data, store_morphosyntax_result, store_semantic_result, store_chat_history
|
| 16 |
|
| 17 |
#Importaciones locales funciones de análisis
|
| 18 |
from .morpho_analysis import generate_arc_diagram, get_repeated_words_colors, highlight_repeated_words, POS_COLORS, POS_TRANSLATIONS
|
|
|
|
| 396 |
def display_chatbot_interface(lang_code):
|
| 397 |
translations = {
|
| 398 |
'es': {
|
| 399 |
+
'title': "AIdeaText - Chatbot Multilingüe",
|
| 400 |
'input_placeholder': "Escribe tu mensaje aquí...",
|
| 401 |
'send_button': "Enviar",
|
| 402 |
},
|
| 403 |
'en': {
|
| 404 |
+
'title': "AIdeaText - Multilingual Chatbot",
|
| 405 |
'input_placeholder': "Type your message here...",
|
| 406 |
'send_button': "Send",
|
| 407 |
},
|
| 408 |
'fr': {
|
| 409 |
+
'title': "AIdeaText - Chatbot Multilingue",
|
| 410 |
'input_placeholder': "Écrivez votre message ici...",
|
| 411 |
'send_button': "Envoyer",
|
| 412 |
}
|
|
|
|
| 432 |
st.markdown(prompt)
|
| 433 |
|
| 434 |
with st.chat_message("assistant"):
|
| 435 |
+
response = get_chatbot_response(st.session_state.chatbot, prompt, lang_code)
|
| 436 |
st.markdown(response)
|
| 437 |
+
st.session_state.messages.append({"role": "assistant", "content": response})
|
| 438 |
+
|
| 439 |
+
# Guardar la conversación en la base de datos
|
| 440 |
+
store_chat_history(st.session_state.username, st.session_state.messages)
|