@yrpri/api 9.0.96 → 9.0.98
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.
|
@@ -14,7 +14,7 @@ const dbModels = models;
|
|
|
14
14
|
const Image = dbModels.Image;
|
|
15
15
|
const AcBackgroundJob = dbModels.AcBackgroundJob;
|
|
16
16
|
const disableFlux = false;
|
|
17
|
-
const useImagen =
|
|
17
|
+
const useImagen = false;
|
|
18
18
|
export class CollectionImageGenerator {
|
|
19
19
|
constructor() {
|
|
20
20
|
this.s3Service = new S3Service(process.env.CLOUDFLARE_API_KEY, process.env.CLOUDFLARE_ZONE_ID);
|
|
@@ -35,6 +35,7 @@ export class DalleImageGenerator {
|
|
|
35
35
|
else if (type === "icon") {
|
|
36
36
|
size = "1024x1024";
|
|
37
37
|
}
|
|
38
|
+
const modelQuality = "standard";
|
|
38
39
|
while (retrying && retryCount < this.maxRetryCount) {
|
|
39
40
|
try {
|
|
40
41
|
// If using Azure OpenAI
|
|
@@ -43,7 +44,7 @@ export class DalleImageGenerator {
|
|
|
43
44
|
prompt,
|
|
44
45
|
n: 1,
|
|
45
46
|
size,
|
|
46
|
-
quality:
|
|
47
|
+
quality: modelQuality,
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
else {
|
|
@@ -53,7 +54,7 @@ export class DalleImageGenerator {
|
|
|
53
54
|
prompt,
|
|
54
55
|
n: 1,
|
|
55
56
|
size,
|
|
56
|
-
quality:
|
|
57
|
+
quality: modelQuality,
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
60
|
if (result) {
|
package/controllers/posts.cjs
CHANGED
|
@@ -35,7 +35,7 @@ var changePostCounter = function (req, postId, column, upDown, next) {
|
|
|
35
35
|
};
|
|
36
36
|
//TODO: Refactor this as not to repeate it in controlelrs
|
|
37
37
|
const addAgentFabricUserToSessionIfNeeded = async (req) => {
|
|
38
|
-
let userId =
|
|
38
|
+
let userId = req.user && req.user.id ? req.user.id : null;
|
|
39
39
|
if (!userId &&
|
|
40
40
|
req.query.agentFabricUserId &&
|
|
41
41
|
process.env.PS_TEMP_AGENTS_FABRIC_GROUP_API_KEY &&
|
|
@@ -664,7 +664,7 @@ router.get("/:id/newPoints", auth.can("view post"), function (req, res) {
|
|
|
664
664
|
model: models.Image,
|
|
665
665
|
as: "UserProfileImages",
|
|
666
666
|
required: false,
|
|
667
|
-
through: { attributes: [] }
|
|
667
|
+
through: { attributes: [] },
|
|
668
668
|
},
|
|
669
669
|
],
|
|
670
670
|
},
|
|
@@ -842,7 +842,7 @@ const sendPostPoints = (req, res, redisKey) => {
|
|
|
842
842
|
as: "UserProfileImages",
|
|
843
843
|
attributes: ["id", "formats"],
|
|
844
844
|
required: false,
|
|
845
|
-
through: { attributes: [] }
|
|
845
|
+
through: { attributes: [] },
|
|
846
846
|
},
|
|
847
847
|
],
|
|
848
848
|
},
|
|
@@ -1144,10 +1144,18 @@ router.post("/:groupId", auth.can("create post"), async function (req, res) {
|
|
|
1144
1144
|
if (!error && post) {
|
|
1145
1145
|
post.setDataValue("newEndorsement", endorsement);
|
|
1146
1146
|
log.info("process-moderation post toxicity in post controller");
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1147
|
+
const skipModerationForAgentFabric = !req.query.skipModerationForAgentFabric &&
|
|
1148
|
+
process.env
|
|
1149
|
+
.PS_TEMP_AGENTS_FABRIC_GROUP_API_KEY &&
|
|
1150
|
+
req.headers["x-api-key"] ===
|
|
1151
|
+
process.env
|
|
1152
|
+
.PS_TEMP_AGENTS_FABRIC_GROUP_API_KEY;
|
|
1153
|
+
if (!skipModerationForAgentFabric) {
|
|
1154
|
+
queue.add("process-moderation", {
|
|
1155
|
+
type: "estimate-post-toxicity",
|
|
1156
|
+
postId: post.id,
|
|
1157
|
+
}, "high");
|
|
1158
|
+
}
|
|
1151
1159
|
queue.add("process-moderation", {
|
|
1152
1160
|
type: "post-review-and-annotate-images",
|
|
1153
1161
|
postId: post.id,
|
|
@@ -1849,9 +1857,7 @@ router.delete("/:id/endorse", auth.can("vote on post"), function (req, res) {
|
|
|
1849
1857
|
endorsement.save().then(function () {
|
|
1850
1858
|
if (oldEndorsementValue > 0) {
|
|
1851
1859
|
changePostCounter(req, req.params.id, "counter_endorsements_up", -1, function () {
|
|
1852
|
-
res
|
|
1853
|
-
.status(200)
|
|
1854
|
-
.send({
|
|
1860
|
+
res.status(200).send({
|
|
1855
1861
|
endorsement: endorsement,
|
|
1856
1862
|
oldEndorsementValue: oldEndorsementValue,
|
|
1857
1863
|
});
|
|
@@ -1859,9 +1865,7 @@ router.delete("/:id/endorse", auth.can("vote on post"), function (req, res) {
|
|
|
1859
1865
|
}
|
|
1860
1866
|
else if (oldEndorsementValue < 0) {
|
|
1861
1867
|
changePostCounter(req, req.params.id, "counter_endorsements_down", -1, function () {
|
|
1862
|
-
res
|
|
1863
|
-
.status(200)
|
|
1864
|
-
.send({
|
|
1868
|
+
res.status(200).send({
|
|
1865
1869
|
endorsement: endorsement,
|
|
1866
1870
|
oldEndorsementValue: oldEndorsementValue,
|
|
1867
1871
|
});
|