Spaces:
Sleeping
Sleeping
File size: 2,243 Bytes
401b16c | 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | #!/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() |