const { PrismaClient } = require('@prisma/client'); const prisma = new PrismaClient(); async function testFreshSystem() { console.log('๐Ÿงช Testing Fresh AI Learning System...\n'); try { // Check that learning data is cleared const learningCount = await prisma.ai_learning_data.count(); const sessionCount = await prisma.automation_sessions.count(); const tradeCount = await prisma.trades.count(); console.log('๐Ÿ“Š Database Status:'); console.log(` AI Learning Entries: ${learningCount} (should be 0)`); console.log(` Automation Sessions: ${sessionCount} (should be 0)`); console.log(` Total Trades: ${tradeCount} (preserved for reference)`); // Test creating a new learning entry const testEntry = await prisma.ai_learning_data.create({ data: { id: `test_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, userId: 'test-user', sessionId: 'test-session', symbol: 'SOLUSD', timeframe: '60', analysisData: { trend: 'BEARISH', confidence: 85, reasoning: 'Test entry for fresh system' }, marketConditions: { volatility: 'HIGH', volume: 'NORMAL' }, outcome: 'PENDING', confidenceScore: 85, createdAt: new Date() } }); console.log('\nโœ… Test Learning Entry Created:'); console.log(` ID: ${testEntry.id}`); console.log(` Outcome: ${testEntry.outcome}`); console.log(` Confidence: ${testEntry.confidenceScore}%`); // Clean up test entry await prisma.ai_learning_data.delete({ where: { id: testEntry.id } }); console.log('\n๐Ÿ—‘๏ธ Test entry cleaned up'); console.log('\n๐ŸŽฏ Fresh AI Learning System Ready!'); console.log(' - Database cleared and ready for new learning'); console.log(' - Trade confirmation system implemented'); console.log(' - ChatGPT integration available for trade clarification'); console.log(' - Manual override and abort reasoning captured'); } catch (error) { console.error('โŒ Test failed:', error); } finally { await prisma.$disconnect(); } } testFreshSystem();