@yrpri/api 9.0.203 → 9.0.205
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.
|
@@ -826,6 +826,44 @@ export class NewAiModelSetup {
|
|
|
826
826
|
await gemini3ProPreview.save();
|
|
827
827
|
log.debug("Google model already exists: Gemini 3 Pro Preview");
|
|
828
828
|
}
|
|
829
|
+
const gemini31ProPreview = await PsAiModel.findOne({
|
|
830
|
+
where: { name: "Gemini 3.1 Pro Preview" },
|
|
831
|
+
});
|
|
832
|
+
const gemini31ProPreviewConfig = {
|
|
833
|
+
type: PsAiModelType.Text,
|
|
834
|
+
modelSize: PsAiModelSize.Medium,
|
|
835
|
+
provider: "google",
|
|
836
|
+
prices: {
|
|
837
|
+
costInTokensPerMillion: 2,
|
|
838
|
+
costOutTokensPerMillion: 12,
|
|
839
|
+
costInCachedContextTokensPerMillion: 1,
|
|
840
|
+
longContextTokenThreshold: 200000,
|
|
841
|
+
longContextCostInTokensPerMillion: 4.0,
|
|
842
|
+
longContextCostInCachedContextTokensPerMillion: 2,
|
|
843
|
+
longContextCostOutTokensPerMillion: 18,
|
|
844
|
+
currency: "USD",
|
|
845
|
+
},
|
|
846
|
+
model: "gemini-3.1-pro-preview",
|
|
847
|
+
active: true,
|
|
848
|
+
maxTokensOut: 100000,
|
|
849
|
+
maxContextTokens: 1000000,
|
|
850
|
+
defaultTemperature: 0.0,
|
|
851
|
+
};
|
|
852
|
+
if (!gemini31ProPreview) {
|
|
853
|
+
await PsAiModel.create({
|
|
854
|
+
name: "Gemini 3.1 Pro Preview",
|
|
855
|
+
organization_id: 1,
|
|
856
|
+
user_id: userId,
|
|
857
|
+
configuration: gemini31ProPreviewConfig,
|
|
858
|
+
});
|
|
859
|
+
log.info("Created Google model: Gemini 3.1 Pro Preview");
|
|
860
|
+
}
|
|
861
|
+
else {
|
|
862
|
+
gemini31ProPreview.set("configuration", gemini31ProPreviewConfig);
|
|
863
|
+
gemini31ProPreview.changed("configuration", true);
|
|
864
|
+
await gemini31ProPreview.save();
|
|
865
|
+
log.debug("Google model already exists: Gemini 3.1 Pro Preview");
|
|
866
|
+
}
|
|
829
867
|
const gemini30Flash = await PsAiModel.findOne({
|
|
830
868
|
where: { name: "Gemini 3.0 Flash" },
|
|
831
869
|
});
|
|
@@ -985,6 +1023,8 @@ export class NewAiModelSetup {
|
|
|
985
1023
|
{ name: "GPT-5", envKey: "OPENAI_API_KEY" },
|
|
986
1024
|
{ name: "GPT-5.1", envKey: "OPENAI_API_KEY" },
|
|
987
1025
|
{ name: "GPT-5.2", envKey: "OPENAI_API_KEY" },
|
|
1026
|
+
{ name: "Gemini 3 Pro Preview", envKey: "GEMINI_API_KEY" },
|
|
1027
|
+
{ name: "Gemini 3.1 Pro Preview", envKey: "GEMINI_API_KEY" },
|
|
988
1028
|
{ name: "Gemini 3.0 Flash", envKey: "GEMINI_API_KEY" },
|
|
989
1029
|
];
|
|
990
1030
|
const groupAccessConfig = [];
|
package/controllers/groups.cjs
CHANGED
|
@@ -295,6 +295,7 @@ var updateGroupConfigParameters = function (req, group) {
|
|
|
295
295
|
group.set("configuration.hideNewestFromFilter", truthValueFromBody(req.body.hideNewestFromFilter));
|
|
296
296
|
group.set("configuration.hideGroupLevelTabs", truthValueFromBody(req.body.hideGroupLevelTabs));
|
|
297
297
|
group.set("configuration.hidePostFilterAndSearch", truthValueFromBody(req.body.hidePostFilterAndSearch));
|
|
298
|
+
group.set("configuration.categoryListView", truthValueFromBody(req.body.categoryListView));
|
|
298
299
|
group.set("configuration.hidePostImageUploads", truthValueFromBody(req.body.hidePostImageUploads));
|
|
299
300
|
group.set("configuration.hideNewPointOnNewIdea", truthValueFromBody(req.body.hideNewPointOnNewIdea));
|
|
300
301
|
group.set("configuration.maxDaysBackForRecommendations", req.body.maxDaysBackForRecommendations &&
|
package/package.json
CHANGED
|
@@ -108,6 +108,17 @@ const renderTemplateWithLocals = (templatePath, locals, done) => {
|
|
|
108
108
|
done(error, { html, text });
|
|
109
109
|
});
|
|
110
110
|
};
|
|
111
|
+
const renderTemplatePart = (templatePath, locals, part, done) => {
|
|
112
|
+
var fileName = part === "html" ? "html.ejs" : "text.ejs";
|
|
113
|
+
ejs.renderFile(path.join(templatePath, fileName), locals, {}, (err, rendered) => {
|
|
114
|
+
if (err) {
|
|
115
|
+
done(err);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
done(null, rendered);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
};
|
|
111
122
|
const translateSubject = function (subjectHash) {
|
|
112
123
|
if (typeof subjectHash === 'string') {
|
|
113
124
|
return i18n.t(subjectHash);
|
|
@@ -433,7 +444,44 @@ var sendOneEmail = function (emailLocals, callback) {
|
|
|
433
444
|
},
|
|
434
445
|
function (seriesCallback) {
|
|
435
446
|
log.info("EmailWorker Started Sending", { locale: i18n.language });
|
|
436
|
-
|
|
447
|
+
var hasRenderedHtml = emailLocals && typeof emailLocals.renderedHtml === "string";
|
|
448
|
+
var hasRenderedText = emailLocals && typeof emailLocals.renderedText === "string";
|
|
449
|
+
var usePreRendered = hasRenderedHtml || hasRenderedText;
|
|
450
|
+
var renderOrUse = function (done) {
|
|
451
|
+
if (!usePreRendered) {
|
|
452
|
+
return renderTemplateWithLocals(path.join(templatesDir, emailLocals.template), emailLocals, done);
|
|
453
|
+
}
|
|
454
|
+
var templatePath = emailLocals && emailLocals.template
|
|
455
|
+
? path.join(templatesDir, emailLocals.template)
|
|
456
|
+
: null;
|
|
457
|
+
if ((hasRenderedHtml && hasRenderedText) || !templatePath) {
|
|
458
|
+
return done(null, {
|
|
459
|
+
html: hasRenderedHtml ? emailLocals.renderedHtml : undefined,
|
|
460
|
+
text: hasRenderedText ? emailLocals.renderedText : undefined,
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
if (hasRenderedHtml && !hasRenderedText) {
|
|
464
|
+
return renderTemplatePart(templatePath, emailLocals, "text", function (error, renderedText) {
|
|
465
|
+
if (error) {
|
|
466
|
+
return done(error);
|
|
467
|
+
}
|
|
468
|
+
return done(null, {
|
|
469
|
+
html: emailLocals.renderedHtml,
|
|
470
|
+
text: renderedText,
|
|
471
|
+
});
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
return renderTemplatePart(templatePath, emailLocals, "html", function (error, renderedHtml) {
|
|
475
|
+
if (error) {
|
|
476
|
+
return done(error);
|
|
477
|
+
}
|
|
478
|
+
return done(null, {
|
|
479
|
+
html: renderedHtml,
|
|
480
|
+
text: emailLocals.renderedText,
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
};
|
|
484
|
+
renderOrUse((error, results) => {
|
|
437
485
|
if (error) {
|
|
438
486
|
log.error("EmailWorker Error", {
|
|
439
487
|
err: error,
|
|
@@ -459,16 +507,21 @@ var sendOneEmail = function (emailLocals, callback) {
|
|
|
459
507
|
if (bcc === emailLocals.user.email) {
|
|
460
508
|
bcc = null;
|
|
461
509
|
}
|
|
462
|
-
|
|
510
|
+
var mailOptions = {
|
|
463
511
|
from: fromEmail,
|
|
464
512
|
sender: sender,
|
|
465
513
|
replyTo: replyTo,
|
|
466
514
|
to: emailLocals.user.email,
|
|
467
515
|
bcc: bcc,
|
|
468
516
|
subject: translatedSubject,
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
517
|
+
};
|
|
518
|
+
if (typeof results.html === "string") {
|
|
519
|
+
mailOptions.html = results.html;
|
|
520
|
+
}
|
|
521
|
+
if (typeof results.text === "string") {
|
|
522
|
+
mailOptions.text = results.text;
|
|
523
|
+
}
|
|
524
|
+
transport.sendMail(mailOptions, function (error, responseStatus) {
|
|
472
525
|
if (error) {
|
|
473
526
|
log.error("EmailWorker", {
|
|
474
527
|
errorHeaders: error.response
|
|
@@ -510,7 +563,7 @@ var sendOneEmail = function (emailLocals, callback) {
|
|
|
510
563
|
parseInt(Math.random() * (423432432432 - 1232) + 1232) +
|
|
511
564
|
".html";
|
|
512
565
|
fs.unlink(fileName, function (err) {
|
|
513
|
-
fs.writeFile(fileName, results.html, function (err) {
|
|
566
|
+
fs.writeFile(fileName, typeof results.html === "string" ? results.html : "", function (err) {
|
|
514
567
|
if (err) {
|
|
515
568
|
log.error(err);
|
|
516
569
|
}
|