Fixed position size calculation: 00 investment now shows 00 position (was 04.76) Fixed token amount display: Now shows correct tokens (~0.996) for 00 investment (was 2.04) Corrected API route: /api/automation/analysis-details now returns 200 instead of 405 Technical changes: - Updated route calculation logic: tradingAmount / trade.price for correct token amounts - Fixed displayPositionSize to show intended investment amount - Used Docker Compose v2 for container management - Resolved Next.js module export issues The API now correctly displays trade details matching user investment intentions.
64 lines
1.9 KiB
JavaScript
64 lines
1.9 KiB
JavaScript
// API endpoint for monitoring browser processes and cleanup status
|
|
import { NextResponse } from 'next/server'
|
|
|
|
export async function GET() {
|
|
try {
|
|
console.log('📊 System process monitoring request...')
|
|
|
|
// Import cleanup service
|
|
const { default: aggressiveCleanup } = await import('../../../../lib/aggressive-cleanup')
|
|
const { progressTracker } = await import('../../../../lib/progress-tracker')
|
|
|
|
// Get process information
|
|
await aggressiveCleanup.getProcessInfo()
|
|
|
|
// Get active sessions
|
|
const activeSessions = progressTracker.getActiveSessions()
|
|
const sessionDetails = activeSessions.map(sessionId => {
|
|
const progress = progressTracker.getProgress(sessionId)
|
|
return {
|
|
sessionId,
|
|
currentStep: progress?.currentStep || 0,
|
|
totalSteps: progress?.totalSteps || 0,
|
|
activeStep: progress?.steps.find(step => step.status === 'active')?.title || 'Unknown'
|
|
}
|
|
})
|
|
|
|
return NextResponse.json({
|
|
success: true,
|
|
timestamp: Date.now(),
|
|
activeSessions: sessionDetails,
|
|
message: 'Process information logged to console'
|
|
})
|
|
} catch (error) {
|
|
console.error('Error in process monitoring:', error)
|
|
return NextResponse.json({
|
|
success: false,
|
|
error: error.message
|
|
}, { status: 500 })
|
|
}
|
|
}
|
|
|
|
export async function POST() {
|
|
try {
|
|
console.log('🧹 Manual aggressive cleanup triggered...')
|
|
|
|
// Import cleanup service
|
|
const { default: aggressiveCleanup } = await import('../../../../lib/aggressive-cleanup')
|
|
|
|
// Run aggressive cleanup
|
|
await aggressiveCleanup.runPostAnalysisCleanup()
|
|
|
|
return NextResponse.json({
|
|
success: true,
|
|
message: 'Aggressive cleanup completed'
|
|
})
|
|
} catch (error) {
|
|
console.error('Error in manual aggressive cleanup:', error)
|
|
return NextResponse.json({
|
|
success: false,
|
|
error: error.message
|
|
}, { status: 500 })
|
|
}
|
|
}
|