Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Add sample data to the chatbot database for testing the dashboard. | |
| This script adds realistic business transactions to populate the dashboard. | |
| """ | |
| import sys | |
| import os | |
| sys.path.append(os.path.join(os.path.dirname(__file__), 'src')) | |
| from chatbot import Chatbot | |
| from models import ChatbotRequest | |
| def add_sample_data(): | |
| """Add sample transactions to the database.""" | |
| print("π Adding sample data to the database...") | |
| chatbot = Chatbot() | |
| # Sample purchases | |
| purchases = [ | |
| "Add a purchase of 10 USB drives from TechMart at β¬5 each", | |
| "Add a purchase of 5 laptops from Electronics Plus at β¬800 each", | |
| "Add a purchase of 20 keyboards from Office Supplies Co at β¬25 each", | |
| "Add a purchase of 8 monitors from TechMart at β¬200 each", | |
| "Add a purchase of 15 webcams from Electronics Plus at β¬45 each" | |
| ] | |
| # Sample sales | |
| sales = [ | |
| "Sold 8 USB drives to ABC Corp at β¬12 each", | |
| "Sold 3 laptops to XYZ Ltd at β¬1200 each", | |
| "Sold 12 keyboards to StartupTech at β¬40 each", | |
| "Sold 5 monitors to Creative Agency at β¬350 each", | |
| "Sold 10 webcams to Remote Work Solutions at β¬75 each", | |
| "Sold 6 USB drives to Local Business at β¬15 each", | |
| "Sold 2 laptops to Consulting Firm at β¬1100 each" | |
| ] | |
| print("π¦ Adding purchase transactions...") | |
| for purchase in purchases: | |
| try: | |
| request = ChatbotRequest(message=purchase) | |
| response = chatbot.process_message(request) | |
| print(f" β {purchase}") | |
| except Exception as e: | |
| print(f" β Failed: {purchase} - {e}") | |
| print("π° Adding sales transactions...") | |
| for sale in sales: | |
| try: | |
| request = ChatbotRequest(message=sale) | |
| response = chatbot.process_message(request) | |
| print(f" β {sale}") | |
| except Exception as e: | |
| print(f" β Failed: {sale} - {e}") | |
| chatbot.close() | |
| print("β Sample data added successfully!") | |
| print("π You can now launch the GUI to see the populated dashboard:") | |
| print(" python run_gui.py") | |
| if __name__ == "__main__": | |
| add_sample_data() |