#!/usr/bin/env python3 # -*- coding: utf-8 -*- from chatbot import ITMOChatbot from knowledge_base import KnowledgeBase def test_chatbot(): print("πŸ§ͺ ВСстированиС Ρ‡Π°Ρ‚-Π±ΠΎΡ‚Π°...") # Π˜Π½ΠΈΡ†ΠΈΠ°Π»ΠΈΠ·Π°Ρ†ΠΈΡ try: chatbot = ITMOChatbot() print("βœ… Π§Π°Ρ‚-Π±ΠΎΡ‚ ΠΈΠ½ΠΈΡ†ΠΈΠ°Π»ΠΈΠ·ΠΈΡ€ΠΎΠ²Π°Π½") except Exception as e: print(f"❌ Ошибка ΠΈΠ½ΠΈΡ†ΠΈΠ°Π»ΠΈΠ·Π°Ρ†ΠΈΠΈ: {e}") return # ΠŸΡ€ΠΎΠ²Π΅Ρ€ΠΊΠ° Π±Π°Π·Ρ‹ Π·Π½Π°Π½ΠΈΠΉ kb = KnowledgeBase() print(f"πŸ“Š ΠšΡƒΡ€ΡΠΎΠ² Π² Π±Π°Π·Π΅: {len(kb.courses)}") # ВСст поиска курсов ΠΏΠΎ сСмСстрам for semester in [1, 2, 3, 4]: courses = kb.get_courses_by_semester(semester) print(f"πŸ“š БСмСстр {semester}: {len(courses)} курсов") if courses: print(f" ΠŸΡ€ΠΈΠΌΠ΅Ρ€: {courses[0]['name']}") # ВСст Ρ‡Π°Ρ‚Π° print("\nπŸ’¬ ВСст Ρ‡Π°Ρ‚Π°:") test_messages = [ "КакиС дисциплины ΠΏΠΎ NLP Π² 1 сСмСстрС ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΡ‹ ИИ?", "РасскаТи ΠΎ ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ΅ AI Product", "Бколько ΠΊΡ€Π΅Π΄ΠΈΡ‚ΠΎΠ² Π·Π° курс машинного обучСния?" ] history = [] for message in test_messages: print(f"\nπŸ‘€ Вопрос: {message}") try: response, score = chatbot.chat(message, history) print(f"πŸ€– ΠžΡ‚Π²Π΅Ρ‚: {response[:100]}...") print(f"πŸ“Š Π Π΅Π»Π΅Π²Π°Π½Ρ‚Π½ΠΎΡΡ‚ΡŒ: {score:.2f}") history.append([message, response]) except Exception as e: print(f"❌ Ошибка: {e}") # ВСст Ρ€Π΅ΠΊΠΎΠΌΠ΅Π½Π΄Π°Ρ†ΠΈΠΉ print("\n🎯 ВСст Ρ€Π΅ΠΊΠΎΠΌΠ΅Π½Π΄Π°Ρ†ΠΈΠΉ:") test_profiles = [ { 'programming_experience': 4, 'math_level': 3, 'interests': ['ml', 'dl', 'python'], 'semester': 1 }, { 'programming_experience': 2, 'math_level': 2, 'interests': ['product', 'business'], 'semester': 2 } ] for i, profile in enumerate(test_profiles, 1): print(f"\nπŸ‘€ ΠŸΡ€ΠΎΡ„ΠΈΠ»ΡŒ {i}: {profile}") try: recommendations = chatbot.recommend_courses(profile) print(f"🎯 Π Π΅ΠΊΠΎΠΌΠ΅Π½Π΄Π°Ρ†ΠΈΠΈ: {recommendations[:200]}...") except Exception as e: print(f"❌ Ошибка: {e}") print("\nβœ… ВСстированиС Π·Π°Π²Π΅Ρ€ΡˆΠ΅Π½ΠΎ!") if __name__ == '__main__': test_chatbot()