rapida-partner 3.6.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/interfaces/ai-agent.interface.ts +49 -7
- package/src/interfaces/project.interface.ts +7 -0
- package/src/interfaces/scheduled-job.interface.ts +8 -1
- package/src/schemas/ai-agent-config.ref.json +31 -6
- package/src/schemas/project.schema.json +17 -0
- package/src/schemas/scheduled-job.ref.json +1 -1
package/package.json
CHANGED
|
@@ -39,7 +39,15 @@ export interface IAiAgentConfig {
|
|
|
39
39
|
// request but does not process incoming messages yet. Prefer
|
|
40
40
|
// "whatsapp"/"telegram" until it is implemented.
|
|
41
41
|
messengers: ("whatsapp" | "instagram" | "telegram")[];
|
|
42
|
+
// The provider key comes from the project integrations, always with
|
|
43
|
+
// service "chat": deepseekIntegration, geminiIntegration or
|
|
44
|
+
// openaiIntegration. The code generator warns when it is missing (the
|
|
45
|
+
// generated .env would ship an empty key).
|
|
42
46
|
aiProvider: "deepseek" | "gemini" | "openai";
|
|
47
|
+
// Model name sent to the provider. Known values (the generator warns on
|
|
48
|
+
// anything else): deepseek → "deepseek-chat", "deepseek-reasoner";
|
|
49
|
+
// gemini → "gemini-2.0-flash", "gemini-2.5-flash", "gemini-2.5-pro";
|
|
50
|
+
// openai → "gpt-4o-mini", "gpt-4o", "gpt-4.1-mini", "gpt-4.1".
|
|
43
51
|
model: string;
|
|
44
52
|
};
|
|
45
53
|
|
|
@@ -70,6 +78,12 @@ export interface IAiAgentConfig {
|
|
|
70
78
|
// generic required "id" tool parameter — do not add your own id/_id
|
|
71
79
|
// entry to formFields, it will create a duplicate, unused parameter.
|
|
72
80
|
//
|
|
81
|
+
// Besides the fixed tools, the agent itself stores and reads the
|
|
82
|
+
// conversation history at /whatsapp-chat-histories: some module of the
|
|
83
|
+
// project (or of targetBackendDefinitionFile) must expose that endpoint —
|
|
84
|
+
// usually whatsappModule from rapida-projects. Code generation fails
|
|
85
|
+
// without it.
|
|
86
|
+
//
|
|
73
87
|
// The target backend also needs a dedicated user account for the bot to
|
|
74
88
|
// authenticate against (see botCredentials below) — this is separate from
|
|
75
89
|
// flows.invitation.mainUserEmail and must be provisioned manually on the
|
|
@@ -100,7 +114,9 @@ export interface IAiAgentConfig {
|
|
|
100
114
|
};
|
|
101
115
|
|
|
102
116
|
// Optional limits for incoming audio messages (transcribed through the
|
|
103
|
-
// project's openaiIntegration with service "transcription").
|
|
117
|
+
// project's openaiIntegration with service "transcription"). Without that
|
|
118
|
+
// key audio stays off: the agent answers that it cannot process audio, and
|
|
119
|
+
// the code generator warns.
|
|
104
120
|
audio?: {
|
|
105
121
|
// Longer audios are rejected before download/transcription.
|
|
106
122
|
// Defaults to 300.
|
|
@@ -112,24 +128,50 @@ export interface IAiAgentConfig {
|
|
|
112
128
|
|
|
113
129
|
// Optional background jobs configuration. Values become the generated
|
|
114
130
|
// defaults of the agent's job services and can still be overridden at
|
|
115
|
-
// runtime through
|
|
131
|
+
// runtime through config/rules.json.
|
|
116
132
|
jobs?: {
|
|
133
|
+
// Appointment reminder sent through WhatsApp. Frequency and timezone live
|
|
134
|
+
// in IBackend.scheduledJobs (id "aiAgentAppointmentReminder"), per
|
|
135
|
+
// environment; the timezone is also the one appointment times are stored
|
|
136
|
+
// in.
|
|
117
137
|
reminder?: {
|
|
118
138
|
// Defaults to true. The reminder job is only generated when the
|
|
119
139
|
// whatsapp messenger is active.
|
|
120
140
|
enabled?: boolean;
|
|
121
|
-
// Cron expression. Defaults to "*/2 * * * *".
|
|
122
|
-
cronInterval?: string;
|
|
123
141
|
// How many minutes ahead of the appointment the reminder fires.
|
|
124
142
|
// Defaults to 1440 (24 hours).
|
|
125
143
|
minutesAhead?: number;
|
|
126
|
-
//
|
|
127
|
-
//
|
|
128
|
-
|
|
144
|
+
// Who gets the reminder: the person who booked ("client",
|
|
145
|
+
// appointment.personId) and/or the professional ("professional",
|
|
146
|
+
// first of appointment.involvedPeopleId). Defaults to both.
|
|
147
|
+
recipients?: TAppointmentReminderRecipient[];
|
|
148
|
+
// WhatsApp message templates approved in Meta's WhatsApp Manager, one
|
|
149
|
+
// per recipient. Meta only delivers free text up to 24 h after the
|
|
150
|
+
// recipient's last message to this number; outside that window only an
|
|
151
|
+
// approved template is delivered. Without a template the agent sends
|
|
152
|
+
// free text (and the code generator warns).
|
|
153
|
+
whatsappTemplates?: {
|
|
154
|
+
// Body parameters, in order: {{1}} client name, {{2}} date
|
|
155
|
+
// (dd/mm/aaaa), {{3}} time (HH:mm), {{4}} professional name.
|
|
156
|
+
client?: IWhatsappMessageTemplate;
|
|
157
|
+
// Body parameters, in order: {{1}} professional name, {{2}} date
|
|
158
|
+
// (dd/mm/aaaa), {{3}} time (HH:mm), {{4}} client name, {{5}} client
|
|
159
|
+
// phone.
|
|
160
|
+
professional?: IWhatsappMessageTemplate;
|
|
161
|
+
};
|
|
129
162
|
};
|
|
130
163
|
};
|
|
131
164
|
}
|
|
132
165
|
|
|
166
|
+
export type TAppointmentReminderRecipient = "client" | "professional";
|
|
167
|
+
|
|
168
|
+
export interface IWhatsappMessageTemplate {
|
|
169
|
+
// Template name exactly as approved in WhatsApp Manager.
|
|
170
|
+
name: string;
|
|
171
|
+
// Template language code. Defaults to "pt_BR".
|
|
172
|
+
languageCode?: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
133
175
|
export interface IAgentContractBinding {
|
|
134
176
|
contractId: string;
|
|
135
177
|
|
|
@@ -64,6 +64,13 @@ export interface IProject {
|
|
|
64
64
|
apiKey: string;
|
|
65
65
|
service: "embedding" | "chat" | "custom" | "cost";
|
|
66
66
|
}[];
|
|
67
|
+
// Chave do Gemini (Google AI). Hoje só o agente de IA usa, quando
|
|
68
|
+
// aiAgentConfig.infrastructure.aiProvider é "gemini" (GEMINI_API_KEY do
|
|
69
|
+
// .env gerado).
|
|
70
|
+
geminiIntegration?: {
|
|
71
|
+
apiKey: string;
|
|
72
|
+
service: "chat";
|
|
73
|
+
}[];
|
|
67
74
|
openaiIntegration?: {
|
|
68
75
|
apiKey: string;
|
|
69
76
|
// "transcription": speech-to-text (Whisper) used by aiAgent projects to
|
|
@@ -3,8 +3,15 @@
|
|
|
3
3
|
* - "referralPriceSnapshot": captura de preços dos anúncios do skeleton
|
|
4
4
|
* "referralCommerce" (base de `IReferralPriceBaseline`). Respeite o limite
|
|
5
5
|
* de requisições das APIs de afiliado ao escolher a frequência.
|
|
6
|
+
* - "aiAgentAppointmentReminder": lembrete de agendamento do agente de IA
|
|
7
|
+
* (`IAiAgentConfig.jobs.reminder`). Roda no processo do agente, não no
|
|
8
|
+
* backend Nest. O `timezone` também é o fuso em que os horários dos
|
|
9
|
+
* agendamentos estão gravados. Sem entrada, o agente usa "*\/2 * * * *" e
|
|
10
|
+
* "America/Sao_Paulo".
|
|
6
11
|
*/
|
|
7
|
-
export type TScheduledJobId =
|
|
12
|
+
export type TScheduledJobId =
|
|
13
|
+
| "referralPriceSnapshot"
|
|
14
|
+
| "aiAgentAppointmentReminder";
|
|
8
15
|
|
|
9
16
|
/**
|
|
10
17
|
* Job agendado do backend gerado (`IBackend.scheduledJobs`), por ambiente.
|
|
@@ -211,14 +211,39 @@
|
|
|
211
211
|
"enabled": {
|
|
212
212
|
"type": "boolean"
|
|
213
213
|
},
|
|
214
|
-
"cronInterval": {
|
|
215
|
-
"type": "string"
|
|
216
|
-
},
|
|
217
214
|
"minutesAhead": {
|
|
218
|
-
"type": "number"
|
|
215
|
+
"type": "number",
|
|
216
|
+
"minimum": 1
|
|
219
217
|
},
|
|
220
|
-
"
|
|
221
|
-
"type": "
|
|
218
|
+
"recipients": {
|
|
219
|
+
"type": "array",
|
|
220
|
+
"minItems": 1,
|
|
221
|
+
"uniqueItems": true,
|
|
222
|
+
"items": { "type": "string", "enum": ["client", "professional"] }
|
|
223
|
+
},
|
|
224
|
+
"whatsappTemplates": {
|
|
225
|
+
"type": "object",
|
|
226
|
+
"properties": {
|
|
227
|
+
"client": {
|
|
228
|
+
"type": "object",
|
|
229
|
+
"properties": {
|
|
230
|
+
"name": { "type": "string", "minLength": 1 },
|
|
231
|
+
"languageCode": { "type": "string", "minLength": 2 }
|
|
232
|
+
},
|
|
233
|
+
"required": ["name"],
|
|
234
|
+
"additionalProperties": false
|
|
235
|
+
},
|
|
236
|
+
"professional": {
|
|
237
|
+
"type": "object",
|
|
238
|
+
"properties": {
|
|
239
|
+
"name": { "type": "string", "minLength": 1 },
|
|
240
|
+
"languageCode": { "type": "string", "minLength": 2 }
|
|
241
|
+
},
|
|
242
|
+
"required": ["name"],
|
|
243
|
+
"additionalProperties": false
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"additionalProperties": false
|
|
222
247
|
}
|
|
223
248
|
},
|
|
224
249
|
"additionalProperties": false
|
|
@@ -112,6 +112,23 @@
|
|
|
112
112
|
"required": ["apiKey", "service"]
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
|
+
"geminiIntegration": {
|
|
116
|
+
"type": "array",
|
|
117
|
+
"items": {
|
|
118
|
+
"type": "object",
|
|
119
|
+
"properties": {
|
|
120
|
+
"apiKey": {
|
|
121
|
+
"type": "string"
|
|
122
|
+
},
|
|
123
|
+
"service": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"enum": ["chat"]
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"required": ["apiKey", "service"],
|
|
129
|
+
"additionalProperties": false
|
|
130
|
+
}
|
|
131
|
+
},
|
|
115
132
|
"openaiIntegration": {
|
|
116
133
|
"type": "array",
|
|
117
134
|
"items": {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
|
6
|
-
"id": { "type": "string", "enum": ["referralPriceSnapshot"] },
|
|
6
|
+
"id": { "type": "string", "enum": ["referralPriceSnapshot", "aiAgentAppointmentReminder"] },
|
|
7
7
|
"cron": { "type": "string", "minLength": 1 },
|
|
8
8
|
"timezone": { "type": "string" }
|
|
9
9
|
},
|