// AI Dashboard Application class AIDashboard { constructor() { this.data = { "approaches": [ { "name": "LLM Workflow", "functionality": "Прогнозування наступного токена", "bestCase": "Генерація тексту, саммаризація", "strengths": "Швидкість, простота, легкість впровадження", "weaknesses": "Обмежений контекст, відсутність зовнішніх знань", "examples": "Чат-боти, email-генерація", "workflow": "Користувач → Тригер на основі правил → LLM → Вихід", "description": "Найпростіший підхід, що використовує LLM для генерації тексту на основі промпту користувача", "complexity": "Низька", "icon": "🔗" }, { "name": "RAG", "functionality": "Розумний пошук знань", "bestCase": "Точні Q&A з різних джерел", "strengths": "Точність завдяки зовнішнім даним", "weaknesses": "Чутливість до якості даних", "examples": "Graph RAG, Advanced RAG, Modular RAG", "workflow": "Користувач → Векторизація → Пошук у базі → LLM (збагачений даними) → Вихід", "description": "Покращений підхід, що додає зовнішні знання до процесу генерації відповідей", "complexity": "Середня", "icon": "🔍" }, { "name": "AI Agent", "functionality": "Автономні дії з використанням компонентів", "bestCase": "Воркфлоу з інструментами та міркуванням", "strengths": "Планування + міркування, виконання складних задач", "weaknesses": "Потребує чітких цілей та доступу до інструментів", "examples": "ReACT Agent, Rewoo Agent", "workflow": "Користувач → Системний промпт → Планування → База даних/Пам'ять/Інструменти → Вихід", "description": "Автономний агент, здатний планувати та виконувати складні задачі з використанням інструментів", "complexity": "Висока", "icon": "🤖" }, { "name": "Agentic AI", "functionality": "Мультиагентна автономна система", "bestCase": "Масштабні задачі, що потребують розподілу ролей", "strengths": "Гнучкість, розподіл задач між агентами", "weaknesses": "Складність розробки та контролю", "examples": "CUA, Embodied Agents", "workflow": "Користувач → Пам'ять/Міркування/Зворотний зв'язок → Кілька агентів → Інструменти/Дані → Вихід", "description": "Найскладніша система з кількома агентами, що працюють разом для вирішення масштабних задач", "complexity": "Дуже висока", "icon": "🌐" } ], "criteria": [ "Функціональність", "Найкращий кейс", "Сильні сторони", "Слабкі сторони", "Приклади" ], "complexityLevels": ["Низька", "Середня", "Висока", "Дуже висока"], "recommendations": [ { "scenario": "Прості задачі генерації тексту", "recommendation": "LLM Workflow", "reason": "Найпростіший у впровадженні та налаштуванні" }, { "scenario": "Потреба в точних відповідях з великої бази знань", "recommendation": "RAG", "reason": "Забезпечує високу точність завдяки зовнішнім даним" }, { "scenario": "Складні задачі з використанням інструментів", "recommendation": "AI Agent", "reason": "Може планувати та виконувати багатоетапні процеси" }, { "scenario": "Масштабні проекти з розподіленими ролями", "recommendation": "Agentic AI", "reason": "Найгнучкіший для складних багатоагентних систем" } ] }; this.currentFilters = { approach: '', complexity: '', criteria: '' }; this.init(); } init() { this.setupEventListeners(); this.renderComparisonTable(); this.renderWorkflows(); this.renderDetails(); this.renderRecommendations(); } setupEventListeners() { // Filter event listeners document.getElementById('approach-filter').addEventListener('change', (e) => { this.currentFilters.approach = e.target.value; this.applyFilters(); }); document.getElementById('complexity-filter').addEventListener('change', (e) => { this.currentFilters.complexity = e.target.value; this.applyFilters(); }); document.getElementById('criteria-filter').addEventListener('change', (e) => { this.currentFilters.criteria = e.target.value; this.applyFilters(); }); // Reset filters button document.getElementById('reset-filters').addEventListener('click', () => { this.resetFilters(); }); } applyFilters() { this.renderComparisonTable(); this.renderWorkflows(); this.renderDetails(); } resetFilters() { this.currentFilters = { approach: '', complexity: '', criteria: '' }; // Reset select elements document.getElementById('approach-filter').value = ''; document.getElementById('complexity-filter').value = ''; document.getElementById('criteria-filter').value = ''; this.applyFilters(); } getFilteredApproaches() { return this.data.approaches.filter(approach => { const matchesApproach = !this.currentFilters.approach || approach.name === this.currentFilters.approach; const matchesComplexity = !this.currentFilters.complexity || approach.complexity === this.currentFilters.complexity; return matchesApproach && matchesComplexity; }); } renderComparisonTable() { const tableBody = document.getElementById('comparison-table-body'); const filteredApproaches = this.getFilteredApproaches(); tableBody.innerHTML = filteredApproaches.map(approach => `
${approach.icon} ${approach.name}
${approach.functionality} ${approach.bestCase} ${approach.strengths} ${approach.weaknesses} ${approach.complexity} `).join(''); } getComplexityClass(complexity) { const classMap = { 'Низька': 'complexity-low', 'Середня': 'complexity-medium', 'Висока': 'complexity-high', 'Дуже висока': 'complexity-very-high' }; return classMap[complexity] || 'complexity-low'; } getApproachClass(name) { const classMap = { 'LLM Workflow': 'llm-workflow', 'RAG': 'rag', 'AI Agent': 'ai-agent', 'Agentic AI': 'agentic-ai' }; return classMap[name] || 'llm-workflow'; } renderWorkflows() { const workflowsGrid = document.getElementById('workflows-grid'); const filteredApproaches = this.getFilteredApproaches(); workflowsGrid.innerHTML = filteredApproaches.map(approach => { const steps = approach.workflow.split(' → '); const stepsHtml = steps.map((step, index) => { const isLast = index === steps.length - 1; return `
${step}
${!isLast ? '
' : ''} `; }).join(''); return `
${approach.icon}

${approach.name}

${stepsHtml}
`; }).join(''); } renderDetails() { const detailsGrid = document.getElementById('details-grid'); const filteredApproaches = this.getFilteredApproaches(); detailsGrid.innerHTML = filteredApproaches.map(approach => `
${approach.icon}

${approach.name}

Опис

${approach.description}

Функціональність

${approach.functionality}

Найкращий кейс

${approach.bestCase}

Сильні сторони

${approach.strengths}

Слабкі сторони

${approach.weaknesses}

Приклади

${approach.examples}

Складність
${approach.complexity}
`).join(''); } renderRecommendations() { const recommendationsGrid = document.getElementById('recommendations-grid'); recommendationsGrid.innerHTML = this.data.recommendations.map(rec => { const approach = this.data.approaches.find(a => a.name === rec.recommendation); const approachIcon = approach ? approach.icon : '💡'; return `
Сценарій: ${rec.scenario}
${approachIcon} ${rec.recommendation}
Причина: ${rec.reason}
`; }).join(''); } } // Initialize the dashboard when the DOM is loaded document.addEventListener('DOMContentLoaded', () => { new AIDashboard(); // Add smooth scrolling for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); const target = document.querySelector(this.getAttribute('href')); if (target) { target.scrollIntoView({ behavior: 'smooth', block: 'start' }); } }); }); // Add intersection observer for fade-in animations const observerOptions = { threshold: 0.1, rootMargin: '0px 0px -50px 0px' }; const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.classList.add('fade-in'); observer.unobserve(entry.target); } }); }, observerOptions); // Observe all cards for animation const observeCards = () => { document.querySelectorAll('.card, .workflow-card, .detail-card, .recommendation-card').forEach(card => { observer.observe(card); }); }; // Initial observation setTimeout(observeCards, 100); // Re-observe after filter changes const originalApplyFilters = AIDashboard.prototype.applyFilters; AIDashboard.prototype.applyFilters = function() { originalApplyFilters.call(this); setTimeout(observeCards, 100); }; });