'use client' import React, { useState, useEffect } from 'react' interface LearningData { totalAnalyses: number totalTrades: number avgAccuracy: number winRate: number confidenceLevel: number phase: string phaseDescription: string strengths: string[] improvements: string[] nextMilestone: string recommendation: string daysActive: number } interface LearningInsights { totalAnalyses: number avgAccuracy: number bestTimeframe: string worstTimeframe: string recommendations: string[] } export default function CompleteLearningPage() { const [learningData, setLearningData] = useState(null) const [learningInsights, setLearningInsights] = useState(null) const [loading, setLoading] = useState(true) const [lastRefresh, setLastRefresh] = useState(new Date()) // Auto-refresh every 30 seconds useEffect(() => { fetchLearningData() const interval = setInterval(() => { fetchLearningData() }, 30000) return () => clearInterval(interval) }, []) const fetchLearningData = async () => { try { setLoading(true) // Fetch AI learning status const [statusResponse, insightsResponse] = await Promise.all([ fetch('/api/ai-learning-status'), fetch('/api/automation/learning-insights') ]) if (statusResponse.ok) { const statusData = await statusResponse.json() if (statusData.success) { setLearningData(statusData.data) } } if (insightsResponse.ok) { const insightsData = await insightsResponse.json() if (insightsData.success) { setLearningInsights(insightsData.insights) } } setLastRefresh(new Date()) } catch (error) { console.error('Failed to fetch learning data:', error) } finally { setLoading(false) } } const getPhaseColor = (phase: string) => { switch (phase) { case 'EXPERT': return 'text-green-400' case 'ADVANCED': return 'text-blue-400' case 'PATTERN_RECOGNITION': return 'text-yellow-400' default: return 'text-gray-400' } } const getPhaseIcon = (phase: string) => { switch (phase) { case 'EXPERT': return '🚀' case 'ADVANCED': return '🌳' case 'PATTERN_RECOGNITION': return '🌿' default: return '🌱' } } if (loading && !learningData) { return (
Loading comprehensive learning data...
) } return (
{/* Header */}

🧠 Complete AI Learning Status

Comprehensive overview of your AI's learning progress and capabilities

Last updated: {lastRefresh.toLocaleTimeString()} ⟳ Auto-refreshes every 30 seconds
{/* Quick Stats */}
{learningData?.totalAnalyses || 0}
Total Analyses
{learningData?.totalTrades || 0}
Total Trades
{((learningData?.avgAccuracy || 0) * 100).toFixed(1)}%
Avg Accuracy
{((learningData?.winRate || 0) * 100).toFixed(1)}%
Win Rate
{/* AI Learning Phase */} {learningData && (

{getPhaseIcon(learningData.phase)} AI Learning Phase

{/* Current Phase */}
{learningData.phase}
{learningData.phaseDescription}
Active for {learningData.daysActive} days
{/* Performance Metrics */}
{learningData.confidenceLevel.toFixed(1)}%
Confidence Level
{((learningData.avgAccuracy || 0) * 100).toFixed(1)}%
Accuracy
{/* Next Milestone */}
Next Milestone
{learningData.nextMilestone}
{/* AI Recommendation */}
AI Recommendation
{learningData.recommendation}
)} {/* Strengths & Improvements */} {learningData && (

📈 Performance Analysis

{/* Strengths */}

Current Strengths

    {learningData.strengths.map((strength, idx) => (
  • {strength}
  • ))}
{/* Improvements */}

🎯 Areas for Improvement

    {learningData.improvements.map((improvement, idx) => (
  • {improvement}
  • ))}
)} {/* Learning Insights */} {learningInsights && (

🎯 Learning Insights

Total Analyses: {learningInsights.totalAnalyses}
Avg Accuracy: {(learningInsights.avgAccuracy * 100).toFixed(1)}%
Best Timeframe: {learningInsights.bestTimeframe}
Worst Timeframe: {learningInsights.worstTimeframe}
{learningInsights.recommendations.length > 0 && (

💡 AI Recommendations

    {learningInsights.recommendations.map((rec, idx) => (
  • 💡 {rec}
  • ))}
)}
)} {/* Refresh Control */}

🔄 Data Controls

Auto Refresh: Every 30 seconds
Last Updated: {lastRefresh.toLocaleTimeString()}
Data refreshes automatically to show the latest AI learning progress
{/* Status Messages */} {!learningData && !loading && (
⚠️ No Learning Data Available
The AI hasn't started learning yet. Run some analyses to see learning progress here.
)} {/* Footer Info */}

This page automatically refreshes every 30 seconds to show real-time AI learning progress.

Navigate to /automation to start the AI learning process.

) }