@yrpri/api 9.0.83 → 9.0.85
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/active-citizen/engine/analytics/utils.cjs +1 -1
- package/active-citizen/engine/moderation/toxicity_analysis.cjs +4 -1
- package/active-citizen/models/ac_translation_cache.cjs +4 -3
- package/agents/assistants/modes/tools/agentTools.js +8 -4
- package/agents/managers/emailInvitesManager.js +3 -3
- package/controllers/groups.cjs +1 -1
- package/package.json +1 -1
|
@@ -112,7 +112,7 @@ const importPost = (post, done) => {
|
|
|
112
112
|
description += answers[i].value.trim();
|
|
113
113
|
}
|
|
114
114
|
catch (error) {
|
|
115
|
-
description += answers[i].value
|
|
115
|
+
description += `${answers[i].value}`;
|
|
116
116
|
console.warn(`Error trimming answer to description: ${answers[i].value}`);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -282,7 +282,10 @@ const getTranslatedTextForPost = (post, callback) => {
|
|
|
282
282
|
parallelCallback(error);
|
|
283
283
|
}
|
|
284
284
|
else if (translations) {
|
|
285
|
-
|
|
285
|
+
const safeTranslations = translations.map((val) => {
|
|
286
|
+
return typeof val === "string" ? val : String(val);
|
|
287
|
+
});
|
|
288
|
+
postStructuredAnswers = safeTranslations.join(". ");
|
|
286
289
|
parallelCallback();
|
|
287
290
|
}
|
|
288
291
|
else {
|
|
@@ -215,9 +215,10 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
215
215
|
const textStrings = [];
|
|
216
216
|
let combinedText = "";
|
|
217
217
|
for (const answer of post.public_data.structuredAnswersJson) {
|
|
218
|
-
if (answer.value) {
|
|
219
|
-
|
|
220
|
-
|
|
218
|
+
if (answer.value !== undefined && answer.value !== null) {
|
|
219
|
+
const safeValue = typeof answer.value === "string" ? answer.value : String(answer.value);
|
|
220
|
+
textStrings.push(safeValue);
|
|
221
|
+
combinedText += safeValue;
|
|
221
222
|
}
|
|
222
223
|
else {
|
|
223
224
|
textStrings.push("");
|
|
@@ -20,7 +20,7 @@ export class AgentTools extends BaseAssistantTools {
|
|
|
20
20
|
async showAgentWorkflowOverviewWidgetHandler(params) {
|
|
21
21
|
try {
|
|
22
22
|
const { agent, run } = await this.agentModels.getCurrentAgentAndWorkflow();
|
|
23
|
-
const workflowJson = JSON.stringify(agent.configuration.workflow);
|
|
23
|
+
const workflowJson = JSON.stringify(this.getSimpleWorkflow(agent.configuration.workflow));
|
|
24
24
|
const base64Workflow = btoa(workflowJson);
|
|
25
25
|
const html = `<yp-agent-workflow-widget
|
|
26
26
|
agentProductId="${agent.id}"
|
|
@@ -401,14 +401,18 @@ export class AgentTools extends BaseAssistantTools {
|
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
|
-
|
|
405
|
-
const
|
|
406
|
-
const workflowCopy = JSON.parse(JSON.stringify(run.workflow));
|
|
404
|
+
getSimpleWorkflow(workflow) {
|
|
405
|
+
const workflowCopy = JSON.parse(JSON.stringify(workflow));
|
|
407
406
|
if (workflowCopy.steps) {
|
|
408
407
|
workflowCopy.steps.forEach((step) => {
|
|
409
408
|
step.emailInstructions = "";
|
|
410
409
|
});
|
|
411
410
|
}
|
|
411
|
+
return workflowCopy;
|
|
412
|
+
}
|
|
413
|
+
async renderAgentRunWidget(agent, run) {
|
|
414
|
+
const subscription = await this.assistant.getCurrentSubscription();
|
|
415
|
+
const workflowCopy = this.getSimpleWorkflow(run.workflow);
|
|
412
416
|
const workflowBase64 = btoa(JSON.stringify(workflowCopy));
|
|
413
417
|
return `<yp-agent-run-widget
|
|
414
418
|
agentProductId="${agent.id}"
|
|
@@ -12,7 +12,7 @@ export class AgentInviteManager {
|
|
|
12
12
|
/**
|
|
13
13
|
* Send a notification email to group admins about the current workflow step or completion.
|
|
14
14
|
*/
|
|
15
|
-
static async sendInviteEmail(link, agentRunId, groupId,
|
|
15
|
+
static async sendInviteEmail(link, agentRunId, groupId, senderUser, inviteeEmail) {
|
|
16
16
|
try {
|
|
17
17
|
const agentRun = await NotificationAgentQueueManager.getAgentRun(agentRunId);
|
|
18
18
|
if (!agentRun) {
|
|
@@ -32,11 +32,11 @@ export class AgentInviteManager {
|
|
|
32
32
|
},
|
|
33
33
|
],
|
|
34
34
|
}));
|
|
35
|
-
const emailContent = EmailTemplateRenderer.renderEmail("",
|
|
35
|
+
const emailContent = EmailTemplateRenderer.renderEmail("", senderUser.name, agentRun.Subscription?.Plan?.AgentProduct?.name || "", agentRun.workflow, link, "https://evoly.ai/is/amplifier/img/amplifier-logo.png", "https://evoly.ai/is/amplifier/img/evoly-bw-logo.png", "https://evoly.ai/", "© 2024 Evoly ehf, Vegmuli 8, 108, Reykjavik, Iceland");
|
|
36
36
|
queue.add("send-one-email", {
|
|
37
37
|
subject: subject,
|
|
38
38
|
template: "general_user_notification",
|
|
39
|
-
user:
|
|
39
|
+
user: { id: null, email: inviteeEmail, name: inviteeEmail },
|
|
40
40
|
domain: group.Community?.Domain,
|
|
41
41
|
group: group,
|
|
42
42
|
object: {},
|
package/controllers/groups.cjs
CHANGED
|
@@ -1015,7 +1015,7 @@ router.post("/:groupId/sendEmailInvitesForAnons", auth.can("edit group"), async
|
|
|
1015
1015
|
from_user_id: req.user.id,
|
|
1016
1016
|
});
|
|
1017
1017
|
const invite_link = `https://app.${req.ypDomain.domain_name}/group/${group.id}?anonInvite=1&token=${token}&forAgentBundle=1`;
|
|
1018
|
-
await AgentInviteManager.sendInviteEmail(invite_link, req.body.agentRunId, group.id, req.user);
|
|
1018
|
+
await AgentInviteManager.sendInviteEmail(invite_link, req.body.agentRunId, group.id, req.user, email);
|
|
1019
1019
|
log.info("Invite Created", {
|
|
1020
1020
|
email,
|
|
1021
1021
|
inviteId: invite.id,
|