#!/usr/bin/env python3 import sys import os sys.path.append(os.path.join(os.path.dirname(__file__), 'src')) from chatbot import Chatbot from models import ChatbotRequest def main(): print("šŸ¤– Business Chatbot with SQL Database and Vector Store") print("="*60) print("I can help you with:") print("• Adding purchases: 'Add a purchase of 20 USB drives from TechMart at €5 each'") print("• Adding sales: 'Sold 10 laptops to John Smith at €800 each'") print("• Viewing recent transactions: 'Show recent transactions'") print("• Searching: 'Find USB drives' or 'Search TechMart'") print("• Storing general info: 'Meeting with supplier scheduled for next week'") print("• Type 'quit' to exit") print("="*60) chatbot = Chatbot() try: while True: user_input = input("\nšŸ’¬ You: ").strip() if user_input.lower() in ['quit', 'exit', 'bye']: print("šŸ‘‹ Goodbye!") break if not user_input: continue # Process the message request = ChatbotRequest(message=user_input) response = chatbot.process_message(request) print(f"\nšŸ¤– Bot: {response.response}") # Show additional info if available if response.entities_extracted: print(f"šŸ“Š Extracted: {response.entities_extracted.transaction_type} - {response.entities_extracted.product} ({response.entities_extracted.quantity}x) - €{response.entities_extracted.total_amount}") if response.vector_stored: print("šŸ’¾ Information stored in vector database for future semantic search") if response.intent_detected: print(f"šŸŽÆ Intent: {response.intent_detected} (confidence: {response.intent_confidence:.2f})") if response.awaiting_clarification: print("ā³ Waiting for your response to complete the transaction...") except KeyboardInterrupt: print("\nšŸ‘‹ Goodbye!") finally: chatbot.close() if __name__ == "__main__": main()