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

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,