Fix automation startup issue and add AI learning documentation
- Fixed foreign key constraint violation in automation service - Added user upsert to ensure user exists before creating automation session - Enhanced error reporting in automation start API - Added comprehensive AI learning system documentation - Automation now starts successfully in simulation mode
This commit is contained in:
@@ -58,6 +58,19 @@ export class AutomationService {
|
||||
|
||||
console.log(`🤖 Starting automation for ${config.symbol} ${config.timeframe} in ${config.mode} mode`)
|
||||
|
||||
// Ensure user exists in database
|
||||
await prisma.user.upsert({
|
||||
where: { id: config.userId },
|
||||
update: {},
|
||||
create: {
|
||||
id: config.userId,
|
||||
email: `${config.userId}@example.com`,
|
||||
name: config.userId,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date()
|
||||
}
|
||||
})
|
||||
|
||||
// Create automation session in database
|
||||
await prisma.automationSession.create({
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user