29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
from colorama import Fore, Back, Style
|
|
|
|
|
|
class MessageManager:
|
|
|
|
def create_chat(self, qa):
|
|
|
|
# Emoticon de robot
|
|
ia_emoticon = "\U0001F916" # Emoticon de robot Unicode
|
|
humano_emoticon = "\U0001F604" # Emoticon de carita feliz Unicode
|
|
|
|
# Imprimir el texto en amarillo y negrita con el emoticon de robot
|
|
|
|
# Definicimo el mensaje de la IA
|
|
print(f"{ia_emoticon} " + Style.BRIGHT + Fore.YELLOW +
|
|
"IA: " + Style.RESET_ALL + "Pregunta algo al documento")
|
|
while True:
|
|
input_usuario = input(
|
|
Style.BRIGHT + Fore.BLUE + f"{humano_emoticon} You: " + Style.RESET_ALL)
|
|
if input_usuario.lower() == 'salir':
|
|
break
|
|
bot_response = qa.invoke({"question": f"{input_usuario}"},
|
|
return_only_outputs=True)
|
|
print(f'{ia_emoticon} ' + Style.BRIGHT + Fore.YELLOW +
|
|
'IA:' + Style.RESET_ALL + f'{bot_response["answer"]}')
|
|
|
|
def generate_citations(self):
|
|
pass
|