Skip to content

Commit 56a165d

Browse files
committed
feat: added general session button in typebot, dify and openai in manager
1 parent 9329330 commit 56a165d

File tree

8 files changed

+421
-376
lines changed

8 files changed

+421
-376
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
# 2.0.9-rc (release candidate)
22

3+
### Features
4+
5+
* Added general session button in typebot, dify and openai in manager
6+
37
### Fixed
48

59
* Import contacts with image in chatwoot
10+
* Fix conversationId when is dify agent
11+
* Fixed loading of selects in the manager
12+
* Add restart button to sessions screen
613

714
# 2.0.8-rc (2024-08-08 20:23)
815

manager/dist/assets/index-C__fF5dP.js

Lines changed: 0 additions & 351 deletions
This file was deleted.

manager/dist/assets/index-oK8_wIXQ.js

Lines changed: 356 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

manager/dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<link rel="icon" type="image/png" href="/assets/images/evolution-logo.png" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>Evolution Manager</title>
8-
<script type="module" crossorigin src="/assets/index-C__fF5dP.js"></script>
8+
<script type="module" crossorigin src="/assets/index-oK8_wIXQ.js"></script>
99
<link rel="stylesheet" crossorigin href="/assets/index-DZ0gaAHg.css">
1010
</head>
1111
<body>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"@sentry/node": "^7.59.2",
5555
"amqplib": "^0.10.3",
5656
"axios": "^1.6.5",
57-
"baileys": "6.7.5",
57+
"baileys": "github:WhiskeySockets/Baileys",
5858
"class-validator": "^0.14.1",
5959
"compression": "^1.7.4",
6060
"cors": "^2.8.5",

src/api/integrations/dify/services/dify.service.ts

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -551,11 +551,7 @@ export class DifyService {
551551
},
552552
});
553553

554-
if (!dify) {
555-
throw new Error('Dify not found');
556-
}
557-
558-
if (dify.instanceId !== instanceId) {
554+
if (dify && dify.instanceId !== instanceId) {
559555
throw new Error('Dify not found');
560556
}
561557

@@ -564,6 +560,9 @@ export class DifyService {
564560
where: {
565561
difyId: difyId,
566562
},
563+
include: {
564+
Dify: true,
565+
},
567566
});
568567
}
569568

@@ -573,8 +572,20 @@ export class DifyService {
573572
remoteJid: remoteJid,
574573
difyId: difyId,
575574
},
575+
include: {
576+
Dify: true,
577+
},
576578
});
577579
}
580+
581+
return await this.prismaRepository.difySession.findMany({
582+
where: {
583+
instanceId: instanceId,
584+
},
585+
include: {
586+
Dify: true,
587+
},
588+
});
578589
} catch (error) {
579590
this.logger.error(error);
580591
throw new Error('Error fetching sessions');
@@ -1199,7 +1210,7 @@ export class DifyService {
11991210
});
12001211

12011212
let completeMessage = '';
1202-
let conversationId
1213+
let conversationId;
12031214

12041215
const stream = response.data;
12051216
const reader = new Readable().wrap(stream);
@@ -1211,7 +1222,7 @@ export class DifyService {
12111222
const event = JSON.parse(data);
12121223
if (event.event === 'agent_message') {
12131224
completeMessage += event.answer;
1214-
conversationId = conversationId ?? event?.conversation_id
1225+
conversationId = conversationId ?? event?.conversation_id;
12151226

12161227
console.log('completeMessage:', completeMessage);
12171228
}
@@ -1241,8 +1252,8 @@ export class DifyService {
12411252
data: {
12421253
status: 'opened',
12431254
awaitUser: true,
1244-
sessionId: conversationId
1245-
}
1255+
sessionId: conversationId,
1256+
},
12461257
});
12471258

12481259
sendTelemetry('/message/sendText');
@@ -1556,7 +1567,7 @@ export class DifyService {
15561567
});
15571568

15581569
let completeMessage = '';
1559-
let conversationId
1570+
let conversationId;
15601571

15611572
const stream = response.data;
15621573
const reader = new Readable().wrap(stream);
@@ -1572,7 +1583,7 @@ export class DifyService {
15721583
const event = JSON.parse(jsonString);
15731584
if (event.event === 'agent_message') {
15741585
completeMessage += event.answer;
1575-
conversationId = conversationId ?? event?.conversation_id
1586+
conversationId = conversationId ?? event?.conversation_id;
15761587
}
15771588
} catch (error) {
15781589
console.error('Error parsing stream data:', error);
@@ -1600,8 +1611,8 @@ export class DifyService {
16001611
data: {
16011612
status: 'opened',
16021613
awaitUser: true,
1603-
sessionId: conversationId
1604-
}
1614+
sessionId: conversationId,
1615+
},
16051616
});
16061617

16071618
sendTelemetry('/message/sendText');

src/api/integrations/openai/services/openai.service.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -750,11 +750,7 @@ export class OpenaiService {
750750
},
751751
});
752752

753-
if (!openaiBot) {
754-
throw new Error('Openai Bot not found');
755-
}
756-
757-
if (openaiBot.instanceId !== instanceId) {
753+
if (openaiBot && openaiBot.instanceId !== instanceId) {
758754
throw new Error('Openai Bot not found');
759755
}
760756

@@ -763,6 +759,9 @@ export class OpenaiService {
763759
where: {
764760
openaiBotId: openaiBotId,
765761
},
762+
include: {
763+
OpenaiBot: true,
764+
},
766765
});
767766
}
768767

@@ -772,8 +771,20 @@ export class OpenaiService {
772771
remoteJid: remoteJid,
773772
openaiBotId: openaiBotId,
774773
},
774+
include: {
775+
OpenaiBot: true,
776+
},
775777
});
776778
}
779+
780+
return await this.prismaRepository.openaiSession.findMany({
781+
where: {
782+
instanceId: instanceId,
783+
},
784+
include: {
785+
OpenaiBot: true,
786+
},
787+
});
777788
} catch (error) {
778789
this.logger.error(error);
779790
throw new Error('Error fetching sessions');

src/api/integrations/typebot/services/typebot.service.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,7 @@ export class TypebotService {
548548
},
549549
});
550550

551-
if (!typebot) {
552-
throw new Error('Typebot not found');
553-
}
554-
555-
if (typebot.instanceId !== instanceId) {
551+
if (typebot && typebot.instanceId !== instanceId) {
556552
throw new Error('Typebot not found');
557553
}
558554

@@ -561,6 +557,9 @@ export class TypebotService {
561557
where: {
562558
typebotId: typebotId,
563559
},
560+
include: {
561+
Typebot: true,
562+
},
564563
});
565564
}
566565

@@ -570,8 +569,20 @@ export class TypebotService {
570569
remoteJid: remoteJid,
571570
instanceId: instanceId,
572571
},
572+
include: {
573+
Typebot: true,
574+
},
573575
});
574576
}
577+
578+
return await this.prismaRepository.typebotSession.findMany({
579+
where: {
580+
instanceId: instanceId,
581+
},
582+
include: {
583+
Typebot: true,
584+
},
585+
});
575586
} catch (error) {
576587
this.logger.error(error);
577588
throw new Error('Error fetching sessions');

0 commit comments

Comments
 (0)