File size: 1,573 Bytes
0a8c81b | 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 | import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'apps/engine')))
from src.agents.email_parsing_agent import EmailParsingAgent
import json
def run_tests():
print("🤖 Starting Email Parsing Agent Tests...")
agent = EmailParsingAgent()
test_cases = [
{
"name": "Chinese 1688 Shipping Notification",
"body": """
【阿里巴巴】亲,您的订单已发货!
订单号: 1688-9923847293
买家:张三
运单号: YT882930491823
物流公司: 圆通速递
请注意查收。
"""
},
{
"name": "English Supplier Notification",
"body": """
Hello VLTA Dropshipping,
Good news! Your order has been shipped.
Order # S2-847291
Waybill: SF938472918342
Shipped via: SF Express International
Thanks,
Supplier Team
"""
},
{
"name": "Spam/Marketing Email",
"body": """
Huge Summer Sale! Get 50% discount on all new items.
Check out our latest newsletter for more details.
"""
}
]
for idx, case in enumerate(test_cases):
print(f"\n--- Test Case {idx+1}: {case['name']} ---")
result = agent.parse_inbound_email(case['body'])
print(json.dumps(result, indent=2, ensure_ascii=False))
if __name__ == "__main__":
run_tests()
|