fix: get integrations sessions by type

This commit is contained in:
Davidson Gomes 2024-08-24 13:18:58 -03:00
parent a90617fa0c
commit aeea61ef4b
18 changed files with 403 additions and 398 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

381
manager/dist/assets/index-PmD1d8Kz.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -5,8 +5,8 @@
<link rel="icon" type="image/png" href="/assets/images/evolution-logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Evolution Manager</title>
<script type="module" crossorigin src="/assets/index-BpEDJ12n.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-BJ9JMAl_.css">
<script type="module" crossorigin src="/assets/index-PmD1d8Kz.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DvXIV-Pi.css">
</head>
<body>
<div id="root"></div>

View File

@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "IntegrationSession" ADD COLUMN "type" VARCHAR(100);

View File

@ -397,6 +397,7 @@ model IntegrationSession {
status SessionStatus
awaitUser Boolean @default(false) @db.Boolean
context Json?
type String? @db.VarChar(100)
createdAt DateTime? @default(now()) @db.Timestamp
updatedAt DateTime @updatedAt @db.Timestamp
Message Message[]

View File

@ -649,6 +649,7 @@ export class DifyController extends ChatbotController implements ChatbotControll
instanceId: instanceId,
remoteJid,
botId: bot ? botId : { not: null },
type: 'dify',
},
});
} catch (error) {

View File

@ -29,6 +29,7 @@ export class DifyService {
awaitUser: false,
botId: data.botId,
instanceId: instance.instanceId,
type: 'dify',
},
});

View File

@ -3,12 +3,12 @@ import { InstanceDto } from '@api/dto/instance.dto';
import { PrismaRepository } from '@api/repository/repository.service';
import { WAMonitoringService } from '@api/services/monitor.service';
import { Logger } from '@config/logger.config';
import { Flowise } from '@prisma/client';
import { getConversationMessage } from '@utils/getConversationMessage';
import { ChatbotController, ChatbotControllerInterface, EmitData } from '../../chatbot.controller';
import { FlowiseDto } from '../dto/flowise.dto';
import { FlowiseService } from '../services/flowise.service';
import { Flowise } from '@prisma/client';
export class FlowiseController extends ChatbotController implements ChatbotControllerInterface {
constructor(
@ -625,6 +625,7 @@ export class FlowiseController extends ChatbotController implements ChatbotContr
instanceId: instanceId,
remoteJid,
botId: bot ? botId : { not: null },
type: 'flowise',
},
});
} catch (error) {

View File

@ -28,6 +28,7 @@ export class FlowiseService {
awaitUser: false,
botId: data.botId,
instanceId: instance.instanceId,
type: 'flowise',
},
});

View File

@ -625,6 +625,7 @@ export class GenericController extends ChatbotController implements ChatbotContr
instanceId: instanceId,
remoteJid,
botId: bot ? botId : { not: null },
type: 'generic',
},
});
} catch (error) {

View File

@ -28,6 +28,7 @@ export class GenericService {
awaitUser: false,
botId: data.botId,
instanceId: instance.instanceId,
type: 'generic',
},
});

View File

@ -363,9 +363,6 @@ export class OpenaiController extends ChatbotController implements ChatbotContro
where: {
instanceId,
},
include: {
sessions: true,
},
});
if (!bots.length) {
@ -390,9 +387,6 @@ export class OpenaiController extends ChatbotController implements ChatbotContro
where: {
id: botId,
},
include: {
sessions: true,
},
});
if (!bot) {
@ -864,9 +858,7 @@ export class OpenaiController extends ChatbotController implements ChatbotContro
instanceId: instanceId,
remoteJid,
botId: openaiBot ? botId : { not: null },
},
include: {
OpenaiBot: true,
type: 'openai',
},
});
} catch (error) {

View File

@ -244,6 +244,7 @@ export class OpenaiService {
awaitUser: false,
botId: data.botId,
instanceId: instance.instanceId,
type: 'openai',
},
});
}
@ -534,6 +535,7 @@ export class OpenaiService {
awaitUser: false,
botId: data.botId,
instanceId: instance.instanceId,
type: 'openai',
},
});

View File

@ -911,6 +911,7 @@ export class TypebotController extends ChatbotController implements ChatbotContr
instanceId: instanceId,
remoteJid,
botId: botId ?? { not: null },
type: 'typebot',
},
});
} catch (error) {

View File

@ -78,6 +78,7 @@ export class TypebotService {
awaitUser: false,
botId: data.botId,
instanceId: instance.id,
type: 'typebot',
},
});
}

View File

@ -99,7 +99,7 @@ export class EventManager {
if (data.websocket)
await this.websocket.set(instanceName, {
websocket: {
enabled: data.websocket?.enabled,
enabled: true,
events: data.websocket?.events,
},
});
@ -107,7 +107,7 @@ export class EventManager {
if (data.rabbitmq)
await this.rabbitmq.set(instanceName, {
rabbitmq: {
enabled: data.rabbitmq?.enabled,
enabled: true,
events: data.rabbitmq?.events,
},
});
@ -115,7 +115,7 @@ export class EventManager {
if (data.sqs)
await this.sqs.set(instanceName, {
sqs: {
enabled: data.sqs?.enabled,
enabled: true,
events: data.sqs?.events,
},
});
@ -123,7 +123,7 @@ export class EventManager {
if (data.webhook)
await this.webhook.set(instanceName, {
webhook: {
enabled: data.webhook?.enabled,
enabled: true,
events: data.webhook?.events,
url: data.webhook?.url,
base64: data.webhook?.base64,