mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-14 09:51:24 -06:00
feat: dify now identifies images
This commit is contained in:
parent
376cafa350
commit
061696e140
@ -3,6 +3,7 @@
|
|||||||
### Features
|
### Features
|
||||||
|
|
||||||
* Added ignoreJids in chatwoot settings
|
* Added ignoreJids in chatwoot settings
|
||||||
|
* Dify now identifies images
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
2
manager/dist/index.html
vendored
2
manager/dist/index.html
vendored
@ -5,7 +5,7 @@
|
|||||||
<link rel="icon" type="image/png" href="/assets/images/evolution-logo.png" />
|
<link rel="icon" type="image/png" href="/assets/images/evolution-logo.png" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Evolution Manager</title>
|
<title>Evolution Manager</title>
|
||||||
<script type="module" crossorigin src="/assets/index-BXAjm9gh.js"></script>
|
<script type="module" crossorigin src="/assets/index-Cqx_OwQi.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-DZ0gaAHg.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-DZ0gaAHg.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -0,0 +1,208 @@
|
|||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to drop the column `difySessionId` on the `Message` table. All the data in the column will be lost.
|
||||||
|
- You are about to drop the column `openaiSessionId` on the `Message` table. All the data in the column will be lost.
|
||||||
|
- You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||||
|
- You are about to drop the `DifySession` table. If the table is not empty, all the data it contains will be lost.
|
||||||
|
- You are about to drop the `OpenaiSession` table. If the table is not empty, all the data it contains will be lost.
|
||||||
|
- You are about to drop the `TypebotSession` table. If the table is not empty, all the data it contains will be lost.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- DropForeignKey
|
||||||
|
ALTER TABLE `DifySession` DROP FOREIGN KEY `DifySession_difyId_fkey`;
|
||||||
|
|
||||||
|
-- DropForeignKey
|
||||||
|
ALTER TABLE `DifySession` DROP FOREIGN KEY `DifySession_instanceId_fkey`;
|
||||||
|
|
||||||
|
-- DropForeignKey
|
||||||
|
ALTER TABLE `Message` DROP FOREIGN KEY `Message_difySessionId_fkey`;
|
||||||
|
|
||||||
|
-- DropForeignKey
|
||||||
|
ALTER TABLE `Message` DROP FOREIGN KEY `Message_openaiSessionId_fkey`;
|
||||||
|
|
||||||
|
-- DropForeignKey
|
||||||
|
ALTER TABLE `Message` DROP FOREIGN KEY `Message_typebotSessionId_fkey`;
|
||||||
|
|
||||||
|
-- DropForeignKey
|
||||||
|
ALTER TABLE `OpenaiSession` DROP FOREIGN KEY `OpenaiSession_instanceId_fkey`;
|
||||||
|
|
||||||
|
-- DropForeignKey
|
||||||
|
ALTER TABLE `OpenaiSession` DROP FOREIGN KEY `OpenaiSession_openaiBotId_fkey`;
|
||||||
|
|
||||||
|
-- DropForeignKey
|
||||||
|
ALTER TABLE `TypebotSession` DROP FOREIGN KEY `TypebotSession_instanceId_fkey`;
|
||||||
|
|
||||||
|
-- DropForeignKey
|
||||||
|
ALTER TABLE `TypebotSession` DROP FOREIGN KEY `TypebotSession_typebotId_fkey`;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `Chat` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `Chatwoot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `Dify` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `DifySetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
|
||||||
|
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `Message` DROP COLUMN `difySessionId`,
|
||||||
|
DROP COLUMN `openaiSessionId`,
|
||||||
|
ADD COLUMN `sessionId` VARCHAR(191) NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `OpenaiBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `OpenaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `Setting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `Typebot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `TypebotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `Webhook` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||||
|
|
||||||
|
-- DropTable
|
||||||
|
DROP TABLE `DifySession`;
|
||||||
|
|
||||||
|
-- DropTable
|
||||||
|
DROP TABLE `OpenaiSession`;
|
||||||
|
|
||||||
|
-- DropTable
|
||||||
|
DROP TABLE `TypebotSession`;
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE `IntegrationSession` (
|
||||||
|
`id` VARCHAR(191) NOT NULL,
|
||||||
|
`sessionId` VARCHAR(255) NOT NULL,
|
||||||
|
`remoteJid` VARCHAR(100) NOT NULL,
|
||||||
|
`pushName` VARCHAR(191) NULL,
|
||||||
|
`status` ENUM('opened', 'closed', 'paused') NOT NULL,
|
||||||
|
`awaitUser` BOOLEAN NOT NULL DEFAULT false,
|
||||||
|
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`updatedAt` TIMESTAMP NOT NULL,
|
||||||
|
`instanceId` VARCHAR(191) NOT NULL,
|
||||||
|
`parameters` JSON NULL,
|
||||||
|
`openaiBotId` VARCHAR(191) NULL,
|
||||||
|
`difyId` VARCHAR(191) NULL,
|
||||||
|
`typebotId` VARCHAR(191) NULL,
|
||||||
|
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE `Message` ADD CONSTRAINT `Message_sessionId_fkey` FOREIGN KEY (`sessionId`) REFERENCES `IntegrationSession`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE `IntegrationSession` ADD CONSTRAINT `IntegrationSession_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE `IntegrationSession` ADD CONSTRAINT `IntegrationSession_openaiBotId_fkey` FOREIGN KEY (`openaiBotId`) REFERENCES `OpenaiBot`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE `IntegrationSession` ADD CONSTRAINT `IntegrationSession_difyId_fkey` FOREIGN KEY (`difyId`) REFERENCES `Dify`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE `IntegrationSession` ADD CONSTRAINT `IntegrationSession_typebotId_fkey` FOREIGN KEY (`typebotId`) REFERENCES `Typebot`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
@ -334,7 +334,7 @@ model IntegrationSession {
|
|||||||
pushName String?
|
pushName String?
|
||||||
status SessionStatus
|
status SessionStatus
|
||||||
awaitUser Boolean @default(false)
|
awaitUser Boolean @default(false)
|
||||||
createdAt DateTime? @default(now()) @db.Timestamp
|
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||||
updatedAt DateTime @updatedAt @db.Timestamp
|
updatedAt DateTime @updatedAt @db.Timestamp
|
||||||
Message Message[]
|
Message Message[]
|
||||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||||
|
@ -670,11 +670,27 @@ export class DifyService {
|
|||||||
: msg?.message?.audioMessage
|
: msg?.message?.audioMessage
|
||||||
? `audioMessage|${mediaId}`
|
? `audioMessage|${mediaId}`
|
||||||
: undefined,
|
: undefined,
|
||||||
imageMessage: msg?.message?.imageMessage ? `imageMessage|${mediaId}` : undefined,
|
imageMessage: msg?.message?.imageMessage
|
||||||
videoMessage: msg?.message?.videoMessage ? `videoMessage|${mediaId}` : undefined,
|
? `imageMessage|${mediaId}${
|
||||||
documentMessage: msg?.message?.documentMessage ? `documentMessage|${mediaId}` : undefined,
|
msg?.message?.imageMessage?.caption ? `|${msg?.message?.imageMessage?.caption}` : ''
|
||||||
documentWithCaptionMessage: msg?.message?.auddocumentWithCaptionMessageioMessage
|
}`
|
||||||
? `documentWithCaptionMessage|${mediaId}`
|
: undefined,
|
||||||
|
videoMessage: msg?.message?.videoMessage
|
||||||
|
? `videoMessage|${mediaId}${
|
||||||
|
msg?.message?.videoMessage?.caption ? `|${msg?.message?.videoMessage?.caption}` : ''
|
||||||
|
}`
|
||||||
|
: undefined,
|
||||||
|
documentMessage: msg?.message?.documentMessage
|
||||||
|
? `documentMessage|${mediaId}${
|
||||||
|
msg?.message?.documentMessage?.caption ? `|${msg?.message?.documentMessage?.caption}` : ''
|
||||||
|
}`
|
||||||
|
: undefined,
|
||||||
|
documentWithCaptionMessage: msg?.message?.documentWithCaptionMessage?.message?.documentMessage
|
||||||
|
? `documentWithCaptionMessage|${mediaId}${
|
||||||
|
msg?.message?.documentWithCaptionMessage?.message?.documentMessage?.caption
|
||||||
|
? `|${msg?.message?.documentWithCaptionMessage?.message?.documentMessage?.caption}`
|
||||||
|
: ''
|
||||||
|
}`
|
||||||
: undefined,
|
: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1035,6 +1051,10 @@ export class DifyService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private isImageMessage(content: string) {
|
||||||
|
return content.includes('imageMessage');
|
||||||
|
}
|
||||||
|
|
||||||
private async initNewSession(
|
private async initNewSession(
|
||||||
instance: any,
|
instance: any,
|
||||||
remoteJid: string,
|
remoteJid: string,
|
||||||
@ -1057,7 +1077,7 @@ export class DifyService {
|
|||||||
|
|
||||||
if (dify.botType === 'chatBot') {
|
if (dify.botType === 'chatBot') {
|
||||||
endpoint += '/chat-messages';
|
endpoint += '/chat-messages';
|
||||||
const payload = {
|
const payload: any = {
|
||||||
inputs: {
|
inputs: {
|
||||||
remoteJid: remoteJid,
|
remoteJid: remoteJid,
|
||||||
pushName: pushName,
|
pushName: pushName,
|
||||||
@ -1071,6 +1091,19 @@ export class DifyService {
|
|||||||
user: remoteJid,
|
user: remoteJid,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (this.isImageMessage(content)) {
|
||||||
|
const contentSplit = content.split('|');
|
||||||
|
|
||||||
|
payload.files = [
|
||||||
|
{
|
||||||
|
type: 'image',
|
||||||
|
transfer_method: 'remote_url',
|
||||||
|
url: contentSplit[1].split('?')[0],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
payload.query = contentSplit[2];
|
||||||
|
}
|
||||||
|
|
||||||
await instance.client.presenceSubscribe(remoteJid);
|
await instance.client.presenceSubscribe(remoteJid);
|
||||||
|
|
||||||
await instance.client.sendPresenceUpdate('composing', remoteJid);
|
await instance.client.sendPresenceUpdate('composing', remoteJid);
|
||||||
@ -1112,7 +1145,7 @@ export class DifyService {
|
|||||||
|
|
||||||
if (dify.botType === 'textGenerator') {
|
if (dify.botType === 'textGenerator') {
|
||||||
endpoint += '/completion-messages';
|
endpoint += '/completion-messages';
|
||||||
const payload = {
|
const payload: any = {
|
||||||
inputs: {
|
inputs: {
|
||||||
query: content,
|
query: content,
|
||||||
pushName: pushName,
|
pushName: pushName,
|
||||||
@ -1126,6 +1159,19 @@ export class DifyService {
|
|||||||
user: remoteJid,
|
user: remoteJid,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (this.isImageMessage(content)) {
|
||||||
|
const contentSplit = content.split('|');
|
||||||
|
|
||||||
|
payload.files = [
|
||||||
|
{
|
||||||
|
type: 'image',
|
||||||
|
transfer_method: 'remote_url',
|
||||||
|
url: contentSplit[1].split('?')[0],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
payload.inputs.query = contentSplit[2];
|
||||||
|
}
|
||||||
|
|
||||||
await instance.client.presenceSubscribe(remoteJid);
|
await instance.client.presenceSubscribe(remoteJid);
|
||||||
|
|
||||||
await instance.client.sendPresenceUpdate('composing', remoteJid);
|
await instance.client.sendPresenceUpdate('composing', remoteJid);
|
||||||
@ -1167,7 +1213,7 @@ export class DifyService {
|
|||||||
|
|
||||||
if (dify.botType === 'agent') {
|
if (dify.botType === 'agent') {
|
||||||
endpoint += '/chat-messages';
|
endpoint += '/chat-messages';
|
||||||
const payload = {
|
const payload: any = {
|
||||||
inputs: {
|
inputs: {
|
||||||
remoteJid: remoteJid,
|
remoteJid: remoteJid,
|
||||||
pushName: pushName,
|
pushName: pushName,
|
||||||
@ -1181,6 +1227,19 @@ export class DifyService {
|
|||||||
user: remoteJid,
|
user: remoteJid,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (this.isImageMessage(content)) {
|
||||||
|
const contentSplit = content.split('|');
|
||||||
|
|
||||||
|
payload.files = [
|
||||||
|
{
|
||||||
|
type: 'image',
|
||||||
|
transfer_method: 'remote_url',
|
||||||
|
url: contentSplit[1].split('?')[0],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
payload.query = contentSplit[2];
|
||||||
|
}
|
||||||
|
|
||||||
await instance.client.presenceSubscribe(remoteJid);
|
await instance.client.presenceSubscribe(remoteJid);
|
||||||
|
|
||||||
await instance.client.sendPresenceUpdate('composing', remoteJid);
|
await instance.client.sendPresenceUpdate('composing', remoteJid);
|
||||||
@ -1247,7 +1306,7 @@ export class DifyService {
|
|||||||
|
|
||||||
if (dify.botType === 'workflow') {
|
if (dify.botType === 'workflow') {
|
||||||
endpoint += '/workflows/run';
|
endpoint += '/workflows/run';
|
||||||
const payload = {
|
const payload: any = {
|
||||||
inputs: {
|
inputs: {
|
||||||
query: content,
|
query: content,
|
||||||
remoteJid: remoteJid,
|
remoteJid: remoteJid,
|
||||||
@ -1260,6 +1319,19 @@ export class DifyService {
|
|||||||
user: remoteJid,
|
user: remoteJid,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (this.isImageMessage(content)) {
|
||||||
|
const contentSplit = content.split('|');
|
||||||
|
|
||||||
|
payload.files = [
|
||||||
|
{
|
||||||
|
type: 'image',
|
||||||
|
transfer_method: 'remote_url',
|
||||||
|
url: contentSplit[1].split('?')[0],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
payload.inputs.query = contentSplit[2];
|
||||||
|
}
|
||||||
|
|
||||||
await instance.client.presenceSubscribe(remoteJid);
|
await instance.client.presenceSubscribe(remoteJid);
|
||||||
|
|
||||||
await instance.client.sendPresenceUpdate('composing', remoteJid);
|
await instance.client.sendPresenceUpdate('composing', remoteJid);
|
||||||
@ -1410,7 +1482,7 @@ export class DifyService {
|
|||||||
|
|
||||||
if (dify.botType === 'chatBot') {
|
if (dify.botType === 'chatBot') {
|
||||||
endpoint += '/chat-messages';
|
endpoint += '/chat-messages';
|
||||||
const payload = {
|
const payload: any = {
|
||||||
inputs: {
|
inputs: {
|
||||||
remoteJid: remoteJid,
|
remoteJid: remoteJid,
|
||||||
pushName: pushName,
|
pushName: pushName,
|
||||||
@ -1424,6 +1496,19 @@ export class DifyService {
|
|||||||
user: remoteJid,
|
user: remoteJid,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (this.isImageMessage(content)) {
|
||||||
|
const contentSplit = content.split('|');
|
||||||
|
|
||||||
|
payload.files = [
|
||||||
|
{
|
||||||
|
type: 'image',
|
||||||
|
transfer_method: 'remote_url',
|
||||||
|
url: contentSplit[1].split('?')[0],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
payload.query = contentSplit[2];
|
||||||
|
}
|
||||||
|
|
||||||
await instance.client.presenceSubscribe(remoteJid);
|
await instance.client.presenceSubscribe(remoteJid);
|
||||||
|
|
||||||
await instance.client.sendPresenceUpdate('composing', remoteJid);
|
await instance.client.sendPresenceUpdate('composing', remoteJid);
|
||||||
@ -1465,7 +1550,7 @@ export class DifyService {
|
|||||||
|
|
||||||
if (dify.botType === 'textGenerator') {
|
if (dify.botType === 'textGenerator') {
|
||||||
endpoint += '/completion-messages';
|
endpoint += '/completion-messages';
|
||||||
const payload = {
|
const payload: any = {
|
||||||
inputs: {
|
inputs: {
|
||||||
query: content,
|
query: content,
|
||||||
remoteJid: remoteJid,
|
remoteJid: remoteJid,
|
||||||
@ -1479,6 +1564,19 @@ export class DifyService {
|
|||||||
user: remoteJid,
|
user: remoteJid,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (this.isImageMessage(content)) {
|
||||||
|
const contentSplit = content.split('|');
|
||||||
|
|
||||||
|
payload.files = [
|
||||||
|
{
|
||||||
|
type: 'image',
|
||||||
|
transfer_method: 'remote_url',
|
||||||
|
url: contentSplit[1].split('?')[0],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
payload.inputs.query = contentSplit[2];
|
||||||
|
}
|
||||||
|
|
||||||
await instance.client.presenceSubscribe(remoteJid);
|
await instance.client.presenceSubscribe(remoteJid);
|
||||||
|
|
||||||
await instance.client.sendPresenceUpdate('composing', remoteJid);
|
await instance.client.sendPresenceUpdate('composing', remoteJid);
|
||||||
@ -1520,7 +1618,7 @@ export class DifyService {
|
|||||||
|
|
||||||
if (dify.botType === 'agent') {
|
if (dify.botType === 'agent') {
|
||||||
endpoint += '/chat-messages';
|
endpoint += '/chat-messages';
|
||||||
const payload = {
|
const payload: any = {
|
||||||
inputs: {
|
inputs: {
|
||||||
remoteJid: remoteJid,
|
remoteJid: remoteJid,
|
||||||
pushName: pushName,
|
pushName: pushName,
|
||||||
@ -1534,6 +1632,19 @@ export class DifyService {
|
|||||||
user: remoteJid,
|
user: remoteJid,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (this.isImageMessage(content)) {
|
||||||
|
const contentSplit = content.split('|');
|
||||||
|
|
||||||
|
payload.files = [
|
||||||
|
{
|
||||||
|
type: 'image',
|
||||||
|
transfer_method: 'remote_url',
|
||||||
|
url: contentSplit[1].split('?')[0],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
payload.query = contentSplit[2];
|
||||||
|
}
|
||||||
|
|
||||||
await instance.client.presenceSubscribe(remoteJid);
|
await instance.client.presenceSubscribe(remoteJid);
|
||||||
|
|
||||||
await instance.client.sendPresenceUpdate('composing', remoteJid);
|
await instance.client.sendPresenceUpdate('composing', remoteJid);
|
||||||
@ -1606,7 +1717,7 @@ export class DifyService {
|
|||||||
|
|
||||||
if (dify.botType === 'workflow') {
|
if (dify.botType === 'workflow') {
|
||||||
endpoint += '/workflows/run';
|
endpoint += '/workflows/run';
|
||||||
const payload = {
|
const payload: any = {
|
||||||
inputs: {
|
inputs: {
|
||||||
query: content,
|
query: content,
|
||||||
remoteJid: remoteJid,
|
remoteJid: remoteJid,
|
||||||
@ -1620,6 +1731,19 @@ export class DifyService {
|
|||||||
user: remoteJid,
|
user: remoteJid,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (this.isImageMessage(content)) {
|
||||||
|
const contentSplit = content.split('|');
|
||||||
|
|
||||||
|
payload.files = [
|
||||||
|
{
|
||||||
|
type: 'image',
|
||||||
|
transfer_method: 'remote_url',
|
||||||
|
url: contentSplit[1].split('?')[0],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
payload.inputs.query = contentSplit[2];
|
||||||
|
}
|
||||||
|
|
||||||
await instance.client.presenceSubscribe(remoteJid);
|
await instance.client.presenceSubscribe(remoteJid);
|
||||||
|
|
||||||
await instance.client.sendPresenceUpdate('composing', remoteJid);
|
await instance.client.sendPresenceUpdate('composing', remoteJid);
|
||||||
|
@ -38,6 +38,23 @@ const bucketExists = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const setBucketPolicy = async () => {
|
||||||
|
if (minioClient) {
|
||||||
|
const policy = {
|
||||||
|
Version: '2012-10-17',
|
||||||
|
Statement: [
|
||||||
|
{
|
||||||
|
Effect: 'Allow',
|
||||||
|
Principal: '*',
|
||||||
|
Action: ['s3:GetObject'],
|
||||||
|
Resource: [`arn:aws:s3:::${bucketName}/*`],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
await minioClient.setBucketPolicy(bucketName, JSON.stringify(policy));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const createBucket = async () => {
|
const createBucket = async () => {
|
||||||
if (minioClient) {
|
if (minioClient) {
|
||||||
try {
|
try {
|
||||||
@ -46,6 +63,8 @@ const createBucket = async () => {
|
|||||||
await minioClient.makeBucket(bucketName);
|
await minioClient.makeBucket(bucketName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await setBucketPolicy();
|
||||||
|
|
||||||
logger.info(`S3 Bucket ${bucketName} - ON`);
|
logger.info(`S3 Bucket ${bucketName} - ON`);
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user