@yrpri/api 9.0.138 → 9.0.140
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/agents/assistants/agentAssistant.js +4 -3
- package/agents/assistants/baseAssistant.js +72 -71
- package/agents/assistants/baseAssistantWithVoice.js +6 -5
- package/agents/assistants/modes/agentDirectConnection.js +8 -7
- package/agents/assistants/modes/agentSelectionMode.js +2 -1
- package/agents/assistants/modes/baseAssistantMode.js +3 -2
- package/agents/assistants/modes/tools/agentTools.js +11 -10
- package/agents/assistants/modes/tools/loginTools.js +7 -6
- package/agents/assistants/modes/tools/models/agents.js +6 -5
- package/agents/assistants/modes/tools/models/subscriptions.js +7 -6
- package/agents/assistants/modes/tools/navigationTools.js +7 -6
- package/agents/assistants/modes/tools/subscriptionTools.js +12 -11
- package/agents/assistants/modes/tools/workflowConverstationTools.js +7 -6
- package/agents/assistants/voiceAssistant.js +45 -44
- package/agents/controllers/agentProductController.js +8 -7
- package/agents/controllers/agentSubscriptionController.js +13 -12
- package/agents/controllers/assistantsController.js +45 -44
- package/agents/controllers/policySynthAgents.d.ts +2 -0
- package/agents/controllers/policySynthAgents.js +63 -31
- package/agents/managers/emailInvitesManager.js +4 -3
- package/agents/managers/newAiModelSetup.js +57 -132
- package/agents/managers/notificationAgentQueueManager.js +55 -54
- package/agents/managers/subscriptionManager.js +24 -23
- package/agents/models/agentProduct.js +2 -1
- package/agents/models/agentProductBoosterPurchase.js +2 -1
- package/agents/models/testData/createEvolyAgentProduct.js +7 -6
- package/agents/models/testData/old/updateAgentWorkflowConfiguration.js +5 -4
- package/agents/models/testData/updateAgentWorkflowConfiguration.js +5 -4
- package/agents/tools/setTemplateWorkflowCommunityId.js +6 -5
- package/app.d.ts +2 -1
- package/app.js +60 -34
- package/authorization.cjs +4 -4
- package/controllers/allOurIdeas.js +45 -44
- package/controllers/groups.cjs +4 -9
- package/controllers/images.cjs +8 -8
- package/controllers/index.cjs +1 -1
- package/controllers/points.cjs +1 -1
- package/controllers/posts.cjs +3 -3
- package/deleteUnwantedDeclerations.cjs +5 -5
- package/models/community.cjs +1 -1
- package/models/domain.cjs +7 -7
- package/models/image.cjs +2 -2
- package/models/index.cjs +8 -4
- package/models/post.cjs +10 -10
- package/models/user.cjs +1 -1
- package/models/video.cjs +4 -4
- package/package.json +5 -5
- package/scripts/addRatingUsersToGroup.js +1 -1
- package/scripts/addUserToOrganization.js +8 -8
- package/scripts/agents/changeModelForWorkflowGroupTemplate.js +13 -12
- package/scripts/agents/generateAgentWorkflowTemplateFromAgentClass.js +8 -7
- package/scripts/analyseRatingsForCommunity.js +2 -2
- package/scripts/analyzeAndFixBrokenPointUsers.js +3 -3
- package/scripts/analyzeEndorsementsByCountry.js +7 -7
- package/scripts/analyzePostsForCommunity.js +1 -1
- package/scripts/bulkStatusUpdates/listUpdates.js +2 -2
- package/scripts/bulkStatusUpdates/mergeLatestPostsToUpdate.js +5 -5
- package/scripts/bulkStatusUpdates/performUpdate.js +9 -9
- package/scripts/bulkStatusUpdates/performUpdateForGroup.cjs +11 -11
- package/scripts/bulkStatusUpdates/performUpdateForStatus.js +15 -15
- package/scripts/change/changeVideoAspectTo.js +3 -3
- package/scripts/change/setUseNewVersion.cjs +4 -4
- package/scripts/changeCommunityGroupcount.js +3 -3
- package/scripts/changeCommunityPostCount.js +3 -3
- package/scripts/changeGroupPostCount.js +3 -3
- package/scripts/changeLanguage.js +4 -4
- package/scripts/changeOfficalStatus.js +3 -3
- package/scripts/cleanups/deleteAnonNotifications.cjs +7 -7
- package/scripts/cleanups/deleteLinkGroupsWithDeletedCommunities.js +8 -8
- package/scripts/cleanups/deleteYearOldNotifications.cjs +5 -5
- package/scripts/cleanups/removeAllUsersFromHiddenPublicGroup.js +5 -5
- package/scripts/clearAllEndorsementInGroup.js +5 -5
- package/scripts/cloning/clearUsersForCommunitiesFromUrl.js +3 -3
- package/scripts/cloning/cloneFromUrlScript.js +4 -4
- package/scripts/cloning/cloneWBFromUrlScriptAndCreateLinks.js +6 -6
- package/scripts/cloning/cloneWBFromUrlScriptNoUsersOrPoints.js +6 -6
- package/scripts/cloning/cloneWBSerbianFromUrlScriptAndCreateLinks.js +6 -6
- package/scripts/cloning/copyCommunityConfigAndTranslationsFromURL.js +3 -3
- package/scripts/cloning/copyCommunityOneGroupToDomainNoUsersNoEndorsements.js +2 -2
- package/scripts/cloning/copyCommunityToDomainNoUsersNoEndorsements.js +2 -2
- package/scripts/cloning/copyCommunityToDomainWithEverything.js +2 -2
- package/scripts/cloning/copyCommunityToDomainWithOnlyGroups.js +3 -3
- package/scripts/cloning/copyGroupConfigAndTranslationsFromURL.js +3 -3
- package/scripts/cloning/copyPostToGroupOld.js +12 -12
- package/scripts/cloning/copyPostVideosFromURL.js +3 -3
- package/scripts/cloning/copyPostWithOutAnyVotingOrActivities.js +2 -2
- package/scripts/cloning/deepCloneSerbianWBFromUrlScriptAndCreateLinks.js +7 -7
- package/scripts/cloning/deepCloneWBFromUrlScriptAndCreateLinks.js +6 -6
- package/scripts/cloning/setAdminsFromURL.js +5 -5
- package/scripts/cloning/setExternalIdsFromURL.js +3 -3
- package/scripts/countCommunity.js +11 -11
- package/scripts/countCommunityUsers.js +4 -4
- package/scripts/countDelayedNotifications.js +3 -3
- package/scripts/countGroup.js +11 -11
- package/scripts/countStuff.js +3 -3
- package/scripts/countUniqueVotersInAGroup.js +3 -3
- package/scripts/createInvitesAndShow.js +2 -2
- package/scripts/database/sync_database.js +2 -2
- package/scripts/database/sync_dev_database.js +3 -3
- package/scripts/debugNotifications.js +5 -5
- package/scripts/deleteAllNewsFeeds.js +2 -2
- package/scripts/deleteCategory.js +1 -1
- package/scripts/deleteOldAppActivities.js +5 -4
- package/scripts/deletePostContactDataForCommunity.js +5 -4
- package/scripts/destroy/destroy_all_but_one_domain.js +59 -59
- package/scripts/displayAuthorForPost.js +1 -1
- package/scripts/domains/createDomain.js +5 -4
- package/scripts/domains/importDomainsFromXls.js +7 -6
- package/scripts/endorsementFraudDetection/analyseEndorsementsForCommunity.js +2 -2
- package/scripts/endorsementFraudDetection/bulkDeleteDuplicateEndorsmentsFromUrl.js +9 -9
- package/scripts/exportAllStatusChanges.js +5 -5
- package/scripts/exportEndorsementsForCommunity.js +5 -5
- package/scripts/exportPointQualitiesForCommunity.js +5 -5
- package/scripts/exportPostsAndPointsForCommunity.js +9 -9
- package/scripts/exportPostsDataSetForDomain.js +12 -12
- package/scripts/exportPostsForGroup.js +7 -7
- package/scripts/exportRatingsForPost.js +2 -2
- package/scripts/exportUserEndorsementsWithUserAnalysis.js +6 -6
- package/scripts/exportUsersForCommunity.js +3 -3
- package/scripts/exportUsersForDomain.js +3 -3
- package/scripts/exportUsersForGroup.js +3 -3
- package/scripts/exports/ratingDistribution.js +6 -6
- package/scripts/exports/whoEndorsedWhatByCommunity.js +2 -2
- package/scripts/findUnusedClientImports.js +2 -2
- package/scripts/fixAllPostPointCounts.js +1 -1
- package/scripts/fixAnonNotificationsSettings.js +5 -5
- package/scripts/fixCountKopavogur.js +1 -1
- package/scripts/fixEndorsementsAfterCopyPostToGroup.js +10 -10
- package/scripts/fixExternalUserId.js +2 -2
- package/scripts/fixGroupAccess.js +3 -3
- package/scripts/fixGroupIdeasAndPointsCount.js +2 -2
- package/scripts/fixNotificationSettings.js +4 -4
- package/scripts/fixSurveyRadioBakedInSubCodes.js +6 -6
- package/scripts/fixWrongUserIdForStatusUpdates.js +6 -5
- package/scripts/gallery/exportGalleryData.js +2 -2
- package/scripts/gallery/importGalleryForCommunity.js +14 -14
- package/scripts/gallery/readJsonAndDownloadImagesVersion2.js +6 -6
- package/scripts/gallery/refreshAcApiPostIdsForCommunity.js +5 -5
- package/scripts/genderAnalysis.js +10 -10
- package/scripts/genderAnalysisByStatus.js +4 -4
- package/scripts/importAllLocalesFromLocalFolders.js +7 -7
- package/scripts/importDomain.js +131 -131
- package/scripts/keys/addOidcToDomain.cjs +9 -9
- package/scripts/landUseGame/export3Ddata.js +15 -15
- package/scripts/listLanguagesForGroup.js +6 -6
- package/scripts/loadTestCreateDummyContentForGroup.js +2 -2
- package/scripts/makeRecursiveMapData.js +4 -4
- package/scripts/mapping/community_map_csv.js +5 -5
- package/scripts/moveCommunityToDomain.js +3 -3
- package/scripts/moveGroupToCommunity.js +3 -3
- package/scripts/movePostToGroup.js +5 -5
- package/scripts/movePostsToGroupsRecountGroupFromUrl.js +6 -6
- package/scripts/oldMovePostToGroup.js +9 -9
- package/scripts/processCsvForPdfUrls.js +2 -2
- package/scripts/processCsvForTranslationAndToxicity.js +10 -10
- package/scripts/recount/recount_recursive_communities.js +6 -6
- package/scripts/recountALLCommunityGroupCounts.js +4 -4
- package/scripts/recountAll.js +3 -3
- package/scripts/recountCommunitesFromUrl.js +3 -3
- package/scripts/recountCommunity.js +2 -2
- package/scripts/recountGroup.js +5 -5
- package/scripts/recountGroupNoUserChange.js +5 -5
- package/scripts/resetAllEndorsementsForGroup.js +3 -3
- package/scripts/resetEnTranslationForGroup.js +5 -5
- package/scripts/setAdminOnAll.cjs +14 -14
- package/scripts/setDomainAdmin.cjs +6 -6
- package/scripts/setDomainLocales.js +2 -2
- package/scripts/setEarlQuestionIdOnGroup.cjs +4 -4
- package/scripts/setLanguageOnGroupCommunitesFromUrl.js +3 -3
- package/scripts/setMemberOfAll.js +14 -14
- package/scripts/setNewUserForContentOfCommunity.js +9 -9
- package/scripts/setOfficialStatusOnAllPostsForCommunity.js +1 -1
- package/scripts/setUserOnAll.js +14 -14
- package/scripts/showCategoryForGroup.js +1 -1
- package/scripts/showOldActivityTypes.js +3 -3
- package/scripts/showPostsMissingCategoryForGroup.js +2 -2
- package/scripts/showStatuses.js +4 -4
- package/scripts/showUniqueVotersInCommunity.js +4 -4
- package/scripts/showUserAgentsAndIpsForEmails.js +4 -4
- package/scripts/simpleExportForGroupsForCommunity.js +5 -5
- package/scripts/simpleExportForPointsForCommunity.js +5 -5
- package/scripts/simpleExportForPostsForCommunity.js +5 -5
- package/scripts/testForEndorsments.js +4 -4
- package/scripts/undeleteGroupAndAllContent.js +8 -8
- package/scripts/undeletePost.js +7 -7
- package/scripts/unlinkSsn.js +4 -4
- package/scripts/updateFromAlthingi.js +8 -8
- package/scripts/users/createUserAddDomain.js +6 -5
- package/scripts/users/importUsersForDomainsFromXls.js +4 -3
- package/scripts/users/listDomainUsersWithSsn.js +6 -5
- package/scripts/users/removeUserFromDomain.js +6 -5
- package/scripts/users/updatePasswordFromSsn.js +5 -4
- package/scripts/users/updateUserSsnFromEmail.js +5 -4
- package/services/controllers/activities.cjs +1 -1
- package/services/controllers/news_feeds.cjs +1 -1
- package/services/controllers/notifications.cjs +1 -1
- package/services/controllers/recommendations.cjs +1 -1
- package/services/engine/allOurIdeas/aiHelper.js +10 -9
- package/services/engine/analytics/export_anon_community_activities.js +3 -3
- package/services/engine/analytics/importer.js +10 -10
- package/services/engine/analytics/plausible/manager.cjs +4 -4
- package/services/engine/analytics/statsCalc.cjs +1 -1
- package/services/engine/analytics/utils.cjs +10 -10
- package/services/engine/moderation/fraud/CreateFraudAuditReport.cjs +2 -1
- package/services/engine/moderation/fraud/FraudBase.cjs +2 -2
- package/services/engine/moderation/fraud/FraudDeleteBase.cjs +4 -4
- package/services/engine/moderation/fraud/FraudGetBase.cjs +1 -1
- package/services/engine/moderation/fraud/FraudGetEndorsements.cjs +1 -1
- package/services/engine/moderation/fraud/FraudGetPointQualities.cjs +1 -1
- package/services/engine/moderation/fraud/FraudGetPoints.cjs +1 -1
- package/services/engine/moderation/fraud/FraudGetPosts.cjs +1 -1
- package/services/engine/moderation/fraud/FraudGetRatings.cjs +1 -1
- package/services/engine/moderation/fraud/FraudScannerNotifier.cjs +9 -9
- package/services/engine/moderation/get_moderation_items.cjs +1 -1
- package/services/engine/moderation/image_labeling/ImageLabelingBase.cjs +1 -1
- package/services/engine/moderation/process_moderation_items.cjs +1 -1
- package/services/engine/moderation/toxicity_analysis.cjs +1 -1
- package/services/engine/news_feeds/generate_dynamically.cjs +1 -1
- package/services/engine/news_feeds/generate_from_notifications.cjs +1 -1
- package/services/engine/notifications/emails_utils.cjs +2 -2
- package/services/engine/notifications/generate_point_notifications.cjs +1 -1
- package/services/engine/notifications/generate_post_notifications.cjs +1 -1
- package/services/engine/notifications/process_delayed_notifications.cjs +38 -38
- package/services/engine/old/exporters/categories_dataset.js +11 -11
- package/services/engine/old/exporters/sentiment_dataset.js +12 -12
- package/services/engine/recommendations/events_importer.cjs +5 -5
- package/services/engine/recommendations/events_manager.cjs +1 -1
- package/services/engine/reports/add_points_to_sheet.cjs +2 -2
- package/services/engine/reports/commonUtils.js +3 -2
- package/services/engine/reports/common_utils.cjs +8 -8
- package/services/engine/reports/docx_group_report.cjs +1 -1
- package/services/engine/reports/xlsAllOurIdeasExport.js +16 -15
- package/services/engine/reports/xls_community_users_report.cjs +2 -2
- package/services/engine/reports/xls_group_report.cjs +1 -1
- package/services/llms/baseChatBot.js +12 -11
- package/services/llms/imageGeneration/chatGptImageGenerator.js +3 -2
- package/services/llms/imageGeneration/collectionImageGenerator.js +7 -6
- package/services/llms/imageGeneration/dalleImageGenerator.js +6 -5
- package/services/llms/imageGeneration/fluxImageGenerator.js +5 -4
- package/services/llms/imageGeneration/imageProcessorService.js +2 -1
- package/services/llms/imageGeneration/imagenImageGenerator.js +8 -7
- package/services/llms/imageGeneration/s3Service.js +12 -11
- package/services/llms/llmTranslation.js +30 -29
- package/services/models/ac_activity.cjs +1 -1
- package/services/models/ac_notification.cjs +1 -1
- package/services/models/ac_translation_cache.cjs +11 -11
- package/services/scripts/analytics/setup_all_plausible_goals.cjs +2 -2
- package/services/scripts/fix_old_delayed_notifications.js +3 -3
- package/services/scripts/kue_status.js +11 -11
- package/services/scripts/kue_watch_stuck_jobs.js +6 -6
- package/services/scripts/translation_clear_language.js +21 -21
- package/services/scripts/translation_delete.js +4 -4
- package/services/scripts/translation_replace_text_from_url.js +4 -4
- package/services/scripts/translation_update.js +4 -4
- package/services/scripts/translations_list.js +5 -5
- package/services/utils/airbrake.cjs +2 -1
- package/services/utils/redisConnection.cjs +6 -5
- package/services/utils/translation_helpers.cjs +3 -2
- package/services/utils/updateAllLocalesFromEn.js +20 -19
- package/services/utils/updateLocaleFolders.js +7 -6
- package/services/workers/activity.cjs +1 -1
- package/services/workers/anonymizations.cjs +1 -1
- package/services/workers/bulk_status_update.cjs +2 -2
- package/services/workers/delayed_jobs.cjs +1 -1
- package/services/workers/deletions.cjs +1 -1
- package/services/workers/email.cjs +1 -1
- package/services/workers/fraud_management.cjs +3 -3
- package/services/workers/generativeAi.js +6 -5
- package/services/workers/main.cjs +1 -1
- package/services/workers/marketing.cjs +1 -1
- package/services/workers/moderation.cjs +1 -1
- package/services/workers/notification_delivery.cjs +1 -1
- package/services/workers/notification_news_feed.cjs +1 -1
- package/services/workers/queue.cjs +2 -2
- package/services/workers/recount.cjs +1 -1
- package/services/workers/reports.cjs +1 -1
- package/services/workers/similarities.cjs +4 -2
- package/services/workers/speech_to_text.cjs +1 -1
- package/utils/airbrake.cjs +1 -1
- package/utils/cjsCodeReview.js +7 -6
- package/utils/community_mapping_tools.cjs +2 -2
- package/utils/copy_utils.cjs +31 -31
- package/utils/export_utils.cjs +7 -7
- package/utils/generateDocumentation.js +10 -9
- package/utils/logger.cjs +2 -23
- package/utils/logger.d.cts +1 -1
- package/utils/loggerAirbrakeTransport.cjs +52 -0
- package/utils/loggerAirbrakeTransport.d.cts +15 -0
- package/utils/loggerAirbrakeTransportTs.d.ts +15 -0
- package/utils/loggerAirbrakeTransportTs.js +45 -0
- package/utils/loggerCore.cjs +29 -0
- package/utils/loggerCore.d.cts +2 -0
- package/utils/loggerCoreTs.d.ts +2 -0
- package/utils/loggerCoreTs.js +23 -0
- package/utils/loggerTs.d.ts +1 -2
- package/utils/loggerTs.js +2 -25
- package/utils/recount_utils.cjs +5 -5
- package/utils/seedModels.js +50 -49
- package/utils/sitemap_generator.cjs +4 -4
- package/utils/ypLanguages.js +2 -2
- package/webSockets.js +8 -7
- package/services/utils/logger.cjs +0 -25
- package/services/utils/logger.d.cts +0 -2
- package/src/agents/assistants/assistant.d.ts +0 -156
- package/src/controllers/audios.d.ts +0 -5
- package/src/controllers/categories.d.ts +0 -5
- package/src/controllers/communities.d.ts +0 -5
- package/src/controllers/domains.d.ts +0 -5
- package/src/controllers/groups.d.ts +0 -5
- package/src/controllers/images.d.ts +0 -5
- package/src/controllers/points.d.ts +0 -5
- package/src/controllers/posts.d.ts +0 -5
- package/src/controllers/ratings.d.ts +0 -5
- package/src/controllers/users.d.ts +0 -5
- package/src/controllers/videos.d.ts +0 -5
- package/src/models/index.d.ts +0 -84
- package/src/services/controllers/activities.d.ts +0 -5
- package/src/services/controllers/notifications.d.ts +0 -5
- package/src/utils/copy_utils.d.ts +0 -4
- package/src/utils/manifest_generator.d.ts +0 -18
|
@@ -11,6 +11,7 @@ import { PsAgentConnector } from "@policysynth/agents/dbModels/agentConnector.js
|
|
|
11
11
|
import { PsAgentConnectorClass } from "@policysynth/agents/dbModels/agentConnectorClass.js";
|
|
12
12
|
import { PsAgentRegistry } from "@policysynth/agents/dbModels/agentRegistry.js";
|
|
13
13
|
import { PsAiModelSize, PsAiModelType, } from "@policysynth/agents/aiModelTypes.js";
|
|
14
|
+
import log from "../../utils/loggerTs.js";
|
|
14
15
|
// List of models that need to be initialized/associated
|
|
15
16
|
const psModels = {
|
|
16
17
|
PsAgentClass,
|
|
@@ -33,16 +34,16 @@ export class NewAiModelSetup {
|
|
|
33
34
|
if (process.env.FORCE_DB_SYNC || process.env.NODE_ENV === "development") {
|
|
34
35
|
await psSequelize.sync();
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
+
log.info("All Models Loaded Init");
|
|
37
38
|
for (const modelName of Object.keys(psModels)) {
|
|
38
39
|
if (typeof psModels[modelName].associate === "function") {
|
|
39
40
|
await psModels[modelName].associate(psSequelize.models);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
+
log.info("All models initialized successfully.");
|
|
43
44
|
}
|
|
44
45
|
catch (error) {
|
|
45
|
-
|
|
46
|
+
log.error("Error initializing models:", error);
|
|
46
47
|
process.exit(1);
|
|
47
48
|
}
|
|
48
49
|
}
|
|
@@ -76,10 +77,10 @@ export class NewAiModelSetup {
|
|
|
76
77
|
user_id: userId,
|
|
77
78
|
configuration: anthropicSonnetConfig,
|
|
78
79
|
});
|
|
79
|
-
|
|
80
|
+
log.info("Created Anthropic model:", createdModel);
|
|
80
81
|
}
|
|
81
82
|
else {
|
|
82
|
-
|
|
83
|
+
log.info("Anthropic model already exists: Anthropic Sonnet 3.5");
|
|
83
84
|
anthropicSonnet.set("configuration", anthropicSonnetConfig);
|
|
84
85
|
anthropicSonnet.changed("configuration", true);
|
|
85
86
|
await anthropicSonnet.save();
|
|
@@ -111,10 +112,10 @@ export class NewAiModelSetup {
|
|
|
111
112
|
user_id: userId,
|
|
112
113
|
configuration: anthropicSonnetConfig,
|
|
113
114
|
});
|
|
114
|
-
|
|
115
|
+
log.info("Created Anthropic model:", createdModel);
|
|
115
116
|
}
|
|
116
117
|
else {
|
|
117
|
-
|
|
118
|
+
log.info("Anthropic model already exists: Anthropic Sonnet 3.7");
|
|
118
119
|
anthropicSonnet.set("configuration", anthropicSonnetConfig);
|
|
119
120
|
anthropicSonnet.changed("configuration", true);
|
|
120
121
|
await anthropicSonnet.save();
|
|
@@ -152,10 +153,10 @@ export class NewAiModelSetup {
|
|
|
152
153
|
user_id: userId,
|
|
153
154
|
configuration: openAiGpt4oConfig,
|
|
154
155
|
});
|
|
155
|
-
|
|
156
|
+
log.info("Created OpenAI model: GPT-4o");
|
|
156
157
|
}
|
|
157
158
|
else {
|
|
158
|
-
|
|
159
|
+
log.info("OpenAI model already exists: GPT-4o updating");
|
|
159
160
|
openAiGpt4.set("configuration", openAiGpt4oConfig);
|
|
160
161
|
openAiGpt4.changed("configuration", true);
|
|
161
162
|
await openAiGpt4.save();
|
|
@@ -186,13 +187,13 @@ export class NewAiModelSetup {
|
|
|
186
187
|
user_id: userId,
|
|
187
188
|
configuration: openAiGpt4oMiniConfig,
|
|
188
189
|
});
|
|
189
|
-
|
|
190
|
+
log.info("Created OpenAI model: GPT-4o Mini");
|
|
190
191
|
}
|
|
191
192
|
else {
|
|
192
193
|
openAiGpt4Mini.set("configuration", openAiGpt4oMiniConfig);
|
|
193
194
|
openAiGpt4Mini.changed("configuration", true);
|
|
194
195
|
await openAiGpt4Mini.save();
|
|
195
|
-
|
|
196
|
+
log.info("OpenAI model already exists: GPT-4o Mini");
|
|
196
197
|
}
|
|
197
198
|
// o1 Mini
|
|
198
199
|
const openAio1Mini = await PsAiModel.findOne({
|
|
@@ -220,13 +221,13 @@ export class NewAiModelSetup {
|
|
|
220
221
|
user_id: userId,
|
|
221
222
|
configuration: openAio1MiniConfig,
|
|
222
223
|
});
|
|
223
|
-
|
|
224
|
+
log.info("Created OpenAI model: o1 Mini");
|
|
224
225
|
}
|
|
225
226
|
else {
|
|
226
227
|
openAio1Mini.set("configuration", openAio1MiniConfig);
|
|
227
228
|
openAio1Mini.changed("configuration", true);
|
|
228
229
|
await openAio1Mini.save();
|
|
229
|
-
|
|
230
|
+
log.info("OpenAI model already exists: o1 Mini");
|
|
230
231
|
}
|
|
231
232
|
// o1 Preview
|
|
232
233
|
const openAio1Preview = await PsAiModel.findOne({
|
|
@@ -254,13 +255,13 @@ export class NewAiModelSetup {
|
|
|
254
255
|
user_id: userId,
|
|
255
256
|
configuration: openAio1PreviewConfig,
|
|
256
257
|
});
|
|
257
|
-
|
|
258
|
+
log.info("Created OpenAI model: o1 Preview");
|
|
258
259
|
}
|
|
259
260
|
else {
|
|
260
261
|
openAio1Preview.set("configuration", openAio1PreviewConfig);
|
|
261
262
|
openAio1Preview.changed("configuration", true);
|
|
262
263
|
await openAio1Preview.save();
|
|
263
|
-
|
|
264
|
+
log.info("OpenAI model already exists: o1 Preview");
|
|
264
265
|
}
|
|
265
266
|
// o1 24
|
|
266
267
|
const openAio11712 = await PsAiModel.findOne({
|
|
@@ -288,10 +289,10 @@ export class NewAiModelSetup {
|
|
|
288
289
|
user_id: userId,
|
|
289
290
|
configuration: openAio11712Config,
|
|
290
291
|
});
|
|
291
|
-
|
|
292
|
+
log.info("Created OpenAI model: o1 24");
|
|
292
293
|
}
|
|
293
294
|
else {
|
|
294
|
-
|
|
295
|
+
log.info("OpenAI model already exists: o1 24 updating");
|
|
295
296
|
openAio11712.set("configuration", openAio11712Config);
|
|
296
297
|
openAio11712.changed("configuration", true);
|
|
297
298
|
await openAio11712.save();
|
|
@@ -322,13 +323,13 @@ export class NewAiModelSetup {
|
|
|
322
323
|
user_id: userId,
|
|
323
324
|
configuration: openAio3MiniConfig,
|
|
324
325
|
});
|
|
325
|
-
|
|
326
|
+
log.info("Created OpenAI model: o3 mini");
|
|
326
327
|
}
|
|
327
328
|
else {
|
|
328
329
|
openAio3Mini.set("configuration", openAio3MiniConfig);
|
|
329
330
|
openAio3Mini.changed("configuration", true);
|
|
330
331
|
await openAio3Mini.save();
|
|
331
|
-
|
|
332
|
+
log.info("OpenAI model already exists: o3 mini");
|
|
332
333
|
}
|
|
333
334
|
const openAiGpt45 = await PsAiModel.findOne({
|
|
334
335
|
where: { name: "GPT-4.5 Preview" },
|
|
@@ -355,13 +356,13 @@ export class NewAiModelSetup {
|
|
|
355
356
|
user_id: userId,
|
|
356
357
|
configuration: openAiGpt45Config,
|
|
357
358
|
});
|
|
358
|
-
|
|
359
|
+
log.info("Created OpenAI model: GPT-4.5 Preview");
|
|
359
360
|
}
|
|
360
361
|
else {
|
|
361
362
|
openAiGpt45.set("configuration", openAiGpt45Config);
|
|
362
363
|
openAiGpt45.changed("configuration", true);
|
|
363
364
|
await openAiGpt45.save();
|
|
364
|
-
|
|
365
|
+
log.info("OpenAI model already exists: GPT-4.5 Preview");
|
|
365
366
|
}
|
|
366
367
|
const openAio3 = await PsAiModel.findOne({
|
|
367
368
|
where: { name: "o3" },
|
|
@@ -371,9 +372,9 @@ export class NewAiModelSetup {
|
|
|
371
372
|
modelSize: PsAiModelSize.Medium,
|
|
372
373
|
provider: "openai",
|
|
373
374
|
prices: {
|
|
374
|
-
costInTokensPerMillion:
|
|
375
|
-
costOutTokensPerMillion:
|
|
376
|
-
costInCachedContextTokensPerMillion:
|
|
375
|
+
costInTokensPerMillion: 2.0,
|
|
376
|
+
costOutTokensPerMillion: 8.0,
|
|
377
|
+
costInCachedContextTokensPerMillion: 0.5,
|
|
377
378
|
currency: "USD",
|
|
378
379
|
},
|
|
379
380
|
maxTokensOut: 100000,
|
|
@@ -388,10 +389,10 @@ export class NewAiModelSetup {
|
|
|
388
389
|
user_id: userId,
|
|
389
390
|
configuration: openAio3Config,
|
|
390
391
|
});
|
|
391
|
-
|
|
392
|
+
log.info("Created OpenAI model: o3");
|
|
392
393
|
}
|
|
393
394
|
else {
|
|
394
|
-
|
|
395
|
+
log.info("OpenAI model already exists: o3 updating");
|
|
395
396
|
openAio3.set("configuration", openAio3Config);
|
|
396
397
|
openAio3.changed("configuration", true);
|
|
397
398
|
await openAio3.save();
|
|
@@ -421,13 +422,13 @@ export class NewAiModelSetup {
|
|
|
421
422
|
user_id: userId,
|
|
422
423
|
configuration: openAio4miniConfig,
|
|
423
424
|
});
|
|
424
|
-
|
|
425
|
+
log.info("Created OpenAI model: o4 mini");
|
|
425
426
|
}
|
|
426
427
|
else {
|
|
427
428
|
openAio4mini.set("configuration", openAio4miniConfig);
|
|
428
429
|
openAio4mini.changed("configuration", true);
|
|
429
430
|
await openAio4mini.save();
|
|
430
|
-
|
|
431
|
+
log.info("OpenAI model already exists: o4 mini");
|
|
431
432
|
}
|
|
432
433
|
const openAiGpt41 = await PsAiModel.findOne({
|
|
433
434
|
where: { name: "GPT-4.1" },
|
|
@@ -454,13 +455,13 @@ export class NewAiModelSetup {
|
|
|
454
455
|
user_id: userId,
|
|
455
456
|
configuration: openAiGpt41Config,
|
|
456
457
|
});
|
|
457
|
-
|
|
458
|
+
log.info("Created OpenAI model: GPT-4.1");
|
|
458
459
|
}
|
|
459
460
|
else {
|
|
460
461
|
openAiGpt41.set("configuration", openAiGpt41Config);
|
|
461
462
|
openAiGpt41.changed("configuration", true);
|
|
462
463
|
await openAiGpt41.save();
|
|
463
|
-
|
|
464
|
+
log.info("OpenAI model already exists: GPT-4.1");
|
|
464
465
|
}
|
|
465
466
|
}
|
|
466
467
|
/**
|
|
@@ -494,13 +495,13 @@ export class NewAiModelSetup {
|
|
|
494
495
|
user_id: userId,
|
|
495
496
|
configuration: geminiProConfig,
|
|
496
497
|
});
|
|
497
|
-
|
|
498
|
+
log.info("Created Google model: Gemini 1.5 Pro 2");
|
|
498
499
|
}
|
|
499
500
|
else {
|
|
500
501
|
geminiPro.set("configuration", geminiProConfig);
|
|
501
502
|
geminiPro.changed("configuration", true);
|
|
502
503
|
await geminiPro.save();
|
|
503
|
-
|
|
504
|
+
log.info("Google model already exists: Gemini 1.5 Pro 2");
|
|
504
505
|
}
|
|
505
506
|
// Gemini 1.5 Flash 2
|
|
506
507
|
const geminiPro15Flash = await PsAiModel.findOne({
|
|
@@ -528,13 +529,13 @@ export class NewAiModelSetup {
|
|
|
528
529
|
user_id: userId,
|
|
529
530
|
configuration: geminiPro15FlashConfig,
|
|
530
531
|
});
|
|
531
|
-
|
|
532
|
+
log.info("Created Google model: Gemini 1.5 Flash 2");
|
|
532
533
|
}
|
|
533
534
|
else {
|
|
534
535
|
geminiPro15Flash.set("configuration", geminiPro15FlashConfig);
|
|
535
536
|
geminiPro15Flash.changed("configuration", true);
|
|
536
537
|
await geminiPro15Flash.save();
|
|
537
|
-
|
|
538
|
+
log.info("Google model already exists: Gemini 1.5 Flash 2");
|
|
538
539
|
}
|
|
539
540
|
// Gemini 2.0 Flash
|
|
540
541
|
const gemini20Flash = await PsAiModel.findOne({
|
|
@@ -562,53 +563,16 @@ export class NewAiModelSetup {
|
|
|
562
563
|
user_id: userId,
|
|
563
564
|
configuration: gemini20FlashConfig,
|
|
564
565
|
});
|
|
565
|
-
|
|
566
|
+
log.info("Created Google model: Gemini 2.0 Flash");
|
|
566
567
|
}
|
|
567
568
|
else {
|
|
568
569
|
gemini20Flash.set("configuration", gemini20FlashConfig);
|
|
569
570
|
gemini20Flash.changed("configuration", true);
|
|
570
571
|
await gemini20Flash.save();
|
|
571
|
-
|
|
572
|
-
}
|
|
573
|
-
const gemini25ProPreview1 = await PsAiModel.findOne({
|
|
574
|
-
where: { name: "Gemini 2.5 Pro Preview 1" },
|
|
575
|
-
});
|
|
576
|
-
const gemini25ProPreview1Config = {
|
|
577
|
-
type: PsAiModelType.TextReasoning,
|
|
578
|
-
modelSize: PsAiModelSize.Large,
|
|
579
|
-
provider: "google",
|
|
580
|
-
prices: {
|
|
581
|
-
costInTokensPerMillion: 1.25,
|
|
582
|
-
costOutTokensPerMillion: 10,
|
|
583
|
-
costInCachedContextTokensPerMillion: 0.875,
|
|
584
|
-
longContextTokenThreshold: 200000,
|
|
585
|
-
longContextCostInTokensPerMillion: 2.5,
|
|
586
|
-
longContextCostInCachedContextTokensPerMillion: 1.75,
|
|
587
|
-
longContextCostOutTokensPerMillion: 15,
|
|
588
|
-
currency: "USD",
|
|
589
|
-
},
|
|
590
|
-
model: "gemini-2.5-pro-preview-04-17",
|
|
591
|
-
active: true,
|
|
592
|
-
maxTokensOut: 100000,
|
|
593
|
-
defaultTemperature: 0.0
|
|
594
|
-
};
|
|
595
|
-
if (!gemini25ProPreview1) {
|
|
596
|
-
await PsAiModel.create({
|
|
597
|
-
name: "Gemini 2.5 Pro Preview 1",
|
|
598
|
-
organization_id: 1,
|
|
599
|
-
user_id: userId,
|
|
600
|
-
configuration: gemini25ProPreview1Config,
|
|
601
|
-
});
|
|
602
|
-
console.log("Created Google model: Gemini 2.5 Pro Preview 1");
|
|
603
|
-
}
|
|
604
|
-
else {
|
|
605
|
-
gemini25ProPreview1.set("configuration", gemini25ProPreview1Config);
|
|
606
|
-
gemini25ProPreview1.changed("configuration", true);
|
|
607
|
-
await gemini25ProPreview1.save();
|
|
608
|
-
console.log("Google model already exists: Gemini 2.5 Pro Preview 1");
|
|
572
|
+
log.info("Google model already exists: Gemini 2.0 Flash");
|
|
609
573
|
}
|
|
610
|
-
const
|
|
611
|
-
where: { name: "Gemini 2.5 Pro
|
|
574
|
+
const gemini25Pro = await PsAiModel.findOne({
|
|
575
|
+
where: { name: "Gemini 2.5 Pro" },
|
|
612
576
|
});
|
|
613
577
|
const gemini25ProConfig = {
|
|
614
578
|
type: PsAiModelType.TextReasoning,
|
|
@@ -624,62 +588,25 @@ export class NewAiModelSetup {
|
|
|
624
588
|
longContextCostOutTokensPerMillion: 15,
|
|
625
589
|
currency: "USD",
|
|
626
590
|
},
|
|
627
|
-
model: "gemini-2.5-pro
|
|
591
|
+
model: "gemini-2.5-pro",
|
|
628
592
|
active: true,
|
|
629
593
|
maxTokensOut: 100000,
|
|
630
594
|
defaultTemperature: 0.0
|
|
631
595
|
};
|
|
632
|
-
if (!
|
|
596
|
+
if (!gemini25Pro) {
|
|
633
597
|
await PsAiModel.create({
|
|
634
|
-
name: "Gemini 2.5 Pro
|
|
598
|
+
name: "Gemini 2.5 Pro",
|
|
635
599
|
organization_id: 1,
|
|
636
600
|
user_id: userId,
|
|
637
601
|
configuration: gemini25ProConfig,
|
|
638
602
|
});
|
|
639
|
-
|
|
640
|
-
}
|
|
641
|
-
else {
|
|
642
|
-
gemini25ProPreview2.set("configuration", gemini25ProConfig);
|
|
643
|
-
gemini25ProPreview2.changed("configuration", true);
|
|
644
|
-
await gemini25ProPreview2.save();
|
|
645
|
-
console.log("Google model already exists: Gemini 2.5 Pro");
|
|
646
|
-
}
|
|
647
|
-
const gemini25ProFinalPreview = await PsAiModel.findOne({
|
|
648
|
-
where: { name: "Gemini 2.5 Pro Final Preview" },
|
|
649
|
-
});
|
|
650
|
-
const gemini25ProFinalConfig = {
|
|
651
|
-
type: PsAiModelType.TextReasoning,
|
|
652
|
-
modelSize: PsAiModelSize.Large,
|
|
653
|
-
provider: "google",
|
|
654
|
-
prices: {
|
|
655
|
-
costInTokensPerMillion: 1.25,
|
|
656
|
-
costOutTokensPerMillion: 10,
|
|
657
|
-
costInCachedContextTokensPerMillion: 0.875,
|
|
658
|
-
longContextTokenThreshold: 200000,
|
|
659
|
-
longContextCostInTokensPerMillion: 2.5,
|
|
660
|
-
longContextCostInCachedContextTokensPerMillion: 1.75,
|
|
661
|
-
longContextCostOutTokensPerMillion: 15,
|
|
662
|
-
currency: "USD",
|
|
663
|
-
},
|
|
664
|
-
model: "gemini-2.5-pro-preview-06-05",
|
|
665
|
-
active: true,
|
|
666
|
-
maxTokensOut: 100000,
|
|
667
|
-
defaultTemperature: 0.0,
|
|
668
|
-
};
|
|
669
|
-
if (!gemini25ProFinalPreview) {
|
|
670
|
-
await PsAiModel.create({
|
|
671
|
-
name: "Gemini 2.5 Pro Final Preview",
|
|
672
|
-
organization_id: 1,
|
|
673
|
-
user_id: userId,
|
|
674
|
-
configuration: gemini25ProFinalConfig,
|
|
675
|
-
});
|
|
676
|
-
console.log("Created Google model: Gemini 2.5 Pro Final Preview");
|
|
603
|
+
log.info("Created Google model: Gemini 2.5 Pro");
|
|
677
604
|
}
|
|
678
605
|
else {
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
await
|
|
682
|
-
|
|
606
|
+
gemini25Pro.set("configuration", gemini25ProConfig);
|
|
607
|
+
gemini25Pro.changed("configuration", true);
|
|
608
|
+
await gemini25Pro.save();
|
|
609
|
+
log.info("Google model already exists: Gemini 2.5 Pro");
|
|
683
610
|
}
|
|
684
611
|
const gemini25FlashPreview1 = await PsAiModel.findOne({
|
|
685
612
|
where: { name: "Gemini 2.5 Flash Preview 1" },
|
|
@@ -710,13 +637,13 @@ export class NewAiModelSetup {
|
|
|
710
637
|
user_id: userId,
|
|
711
638
|
configuration: gemini25FlashPreview1Config,
|
|
712
639
|
});
|
|
713
|
-
|
|
640
|
+
log.info("Created Google model: Gemini 2.5 Flash Preview 1");
|
|
714
641
|
}
|
|
715
642
|
else {
|
|
716
643
|
gemini25FlashPreview1.set("configuration", gemini25FlashPreview1Config);
|
|
717
644
|
gemini25FlashPreview1.changed("configuration", true);
|
|
718
645
|
await gemini25FlashPreview1.save();
|
|
719
|
-
|
|
646
|
+
log.info("Google model already exists: Gemini 2.5 Pro");
|
|
720
647
|
}
|
|
721
648
|
const gemini25FlashPreview = await PsAiModel.findOne({
|
|
722
649
|
where: { name: "Gemini 2.5 Flash Preview" },
|
|
@@ -743,13 +670,13 @@ export class NewAiModelSetup {
|
|
|
743
670
|
user_id: userId,
|
|
744
671
|
configuration: gemini25FlashPreviewConfig,
|
|
745
672
|
});
|
|
746
|
-
|
|
673
|
+
log.info("Created Google model: Gemini 2.5 Flash Preview");
|
|
747
674
|
}
|
|
748
675
|
else {
|
|
749
676
|
gemini25FlashPreview.set("configuration", gemini25FlashPreviewConfig);
|
|
750
677
|
gemini25FlashPreview.changed("configuration", true);
|
|
751
678
|
await gemini25FlashPreview.save();
|
|
752
|
-
|
|
679
|
+
log.info("Google model already exists: Gemini 2.5 Flash Preview");
|
|
753
680
|
}
|
|
754
681
|
}
|
|
755
682
|
/**
|
|
@@ -796,14 +723,14 @@ export class NewAiModelSetup {
|
|
|
796
723
|
configuration: topLevelAgentClassConfig,
|
|
797
724
|
user_id: userId,
|
|
798
725
|
});
|
|
799
|
-
|
|
726
|
+
log.info("Created top-level agent class: Operations");
|
|
800
727
|
}
|
|
801
728
|
else {
|
|
802
|
-
|
|
729
|
+
log.info("Top-level agent class: Operations already exists");
|
|
803
730
|
}
|
|
804
731
|
}
|
|
805
732
|
catch (error) {
|
|
806
|
-
|
|
733
|
+
log.error("Error seeding AI models:", error);
|
|
807
734
|
process.exit(1);
|
|
808
735
|
}
|
|
809
736
|
}
|
|
@@ -812,13 +739,13 @@ export class NewAiModelSetup {
|
|
|
812
739
|
*/
|
|
813
740
|
static setupAiModels(userId) {
|
|
814
741
|
setTimeout(async () => {
|
|
815
|
-
|
|
742
|
+
log.info("Seeding AI models");
|
|
816
743
|
const user = await User.findOne({
|
|
817
744
|
attributes: ["id"],
|
|
818
745
|
where: { id: userId },
|
|
819
746
|
});
|
|
820
747
|
if (!user) {
|
|
821
|
-
|
|
748
|
+
log.error("User not found");
|
|
822
749
|
return;
|
|
823
750
|
}
|
|
824
751
|
await NewAiModelSetup.seedAiModels(user.id);
|
|
@@ -858,9 +785,7 @@ export class NewAiModelSetup {
|
|
|
858
785
|
{ name: "Gemini 1.5 Pro 2", envKey: "GEMINI_API_KEY" },
|
|
859
786
|
{ name: "Gemini 1.5 Flash 2", envKey: "GEMINI_API_KEY" },
|
|
860
787
|
{ name: "Gemini 2.0 Flash", envKey: "GEMINI_API_KEY" },
|
|
861
|
-
{ name: "Gemini 2.5 Pro
|
|
862
|
-
{ name: "Gemini 2.5 Pro Preview 2", envKey: "GEMINI_API_KEY" },
|
|
863
|
-
{ name: "Gemini 2.5 Pro Final Preview", envKey: "GEMINI_API_KEY" },
|
|
788
|
+
{ name: "Gemini 2.5 Pro", envKey: "GEMINI_API_KEY" },
|
|
864
789
|
{ name: "Gemini 2.5 Flash Preview 1", envKey: "GEMINI_API_KEY" },
|
|
865
790
|
{ name: "Gemini 2.5 Flash Preview", envKey: "GEMINI_API_KEY" },
|
|
866
791
|
{ name: "o1 24", envKey: "OPENAI_API_KEY" },
|