feat: added general session button in typebot, dify and openai in manager

This commit is contained in:
Davidson Gomes 2024-08-08 23:14:51 -03:00
parent 9329330297
commit 56a165db54
8 changed files with 421 additions and 376 deletions

View File

@ -1,8 +1,15 @@
# 2.0.9-rc (release candidate)
### Features
* Added general session button in typebot, dify and openai in manager
### Fixed
* Import contacts with image in chatwoot
* Fix conversationId when is dify agent
* Fixed loading of selects in the manager
* Add restart button to sessions screen
# 2.0.8-rc (2024-08-08 20:23)

File diff suppressed because one or more lines are too long

356
manager/dist/assets/index-oK8_wIXQ.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
<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-C__fF5dP.js"></script>
<script type="module" crossorigin src="/assets/index-oK8_wIXQ.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DZ0gaAHg.css">
</head>
<body>

View File

@ -54,7 +54,7 @@
"@sentry/node": "^7.59.2",
"amqplib": "^0.10.3",
"axios": "^1.6.5",
"baileys": "6.7.5",
"baileys": "github:WhiskeySockets/Baileys",
"class-validator": "^0.14.1",
"compression": "^1.7.4",
"cors": "^2.8.5",

View File

@ -551,11 +551,7 @@ export class DifyService {
},
});
if (!dify) {
throw new Error('Dify not found');
}
if (dify.instanceId !== instanceId) {
if (dify && dify.instanceId !== instanceId) {
throw new Error('Dify not found');
}
@ -564,6 +560,9 @@ export class DifyService {
where: {
difyId: difyId,
},
include: {
Dify: true,
},
});
}
@ -573,8 +572,20 @@ export class DifyService {
remoteJid: remoteJid,
difyId: difyId,
},
include: {
Dify: true,
},
});
}
return await this.prismaRepository.difySession.findMany({
where: {
instanceId: instanceId,
},
include: {
Dify: true,
},
});
} catch (error) {
this.logger.error(error);
throw new Error('Error fetching sessions');
@ -1199,7 +1210,7 @@ export class DifyService {
});
let completeMessage = '';
let conversationId
let conversationId;
const stream = response.data;
const reader = new Readable().wrap(stream);
@ -1211,7 +1222,7 @@ export class DifyService {
const event = JSON.parse(data);
if (event.event === 'agent_message') {
completeMessage += event.answer;
conversationId = conversationId ?? event?.conversation_id
conversationId = conversationId ?? event?.conversation_id;
console.log('completeMessage:', completeMessage);
}
@ -1241,8 +1252,8 @@ export class DifyService {
data: {
status: 'opened',
awaitUser: true,
sessionId: conversationId
}
sessionId: conversationId,
},
});
sendTelemetry('/message/sendText');
@ -1556,7 +1567,7 @@ export class DifyService {
});
let completeMessage = '';
let conversationId
let conversationId;
const stream = response.data;
const reader = new Readable().wrap(stream);
@ -1572,7 +1583,7 @@ export class DifyService {
const event = JSON.parse(jsonString);
if (event.event === 'agent_message') {
completeMessage += event.answer;
conversationId = conversationId ?? event?.conversation_id
conversationId = conversationId ?? event?.conversation_id;
}
} catch (error) {
console.error('Error parsing stream data:', error);
@ -1600,8 +1611,8 @@ export class DifyService {
data: {
status: 'opened',
awaitUser: true,
sessionId: conversationId
}
sessionId: conversationId,
},
});
sendTelemetry('/message/sendText');

View File

@ -750,11 +750,7 @@ export class OpenaiService {
},
});
if (!openaiBot) {
throw new Error('Openai Bot not found');
}
if (openaiBot.instanceId !== instanceId) {
if (openaiBot && openaiBot.instanceId !== instanceId) {
throw new Error('Openai Bot not found');
}
@ -763,6 +759,9 @@ export class OpenaiService {
where: {
openaiBotId: openaiBotId,
},
include: {
OpenaiBot: true,
},
});
}
@ -772,8 +771,20 @@ export class OpenaiService {
remoteJid: remoteJid,
openaiBotId: openaiBotId,
},
include: {
OpenaiBot: true,
},
});
}
return await this.prismaRepository.openaiSession.findMany({
where: {
instanceId: instanceId,
},
include: {
OpenaiBot: true,
},
});
} catch (error) {
this.logger.error(error);
throw new Error('Error fetching sessions');

View File

@ -548,11 +548,7 @@ export class TypebotService {
},
});
if (!typebot) {
throw new Error('Typebot not found');
}
if (typebot.instanceId !== instanceId) {
if (typebot && typebot.instanceId !== instanceId) {
throw new Error('Typebot not found');
}
@ -561,6 +557,9 @@ export class TypebotService {
where: {
typebotId: typebotId,
},
include: {
Typebot: true,
},
});
}
@ -570,8 +569,20 @@ export class TypebotService {
remoteJid: remoteJid,
instanceId: instanceId,
},
include: {
Typebot: true,
},
});
}
return await this.prismaRepository.typebotSession.findMany({
where: {
instanceId: instanceId,
},
include: {
Typebot: true,
},
});
} catch (error) {
this.logger.error(error);
throw new Error('Error fetching sessions');