Fix automation system and AI learning integration

Fixed automation v2 start button (relative API URLs)
 Fixed batch analysis API endpoint in simple-automation
 Fixed AI learning storage with correct userId
 Implemented comprehensive learning data storage
 Fixed parallel analysis system working correctly

- Changed frontend API calls from localhost:9001 to relative URLs
- Updated simple-automation to use localhost:3000 for batch analysis
- Fixed learning integration with 'default-user' instead of 'system'
- AI learning now stores analysis results with confidence/recommendations
- Batch analysis working: 35s completion, 85% confidence, learning stored
- True parallel screenshot system operational (6 screenshots when multi-timeframe)
- Automation start/stop functionality fully working
This commit is contained in:
mindesbunister
2025-07-24 22:56:16 +02:00
parent 91f6cd8b10
commit 0e3baa139f
10 changed files with 1250 additions and 512 deletions

View File

@@ -1,25 +1,26 @@
import { emergencyAutomation } from '@/lib/emergency-automation'
import { simpleAutomation } from '@/lib/simple-automation';
export async function POST() {
try {
console.log('🚨 EMERGENCY: Stop request received')
console.log('🛑 AUTOMATION STOP: Request received');
const result = await emergencyAutomation.stop()
const result = await simpleAutomation.stop();
// Also force kill any remaining processes
// Additional cleanup
try {
const { execSync } = require('child_process')
execSync('pkill -f "chrome|chromium" 2>/dev/null || true')
console.log('✅ EMERGENCY: Cleanup completed')
const { execSync } = require('child_process');
execSync('pkill -f "chrome|chromium" 2>/dev/null || true');
console.log('✅ Additional cleanup completed');
} catch (cleanupError) {
console.error('Cleanup error:', cleanupError.message)
console.error('Cleanup error:', cleanupError.message);
}
return Response.json(result)
return Response.json(result);
} catch (error) {
console.error('Stop automation error:', error);
return Response.json({
success: false,
message: error.message
}, { status: 500 })
}, { status: 500 });
}
}