mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-13 15:14:49 -06:00
feat: translation in manager: English, Portuguese, Spanish and French
This commit is contained in:
parent
9ae5255d5f
commit
046c64c65d
@ -1,3 +1,10 @@
|
||||
# 2.1.0 (develop)
|
||||
|
||||
### Features
|
||||
|
||||
* Improved layout manager
|
||||
* Translation in manager: English, Portuguese, Spanish and French
|
||||
|
||||
# 2.0.10 (2024-08-16 16:23)
|
||||
|
||||
### Features
|
||||
|
381
manager/dist/assets/index-AqIWTWDr.js
vendored
Normal file
381
manager/dist/assets/index-AqIWTWDr.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
manager/dist/assets/index-BJ9JMAl_.css
vendored
Normal file
1
manager/dist/assets/index-BJ9JMAl_.css
vendored
Normal file
File diff suppressed because one or more lines are too long
356
manager/dist/assets/index-Cqx_OwQi.js
vendored
356
manager/dist/assets/index-Cqx_OwQi.js
vendored
File diff suppressed because one or more lines are too long
1
manager/dist/assets/index-DZ0gaAHg.css
vendored
1
manager/dist/assets/index-DZ0gaAHg.css
vendored
File diff suppressed because one or more lines are too long
4
manager/dist/index.html
vendored
4
manager/dist/index.html
vendored
@ -5,8 +5,8 @@
|
||||
<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-Cqx_OwQi.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-DZ0gaAHg.css">
|
||||
<script type="module" crossorigin src="/assets/index-AqIWTWDr.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-BJ9JMAl_.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "evolution-api",
|
||||
"version": "2.0.10",
|
||||
"version": "2.1.0",
|
||||
"description": "Rest api for communication with WhatsApp",
|
||||
"main": "./dist/main.js",
|
||||
"type": "commonjs",
|
||||
|
@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "IntegrationSession" ADD COLUMN "context" JSONB;
|
@ -394,6 +394,7 @@ model IntegrationSession {
|
||||
pushName String?
|
||||
status SessionStatus
|
||||
awaitUser Boolean @default(false) @db.Boolean
|
||||
context Json?
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Message Message[]
|
||||
|
@ -1241,7 +1241,7 @@ export class OpenaiService {
|
||||
};
|
||||
|
||||
if (stopBotFromMe && key.fromMe && session) {
|
||||
await this.prismaRepository.integrationSession.update({
|
||||
session = await this.prismaRepository.integrationSession.update({
|
||||
where: {
|
||||
id: session.id,
|
||||
},
|
||||
@ -1249,7 +1249,6 @@ export class OpenaiService {
|
||||
status: 'paused',
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!listeningFromMe && key.fromMe) {
|
||||
@ -1263,6 +1262,7 @@ export class OpenaiService {
|
||||
this.waMonitor.waInstances[instance.instanceName],
|
||||
remoteJid,
|
||||
pushName,
|
||||
key.fromMe,
|
||||
findOpenai,
|
||||
session,
|
||||
settings,
|
||||
@ -1287,6 +1287,7 @@ export class OpenaiService {
|
||||
this.waMonitor.waInstances[instance.instanceName],
|
||||
remoteJid,
|
||||
pushName,
|
||||
key.fromMe,
|
||||
findOpenai,
|
||||
session,
|
||||
settings,
|
||||
@ -1355,6 +1356,7 @@ export class OpenaiService {
|
||||
instance: any,
|
||||
remoteJid: string,
|
||||
pushName: string,
|
||||
fromMe: boolean,
|
||||
openaiBot: OpenaiBot,
|
||||
settings: OpenaiSetting,
|
||||
session: IntegrationSession,
|
||||
@ -1371,7 +1373,7 @@ export class OpenaiService {
|
||||
}
|
||||
|
||||
const messageData: any = {
|
||||
role: 'user',
|
||||
role: fromMe ? 'assistant' : 'user',
|
||||
content: [{ type: 'text', text: content }],
|
||||
};
|
||||
|
||||
@ -1393,6 +1395,11 @@ export class OpenaiService {
|
||||
|
||||
await this.client.beta.threads.messages.create(data.session.sessionId, messageData);
|
||||
|
||||
if (fromMe) {
|
||||
sendTelemetry('/message/sendText');
|
||||
return;
|
||||
}
|
||||
|
||||
const runAssistant = await this.client.beta.threads.runs.create(data.session.sessionId, {
|
||||
assistant_id: openaiBot.assistantId,
|
||||
});
|
||||
@ -1561,12 +1568,13 @@ export class OpenaiService {
|
||||
instance: any,
|
||||
remoteJid: string,
|
||||
pushName: string,
|
||||
fromMe: boolean,
|
||||
openaiBot: OpenaiBot,
|
||||
session: IntegrationSession,
|
||||
settings: OpenaiSetting,
|
||||
content: string,
|
||||
) {
|
||||
if (session && session.status !== 'opened') {
|
||||
if (session && session.status === 'closed') {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1598,25 +1606,35 @@ export class OpenaiService {
|
||||
});
|
||||
}
|
||||
|
||||
await this.initAssistantNewSession(instance, remoteJid, pushName, openaiBot, settings, session, content);
|
||||
await this.initAssistantNewSession(
|
||||
instance,
|
||||
remoteJid,
|
||||
pushName,
|
||||
fromMe,
|
||||
openaiBot,
|
||||
settings,
|
||||
session,
|
||||
content,
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!session) {
|
||||
await this.initAssistantNewSession(instance, remoteJid, pushName, openaiBot, settings, session, content);
|
||||
await this.initAssistantNewSession(instance, remoteJid, pushName, fromMe, openaiBot, settings, session, content);
|
||||
return;
|
||||
}
|
||||
|
||||
await this.prismaRepository.integrationSession.update({
|
||||
where: {
|
||||
id: session.id,
|
||||
},
|
||||
data: {
|
||||
status: 'opened',
|
||||
awaitUser: false,
|
||||
},
|
||||
});
|
||||
if (session.status !== 'paused')
|
||||
await this.prismaRepository.integrationSession.update({
|
||||
where: {
|
||||
id: session.id,
|
||||
},
|
||||
data: {
|
||||
status: 'opened',
|
||||
awaitUser: false,
|
||||
},
|
||||
});
|
||||
|
||||
if (!content) {
|
||||
if (settings.unknownMessage) {
|
||||
@ -1670,7 +1688,7 @@ export class OpenaiService {
|
||||
const threadId = session.sessionId;
|
||||
|
||||
const messageData: any = {
|
||||
role: 'user',
|
||||
role: fromMe ? 'assistant' : 'user',
|
||||
content: [{ type: 'text', text: content }],
|
||||
};
|
||||
|
||||
@ -1691,20 +1709,16 @@ export class OpenaiService {
|
||||
}
|
||||
|
||||
await this.client.beta.threads.messages.create(threadId, messageData);
|
||||
const contactPushName = await this.prismaRepository.contact
|
||||
.findFirst({
|
||||
where: {
|
||||
remoteJid,
|
||||
},
|
||||
select: {
|
||||
pushName: true,
|
||||
},
|
||||
})
|
||||
.then((contact) => contact.pushName);
|
||||
|
||||
if (fromMe || session?.status === 'paused') {
|
||||
sendTelemetry('/message/sendText');
|
||||
return;
|
||||
}
|
||||
|
||||
const runAssistant = await this.client.beta.threads.runs.create(threadId, {
|
||||
assistant_id: openaiBot.assistantId,
|
||||
additional_instructions: `WhatsappApiInfo:
|
||||
Name: ${contactPushName}
|
||||
Name: ${pushName}
|
||||
RemoteJid: ${remoteJid}
|
||||
`,
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user