File size: 1,018 Bytes
6f053b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import sys
import os

# Ensure src is in path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))

from infrastructure.core import InsuranceChatbot

def main():
    print("Initializing Insurance Policy Assistant Chatbot...")
    bot = InsuranceChatbot()
    bot.train_model()
    
    print("\nChatbot ready! Type 'salir' to exit.")
    print("-" * 50)
    
    while True:
        try:
            user_input = input("Tú: ")
            if user_input.lower() in ['salir', 'exit', 'quit']:
                print("Hasta luego!")
                break
                
            response = bot.handle_message(user_input)
            # The actions currently print to stdout, so response might be None or return value
            if response:
                print(f"Bot: {response}")
                
        except KeyboardInterrupt:
            print("\nExiting...")
            break
        except Exception as e:
            print(f"Error: {e}")

if __name__ == "__main__":
    main()