diff --git a/Dockerfile b/Dockerfile index aae70eac..4c99317d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM node:20-alpine AS builder RUN apk update && \ apk add git ffmpeg wget curl bash -LABEL version="2.1.2" description="Api to control whatsapp features through http requests." +LABEL version="2.2.0" description="Api to control whatsapp features through http requests." LABEL maintainer="Davidson Gomes" git="https://github.com/DavidsonGomes" LABEL contact="contato@atendai.com" diff --git a/package.json b/package.json index 0c3a72e3..9946c585 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "evolution-api", - "version": "2.1.2", + "version": "2.2.0", "description": "Rest api for communication with WhatsApp", "main": "./dist/main.js", "type": "commonjs", diff --git a/prisma/postgresql-migrations/20241011100803_split_messages_and_time_per_char_integrations/migration.sql b/prisma/postgresql-migrations/20241011100803_split_messages_and_time_per_char_integrations/migration.sql new file mode 100644 index 00000000..de3f8095 --- /dev/null +++ b/prisma/postgresql-migrations/20241011100803_split_messages_and_time_per_char_integrations/migration.sql @@ -0,0 +1,31 @@ +-- AlterTable +ALTER TABLE "Dify" ADD COLUMN "splitMessages" BOOLEAN DEFAULT false, +ADD COLUMN "timePerChar" INTEGER DEFAULT 50; + +-- AlterTable +ALTER TABLE "DifySetting" ADD COLUMN "splitMessages" BOOLEAN DEFAULT false, +ADD COLUMN "timePerChar" INTEGER DEFAULT 50; + +-- AlterTable +ALTER TABLE "EvolutionBot" ADD COLUMN "splitMessages" BOOLEAN DEFAULT false, +ADD COLUMN "timePerChar" INTEGER DEFAULT 50; + +-- AlterTable +ALTER TABLE "EvolutionBotSetting" ADD COLUMN "splitMessages" BOOLEAN DEFAULT false, +ADD COLUMN "timePerChar" INTEGER DEFAULT 50; + +-- AlterTable +ALTER TABLE "Flowise" ADD COLUMN "splitMessages" BOOLEAN DEFAULT false, +ADD COLUMN "timePerChar" INTEGER DEFAULT 50; + +-- AlterTable +ALTER TABLE "FlowiseSetting" ADD COLUMN "splitMessages" BOOLEAN DEFAULT false, +ADD COLUMN "timePerChar" INTEGER DEFAULT 50; + +-- AlterTable +ALTER TABLE "OpenaiBot" ADD COLUMN "splitMessages" BOOLEAN DEFAULT false, +ADD COLUMN "timePerChar" INTEGER DEFAULT 50; + +-- AlterTable +ALTER TABLE "OpenaiSetting" ADD COLUMN "splitMessages" BOOLEAN DEFAULT false, +ADD COLUMN "timePerChar" INTEGER DEFAULT 50; diff --git a/src/api/integrations/chatbot/evolutionBot/controllers/evolutionBot.controller.ts b/src/api/integrations/chatbot/evolutionBot/controllers/evolutionBot.controller.ts index 195928a7..fb47c8ac 100644 --- a/src/api/integrations/chatbot/evolutionBot/controllers/evolutionBot.controller.ts +++ b/src/api/integrations/chatbot/evolutionBot/controllers/evolutionBot.controller.ts @@ -767,7 +767,7 @@ export class EvolutionBotController extends ChatbotController implements Chatbot if (!listeningFromMe) listeningFromMe = settings.listeningFromMe; if (!stopBotFromMe) stopBotFromMe = settings.stopBotFromMe; if (!keepOpen) keepOpen = settings.keepOpen; - if (!debounceTime) debounceTime = settings.debounceTime; + if (debounceTime === undefined || debounceTime === null) debounceTime = settings.debounceTime; if (!ignoreJids) ignoreJids = settings.ignoreJids; if (splitMessages === undefined || splitMessages === null) splitMessages = settings?.splitMessages ?? false; if (timePerChar === undefined || timePerChar === null) timePerChar = settings?.timePerChar ?? 0; diff --git a/src/api/integrations/chatbot/flowise/controllers/flowise.controller.ts b/src/api/integrations/chatbot/flowise/controllers/flowise.controller.ts index eab68710..8b71b3bd 100644 --- a/src/api/integrations/chatbot/flowise/controllers/flowise.controller.ts +++ b/src/api/integrations/chatbot/flowise/controllers/flowise.controller.ts @@ -767,7 +767,7 @@ export class FlowiseController extends ChatbotController implements ChatbotContr if (!listeningFromMe) listeningFromMe = settings.listeningFromMe; if (!stopBotFromMe) stopBotFromMe = settings.stopBotFromMe; if (!keepOpen) keepOpen = settings.keepOpen; - if (!debounceTime) debounceTime = settings.debounceTime; + if (debounceTime === undefined || debounceTime === null) debounceTime = settings.debounceTime; if (!ignoreJids) ignoreJids = settings.ignoreJids; if (splitMessages === undefined || splitMessages === null) splitMessages = settings?.splitMessages ?? false; if (timePerChar === undefined || timePerChar === null) timePerChar = settings?.timePerChar ?? 0; diff --git a/src/api/integrations/chatbot/openai/controllers/openai.controller.ts b/src/api/integrations/chatbot/openai/controllers/openai.controller.ts index 95a61b32..eb6996f8 100644 --- a/src/api/integrations/chatbot/openai/controllers/openai.controller.ts +++ b/src/api/integrations/chatbot/openai/controllers/openai.controller.ts @@ -1005,7 +1005,7 @@ export class OpenaiController extends ChatbotController implements ChatbotContro if (!listeningFromMe) listeningFromMe = settings.listeningFromMe; if (!stopBotFromMe) stopBotFromMe = settings.stopBotFromMe; if (!keepOpen) keepOpen = settings.keepOpen; - if (!debounceTime) debounceTime = settings.debounceTime; + if (debounceTime === undefined || debounceTime === null) debounceTime = settings.debounceTime; if (!ignoreJids) ignoreJids = settings.ignoreJids; if (splitMessages === undefined || splitMessages === null) splitMessages = settings?.splitMessages ?? false; if (timePerChar === undefined || timePerChar === null) timePerChar = settings?.timePerChar ?? 0; diff --git a/src/api/integrations/chatbot/typebot/controllers/typebot.controller.ts b/src/api/integrations/chatbot/typebot/controllers/typebot.controller.ts index e0818a68..c84a3b0a 100644 --- a/src/api/integrations/chatbot/typebot/controllers/typebot.controller.ts +++ b/src/api/integrations/chatbot/typebot/controllers/typebot.controller.ts @@ -670,52 +670,6 @@ export class TypebotController extends ChatbotController implements ChatbotContr 'init', prefilledVariables, ); - - // const response = await this.typebotService.createNewSession(instanceData, { - // enabled: true, - // url: url, - // typebot: typebot, - // remoteJid: remoteJid, - // expire: expire, - // keywordFinish: keywordFinish, - // delayMessage: delayMessage, - // unknownMessage: unknownMessage, - // listeningFromMe: listeningFromMe, - // stopBotFromMe: stopBotFromMe, - // keepOpen: keepOpen, - // prefilledVariables: prefilledVariables, - // typebotId: findBot.id, - // }); - - // if (response.session) { - // await this.typebotService.sendWAMessage( - // instanceData, - // response.session, - // { - // expire: expire, - // keywordFinish: keywordFinish, - // delayMessage: delayMessage, - // unknownMessage: unknownMessage, - // listeningFromMe: listeningFromMe, - // stopBotFromMe: stopBotFromMe, - // keepOpen: keepOpen, - // }, - // remoteJid, - // response.messages, - // response.input, - // response.clientSideActions, - // ); - - // this.waMonitor.waInstances[instance.instanceName].sendDataWebhook(Events.TYPEBOT_START, { - // remoteJid: remoteJid, - // url: url, - // typebot: typebot, - // prefilledVariables: prefilledVariables, - // sessionId: `${response.sessionId}`, - // }); - // } else { - // throw new Error('Session ID not found in response'); - // } } else { const id = Math.floor(Math.random() * 10000000000).toString();