Spaces:
Sleeping
Sleeping
File size: 1,421 Bytes
7288353 f5c3f28 7288353 f5c3f28 7288353 f5c3f28 7288353 f5c3f28 7288353 f5c3f28 7288353 f5c3f28 7288353 |
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 |
import streamlit as st
import sys
import os
# Configuração do caminho para incluir as pastas necessárias
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# Importando módulos necessários
from interface.chatbot import Chatbot
from interface.login import Login
def main():
app = Chatbot()
login = Login()
if not st.session_state.user_authorized:
login.mount_login_page()
else:
with st.sidebar:
app.create_sidebar()
user_query = app.mount_chatbot() # Recebe o input de texto feito pelo usuário
app.display_chat()
if st.session_state.is_feedback_active:
app.display_feedback()
if app.user_button_input:
st.chat_message("user").write(app.user_button_input)
app.generate_answer(app.user_button_input)
app.user_button_input = "" # Zerando a variável após uso
st.session_state.is_feedback_active = True # Ativando o feedback
app.display_feedback()
if user_query:
# Escreve e armazena a mensagem do usuário
st.chat_message("user").write(user_query)
app.generate_answer(user_query) # Gera, envia e armazena a resposta do assistente
st.session_state.is_feedback_active = True # Ativando o feedback
app.display_feedback()
if __name__ == "__main__":
main()
|