mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-19 11:52:20 -06:00
Update ESLint configuration, Dockerfile, and package dependencies; refactor bot trigger logic
- Updated ESLint configuration to use TypeScript project references and adjusted parser options. - Modified Dockerfile to include OpenSSL in both builder and final stages. - Changed `mime` package version from `^4.0.6` to `^3.0.0` in `package.json` and updated TypeScript ESLint packages to `^6.21.0`. - Refactored `findBotByTrigger` function to remove unnecessary settings repository parameter. - Adjusted bot trigger logic in multiple controller files to streamline function calls.
This commit is contained in:
@@ -271,7 +271,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
public async getProfileStatus() {
|
||||
const status = await this.client.fetchStatus(this.instance.wuid);
|
||||
|
||||
return status?.status;
|
||||
return status[0]?.status;
|
||||
}
|
||||
|
||||
public get profilePictureUrl() {
|
||||
@@ -974,7 +974,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
|
||||
const messagesRaw: any[] = [];
|
||||
|
||||
const messagesRepository = new Set(
|
||||
const messagesRepository: Set<string> = new Set(
|
||||
chatwootImport.getRepositoryMessagesCache(instance) ??
|
||||
(
|
||||
await this.prismaRepository.message.findMany({
|
||||
@@ -1790,7 +1790,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
try {
|
||||
return {
|
||||
wuid: jid,
|
||||
status: (await this.client.fetchStatus(jid))?.status,
|
||||
status: (await this.client.fetchStatus(jid))[0]?.status,
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
|
||||
@@ -184,7 +184,6 @@ export class ChatbotController {
|
||||
|
||||
public async findBotTrigger(
|
||||
botRepository: any,
|
||||
settingsRepository: any,
|
||||
content: string,
|
||||
instance: InstanceDto,
|
||||
session?: IntegrationSession,
|
||||
@@ -192,7 +191,7 @@ export class ChatbotController {
|
||||
let findBot: null;
|
||||
|
||||
if (!session) {
|
||||
findBot = await findBotByTrigger(botRepository, settingsRepository, content, instance.instanceId);
|
||||
findBot = await findBotByTrigger(botRepository, content, instance.instanceId);
|
||||
|
||||
if (!findBot) {
|
||||
return;
|
||||
|
||||
@@ -756,13 +756,7 @@ export class DifyController extends ChatbotController implements ChatbotControll
|
||||
|
||||
const content = getConversationMessage(msg);
|
||||
|
||||
let findBot = (await this.findBotTrigger(
|
||||
this.botRepository,
|
||||
this.settingsRepository,
|
||||
content,
|
||||
instance,
|
||||
session,
|
||||
)) as DifyModel;
|
||||
let findBot = (await this.findBotTrigger(this.botRepository, content, instance, session)) as DifyModel;
|
||||
|
||||
if (!findBot) {
|
||||
const fallback = await this.settingsRepository.findFirst({
|
||||
|
||||
@@ -728,13 +728,7 @@ export class EvolutionBotController extends ChatbotController implements Chatbot
|
||||
|
||||
const content = getConversationMessage(msg);
|
||||
|
||||
let findBot = (await this.findBotTrigger(
|
||||
this.botRepository,
|
||||
this.settingsRepository,
|
||||
content,
|
||||
instance,
|
||||
session,
|
||||
)) as EvolutionBot;
|
||||
let findBot = (await this.findBotTrigger(this.botRepository, content, instance, session)) as EvolutionBot;
|
||||
|
||||
if (!findBot) {
|
||||
const fallback = await this.settingsRepository.findFirst({
|
||||
|
||||
@@ -728,13 +728,7 @@ export class FlowiseController extends ChatbotController implements ChatbotContr
|
||||
|
||||
const content = getConversationMessage(msg);
|
||||
|
||||
let findBot = (await this.findBotTrigger(
|
||||
this.botRepository,
|
||||
this.settingsRepository,
|
||||
content,
|
||||
instance,
|
||||
session,
|
||||
)) as Flowise;
|
||||
let findBot = (await this.findBotTrigger(this.botRepository, content, instance, session)) as Flowise;
|
||||
|
||||
if (!findBot) {
|
||||
const fallback = await this.settingsRepository.findFirst({
|
||||
|
||||
@@ -965,13 +965,7 @@ export class OpenaiController extends ChatbotController implements ChatbotContro
|
||||
|
||||
const content = getConversationMessage(msg);
|
||||
|
||||
let findBot = (await this.findBotTrigger(
|
||||
this.botRepository,
|
||||
this.settingsRepository,
|
||||
content,
|
||||
instance,
|
||||
session,
|
||||
)) as OpenaiBot;
|
||||
let findBot = (await this.findBotTrigger(this.botRepository, content, instance, session)) as OpenaiBot;
|
||||
|
||||
if (!findBot) {
|
||||
const fallback = await this.settingsRepository.findFirst({
|
||||
|
||||
@@ -943,13 +943,7 @@ export class TypebotController extends ChatbotController implements ChatbotContr
|
||||
|
||||
const content = getConversationMessage(msg);
|
||||
|
||||
let findBot = (await this.findBotTrigger(
|
||||
this.botRepository,
|
||||
this.settingsRepository,
|
||||
content,
|
||||
instance,
|
||||
session,
|
||||
)) as TypebotModel;
|
||||
let findBot = (await this.findBotTrigger(this.botRepository, content, instance, session)) as TypebotModel;
|
||||
|
||||
if (!findBot) {
|
||||
const fallback = await this.settingsRepository.findFirst({
|
||||
|
||||
Reference in New Issue
Block a user