Izazo / test_agent.py
NovakTJ
debugging za history
731bda8
#!/usr/bin/env python3
"""
Simple test script for TurBot agent with memory debugging.
"""
from src.agent import chat_with_turbot
def test_memory():
"""Test the TurBot agent's memory with name test."""
print("🧠 Testing TurBot Memory - Name Test")
print("=" * 60)
test_questions = [
"Zdravo! Moje ime je Marko.",
"Kako se zovem?",
"Da li se sećaš mog imena?",
"Koje je moje ime?"
]
history = []
for i, question in enumerate(test_questions):
print(f"\n👤 Korisnik: {question}")
print("-" * 40)
try:
response = chat_with_turbot(question, history)
print(f"🤖 TurBot: {response}")
# Add to history for next iteration
history.append([question, response])
# Debug: Show current history
print(f"\n📝 History length: {len(history)}")
print("📝 Current history:")
for j, (h, a) in enumerate(history):
print(f" {j+1}. User: {h[:50]}...")
print(f" Bot: {a[:50]}...")
except Exception as e:
print(f"❌ Greška: {str(e)}")
print("-" * 40)
def test_turbot():
"""Test the TurBot agent with some sample questions."""
print("🤖 Testing TurBot - Digitalni Asistent za Turističku Agenciju")
print("=" * 60)
test_questions = [
"Zdravo! Ko ste vi?",
"Koje letnje ponude imate za Mediteran?",
"Tražim putovanje u Grčku za porodicu od četiri osobe.",
"Koji all-inclusive paketi za Tursku su dostupni?"
]
history = []
for question in test_questions:
print(f"\n👤 Korisnik: {question}")
print("-" * 40)
try:
response = chat_with_turbot(question, history)
print(f"🤖 TurBot: {response}")
# Add to history for next iteration
history.append([question, response])
except Exception as e:
print(f"❌ Greška: {str(e)}")
print("-" * 40)
if __name__ == "__main__":
# Run memory test first
test_memory()
print("\n" + "="*60)
print("Now testing regular questions...")
print("="*60)
# Then run regular test
test_turbot()