@yrpri/api 9.0.102 → 9.0.104
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/llms/imageGeneration/chatGptImageGenerator.js +56 -0
- package/active-citizen/llms/imageGeneration/collectionImageGenerator.js +6 -0
- package/agents/controllers/agentProductController.js +2 -1
- package/agents/controllers/agentSubscriptionController.js +20 -11
- package/agents/controllers/assistantsController.js +28 -18
- package/agents/controllers/policySynthAgents.js +33 -12
- package/agents/managers/newAiModelSetup.js +96 -0
- package/agents/managers/subscriptionManager.js +2 -2
- package/app.js +12 -12
- package/authorization.cjs +4 -0
- package/controllers/allOurIdeas.js +2 -1
- package/controllers/communities.cjs +47 -1
- package/controllers/groups.cjs +67 -4
- package/controllers/index.cjs +7 -7
- package/controllers/nonSpa.cjs +1 -1
- package/package.json +46 -44
- package/server.d.ts +104 -2
- package/utils/copy_utils.cjs +7 -1
- package/active-citizen/engine/allOurIdeas/aiHelper.d.ts +0 -21
- package/active-citizen/engine/allOurIdeas/aiHelper.d.ts.map +0 -1
- package/active-citizen/engine/allOurIdeas/explainAnswersAssistant.d.ts.map +0 -1
- package/active-citizen/engine/allOurIdeas/iconGenerator.d.ts +0 -12
- package/active-citizen/engine/allOurIdeas/iconGenerator.d.ts.map +0 -1
- package/active-citizen/engine/analytics/export_anon_community_activities.d.ts.map +0 -1
- package/active-citizen/engine/analytics/importer.d.ts.map +0 -1
- package/active-citizen/engine/old/exporters/categories_dataset.d.ts.map +0 -1
- package/active-citizen/engine/old/exporters/dataset_tools.d.ts.map +0 -1
- package/active-citizen/engine/old/exporters/sentiment_dataset.d.ts.map +0 -1
- package/active-citizen/engine/reports/xls_all_our_ideas_export.js +0 -141
- package/active-citizen/llms/baseChatBot.d.ts +0 -51
- package/active-citizen/llms/baseChatBot.d.ts.map +0 -1
- package/active-citizen/llms/collectionImageGenerator.js +0 -357
- package/active-citizen/llms/llmTranslation.d.ts +0 -24
- package/active-citizen/llms/llmTranslation.d.ts.map +0 -1
- package/active-citizen/scripts/fix_old_delayed_notifications.d.ts.map +0 -1
- package/active-citizen/scripts/kue_status.d.ts.map +0 -1
- package/active-citizen/scripts/kue_watch_stuck_jobs.d.ts.map +0 -1
- package/active-citizen/scripts/translation_clear_language.d.ts.map +0 -1
- package/active-citizen/scripts/translation_delete.d.ts.map +0 -1
- package/active-citizen/scripts/translation_replace_text_from_url.d.ts.map +0 -1
- package/active-citizen/scripts/translation_update.d.ts.map +0 -1
- package/active-citizen/scripts/translations_list.d.ts.map +0 -1
- package/active-citizen/utils/airbrake.d.ts.map +0 -1
- package/active-citizen/utils/airbrake.js +0 -17
- package/active-citizen/utils/updateAllLocalesFromEn.d.ts +0 -21
- package/active-citizen/utils/updateAllLocalesFromEn.d.ts.map +0 -1
- package/active-citizen/utils/updateLocaleFolders.d.ts +0 -2
- package/active-citizen/utils/updateLocaleFolders.d.ts.map +0 -1
- package/active-citizen/workers/cloudflare/voiceSession/worker.js +0 -213
- package/active-citizen/workers/generativeAi.d.ts.map +0 -1
- package/agents/agentProductManager.js +0 -91
- package/agents/assistants/agentAssistantOld.js +0 -863
- package/agents/assistants/modes/agentConfigurationMode.js +0 -63
- package/agents/assistants/modes/agentOperationsMode.js +0 -195
- package/agents/assistants/modes/commonTools.js +0 -58
- package/agents/assistants/modes/directConversationMode.js +0 -14
- package/agents/assistants/modes/toolHandlers/accountHandlers.js +0 -46
- package/agents/assistants/modes/toolHandlers/commonHandlers.js +0 -57
- package/agents/assistants/modes/toolHandlers/commonTools.js +0 -58
- package/agents/assistants/modes/toolHandlers/loginHandlers.js +0 -46
- package/agents/assistants/modes/toolHandlers/subscriptionHandlers.js +0 -469
- package/agents/assistants/modes/tools/agentConnectionTools.js +0 -326
- package/agents/assistants/modes/tools/commonHandlers.js +0 -57
- package/agents/assistants/modes/tools/loginHandlers.js +0 -46
- package/agents/assistants/modes/tools/subscriptionHandlers.js +0 -469
- package/agents/assistants/modes/tools/workflowConversationTools.js +0 -326
- package/agents/assistants/modes/tools/workflowTools.js +0 -112
- package/agents/controllers/assistantController.js +0 -243
- package/agents/managers/workflowManager.js +0 -76
- package/agents/models/testData/setupConfig.js +0 -140
- package/agents/models/workflow.js +0 -53
- package/agents/models/workflowConverstation.js +0 -53
- package/agents/subscriptionManager.js +0 -218
- package/agents/tools/updateCommunityWorkflow.js +0 -1
- package/agents/tools/updateTemplateWorkflow.js +0 -45
- package/app.d.ts +0 -40
- package/app.d.ts.map +0 -1
- package/bot_control.d.ts.map +0 -1
- package/migrations/200824_create_embeddings_and_org_update.cjs +0 -15
- package/migrations/270724_createUsersAndAdminsForClasses.cjs +0 -100
- package/publish.d.ts.map +0 -1
- package/repack.d.ts.map +0 -1
- package/scripts/addRatingUsersToGroup.d.ts.map +0 -1
- package/scripts/addUserToOrganization.d.ts.map +0 -1
- package/scripts/analyseRatingsForCommunity.d.ts.map +0 -1
- package/scripts/analyzeAndFixBrokenPointUsers.d.ts.map +0 -1
- package/scripts/analyzeEndorsementsByCountry.d.ts.map +0 -1
- package/scripts/analyzePostsForCommunity.d.ts.map +0 -1
- package/scripts/bulkStatusUpdates/listUpdates.d.ts.map +0 -1
- package/scripts/bulkStatusUpdates/mergeLatestPostsToUpdate.d.ts.map +0 -1
- package/scripts/bulkStatusUpdates/performUpdate.d.ts.map +0 -1
- package/scripts/bulkStatusUpdates/performUpdateForGroup.d.ts.map +0 -1
- package/scripts/bulkStatusUpdates/performUpdateForGroup.js +0 -125
- package/scripts/bulkStatusUpdates/performUpdateForStatus.d.ts.map +0 -1
- package/scripts/change/changeVideoAspectTo.d.ts.map +0 -1
- package/scripts/change/setDomainAdmin.cjs +0 -45
- package/scripts/changeCommunityGroupcount.d.ts.map +0 -1
- package/scripts/changeCommunityPostCount.d.ts.map +0 -1
- package/scripts/changeGroupPostCount.d.ts.map +0 -1
- package/scripts/changeLanguage.d.ts.map +0 -1
- package/scripts/changeOfficalStatus.d.ts.map +0 -1
- package/scripts/cleanups/deleteAnonNotifications.d.ts.map +0 -1
- package/scripts/cleanups/deleteAnonNotifications.js +0 -91
- package/scripts/cleanups/deleteLinkGroupsWithDeletedCommunities.d.ts.map +0 -1
- package/scripts/cleanups/removeAllUsersFromHiddenPublicGroup.d.ts.map +0 -1
- package/scripts/clearAllEndorsementInGroup.d.ts.map +0 -1
- package/scripts/cloning/clearUsersForCommunitiesFromUrl.d.ts.map +0 -1
- package/scripts/cloning/cloneFromUrlScript.d.ts.map +0 -1
- package/scripts/cloning/cloneWBFromUrlScriptAndCreateLinks.d.ts.map +0 -1
- package/scripts/cloning/cloneWBFromUrlScriptNoUsersOrPoints.d.ts.map +0 -1
- package/scripts/cloning/cloneWBSerbianFromUrlScriptAndCreateLinks.d.ts.map +0 -1
- package/scripts/cloning/copyCommunityConfigAndTranslationsFromURL.d.ts.map +0 -1
- package/scripts/cloning/copyCommunityOneGroupToDomainNoUsersNoEndorsements.d.ts.map +0 -1
- package/scripts/cloning/copyCommunityToDomainNoUsersNoEndorsements.d.ts.map +0 -1
- package/scripts/cloning/copyCommunityToDomainWithEverything.d.ts.map +0 -1
- package/scripts/cloning/copyCommunityToDomainWithOnlyGroups.d.ts.map +0 -1
- package/scripts/cloning/copyGroupConfigAndTranslationsFromURL.d.ts.map +0 -1
- package/scripts/cloning/copyPostToGroupOld.d.ts.map +0 -1
- package/scripts/cloning/copyPostVideosFromURL.d.ts.map +0 -1
- package/scripts/cloning/copyPostWithOutAnyVotingOrActivities.d.ts.map +0 -1
- package/scripts/cloning/deepCloneSerbianWBFromUrlScriptAndCreateLinks.d.ts.map +0 -1
- package/scripts/cloning/deepCloneWBFromUrlScriptAndCreateLinks.d.ts.map +0 -1
- package/scripts/cloning/setAdminsFromURL.d.ts.map +0 -1
- package/scripts/cloning/setExternalIdsFromURL.d.ts.map +0 -1
- package/scripts/countCommunity.d.ts.map +0 -1
- package/scripts/countCommunityUsers.d.ts.map +0 -1
- package/scripts/countDelayedNotifications.d.ts.map +0 -1
- package/scripts/countGroup.d.ts.map +0 -1
- package/scripts/countStuff.d.ts.map +0 -1
- package/scripts/countUniqueVotersInAGroup.d.ts.map +0 -1
- package/scripts/createInvitesAndShow.d.ts.map +0 -1
- package/scripts/database/seedTestAiModels.js +0 -64
- package/scripts/database/sync_database.d.ts.map +0 -1
- package/scripts/database/sync_dev_database.d.ts.map +0 -1
- package/scripts/debugNotifications.d.ts.map +0 -1
- package/scripts/deleteAllNewsFeeds.d.ts.map +0 -1
- package/scripts/deleteCategory.d.ts.map +0 -1
- package/scripts/deleteOldAppActivities.d.ts.map +0 -1
- package/scripts/deletePostContactDataForCommunity.d.ts.map +0 -1
- package/scripts/destroy/destroy_all_but_one_domain.d.ts.map +0 -1
- package/scripts/displayAuthorForPost.d.ts.map +0 -1
- package/scripts/endorsementFraudDetection/analyseEndorsementsForCommunity.d.ts.map +0 -1
- package/scripts/endorsementFraudDetection/bulkDeleteDuplicateEndorsmentsFromUrl.d.ts.map +0 -1
- package/scripts/exportAllStatusChanges.d.ts.map +0 -1
- package/scripts/exportClientAcitivity.d.ts.map +0 -1
- package/scripts/exportEndorsementsForCommunity.d.ts.map +0 -1
- package/scripts/exportPointQualitiesForCommunity.d.ts.map +0 -1
- package/scripts/exportPostsAndPointsForCommunity.d.ts.map +0 -1
- package/scripts/exportPostsDataSetForDomain.d.ts.map +0 -1
- package/scripts/exportPostsForGroup.d.ts.map +0 -1
- package/scripts/exportRatingsForPost.d.ts.map +0 -1
- package/scripts/exportUserEndorsementsWithUserAnalysis.d.ts.map +0 -1
- package/scripts/exportUsersForCommunity.d.ts.map +0 -1
- package/scripts/exportUsersForDomain.d.ts.map +0 -1
- package/scripts/exportUsersForGroup.d.ts.map +0 -1
- package/scripts/exports/ratingDistribution.d.ts.map +0 -1
- package/scripts/exports/whoEndorsedWhatByCommunity.d.ts.map +0 -1
- package/scripts/findUnusedClientImports.d.ts.map +0 -1
- package/scripts/fixAllPostPointCounts.d.ts.map +0 -1
- package/scripts/fixAnonNotificationsSettings.d.ts.map +0 -1
- package/scripts/fixCountKopavogur.d.ts.map +0 -1
- package/scripts/fixEndorsementsAfterCopyPostToGroup.d.ts.map +0 -1
- package/scripts/fixExternalUserId.d.ts.map +0 -1
- package/scripts/fixGroupAccess.d.ts.map +0 -1
- package/scripts/fixGroupIdeasAndPointsCount.d.ts.map +0 -1
- package/scripts/fixNotificationSettings.d.ts.map +0 -1
- package/scripts/fixSurveyRadioBakedInSubCodes.d.ts.map +0 -1
- package/scripts/fixWrongUserIdForStatusUpdates.d.ts.map +0 -1
- package/scripts/gallery/exportGalleryData.d.ts.map +0 -1
- package/scripts/gallery/importGalleryForCommunity.d.ts.map +0 -1
- package/scripts/gallery/readJsonAndDownloadImagesVersion2.d.ts.map +0 -1
- package/scripts/gallery/refreshAcApiPostIdsForCommunity.d.ts.map +0 -1
- package/scripts/genderAnalysis.d.ts.map +0 -1
- package/scripts/genderAnalysisByStatus.d.ts.map +0 -1
- package/scripts/importAllLocalesFromLocalFolders.d.ts.map +0 -1
- package/scripts/importDomain.d.ts.map +0 -1
- package/scripts/landUseGame/export3Ddata.d.ts.map +0 -1
- package/scripts/listLanguagesForGroup.d.ts.map +0 -1
- package/scripts/loadTestCreateDummyContentForGroup.d.ts.map +0 -1
- package/scripts/makeRecursiveMapData.d.ts.map +0 -1
- package/scripts/mapping/community_map_csv.d.ts.map +0 -1
- package/scripts/moveCommunityToDomain.d.ts.map +0 -1
- package/scripts/moveGroupToCommunity.d.ts.map +0 -1
- package/scripts/movePostToGroup.d.ts.map +0 -1
- package/scripts/movePostsToGroupsRecountGroupFromUrl.d.ts.map +0 -1
- package/scripts/oldMovePostToGroup.d.ts.map +0 -1
- package/scripts/processCsvForPdfUrls.d.ts.map +0 -1
- package/scripts/processCsvForTranslationAndToxicity.d.ts.map +0 -1
- package/scripts/recount/recount_recursive_communities.d.ts.map +0 -1
- package/scripts/recountALLCommunityGroupCounts.d.ts.map +0 -1
- package/scripts/recountAll.d.ts.map +0 -1
- package/scripts/recountCommunitesFromUrl.d.ts.map +0 -1
- package/scripts/recountCommunity.d.ts.map +0 -1
- package/scripts/recountGroup.d.ts.map +0 -1
- package/scripts/recountGroupNoUserChange.d.ts.map +0 -1
- package/scripts/resetAllEndorsementsForGroup.d.ts.map +0 -1
- package/scripts/resetEnTranslationForGroup.d.ts.map +0 -1
- package/scripts/setDomainLocales.d.ts.map +0 -1
- package/scripts/setLanguageOnGroupCommunitesFromUrl.d.ts.map +0 -1
- package/scripts/setMemberOfAll.d.ts.map +0 -1
- package/scripts/setNewUserForContentOfCommunity.d.ts.map +0 -1
- package/scripts/setOfficialStatusOnAllPostsForCommunity.d.ts.map +0 -1
- package/scripts/setUserOnAll.d.ts.map +0 -1
- package/scripts/showCategoryForGroup.d.ts.map +0 -1
- package/scripts/showOldActivityTypes.d.ts.map +0 -1
- package/scripts/showPostsMissingCategoryForGroup.d.ts.map +0 -1
- package/scripts/showStatuses.d.ts.map +0 -1
- package/scripts/showUniqueVotersInCommunity.d.ts.map +0 -1
- package/scripts/showUserAgentsAndIpsForEmails.d.ts.map +0 -1
- package/scripts/simpleExportForGroupsForCommunity.d.ts.map +0 -1
- package/scripts/simpleExportForPointsForCommunity.d.ts.map +0 -1
- package/scripts/simpleExportForPostsForCommunity.d.ts.map +0 -1
- package/scripts/testForEndorsments.d.ts.map +0 -1
- package/scripts/undeleteGroupAndAllContent.d.ts.map +0 -1
- package/scripts/undeletePost.d.ts.map +0 -1
- package/scripts/unlinkSsn.d.ts.map +0 -1
- package/scripts/updateFromAlthingi.d.ts.map +0 -1
- package/server.d.ts.map +0 -1
- package/utils/copyGroup.js +0 -246
- package/utils/loggerTs.d.ts +0 -4
- package/utils/loggerTs.d.ts.map +0 -1
- package/utils/ypLanguages.d.ts +0 -18
- package/utils/ypLanguages.d.ts.map +0 -1
|
@@ -9,6 +9,7 @@ var _ = require("lodash");
|
|
|
9
9
|
var async = require("async");
|
|
10
10
|
var crypto = require("crypto");
|
|
11
11
|
var queue = require("../active-citizen/workers/queue.cjs");
|
|
12
|
+
const { Op, literal } = require("sequelize");
|
|
12
13
|
const getAllModeratedItemsByCommunity = require("../active-citizen/engine/moderation/get_moderation_items.cjs").getAllModeratedItemsByCommunity;
|
|
13
14
|
const performSingleModerationAction = require("../active-citizen/engine/moderation/process_moderation_items.cjs").performSingleModerationAction;
|
|
14
15
|
const getLoginsExportDataForCommunity = require("../utils/export_utils.cjs").getLoginsExportDataForCommunity;
|
|
@@ -722,6 +723,7 @@ const updateCommunityConfigParameters = function (req, community) {
|
|
|
722
723
|
: null);
|
|
723
724
|
community.set("configuration.forceSecureSamlLogin", truthValueFromBody(req.body.forceSecureSamlLogin));
|
|
724
725
|
community.set("configuration.hideRecommendationOnNewsFeed", truthValueFromBody(req.body.hideRecommendationOnNewsFeed));
|
|
726
|
+
community.set("configuration.useAsTemplate", truthValueFromBody(req.body.useAsTemplate));
|
|
725
727
|
community.set("configuration.closeNewsfeedSubmissions", truthValueFromBody(req.body.closeNewsfeedSubmissions));
|
|
726
728
|
community.set("configuration.useCommunityIdForAnalytics", truthValueFromBody(req.body.useCommunityIdForAnalytics));
|
|
727
729
|
community.set("configuration.disableGroupDynamicFontSizes", truthValueFromBody(req.body.disableGroupDynamicFontSizes));
|
|
@@ -938,6 +940,50 @@ router.post("/:communityId/user_membership", auth.isLoggedInNoAnonymousCheck, au
|
|
|
938
940
|
}
|
|
939
941
|
});
|
|
940
942
|
});
|
|
943
|
+
router.get("/:domainId/getTemplates", auth.can("view domain"), async (req, res) => {
|
|
944
|
+
try {
|
|
945
|
+
const userId = req.user.id;
|
|
946
|
+
const domainId = req.params.domainId;
|
|
947
|
+
const templateCommunities = await models.Community.findAll({
|
|
948
|
+
where: {
|
|
949
|
+
[Op.and]: [
|
|
950
|
+
{ domain_id: domainId },
|
|
951
|
+
{ "configuration.useAsTemplate": true },
|
|
952
|
+
{
|
|
953
|
+
[Op.or]: [
|
|
954
|
+
// public templates
|
|
955
|
+
{ access: models.Community.ACCESS_PUBLIC },
|
|
956
|
+
// templates where user is an admin
|
|
957
|
+
literal(`"CommunityAdmins"."id" IS NOT NULL`)
|
|
958
|
+
]
|
|
959
|
+
}
|
|
960
|
+
]
|
|
961
|
+
},
|
|
962
|
+
include: [
|
|
963
|
+
{
|
|
964
|
+
model: models.User,
|
|
965
|
+
as: "CommunityAdmins",
|
|
966
|
+
attributes: [],
|
|
967
|
+
through: { attributes: [] },
|
|
968
|
+
where: { id: userId },
|
|
969
|
+
required: false,
|
|
970
|
+
}
|
|
971
|
+
],
|
|
972
|
+
attributes: ["id", "name"],
|
|
973
|
+
distinct: true,
|
|
974
|
+
order: [["name", "ASC"]]
|
|
975
|
+
});
|
|
976
|
+
res.send(templateCommunities || []);
|
|
977
|
+
}
|
|
978
|
+
catch (error) {
|
|
979
|
+
log.error("Could not get template communities", {
|
|
980
|
+
err: error,
|
|
981
|
+
context: "getTemplates",
|
|
982
|
+
user: toJson(req.user.simple()),
|
|
983
|
+
});
|
|
984
|
+
res.sendStatus(500);
|
|
985
|
+
}
|
|
986
|
+
});
|
|
941
987
|
router.post("/:communityId/:userEmail/invite_user", auth.can("edit community"), function (req, res) {
|
|
942
988
|
var invite, user, token;
|
|
943
989
|
async.series([
|
|
@@ -2634,7 +2680,7 @@ router.post("/:id/clone", auth.can("edit community"), function (req, res) {
|
|
|
2634
2680
|
else if (newCommunity) {
|
|
2635
2681
|
recountCommunity(newCommunity.id, () => {
|
|
2636
2682
|
log.info("Community Cloned", { communityId: req.params.id });
|
|
2637
|
-
res.
|
|
2683
|
+
res.send({ id: newCommunity.id });
|
|
2638
2684
|
});
|
|
2639
2685
|
}
|
|
2640
2686
|
else {
|
package/controllers/groups.cjs
CHANGED
|
@@ -15,6 +15,7 @@ var aws = require("aws-sdk");
|
|
|
15
15
|
var getExportFileDataForGroup = require("../utils/export_utils.cjs").getExportFileDataForGroup;
|
|
16
16
|
const exportGroupToDocx = require("../utils/docx_utils.cjs").exportGroupToDocx;
|
|
17
17
|
const { v4: uuidv4 } = require("uuid");
|
|
18
|
+
const { Op, literal } = require("sequelize");
|
|
18
19
|
var moment = require("moment");
|
|
19
20
|
var sanitizeFilename = require("sanitize-filename");
|
|
20
21
|
var queue = require("../active-citizen/workers/queue.cjs");
|
|
@@ -349,6 +350,7 @@ var updateGroupConfigParameters = function (req, group) {
|
|
|
349
350
|
? req.body.customVoteDownHoverText
|
|
350
351
|
: null);
|
|
351
352
|
group.set("configuration.hideRecommendationOnNewsFeed", truthValueFromBody(req.body.hideRecommendationOnNewsFeed));
|
|
353
|
+
group.set("configuration.useAsTemplate", truthValueFromBody(req.body.useAsTemplate));
|
|
352
354
|
group.set("configuration.disableMachineTranscripts", truthValueFromBody(req.body.disableMachineTranscripts));
|
|
353
355
|
group.set("configuration.hideLogoBoxExceptOnMobile", truthValueFromBody(req.body.hideLogoBoxExceptOnMobile));
|
|
354
356
|
group.set("configuration.hideInfoBoxExceptForAdmins", truthValueFromBody(req.body.hideInfoBoxExceptForAdmins));
|
|
@@ -2480,7 +2482,7 @@ router.post("/:id/clone", auth.can("edit group"), function (req, res) {
|
|
|
2480
2482
|
})
|
|
2481
2483
|
.then(function (group) {
|
|
2482
2484
|
if (group) {
|
|
2483
|
-
copyGroup(group.id, group.Community, group.Community.domain_id, {
|
|
2485
|
+
copyGroup(group.id, group.Community, group.Community.domain_id, { skipUsers: true, skipActivities: true }, (error, newGroup) => {
|
|
2484
2486
|
if (error) {
|
|
2485
2487
|
log.error("Group Cloned Failed", {
|
|
2486
2488
|
error,
|
|
@@ -2488,9 +2490,13 @@ router.post("/:id/clone", auth.can("edit group"), function (req, res) {
|
|
|
2488
2490
|
});
|
|
2489
2491
|
res.sendStatus(500);
|
|
2490
2492
|
}
|
|
2491
|
-
else {
|
|
2493
|
+
else if (newGroup) {
|
|
2492
2494
|
log.info("Group Cloned", { groupId: req.params.id });
|
|
2493
|
-
res.
|
|
2495
|
+
res.send({ id: newGroup.id });
|
|
2496
|
+
}
|
|
2497
|
+
else {
|
|
2498
|
+
log.error("Group Cloned succeeded but newGroup is missing", { groupId: req.params.id });
|
|
2499
|
+
res.sendStatus(500);
|
|
2494
2500
|
}
|
|
2495
2501
|
});
|
|
2496
2502
|
}
|
|
@@ -2944,7 +2950,7 @@ var getPostsWithAllFromIds = function (postsWithIds, postOrder, done) {
|
|
|
2944
2950
|
}
|
|
2945
2951
|
});
|
|
2946
2952
|
};
|
|
2947
|
-
router.get("/:id/posts/:filter/:categoryId/:status
|
|
2953
|
+
router.get("/:id/posts/:filter/:categoryId{/:status}", auth.can("view group"), function (req, res) {
|
|
2948
2954
|
const redisKey = `cache:posts:${req.params.id}:${req.params.filter}:${req.params.categoryId}:${req.params.status}:${req.query.offset}:${req.query.randomSeed}`;
|
|
2949
2955
|
req.redisClient
|
|
2950
2956
|
.get(redisKey)
|
|
@@ -4059,6 +4065,63 @@ router.put("/:groupId/plausibleStatsProxy", auth.can("edit group marketing"), as
|
|
|
4059
4065
|
res.sendStatus(500);
|
|
4060
4066
|
}
|
|
4061
4067
|
});
|
|
4068
|
+
router.get("/:domainId/getTemplates", auth.can("view domain"), async (req, res) => {
|
|
4069
|
+
try {
|
|
4070
|
+
const userId = req.user.id;
|
|
4071
|
+
const domainId = req.params.domainId;
|
|
4072
|
+
const templateGroups = await models.Group.findAll({
|
|
4073
|
+
where: {
|
|
4074
|
+
[Op.and]: [
|
|
4075
|
+
{ "configuration.useAsTemplate": true },
|
|
4076
|
+
{
|
|
4077
|
+
[Op.or]: [
|
|
4078
|
+
// public templates
|
|
4079
|
+
{ access: models.Group.ACCESS_PUBLIC },
|
|
4080
|
+
// templates where user is an admin
|
|
4081
|
+
literal(`"GroupAdmins"."id" IS NOT NULL`)
|
|
4082
|
+
]
|
|
4083
|
+
}
|
|
4084
|
+
]
|
|
4085
|
+
},
|
|
4086
|
+
include: [
|
|
4087
|
+
{
|
|
4088
|
+
model: models.User,
|
|
4089
|
+
as: "GroupAdmins",
|
|
4090
|
+
attributes: [],
|
|
4091
|
+
through: { attributes: [] },
|
|
4092
|
+
where: { id: userId },
|
|
4093
|
+
required: false,
|
|
4094
|
+
},
|
|
4095
|
+
{
|
|
4096
|
+
model: models.Community,
|
|
4097
|
+
as: "Community",
|
|
4098
|
+
attributes: ["id", "name"],
|
|
4099
|
+
required: true,
|
|
4100
|
+
include: [
|
|
4101
|
+
{
|
|
4102
|
+
model: models.Domain,
|
|
4103
|
+
attributes: ["id", "name"],
|
|
4104
|
+
required: true,
|
|
4105
|
+
where: { id: domainId }
|
|
4106
|
+
},
|
|
4107
|
+
],
|
|
4108
|
+
}
|
|
4109
|
+
],
|
|
4110
|
+
attributes: ["id", "name"],
|
|
4111
|
+
distinct: true,
|
|
4112
|
+
order: [["name", "ASC"]]
|
|
4113
|
+
});
|
|
4114
|
+
res.send(templateGroups || []);
|
|
4115
|
+
}
|
|
4116
|
+
catch (error) {
|
|
4117
|
+
log.error("Could not get template groups", {
|
|
4118
|
+
err: error,
|
|
4119
|
+
context: "getTemplates",
|
|
4120
|
+
user: toJson(req.user.simple()),
|
|
4121
|
+
});
|
|
4122
|
+
res.sendStatus(500);
|
|
4123
|
+
}
|
|
4124
|
+
});
|
|
4062
4125
|
router.get("/:groupId/:type/getPlausibleSeries", auth.can("edit group marketing"), async (req, res) => {
|
|
4063
4126
|
// Example: "timeseries?site_id=your-priorities&period=7d";
|
|
4064
4127
|
try {
|
package/controllers/index.cjs
CHANGED
|
@@ -425,25 +425,25 @@ initializeIndexCache();
|
|
|
425
425
|
router.get("/", function (req, res) {
|
|
426
426
|
sendIndex(req, res);
|
|
427
427
|
});
|
|
428
|
-
router.get("/domain
|
|
428
|
+
router.get("/domain{/*splat}", function (req, res) {
|
|
429
429
|
sendIndex(req, res);
|
|
430
430
|
});
|
|
431
|
-
router.get("/organization
|
|
431
|
+
router.get("/organization{/*splat}", function (req, res) {
|
|
432
432
|
sendIndex(req, res);
|
|
433
433
|
});
|
|
434
|
-
router.get("/community
|
|
434
|
+
router.get("/community{/*splat}", function (req, res) {
|
|
435
435
|
sendIndex(req, res);
|
|
436
436
|
});
|
|
437
|
-
router.get("/agent_bundle
|
|
437
|
+
router.get("/agent_bundle{/*splat}", function (req, res) {
|
|
438
438
|
sendIndex(req, res);
|
|
439
439
|
});
|
|
440
|
-
router.get("/group
|
|
440
|
+
router.get("/group{/*splat}", function (req, res) {
|
|
441
441
|
sendIndex(req, res);
|
|
442
442
|
});
|
|
443
|
-
router.get("/post
|
|
443
|
+
router.get("/post{/*splat}", function (req, res) {
|
|
444
444
|
sendIndex(req, res);
|
|
445
445
|
});
|
|
446
|
-
router.get("/user
|
|
446
|
+
router.get("/user{/*splat}", function (req, res) {
|
|
447
447
|
sendIndex(req, res);
|
|
448
448
|
});
|
|
449
449
|
module.exports = router;
|
package/controllers/nonSpa.cjs
CHANGED
|
@@ -504,7 +504,7 @@ var sendUser = function sendUserForBot(id, req, res) {
|
|
|
504
504
|
res.sendStatus(500);
|
|
505
505
|
});
|
|
506
506
|
};
|
|
507
|
-
router.get('
|
|
507
|
+
router.get('/{*splat}', function botController(req, res, next) {
|
|
508
508
|
const { splitUrl, splitPath, id, url } = getSplitUrl(req);
|
|
509
509
|
let communitiesOffset = 0;
|
|
510
510
|
if (url.indexOf("communitiesOffset=") > -1) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yrpri/api",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.104",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Robert Bjarnason & Citizens Foundation",
|
|
6
6
|
"repository": {
|
|
@@ -16,23 +16,23 @@
|
|
|
16
16
|
],
|
|
17
17
|
"type": "module",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@airbrake/node": "^2.1.
|
|
20
|
-
"@aws-sdk/client-s3": "^3.
|
|
21
|
-
"@google-cloud/aiplatform": "^
|
|
22
|
-
"@google-cloud/speech": "^
|
|
23
|
-
"@google-cloud/storage": "^7.
|
|
24
|
-
"@google-cloud/translate": "^
|
|
25
|
-
"@google-cloud/vertexai": "^1.
|
|
26
|
-
"@google-cloud/vision": "^
|
|
27
|
-
"@node-saml/passport-saml": "^5.0.
|
|
28
|
-
"@policysynth/agents": "^1.3.
|
|
19
|
+
"@airbrake/node": "^2.1.9",
|
|
20
|
+
"@aws-sdk/client-s3": "^3.803.0",
|
|
21
|
+
"@google-cloud/aiplatform": "^4.1.0",
|
|
22
|
+
"@google-cloud/speech": "^7.0.1",
|
|
23
|
+
"@google-cloud/storage": "^7.16.0",
|
|
24
|
+
"@google-cloud/translate": "^9.0.1",
|
|
25
|
+
"@google-cloud/vertexai": "^1.10.0",
|
|
26
|
+
"@google-cloud/vision": "^5.1.0",
|
|
27
|
+
"@node-saml/passport-saml": "^5.0.1",
|
|
28
|
+
"@policysynth/agents": "^1.3.92",
|
|
29
29
|
"@types/connect-redis": "^0.0.23",
|
|
30
30
|
"async": "^3.2.6",
|
|
31
31
|
"authorized": "^1.0.0",
|
|
32
32
|
"aws-sdk": "^2.1692.0",
|
|
33
|
-
"axios": "^1.
|
|
33
|
+
"axios": "^1.9.0",
|
|
34
34
|
"bcrypt": "^5.1.1",
|
|
35
|
-
"body-parser": "^
|
|
35
|
+
"body-parser": "^2.2.0",
|
|
36
36
|
"bull": "^4.16.5",
|
|
37
37
|
"bunyan": "^1.8.15",
|
|
38
38
|
"bunyan-prettystream": "git+https://github.com/rbjarnason/node-bunyan-prettystream.git",
|
|
@@ -40,94 +40,95 @@
|
|
|
40
40
|
"color-hash": "^2.0.2",
|
|
41
41
|
"compression": "^1.8.0",
|
|
42
42
|
"concat-stream": "^2.0.0",
|
|
43
|
-
"connect-redis": "^8.0.
|
|
43
|
+
"connect-redis": "^8.0.3",
|
|
44
44
|
"cors": "^2.8.5",
|
|
45
45
|
"deep-equal": "^2.2.3",
|
|
46
|
-
"docx": "^9.
|
|
46
|
+
"docx": "^9.5.0",
|
|
47
47
|
"download-file": "^0.1.5",
|
|
48
48
|
"ejs": "^3.1.10",
|
|
49
49
|
"exceljs": "^4.4.0",
|
|
50
|
-
"express": "^
|
|
50
|
+
"express": "^5.1.0",
|
|
51
51
|
"express-rate-limit": "^7.5.0",
|
|
52
52
|
"express-session": "git+https://github.com/rbjarnason/session.git#upgrade-21",
|
|
53
53
|
"express-useragent": "^1.0.15",
|
|
54
54
|
"farmhash": "4.0.1",
|
|
55
55
|
"html-to-docx": "^1.8.0",
|
|
56
|
-
"i18next": "^
|
|
56
|
+
"i18next": "^25.1.1",
|
|
57
57
|
"i18next-fs-backend": "^2.6.0",
|
|
58
|
-
"image-size": "^
|
|
59
|
-
"isbot": "^5.1.
|
|
58
|
+
"image-size": "^2.0.2",
|
|
59
|
+
"isbot": "^5.1.27",
|
|
60
60
|
"iso-639-1": "^3.1.5",
|
|
61
61
|
"jsonrepair": "^3.12.0",
|
|
62
62
|
"knuth-shuffle-seeded": "^1.0.6",
|
|
63
63
|
"lodash": "^4.17.21",
|
|
64
|
-
"marked": "^15.0.
|
|
64
|
+
"marked": "^15.0.11",
|
|
65
65
|
"moment": "^2.30.1",
|
|
66
66
|
"morgan": "~1.10.0",
|
|
67
|
-
"multer": "1.4.5-lts.
|
|
67
|
+
"multer": "1.4.5-lts.2",
|
|
68
68
|
"multer-s3": "^3.0.1",
|
|
69
69
|
"multer-sharp-s3": "^0.2.5",
|
|
70
|
-
"newrelic": "^12.
|
|
71
|
-
"nodemailer": "^
|
|
72
|
-
"open-graph-scraper": "^6.
|
|
73
|
-
"openai": "^4.
|
|
70
|
+
"newrelic": "^12.18.2",
|
|
71
|
+
"nodemailer": "^7.0.2",
|
|
72
|
+
"open-graph-scraper": "^6.10.0",
|
|
73
|
+
"openai": "^4.97.0",
|
|
74
74
|
"passport": "^0.6.0",
|
|
75
75
|
"passport-facebook": "^3.0.0",
|
|
76
76
|
"passport-github": "^1.1.0",
|
|
77
77
|
"passport-google-oauth": "^2.0.0",
|
|
78
78
|
"passport-local": "^1.0.0",
|
|
79
79
|
"passport-openidconnect": "git+https://github.com/rbjarnason/passport-openidconnect.git",
|
|
80
|
+
"passport-saml": "git+https://github.com/rbjarnason/passport-saml.git#smarternj",
|
|
80
81
|
"passport-sso": "git+https://github.com/rbjarnason/passport-sso.git",
|
|
82
|
+
"pug": "^3.0.3",
|
|
81
83
|
"randomstring": "^1.3.1",
|
|
82
84
|
"rate-limit-redis": "^4.2.0",
|
|
85
|
+
"redis": "^4.7.0",
|
|
83
86
|
"replicate": "^1.0.1",
|
|
84
87
|
"request": "^2.88.2",
|
|
85
88
|
"request-ip": "^3.3.0",
|
|
86
89
|
"sanitize-filename": "^1.6.3",
|
|
87
|
-
"sequelize": "^6.
|
|
88
|
-
"sharp": "^0.
|
|
90
|
+
"sequelize": "^6.37.7",
|
|
91
|
+
"sharp": "^0.34.1",
|
|
89
92
|
"sitemap": "^8.0.0",
|
|
90
|
-
"stripe": "^
|
|
93
|
+
"stripe": "^18.1.0",
|
|
91
94
|
"striptags": "^3.2.0",
|
|
92
95
|
"uuid": "^11.1.0",
|
|
93
|
-
"ws": "^8.18.
|
|
96
|
+
"ws": "^8.18.2"
|
|
94
97
|
},
|
|
95
98
|
"devDependencies": {
|
|
96
|
-
"@maxmind/geoip2-node": "^6.
|
|
99
|
+
"@maxmind/geoip2-node": "^6.1.0",
|
|
97
100
|
"@tsconfig/node18": "^18.2.4",
|
|
98
101
|
"@types/bunyan": "^1.8.11",
|
|
99
102
|
"@types/bunyan-prettystream": "^0.1.35",
|
|
100
103
|
"@types/compression": "^1.7.5",
|
|
101
104
|
"@types/cors": "^2.8.17",
|
|
102
|
-
"@types/express": "^
|
|
105
|
+
"@types/express": "^5.0.1",
|
|
103
106
|
"@types/express-session": "^1.18.1",
|
|
104
107
|
"@types/express-useragent": "^1.0.5",
|
|
108
|
+
"@types/lodash": "^4.17.16",
|
|
105
109
|
"@types/marked": "^6.0.0",
|
|
106
110
|
"@types/morgan": "^1.9.9",
|
|
107
|
-
"@types/node": "^22.
|
|
111
|
+
"@types/node": "^22.15.12",
|
|
108
112
|
"@types/passport": "^1.0.17",
|
|
109
113
|
"@types/request-ip": "^0.0.41",
|
|
110
|
-
"@types/sequelize": "^4.28.20",
|
|
111
114
|
"@types/sharp": "^0.32.0",
|
|
112
115
|
"@types/uuid": "^10.0.0",
|
|
113
|
-
"@types/ws": "^8.
|
|
114
|
-
"axios": "^1.
|
|
116
|
+
"@types/ws": "^8.18.1",
|
|
117
|
+
"axios": "^1.9.0",
|
|
115
118
|
"csv-parse": "^5.6.0",
|
|
116
119
|
"diacritics": "^1.3.0",
|
|
117
120
|
"jshint": "^2.13.6",
|
|
118
121
|
"jslint": "^0.12.1",
|
|
119
122
|
"ncp": "^2.0.0",
|
|
120
|
-
"nodemon": "^3.1.
|
|
123
|
+
"nodemon": "^3.1.10",
|
|
121
124
|
"random-words": "^2.0.1",
|
|
122
|
-
"
|
|
123
|
-
"sequelize": "^6.37.5",
|
|
124
|
-
"sequelize-cli": "^6.6.2",
|
|
125
|
+
"sequelize-cli": "^6.6.3",
|
|
125
126
|
"temp": "^0.9.4",
|
|
126
127
|
"ts-node": "^10.9.2",
|
|
127
|
-
"typescript": "^5.
|
|
128
|
+
"typescript": "^5.8.3",
|
|
128
129
|
"uuid": "^11.1.0",
|
|
129
130
|
"wordwrap": "^1.0.0",
|
|
130
|
-
"ws": "^8.18.
|
|
131
|
+
"ws": "^8.18.2",
|
|
131
132
|
"yamljs": "^0.3.0"
|
|
132
133
|
},
|
|
133
134
|
"scripts": {
|
|
@@ -135,16 +136,17 @@
|
|
|
135
136
|
"publish_live": "npm run build;npm pack && node repack && node publish.js https://registry.npmjs.org/",
|
|
136
137
|
"publish_local": "npm run build;npm pack && node repack && node publish.js http://localhost:4873",
|
|
137
138
|
"start": "nodemon -e ts ts-out/server.js",
|
|
138
|
-
"watch-start": "tsc --project ./ --outDir ./ts-out -w & nodemon -q ./ts-out/server.js",
|
|
139
|
+
"watch-start": "DEBUG=router:* tsc --project ./ --outDir ./ts-out -w & nodemon -q ./ts-out/server.js",
|
|
139
140
|
"dev": "nodemon --config nodemon.json ./ts-out/server.js",
|
|
140
141
|
"heroku-postbuild": "echo 'Skipping build'",
|
|
141
142
|
"dev:debug": "nodemon --config nodemon.json --inspect-brk api_app.ts",
|
|
142
|
-
"build": "tsc --project ./ --outDir ./
|
|
143
|
+
"build": "tsc --project ./ --outDir ./dist && ncp views dist/views && ncp config dist/config && ncp active-citizen/email_templates dist/active-citizen/email_templates && ncp active-citizen/locales dist/active-citizen/locales",
|
|
144
|
+
"build:dev": "tsc --project ./ --outDir ./ts-out && ncp views ts-out/views && ncp config ts-out/config && ncp active-citizen/email_templates ts-out/active-citizen/email_templates && ncp active-citizen/locales ts-out/active-citizen/locales"
|
|
143
145
|
},
|
|
144
146
|
"cacheDirectories": [
|
|
145
147
|
"node_modules"
|
|
146
148
|
],
|
|
147
149
|
"engines": {
|
|
148
|
-
"node": "22.
|
|
150
|
+
"node": "22.15.0"
|
|
149
151
|
}
|
|
150
152
|
}
|
package/server.d.ts
CHANGED
|
@@ -1,2 +1,104 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare module 'logger';
|
|
2
|
+
declare module 'iso-639-1';
|
|
3
|
+
declare module 'newrelic';
|
|
4
|
+
declare module 'html-to-docx';
|
|
5
|
+
|
|
6
|
+
interface Logger {
|
|
7
|
+
debug(text: string): void;
|
|
8
|
+
info(text: string): void;
|
|
9
|
+
warn(text: string): void;
|
|
10
|
+
error(text: string): void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface Models {
|
|
14
|
+
[key: string]: typeof DbData; // Assuming all models extend DbData
|
|
15
|
+
Post?: typeof PostData;
|
|
16
|
+
Domain?: typeof DomainData;
|
|
17
|
+
User?: typeof UserData;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface DbData extends Model {
|
|
21
|
+
created_at: string;
|
|
22
|
+
updated_at: string;
|
|
23
|
+
id: number;
|
|
24
|
+
static findOne(options: any): Promise<any>;
|
|
25
|
+
static findAll(options: any): Promise<any>;
|
|
26
|
+
static destroy(options: any): Promise<any>;
|
|
27
|
+
static update(options: any, data: any): Promise<any>;
|
|
28
|
+
static create(options: any): Promise<any>;
|
|
29
|
+
static count(options: any | undefined = undefined): Promise<any>;
|
|
30
|
+
static build(options: any): Promise<any>;
|
|
31
|
+
save(): Promise<any>;
|
|
32
|
+
set(col: string, value: any): void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface DomainClass extends DbData {
|
|
36
|
+
configuration: {
|
|
37
|
+
ltp?: {
|
|
38
|
+
crt?: LtpCurrentRealityTreeData
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface CommunityClass extends DbData {
|
|
44
|
+
Domain: DomainClass;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface PostClass extends DbData {
|
|
48
|
+
data?: {
|
|
49
|
+
crt?: LtpCurrentRealityTreeData
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface GroupClass extends DbData {
|
|
54
|
+
description: string;
|
|
55
|
+
configuration: YpGroupConfiguration;
|
|
56
|
+
hasGroupAdmins(user: UserClass): Promise<boolean>;
|
|
57
|
+
addGroupAdmins(user: UserClass): Promise<void>;
|
|
58
|
+
hasGroupUsers(user: UserClass): Promise<boolean>;
|
|
59
|
+
addGroupUsers(user: UserClass): Promise<void>;
|
|
60
|
+
changed(field: string, value: any): void;
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface UserClass extends DbData {
|
|
65
|
+
email: string;
|
|
66
|
+
name: string;
|
|
67
|
+
new (): Promise<UserClass>;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
interface AcBackgroundJobClass extends DbData {
|
|
72
|
+
static updateDataAsync(jobId: number, data: any): Promise<any>;
|
|
73
|
+
static updateErrorAsync(jobId: number, error: string): Promise<any>;
|
|
74
|
+
static createJob(data: any, dataTwo: any, done: Function): Promise<any>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface AcXlsExportJobData {
|
|
78
|
+
jobId: number;
|
|
79
|
+
userId: number;
|
|
80
|
+
exportType: string;
|
|
81
|
+
fileName: string;
|
|
82
|
+
utmSource: string;
|
|
83
|
+
questionId: number;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface ImageClass extends DbData {
|
|
87
|
+
formats: string[];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
type YpChatBotMemoryStageTypes = PsMemoryStageTypes | "chatbot-conversation";
|
|
91
|
+
|
|
92
|
+
interface PsChatBotMemoryData extends PsBaseMemoryData {
|
|
93
|
+
stages: Record<any, any>;
|
|
94
|
+
chatLog?: YpSimpleChatLog[];
|
|
95
|
+
problemStatement?: PsProblemStatement;
|
|
96
|
+
currentStage: YpChatBotMemoryStageTypes;
|
|
97
|
+
groupId?: number;
|
|
98
|
+
communityId?: number;
|
|
99
|
+
domainId?: number;
|
|
100
|
+
totalCost?: number;
|
|
101
|
+
customInstructions?: object,
|
|
102
|
+
subProblems?: IEngineSubProblem[],
|
|
103
|
+
currentStageData?: undefined;
|
|
104
|
+
}
|
package/utils/copy_utils.cjs
CHANGED
|
@@ -737,7 +737,12 @@ const copyGroup = (fromGroupId, toCommunityIn, toDomainId, options, done) => {
|
|
|
737
737
|
copyGroup(groupInFolder.id, toCommunity, toDomainId, {
|
|
738
738
|
...JSON.parse(JSON.stringify(options)),
|
|
739
739
|
setInGroupFolderId: newGroup.id,
|
|
740
|
-
},
|
|
740
|
+
}, (recursiveError, nestedNewGroup) => {
|
|
741
|
+
if (recursiveError) {
|
|
742
|
+
return groupInFolderCallback(recursiveError);
|
|
743
|
+
}
|
|
744
|
+
groupInFolderCallback();
|
|
745
|
+
});
|
|
741
746
|
}, (error) => {
|
|
742
747
|
groupSeriesCallback(error);
|
|
743
748
|
});
|
|
@@ -1052,6 +1057,7 @@ const copyCommunity = (fromCommunityId, toDomainId, options, linkFromOptions, do
|
|
|
1052
1057
|
if (newCommunity.hostname) {
|
|
1053
1058
|
newCommunity.set("hostname", newCommunity.hostname + "-copy");
|
|
1054
1059
|
}
|
|
1060
|
+
newCommunity.set("configuration.useAsTemplate", false);
|
|
1055
1061
|
newCommunity.save().then(function () {
|
|
1056
1062
|
async.series([
|
|
1057
1063
|
(communitySeriesCallback) => {
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/// <reference types="../webApps/client/src/typesAoi.d.ts" />
|
|
2
|
-
import { OpenAI } from "openai";
|
|
3
|
-
import { Stream } from "openai/streaming";
|
|
4
|
-
import { WebSocket } from "ws";
|
|
5
|
-
export declare class AiHelper {
|
|
6
|
-
openaiClient: OpenAI;
|
|
7
|
-
wsClientSocket: WebSocket | undefined;
|
|
8
|
-
modelName: string;
|
|
9
|
-
maxTokens: number;
|
|
10
|
-
temperature: number;
|
|
11
|
-
cacheExpireTime: number;
|
|
12
|
-
redisClient?: any;
|
|
13
|
-
cacheKeyForFullResponse?: string;
|
|
14
|
-
constructor(wsClientSocket?: WebSocket | undefined);
|
|
15
|
-
streamChatCompletions(messages: any[]): Promise<void>;
|
|
16
|
-
sendToClient(sender: string, message: string, type?: string): void;
|
|
17
|
-
streamWebSocketResponses(stream: Stream<OpenAI.Chat.Completions.ChatCompletionChunk>): Promise<void>;
|
|
18
|
-
getAnswerIdeas(question: string, previousIdeas: string[] | null, firstMessage: string | null): Promise<string | null | undefined>;
|
|
19
|
-
getAiAnalysis(questionId: number, contextPrompt: string, answers: AoiChoiceData[], cacheKeyForFullResponse: string, redisClient: any, locale: string, topOrBottomIdeasText: string, typeOfAnalysisText: string): Promise<string | null | undefined>;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=aiHelper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aiHelper.d.ts","sourceRoot":"","sources":["../../../../active-citizen/engine/allOurIdeas/aiHelper.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAE/B,qBAAa,QAAQ;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,SAAS,GAAG,SAAS,CAAC;IACtC,SAAS,SAAwB;IACjC,SAAS,SAAQ;IACjB,WAAW,SAAO;IAClB,eAAe,SAAW;IAE1B,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,uBAAuB,CAAC,EAAE,MAAM,CAAC;gBAErB,cAAc,GAAE,SAAS,GAAG,SAAqB;IAOvD,qBAAqB,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAa3D,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,SAAW;IAUvD,wBAAwB,CAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC;IAkCvD,cAAc,CAClB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EAAE,GAAG,IAAI,EAC9B,YAAY,EAAE,MAAM,GAAG,IAAI,GAC1B,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IA0D/B,aAAa,CACjB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,aAAa,EAAE,EACxB,uBAAuB,EAAE,MAAM,EAC/B,WAAW,EAAE,GAAG,EAChB,MAAM,EAAE,MAAM,EACd,oBAAoB,EAAE,MAAM,EAC5B,kBAAkB,EAAE,MAAM,GACzB,OAAO,CAAC,MAAM,GAAE,IAAI,GAAC,SAAS,CAAC;CAwEnC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"explainAnswersAssistant.d.ts","sourceRoot":"","sources":["../../../../active-citizen/engine/allOurIdeas/explainAnswersAssistant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,qBAAa,uBAAwB,SAAQ,aAAa;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,SAAwB;IACjC,SAAS,SAAQ;IACjB,WAAW,SAAO;gBAEL,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC;IAWlE,kBAAkB;IAoBlB,mBAAmB,YAAmB,eAAe,EAAE,mBA0BrD;CACH"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="../webApps/client/src/types.d.ts" />
|
|
2
|
-
export declare class AoiIconGenerator {
|
|
3
|
-
resizeImage(imagePath: string, width: number, height: number): Promise<string>;
|
|
4
|
-
downloadImage(imageUrl: string, imageFilePath: string): Promise<unknown>;
|
|
5
|
-
uploadImageToS3(bucket: string, filePath: string, key: string): Promise<unknown>;
|
|
6
|
-
getImageUrlFromPrompt(prompt: string, type?: YpAiGenerateImageTypes): Promise<any>;
|
|
7
|
-
createCollectionImage(workPackage: YpGenerativeAiWorkPackageData): Promise<{
|
|
8
|
-
imageId: number;
|
|
9
|
-
imageUrl: string;
|
|
10
|
-
}>;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=iconGenerator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"iconGenerator.d.ts","sourceRoot":"","sources":["../../../../active-citizen/engine/allOurIdeas/iconGenerator.ts"],"names":[],"mappings":";AAsBA,qBAAa,gBAAgB;IAErB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAO5D,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;IAiBrD,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAyB7D,qBAAqB,CACzB,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,sBAA+B;IAwFjC,qBAAqB,CACzB,WAAW,EAAE,6BAA6B,GACzC,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CA0DlD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"export_anon_community_activities.d.ts","sourceRoot":"","sources":["../../../../active-citizen/engine/analytics/export_anon_community_activities.js"],"names":[],"mappings":"AAsTA,qGA6CC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"importer.d.ts","sourceRoot":"","sources":["../../../../active-citizen/engine/analytics/importer.js"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"categories_dataset.d.ts","sourceRoot":"","sources":["../../../../../active-citizen/engine/old/exporters/categories_dataset.js"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dataset_tools.d.ts","sourceRoot":"","sources":["../../../../../active-citizen/engine/old/exporters/dataset_tools.js"],"names":[],"mappings":"AAgCA,6HA2CC;AA/DD,wCAkBC;AA5BD,8CAQC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sentiment_dataset.d.ts","sourceRoot":"","sources":["../../../../../active-citizen/engine/old/exporters/sentiment_dataset.js"],"names":[],"mappings":""}
|