- Added live-decisions API call after learning system recording - All AI decisions (HOLD, BUY, SELL) now appear in dashboard - Fixed the 'Waiting for Analysis' issue in frontend - Decisions include full context: confidence, reasoning, levels, etc
37 lines
1.0 KiB
JavaScript
37 lines
1.0 KiB
JavaScript
// Singleton automation instance manager with learning integration
|
|
let automationInstance = null;
|
|
|
|
async function createAutomationInstance() {
|
|
try {
|
|
// Use the working simple automation directly
|
|
const { simpleAutomation } = await import('./simple-automation.js');
|
|
console.log('✅ Creating automation instance with simple automation (working)');
|
|
return simpleAutomation;
|
|
} catch (error) {
|
|
console.error('❌ Could not create automation instance:', error);
|
|
throw new Error('No automation system available');
|
|
}
|
|
}
|
|
|
|
async function getAutomationInstance() {
|
|
if (!automationInstance) {
|
|
automationInstance = await createAutomationInstance();
|
|
}
|
|
return automationInstance;
|
|
}
|
|
|
|
async function resetAutomationInstance() {
|
|
if (automationInstance) {
|
|
console.log('🔄 Resetting automation instance');
|
|
if (typeof automationInstance.stop === 'function') {
|
|
await automationInstance.stop();
|
|
}
|
|
}
|
|
automationInstance = null;
|
|
}
|
|
|
|
export {
|
|
getAutomationInstance,
|
|
resetAutomationInstance
|
|
};
|