File size: 1,451 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
#!/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 test_chatbot():
    print("🧪 Testing Chatbot System")
    print("="*50)
    
    chatbot = Chatbot()
    
    # Test cases
    test_cases = [
        "Add a purchase of 20 USB drives from TechMart at €5 each",
        "Sold 10 laptops to John Smith at €800 each",
        "Purchase 5 office chairs from Office Supplies Co at €150 per chair",
        "Show recent transactions",
        "Find USB drives",
        "Search TechMart",
        "Meeting with new supplier scheduled for next week"
    ]
    
    for i, test_message in enumerate(test_cases, 1):
        print(f"\n🔍 Test {i}: {test_message}")
        print("-" * 50)
        
        request = ChatbotRequest(message=test_message)
        response = chatbot.process_message(request)
        
        print(f"Response: {response.response}")
        
        if response.entities_extracted:
            entities = response.entities_extracted
            print(f"Entities: {entities.transaction_type} - {entities.product} ({entities.quantity}x) - €{entities.total_amount}")
        
        if response.vector_stored:
            print("✅ Stored in vector database")
        
        print()
    
    chatbot.close()
    print("✅ All tests completed!")

if __name__ == "__main__":
    test_chatbot()