@webiny/ai-powerups 0.0.0-unstable.a4f3e4ea8b → 0.0.0-unstable.a85ef555b2
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/AiPowerups.d.ts +12 -0
- package/AiPowerups.js +3 -3
- package/AiPowerups.js.map +1 -1
- package/admin/Extension.d.ts +1 -1
- package/admin/Extension.js +10 -3
- package/admin/Extension.js.map +1 -1
- package/admin/features/settings/shared/abstractions.d.ts +7 -2
- package/admin/features/settings/shared/abstractions.js.map +1 -1
- package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.d.ts +2 -2
- package/admin/presentation/AiPowerUpsSettings/settingsGroup.d.ts +6 -3
- package/admin/presentation/AiPowerUpsSettings/settingsGroup.js.map +1 -1
- package/admin/presentation/CapabilitiesSettings.js +28 -21
- package/admin/presentation/CapabilitiesSettings.js.map +1 -1
- package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsDialog.d.ts +2 -2
- package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsDrawer.d.ts +2 -2
- package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsMenuItem.d.ts +2 -2
- package/admin/presentation/CmsCompareEntryRevisions/feature.js +1 -1
- package/admin/presentation/CmsCompareEntryRevisions/feature.js.map +1 -1
- package/admin/presentation/CmsContentGeneration/CmsGenerateContentButton.d.ts +2 -2
- package/admin/presentation/CmsContentGeneration/CmsGenerateContentDialog.d.ts +2 -2
- package/admin/presentation/CmsContentGeneration/Extension.js +3 -3
- package/admin/presentation/CmsContentGeneration/Extension.js.map +1 -1
- package/admin/presentation/CmsEntryWizard/CmsEntryWizard.d.ts +2 -2
- package/admin/presentation/CmsEntryWizard/CmsEntryWizardGate.d.ts +2 -2
- package/admin/presentation/CmsEntryWizard/CmsEntryWizardGate.js +4 -1
- package/admin/presentation/CmsEntryWizard/CmsEntryWizardGate.js.map +1 -1
- package/admin/presentation/WbContentGeneration/GenerateContentDialog.d.ts +2 -2
- package/admin/presentation/modelRoles.js +2 -2
- package/admin/presentation/modelRoles.js.map +1 -1
- package/api/Extension.js +18 -3
- package/api/Extension.js.map +1 -1
- package/api/features/AdminAssistant/AdminAssistantStreamRoute.d.ts +34 -0
- package/api/features/AdminAssistant/AdminAssistantStreamRoute.js +42 -0
- package/api/features/AdminAssistant/AdminAssistantStreamRoute.js.map +1 -0
- package/api/features/AdminAssistant/AdminAssistantUseCase.d.ts +42 -0
- package/api/features/AdminAssistant/AdminAssistantUseCase.js +170 -0
- package/api/features/AdminAssistant/AdminAssistantUseCase.js.map +1 -0
- package/api/features/AdminAssistant/abstractions.d.ts +38 -0
- package/api/features/AdminAssistant/abstractions.js +6 -0
- package/api/features/AdminAssistant/abstractions.js.map +1 -0
- package/api/features/AdminAssistant/approvals.d.ts +29 -0
- package/api/features/AdminAssistant/approvals.js +30 -0
- package/api/features/AdminAssistant/approvals.js.map +1 -0
- package/api/features/AdminAssistant/capability.d.ts +31 -0
- package/api/features/AdminAssistant/capability.js +19 -0
- package/api/features/AdminAssistant/capability.js.map +1 -0
- package/api/features/AdminAssistant/events.d.ts +54 -0
- package/api/features/AdminAssistant/events.js +0 -0
- package/api/features/AdminAssistant/feature.d.ts +12 -0
- package/api/features/AdminAssistant/feature.js +23 -0
- package/api/features/AdminAssistant/feature.js.map +1 -0
- package/api/features/AdminAssistant/index.d.ts +5 -0
- package/api/features/AdminAssistant/index.js +3 -0
- package/api/features/AdminAssistant/parseChatBody.d.ts +14 -0
- package/api/features/AdminAssistant/parseChatBody.js +33 -0
- package/api/features/AdminAssistant/parseChatBody.js.map +1 -0
- package/api/features/AdminAssistant/systemPrompt.d.ts +7 -0
- package/api/features/AdminAssistant/systemPrompt.js +24 -0
- package/api/features/AdminAssistant/systemPrompt.js.map +1 -0
- package/api/features/AiImageEnrichment/AiImageEnrichmentStreamRoute.d.ts +36 -0
- package/api/features/AiImageEnrichment/AiImageEnrichmentStreamRoute.js +92 -0
- package/api/features/AiImageEnrichment/AiImageEnrichmentStreamRoute.js.map +1 -0
- package/api/features/AiImageEnrichment/AiImageEnrichmentTask.d.ts +20 -15
- package/api/features/AiImageEnrichment/AiImageEnrichmentTask.js +66 -106
- package/api/features/AiImageEnrichment/AiImageEnrichmentTask.js.map +1 -1
- package/api/features/AiImageEnrichment/ApplyImageEnrichmentUseCase.d.ts +18 -0
- package/api/features/AiImageEnrichment/ApplyImageEnrichmentUseCase.js +50 -0
- package/api/features/AiImageEnrichment/ApplyImageEnrichmentUseCase.js.map +1 -0
- package/api/features/AiImageEnrichment/EnrichmentCapabilityDisabledError.d.ts +9 -0
- package/api/features/AiImageEnrichment/EnrichmentCapabilityDisabledError.js +8 -0
- package/api/features/AiImageEnrichment/EnrichmentCapabilityDisabledError.js.map +1 -0
- package/api/features/AiImageEnrichment/PrepareImageEnrichmentUseCase.d.ts +17 -0
- package/api/features/AiImageEnrichment/PrepareImageEnrichmentUseCase.js +47 -0
- package/api/features/AiImageEnrichment/PrepareImageEnrichmentUseCase.js.map +1 -0
- package/api/features/AiImageEnrichment/abstractions.d.ts +66 -0
- package/api/features/AiImageEnrichment/abstractions.js +12 -0
- package/api/features/AiImageEnrichment/abstractions.js.map +1 -0
- package/api/features/AiImageEnrichment/buildEnrichmentAiRequest.d.ts +12 -0
- package/api/features/AiImageEnrichment/buildEnrichmentAiRequest.js +30 -0
- package/api/features/AiImageEnrichment/buildEnrichmentAiRequest.js.map +1 -0
- package/api/features/AiImageEnrichment/capability.d.ts +7 -2
- package/api/features/AiImageEnrichment/capability.js +3 -3
- package/api/features/AiImageEnrichment/capability.js.map +1 -1
- package/api/features/AiImageEnrichment/errors.d.ts +33 -0
- package/api/features/AiImageEnrichment/errors.js +29 -0
- package/api/features/AiImageEnrichment/errors.js.map +1 -0
- package/api/features/AiImageEnrichment/feature.js +9 -0
- package/api/features/AiImageEnrichment/feature.js.map +1 -1
- package/api/features/AiImageEnrichment/imageEnrichmentErrorStatusCode.d.ts +6 -0
- package/api/features/AiImageEnrichment/imageEnrichmentErrorStatusCode.js +10 -0
- package/api/features/AiImageEnrichment/imageEnrichmentErrorStatusCode.js.map +1 -0
- package/api/features/AiImageEnrichment/readEnrichmentPartial.d.ts +8 -0
- package/api/features/AiImageEnrichment/readEnrichmentPartial.js +16 -0
- package/api/features/AiImageEnrichment/readEnrichmentPartial.js.map +1 -0
- package/api/features/AiImageEnrichment/streamEvents.d.ts +36 -0
- package/api/features/AiImageEnrichment/streamEvents.js +0 -0
- package/api/features/Capabilities/AiCapabilityDisabledError.d.ts +16 -0
- package/api/features/Capabilities/AiCapabilityDisabledError.js +8 -0
- package/api/features/Capabilities/AiCapabilityDisabledError.js.map +1 -0
- package/api/features/Capabilities/AiModelNotAvailableError.d.ts +13 -0
- package/api/features/Capabilities/AiModelNotAvailableError.js +8 -0
- package/api/features/Capabilities/AiModelNotAvailableError.js.map +1 -0
- package/api/features/Capabilities/CapabilitiesHandler.d.ts +14 -10
- package/api/features/Capabilities/CapabilitiesHandler.js +18 -8
- package/api/features/Capabilities/CapabilitiesHandler.js.map +1 -1
- package/api/features/Capabilities/ResolveAiCapabilityUseCase.d.ts +6 -3
- package/api/features/Capabilities/ResolveAiCapabilityUseCase.js +37 -8
- package/api/features/Capabilities/ResolveAiCapabilityUseCase.js.map +1 -1
- package/api/features/Capabilities/abstractions.d.ts +15 -2
- package/api/features/Capabilities/abstractions.js.map +1 -1
- package/api/features/Capabilities/index.d.ts +2 -0
- package/api/features/Capabilities/index.js +2 -0
- package/api/features/Capabilities/types.d.ts +40 -4
- package/api/features/Capabilities/types.js +4 -0
- package/api/features/Capabilities/types.js.map +1 -0
- package/api/features/CmsCompareEntryRevisions/capability.d.ts +2 -2
- package/api/features/CmsCompareEntryRevisions/capability.js +1 -1
- package/api/features/CmsCompareEntryRevisions/capability.js.map +1 -1
- package/api/features/CmsGenerateEntryContent/CmsGenerateEntryContentTask.d.ts +11 -6
- package/api/features/CmsGenerateEntryContent/CmsGenerateEntryContentTask.js +19 -10
- package/api/features/CmsGenerateEntryContent/CmsGenerateEntryContentTask.js.map +1 -1
- package/api/features/CmsGenerateEntryContent/capability.d.ts +2 -2
- package/api/features/CmsGenerateEntryContent/capability.js +1 -1
- package/api/features/CmsGenerateEntryContent/capability.js.map +1 -1
- package/api/features/CmsResolveImageTool/CmsResolveImageTool.js +1 -1
- package/api/features/CmsResolveImageTool/CmsResolveImageTool.js.map +1 -1
- package/api/features/ConfiguredAiModels/ConfiguredAiModelsService.d.ts +18 -0
- package/api/features/ConfiguredAiModels/ConfiguredAiModelsService.js +92 -0
- package/api/features/ConfiguredAiModels/ConfiguredAiModelsService.js.map +1 -0
- package/api/features/ConfiguredAiModels/abstractions.d.ts +32 -0
- package/api/features/ConfiguredAiModels/abstractions.js +5 -0
- package/api/features/ConfiguredAiModels/abstractions.js.map +1 -0
- package/api/features/ConfiguredAiModels/feature.d.ts +4 -0
- package/api/features/ConfiguredAiModels/feature.js +11 -0
- package/api/features/ConfiguredAiModels/feature.js.map +1 -0
- package/api/features/ConfiguredAiModels/index.d.ts +2 -0
- package/api/features/ConfiguredAiModels/index.js +1 -0
- package/api/features/GetSettings/GetSettingsUseCase.d.ts +1 -1
- package/api/features/ModelRoles/ModelRolesHandler.js +10 -4
- package/api/features/ModelRoles/ModelRolesHandler.js.map +1 -1
- package/api/features/Providers/ProvidersHandler.d.ts +1 -3
- package/api/features/Providers/ProvidersHandler.js +2 -15
- package/api/features/Providers/ProvidersHandler.js.map +1 -1
- package/api/features/WbGeneratePageContent/WbGeneratePageContentTask.d.ts +11 -6
- package/api/features/WbGeneratePageContent/WbGeneratePageContentTask.js +19 -10
- package/api/features/WbGeneratePageContent/WbGeneratePageContentTask.js.map +1 -1
- package/api/features/WbGeneratePageContent/capability.d.ts +2 -2
- package/api/features/WbGeneratePageContent/capability.js +1 -1
- package/api/features/WbGeneratePageContent/capability.js.map +1 -1
- package/api/features/WbTranslatePage/WbTranslatePageDecorator.js +5 -1
- package/api/features/WbTranslatePage/WbTranslatePageDecorator.js.map +1 -1
- package/api/features/WbTranslatePage/capability.d.ts +2 -2
- package/api/features/WbTranslatePage/capability.js +1 -1
- package/api/features/WbTranslatePage/capability.js.map +1 -1
- package/api/features/WbTranslatePage/feature.js +5 -2
- package/api/features/WbTranslatePage/feature.js.map +1 -1
- package/api/features/WorkflowReview/AiStepRunner/AiStepRunner.d.ts +41 -0
- package/api/features/WorkflowReview/AiStepRunner/AiStepRunner.js +253 -0
- package/api/features/WorkflowReview/AiStepRunner/AiStepRunner.js.map +1 -0
- package/api/features/WorkflowReview/AiStepRunner/aiRunFailureReasons.d.ts +4 -0
- package/api/features/WorkflowReview/AiStepRunner/aiRunFailureReasons.js +7 -0
- package/api/features/WorkflowReview/AiStepRunner/aiRunFailureReasons.js.map +1 -0
- package/api/features/WorkflowReview/AiStepRunner/feature.d.ts +5 -0
- package/api/features/WorkflowReview/AiStepRunner/feature.js +11 -0
- package/api/features/WorkflowReview/AiStepRunner/feature.js.map +1 -0
- package/api/features/WorkflowReview/AiStepType/AiStepType.d.ts +53 -0
- package/api/features/WorkflowReview/AiStepType/AiStepType.js +121 -0
- package/api/features/WorkflowReview/AiStepType/AiStepType.js.map +1 -0
- package/api/features/WorkflowReview/ListWorkflowAiModels/ListWorkflowAiModelsUseCase.d.ts +17 -0
- package/api/features/WorkflowReview/ListWorkflowAiModels/ListWorkflowAiModelsUseCase.js +61 -0
- package/api/features/WorkflowReview/ListWorkflowAiModels/ListWorkflowAiModelsUseCase.js.map +1 -0
- package/api/features/WorkflowReview/ListWorkflowAiModels/abstractions.d.ts +32 -0
- package/api/features/WorkflowReview/ListWorkflowAiModels/abstractions.js +5 -0
- package/api/features/WorkflowReview/ListWorkflowAiModels/abstractions.js.map +1 -0
- package/api/features/WorkflowReview/ListWorkflowAiModels/feature.d.ts +4 -0
- package/api/features/WorkflowReview/ListWorkflowAiModels/feature.js +11 -0
- package/api/features/WorkflowReview/ListWorkflowAiModels/feature.js.map +1 -0
- package/api/features/WorkflowReview/ListWorkflowAiModels/index.d.ts +2 -0
- package/api/features/WorkflowReview/ListWorkflowAiModels/index.js +1 -0
- package/api/features/WorkflowReview/WorkflowsReviewCapability.d.ts +12 -0
- package/api/features/WorkflowReview/WorkflowsReviewCapability.js +38 -0
- package/api/features/WorkflowReview/WorkflowsReviewCapability.js.map +1 -0
- package/api/features/WorkflowReview/aiFailureReasons.d.ts +11 -0
- package/api/features/WorkflowReview/aiFailureReasons.js +9 -0
- package/api/features/WorkflowReview/aiFailureReasons.js.map +1 -0
- package/api/features/WorkflowReview/aiReviewOutputSchema.d.ts +29 -0
- package/api/features/WorkflowReview/aiReviewOutputSchema.js +28 -0
- package/api/features/WorkflowReview/aiReviewOutputSchema.js.map +1 -0
- package/api/features/WorkflowReview/aiStepConfigSchema.d.ts +13 -0
- package/api/features/WorkflowReview/aiStepConfigSchema.js +11 -0
- package/api/features/WorkflowReview/aiStepConfigSchema.js.map +1 -0
- package/api/features/WorkflowReview/buildAiStepPrompt.d.ts +35 -0
- package/api/features/WorkflowReview/buildAiStepPrompt.js +47 -0
- package/api/features/WorkflowReview/buildAiStepPrompt.js.map +1 -0
- package/api/features/WorkflowReview/constants.d.ts +8 -0
- package/api/features/WorkflowReview/constants.js +7 -0
- package/api/features/WorkflowReview/constants.js.map +1 -0
- package/api/features/WorkflowReview/toLoggedAiError.d.ts +13 -0
- package/api/features/WorkflowReview/toLoggedAiError.js +27 -0
- package/api/features/WorkflowReview/toLoggedAiError.js.map +1 -0
- package/api/graphql/BaseGraphQLSchema.d.ts +3 -2
- package/api/graphql/BaseGraphQLSchema.js +10 -6
- package/api/graphql/BaseGraphQLSchema.js.map +1 -1
- package/api/graphql/CmsCompareEntryRevisionsSchema.d.ts +3 -2
- package/api/graphql/CmsCompareEntryRevisionsSchema.js +5 -1
- package/api/graphql/CmsCompareEntryRevisionsSchema.js.map +1 -1
- package/api/graphql/ListWorkflowAiModelsSchema.d.ts +15 -0
- package/api/graphql/ListWorkflowAiModelsSchema.js +48 -0
- package/api/graphql/ListWorkflowAiModelsSchema.js.map +1 -0
- package/exports/api/ai-powerups.d.ts +5 -0
- package/exports/api/ai-powerups.js +3 -0
- package/package.json +36 -31
package/AiPowerups.d.ts
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Both extensions load unconditionally; each gates itself at runtime.
|
|
4
|
+
*
|
|
5
|
+
* This used to sit inside `FeatureFlag.CanUseAiPowerups`, which reads project config while the
|
|
6
|
+
* project graph is built, so the decision was baked in at deploy time. A WCP licence that granted
|
|
7
|
+
* AI Power-Ups therefore did nothing until the next deploy, which is the wrong shape for something
|
|
8
|
+
* a customer can buy at any moment.
|
|
9
|
+
*
|
|
10
|
+
* The gate now lives where the licence is readable: `api/Extension.ts` checks the effective flags
|
|
11
|
+
* at `register()` (the licence is refreshed per request, before any feature registers), and
|
|
12
|
+
* `admin/Extension.tsx` checks them on render. `ai-chat` and `api-aco` already gate this way.
|
|
13
|
+
*/
|
|
2
14
|
export declare const AiPowerups: () => React.JSX.Element;
|
package/AiPowerups.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import react from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const AiPowerups = ()=>/*#__PURE__*/ react.createElement(
|
|
2
|
+
import { Api } from "@webiny/project-aws/api.js";
|
|
3
|
+
import { Admin } from "@webiny/project-aws/admin.js";
|
|
4
|
+
const AiPowerups = ()=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Api.Extension, {
|
|
5
5
|
src: import.meta.dirname + "/api/Extension.js"
|
|
6
6
|
}), /*#__PURE__*/ react.createElement(Admin.Extension, {
|
|
7
7
|
src: import.meta.dirname + "/admin/Extension.js"
|
package/AiPowerups.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiPowerups.js","sources":["../src/AiPowerups.tsx"],"sourcesContent":["import React from \"react\";\nimport { Api
|
|
1
|
+
{"version":3,"file":"AiPowerups.js","sources":["../src/AiPowerups.tsx"],"sourcesContent":["import React from \"react\";\nimport { Api } from \"@webiny/project-aws/api.js\";\nimport { Admin } from \"@webiny/project-aws/admin.js\";\n\n/**\n * Both extensions load unconditionally; each gates itself at runtime.\n *\n * This used to sit inside `FeatureFlag.CanUseAiPowerups`, which reads project config while the\n * project graph is built, so the decision was baked in at deploy time. A WCP licence that granted\n * AI Power-Ups therefore did nothing until the next deploy, which is the wrong shape for something\n * a customer can buy at any moment.\n *\n * The gate now lives where the licence is readable: `api/Extension.ts` checks the effective flags\n * at `register()` (the licence is refreshed per request, before any feature registers), and\n * `admin/Extension.tsx` checks them on render. `ai-chat` and `api-aco` already gate this way.\n */\nexport const AiPowerups = () => {\n return (\n <>\n {/* Api extensions */}\n <Api.Extension src={import.meta.dirname + \"/api/Extension.js\"} />\n\n {/* Admin extensions */}\n <Admin.Extension src={import.meta.dirname + \"/admin/Extension.js\"} />\n </>\n );\n};\n"],"names":["AiPowerups","Api","Admin"],"mappings":";;;AAgBO,MAAMA,aAAa,IACf,WAAP,GACI,wDAEI,oBAACC,IAAI,SAAS;QAAC,KAAK,YAAY,OAAO,GAAG;sBAG1C,oBAACC,MAAM,SAAS;QAAC,KAAK,YAAY,OAAO,GAAG"}
|
package/admin/Extension.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const Extension: () => React.JSX.Element;
|
|
2
|
+
export declare const Extension: () => React.JSX.Element | null;
|
package/admin/Extension.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import react from "react";
|
|
2
|
-
import { AdminConfig, AdminLayout, RegisterFeature, useRouter } from "@webiny/app-admin";
|
|
2
|
+
import { AdminConfig, AdminLayout, RegisterFeature, useFeatureFlags, useRouter } from "@webiny/app-admin";
|
|
3
3
|
import { AiPowerUpsSettingsFeature } from "./presentation/AiPowerUpsSettings/index.js";
|
|
4
4
|
import { AiPowerUpsSettingsPage } from "./presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.js";
|
|
5
5
|
import { WbContentGeneration } from "./presentation/WbContentGeneration/Extension.js";
|
|
@@ -16,7 +16,10 @@ const AiPowerUpsSettings = ()=>{
|
|
|
16
16
|
route: Routes.Settings,
|
|
17
17
|
element: /*#__PURE__*/ react.createElement(AdminLayout, {
|
|
18
18
|
title: "AI Power-Ups"
|
|
19
|
-
}, /*#__PURE__*/ react.createElement(
|
|
19
|
+
}, /*#__PURE__*/ react.createElement(AdminConfig.Breadcrumb, {
|
|
20
|
+
name: "ai-powerups",
|
|
21
|
+
label: "AI Power-Ups"
|
|
22
|
+
}), /*#__PURE__*/ react.createElement(AiPowerUpsSettingsPage, null))
|
|
20
23
|
}), /*#__PURE__*/ react.createElement(Menu, {
|
|
21
24
|
parent: "settings.system",
|
|
22
25
|
name: "aiPowerUps",
|
|
@@ -30,13 +33,17 @@ const AiPowerUpsSettings = ()=>{
|
|
|
30
33
|
})
|
|
31
34
|
}));
|
|
32
35
|
};
|
|
33
|
-
const Extension = ()
|
|
36
|
+
const Extension = ()=>{
|
|
37
|
+
const featureFlags = useFeatureFlags();
|
|
38
|
+
if (!featureFlags.isEnabled("aiPowerups")) return null;
|
|
39
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
34
40
|
feature: AiPromptFormFeature
|
|
35
41
|
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
36
42
|
feature: AiPowerUpsHeadlessFeatures
|
|
37
43
|
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
38
44
|
feature: AiPowerUpsSettingsFeature
|
|
39
45
|
}), /*#__PURE__*/ react.createElement(AiPowerUpsSettings, null), /*#__PURE__*/ react.createElement(WbContentGeneration, null), /*#__PURE__*/ react.createElement(CmsContentGeneration, null), /*#__PURE__*/ react.createElement(CmsCompareEntryRevisions, null), /*#__PURE__*/ react.createElement(CmsEntryWizardExtension, null));
|
|
46
|
+
};
|
|
40
47
|
export { Extension };
|
|
41
48
|
|
|
42
49
|
//# sourceMappingURL=Extension.js.map
|
package/admin/Extension.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/Extension.js","sources":["../../src/admin/Extension.tsx"],"sourcesContent":["import React from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"admin/Extension.js","sources":["../../src/admin/Extension.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n AdminConfig,\n AdminLayout,\n useRouter,\n RegisterFeature,\n useFeatureFlags\n} from \"@webiny/app-admin\";\nimport { AiPowerUpsSettingsFeature } from \"./presentation/AiPowerUpsSettings/index.js\";\nimport { AiPowerUpsSettingsPage } from \"./presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.js\";\nimport { WbContentGeneration } from \"~/admin/presentation/WbContentGeneration/Extension.js\";\nimport { CmsContentGeneration } from \"~/admin/presentation/CmsContentGeneration/Extension.js\";\nimport { CmsEntryWizardExtension } from \"~/admin/presentation/CmsEntryWizard/Extension.js\";\nimport { CmsCompareEntryRevisions } from \"~/admin/presentation/CmsCompareEntryRevisions/Extension.js\";\nimport { AiPowerUpsHeadlessFeatures } from \"~/admin/features/feature.js\";\nimport { AiPromptFormFeature } from \"~/admin/presentation/AiPromptFormFactory/feature.js\";\nimport { Routes } from \"./routes.js\";\n\nconst { Menu, Route } = AdminConfig;\n\nconst AiPowerUpsSettings = () => {\n const { getLink } = useRouter();\n\n return (\n <AdminConfig>\n <Route\n route={Routes.Settings}\n element={\n <AdminLayout title={\"AI Power-Ups\"}>\n <AdminConfig.Breadcrumb name={\"ai-powerups\"} label={\"AI Power-Ups\"} />\n <AiPowerUpsSettingsPage />\n </AdminLayout>\n }\n />\n <Menu\n parent={\"settings.system\"}\n name={\"aiPowerUps\"}\n element={\n <Menu.Link\n text={\"AI Power-Ups\"}\n badge={<Menu.Link.Badge text=\"BETA\" />}\n to={getLink(Routes.Settings)}\n pinnable={true}\n />\n }\n />\n </AdminConfig>\n );\n};\n\nexport const Extension = () => {\n /*\n * Gated here rather than around `<Admin.Extension>` in `AiPowerups.tsx`, so a licence granted\n * after the last deploy takes effect on the next page load instead of the next deploy. Returning\n * null registers nothing, so an unlicensed project has no AI Power-Ups settings screen and no AI\n * buttons, rather than ones that fail when clicked. `app-audit-logs` gates the same way.\n */\n const featureFlags = useFeatureFlags();\n\n if (!featureFlags.isEnabled(\"aiPowerups\")) {\n return null;\n }\n\n return (\n <>\n <RegisterFeature feature={AiPromptFormFeature} />\n <RegisterFeature feature={AiPowerUpsHeadlessFeatures} />\n <RegisterFeature feature={AiPowerUpsSettingsFeature} />\n <AiPowerUpsSettings />\n {/* Website Builder Extension */}\n <WbContentGeneration />\n {/* Headless CMS Extension */}\n <CmsContentGeneration />\n {/* CMS Revision Comparison */}\n <CmsCompareEntryRevisions />\n {/* AI Entry Wizard (registered first so custom wizards can override) */}\n <CmsEntryWizardExtension />\n </>\n );\n};\n"],"names":["Menu","Route","AdminConfig","AiPowerUpsSettings","getLink","useRouter","Routes","AdminLayout","AiPowerUpsSettingsPage","Extension","featureFlags","useFeatureFlags","RegisterFeature","AiPromptFormFeature","AiPowerUpsHeadlessFeatures","AiPowerUpsSettingsFeature","WbContentGeneration","CmsContentGeneration","CmsCompareEntryRevisions","CmsEntryWizardExtension"],"mappings":";;;;;;;;;;;AAkBA,MAAM,EAAEA,MAAAA,IAAI,EAAEC,OAAAA,KAAK,EAAE,GAAGC;AAExB,MAAMC,qBAAqB;IACvB,MAAM,EAAEC,OAAO,EAAE,GAAGC;IAEpB,OAAO,WAAP,GACI,oBAACH,aAAWA,MAAAA,WAAAA,GACR,oBAACD,OAAKA;QACF,OAAOK,OAAO,QAAQ;QACtB,uBACI,oBAACC,aAAWA;YAAC,OAAO;yBAChB,oBAACL,YAAY,UAAU;YAAC,MAAM;YAAe,OAAO;0BACpD,oBAACM,wBAAsBA;sBAInC,oBAACR,MAAIA;QACD,QAAQ;QACR,MAAM;QACN,uBACI,oBAACA,KAAK,IAAI;YACN,MAAM;YACN,qBAAO,oBAACA,KAAK,IAAI,CAAC,KAAK;gBAAC,MAAK;;YAC7B,IAAII,QAAQE,OAAO,QAAQ;YAC3B,UAAU;;;AAMlC;AAEO,MAAMG,YAAY;IAOrB,MAAMC,eAAeC;IAErB,IAAI,CAACD,aAAa,SAAS,CAAC,eACxB,OAAO;IAGX,OAAO,WAAP,GACI,wDACI,oBAACE,iBAAeA;QAAC,SAASC;sBAC1B,oBAACD,iBAAeA;QAAC,SAASE;sBAC1B,oBAACF,iBAAeA;QAAC,SAASG;sBAC1B,oBAACZ,oBAAkBA,OAAAA,WAAAA,GAEnB,oBAACa,qBAAmBA,OAAAA,WAAAA,GAEpB,oBAACC,sBAAoBA,OAAAA,WAAAA,GAErB,oBAACC,0BAAwBA,OAAAA,WAAAA,GAEzB,oBAACC,yBAAuBA;AAGpC"}
|
|
@@ -44,6 +44,11 @@ export interface IAiPowerUpsProjectPreset {
|
|
|
44
44
|
files?: IAiPowerUpsProjectFile[];
|
|
45
45
|
version: number;
|
|
46
46
|
}
|
|
47
|
+
/** What a project decided about one capability. Absent `enabled` means enabled. */
|
|
48
|
+
export interface IAiPowerUpsCapabilityEntry {
|
|
49
|
+
enabled?: boolean;
|
|
50
|
+
overrides: IAiPowerUpsCapabilityOverride;
|
|
51
|
+
}
|
|
47
52
|
export interface IAiPowerUpsCapabilityOverride {
|
|
48
53
|
roleId?: string;
|
|
49
54
|
connectionId?: string;
|
|
@@ -61,10 +66,10 @@ export interface IAiPowerUpsSettings {
|
|
|
61
66
|
capabilities: {
|
|
62
67
|
/**
|
|
63
68
|
* Keyed by capability id, and open-ended: extensions register their own, so there is no
|
|
64
|
-
* union to enumerate. `Partial` because most capabilities
|
|
69
|
+
* union to enumerate. `Partial` because most capabilities are untouched, and a bare
|
|
65
70
|
* `Record` would type a miss as present.
|
|
66
71
|
*/
|
|
67
|
-
|
|
72
|
+
items: Partial<Record<string, IAiPowerUpsCapabilityEntry>>;
|
|
68
73
|
};
|
|
69
74
|
readerPersonas: {
|
|
70
75
|
presets: IAiPowerUpsPersonaPreset[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/features/settings/shared/abstractions.js","sources":["../../../../../src/admin/features/settings/shared/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { AiModelRoleId } from \"~/admin/domain/modelRoles.js\";\n\nexport interface IAiPowerUpsSettingsCache {\n get(): IAiPowerUpsSettings | null;\n set(data: IAiPowerUpsSettings): void;\n}\n\nexport const SettingsCache = createAbstraction<IAiPowerUpsSettingsCache>(\n \"AiPowerUps/SettingsCache\"\n);\nexport namespace SettingsCache {\n export type Interface = IAiPowerUpsSettingsCache;\n}\n\nexport interface IAiPowerUpsPersonaPreset {\n id: string;\n name: string;\n description: string;\n style?: string;\n}\n\n/** One vendor credential. The `apiKey` is only ever the mask; the plaintext never leaves the api. */\nexport interface IAiPowerUpsConnectionPreset {\n id: string;\n name: string;\n sdkName: string;\n apiKey: string;\n}\n\nexport interface IAiPowerUpsModelRoleAssignment {\n connectionId: string;\n model: string;\n}\n\n/** A file attached to a project, as the picker returns it. */\nexport interface IAiPowerUpsProjectFile {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n width?: number;\n height?: number;\n}\n\nexport interface IAiPowerUpsProjectPreset {\n id: string;\n name: string;\n description?: string;\n instructions?: string;\n defaultReaderPersonaId?: string;\n defaultWriterPersonaId?: string;\n files?: IAiPowerUpsProjectFile[];\n version: number;\n}\n\nexport interface IAiPowerUpsCapabilityOverride {\n roleId?: string;\n connectionId?: string;\n model?: string;\n additionalInstructions?: string;\n}\n\nexport interface IAiPowerUpsSettings {\n connections: {\n presets: IAiPowerUpsConnectionPreset[];\n };\n modelRoles: {\n /** Keyed by role id, and every role always present — the set is closed. */\n roles: Record<AiModelRoleId, IAiPowerUpsModelRoleAssignment>;\n };\n capabilities: {\n /**\n * Keyed by capability id, and open-ended: extensions register their own, so there is no\n * union to enumerate. `Partial` because most capabilities
|
|
1
|
+
{"version":3,"file":"admin/features/settings/shared/abstractions.js","sources":["../../../../../src/admin/features/settings/shared/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { AiModelRoleId } from \"~/admin/domain/modelRoles.js\";\n\nexport interface IAiPowerUpsSettingsCache {\n get(): IAiPowerUpsSettings | null;\n set(data: IAiPowerUpsSettings): void;\n}\n\nexport const SettingsCache = createAbstraction<IAiPowerUpsSettingsCache>(\n \"AiPowerUps/SettingsCache\"\n);\nexport namespace SettingsCache {\n export type Interface = IAiPowerUpsSettingsCache;\n}\n\nexport interface IAiPowerUpsPersonaPreset {\n id: string;\n name: string;\n description: string;\n style?: string;\n}\n\n/** One vendor credential. The `apiKey` is only ever the mask; the plaintext never leaves the api. */\nexport interface IAiPowerUpsConnectionPreset {\n id: string;\n name: string;\n sdkName: string;\n apiKey: string;\n}\n\nexport interface IAiPowerUpsModelRoleAssignment {\n connectionId: string;\n model: string;\n}\n\n/** A file attached to a project, as the picker returns it. */\nexport interface IAiPowerUpsProjectFile {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n width?: number;\n height?: number;\n}\n\nexport interface IAiPowerUpsProjectPreset {\n id: string;\n name: string;\n description?: string;\n instructions?: string;\n defaultReaderPersonaId?: string;\n defaultWriterPersonaId?: string;\n files?: IAiPowerUpsProjectFile[];\n version: number;\n}\n\n/** What a project decided about one capability. Absent `enabled` means enabled. */\nexport interface IAiPowerUpsCapabilityEntry {\n enabled?: boolean;\n overrides: IAiPowerUpsCapabilityOverride;\n}\n\nexport interface IAiPowerUpsCapabilityOverride {\n roleId?: string;\n connectionId?: string;\n model?: string;\n additionalInstructions?: string;\n}\n\nexport interface IAiPowerUpsSettings {\n connections: {\n presets: IAiPowerUpsConnectionPreset[];\n };\n modelRoles: {\n /** Keyed by role id, and every role always present — the set is closed. */\n roles: Record<AiModelRoleId, IAiPowerUpsModelRoleAssignment>;\n };\n capabilities: {\n /**\n * Keyed by capability id, and open-ended: extensions register their own, so there is no\n * union to enumerate. `Partial` because most capabilities are untouched, and a bare\n * `Record` would type a miss as present.\n */\n items: Partial<Record<string, IAiPowerUpsCapabilityEntry>>;\n };\n readerPersonas: {\n presets: IAiPowerUpsPersonaPreset[];\n };\n writerPersonas: {\n presets: IAiPowerUpsPersonaPreset[];\n };\n projects: {\n presets: IAiPowerUpsProjectPreset[];\n };\n}\n"],"names":["SettingsCache","createAbstraction"],"mappings":";AAQO,MAAMA,gBAAgBC,kBACzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const AiPowerUpsSettingsPage: (() => React.JSX.Element) & {
|
|
3
|
-
|
|
2
|
+
export declare const AiPowerUpsSettingsPage: (() => React.JSX.Element) & React.NamedExoticComponent<unknown> & {
|
|
3
|
+
readonly type: () => React.JSX.Element;
|
|
4
4
|
};
|
|
@@ -9,9 +9,12 @@ export interface IAiPowerUpsSettingsGroup {
|
|
|
9
9
|
description?: string;
|
|
10
10
|
icon?: Icon;
|
|
11
11
|
/**
|
|
12
|
-
* Awaited before `buildForm` runs.
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* Awaited before `buildForm` runs.
|
|
13
|
+
*
|
|
14
|
+
* Field *options* are evaluated lazily on render, so a group that only needs server data for a
|
|
15
|
+
* select can fetch it in the background. Field *structure* is not: the Capabilities group
|
|
16
|
+
* builds one field per capability registered on the api, so that list has to be in hand before
|
|
17
|
+
* the form is built or the tab comes up empty.
|
|
15
18
|
*/
|
|
16
19
|
init?(): Promise<void>;
|
|
17
20
|
buildForm(formBuilder: IAiPowerUpsSettingsGroupFormBuilder): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/AiPowerUpsSettings/settingsGroup.js","sources":["../../../../src/admin/presentation/AiPowerUpsSettings/settingsGroup.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport { FormModelFactory, FormModel, Icon } from \"@webiny/app-admin\";\n\nexport interface IAiPowerUpsSettingsGroupFormBuilder {\n fields(\n fn: (\n fields: FormModelFactory.FieldBuilderRegistry\n ) => Record<string, FormModelFactory.FieldBuilder>\n ): void;\n layout(fn: (layout: FormModelFactory.LayoutBuilder) => FormModel.LayoutNodeBuilder[]): void;\n}\n\nexport interface IAiPowerUpsSettingsGroup {\n name: string;\n label: string;\n description?: string;\n icon?: Icon;\n /**\n * Awaited before `buildForm` runs
|
|
1
|
+
{"version":3,"file":"admin/presentation/AiPowerUpsSettings/settingsGroup.js","sources":["../../../../src/admin/presentation/AiPowerUpsSettings/settingsGroup.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport { FormModelFactory, FormModel, Icon } from \"@webiny/app-admin\";\n\nexport interface IAiPowerUpsSettingsGroupFormBuilder {\n fields(\n fn: (\n fields: FormModelFactory.FieldBuilderRegistry\n ) => Record<string, FormModelFactory.FieldBuilder>\n ): void;\n layout(fn: (layout: FormModelFactory.LayoutBuilder) => FormModel.LayoutNodeBuilder[]): void;\n}\n\nexport interface IAiPowerUpsSettingsGroup {\n name: string;\n label: string;\n description?: string;\n icon?: Icon;\n /**\n * Awaited before `buildForm` runs.\n *\n * Field *options* are evaluated lazily on render, so a group that only needs server data for a\n * select can fetch it in the background. Field *structure* is not: the Capabilities group\n * builds one field per capability registered on the api, so that list has to be in hand before\n * the form is built or the tab comes up empty.\n */\n init?(): Promise<void>;\n buildForm(formBuilder: IAiPowerUpsSettingsGroupFormBuilder): void;\n}\n\nexport const AiPowerUpsSettingsGroup = createAbstraction<IAiPowerUpsSettingsGroup>(\n \"AiPowerUps/SettingsGroup\"\n);\n\nexport namespace AiPowerUpsSettingsGroup {\n export type Interface = IAiPowerUpsSettingsGroup;\n export type FormBuilder = IAiPowerUpsSettingsGroupFormBuilder;\n}\n"],"names":["AiPowerUpsSettingsGroup","createAbstraction"],"mappings":";AA6BO,MAAMA,0BAA0BC,kBACnC"}
|
|
@@ -2,6 +2,10 @@ import { AiPowerUpsSettingsGroup } from "./AiPowerUpsSettings/settingsGroup.js";
|
|
|
2
2
|
import { ListCapabilitiesRepository, ListCapabilitiesUseCase } from "../features/listCapabilities/abstractions.js";
|
|
3
3
|
import { ListModelsRepository, ListModelsUseCase } from "../features/listModels/abstractions.js";
|
|
4
4
|
import { AI_MODEL_ROLE_DISPLAY, roleLabel } from "./modelRoles.js";
|
|
5
|
+
function isEnabled(form, capabilityId) {
|
|
6
|
+
const data = form.getData();
|
|
7
|
+
return data.capabilities?.items?.[capabilityId]?.enabled !== false;
|
|
8
|
+
}
|
|
5
9
|
class CapabilitiesSettingsImpl {
|
|
6
10
|
constructor(listCapabilities, capabilitiesRepository, listModels, modelsRepository){
|
|
7
11
|
this.listCapabilities = listCapabilities;
|
|
@@ -25,13 +29,13 @@ class CapabilitiesSettingsImpl {
|
|
|
25
29
|
}
|
|
26
30
|
buildForm(form) {
|
|
27
31
|
form.fields((fields)=>({
|
|
28
|
-
|
|
32
|
+
items: fields.object().label("Capabilities").renderer("passthrough").fields((f)=>Object.fromEntries(this.sortedCapabilities().map((capability)=>[
|
|
29
33
|
capability.id,
|
|
30
34
|
this.buildCapabilityField(f, capability)
|
|
31
35
|
])))
|
|
32
36
|
}));
|
|
33
37
|
form.layout((layout)=>[
|
|
34
|
-
layout.row("
|
|
38
|
+
layout.row("items")
|
|
35
39
|
]);
|
|
36
40
|
}
|
|
37
41
|
buildCapabilityField(f, capability) {
|
|
@@ -41,24 +45,27 @@ class CapabilitiesSettingsImpl {
|
|
|
41
45
|
itemDescription: ()=>capability.description,
|
|
42
46
|
open: false
|
|
43
47
|
}).fields((cf)=>({
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
48
|
+
enabled: cf.boolean().label("Enabled").defaultValue(true).description("Turn this off to remove the feature from the app. The settings below are kept, but ignored, while it is off."),
|
|
49
|
+
overrides: cf.object().label("Overrides").renderer("passthrough").fields((of)=>({
|
|
50
|
+
roleId: of.text().label("Model role").disabledWhen(({ form })=>!isEnabled(form, capability.id)).description(`Which role supplies this feature's model. Left empty, it uses ${defaultRoleLabel}.`).options(()=>AI_MODEL_ROLE_DISPLAY.map((role)=>({
|
|
51
|
+
label: role.label,
|
|
52
|
+
value: role.id
|
|
53
|
+
}))),
|
|
54
|
+
connectionId: of.text().label("Pin a connection").disabledWhen(({ form })=>!isEnabled(form, capability.id)).description("Advanced. Overrides the role above for this feature only.").options(({ form })=>[
|
|
55
|
+
{
|
|
56
|
+
label: "Use the role's connection",
|
|
57
|
+
value: ""
|
|
58
|
+
},
|
|
59
|
+
...this.getConnections(form).map((c)=>({
|
|
60
|
+
label: c.name,
|
|
61
|
+
value: c.id
|
|
62
|
+
}))
|
|
63
|
+
]),
|
|
64
|
+
model: of.text().label("Pin a model").disabledWhen(({ form })=>!isEnabled(form, capability.id) || !this.getPinnedConnection(form, capability.id)).description("Both the connection and the model must be set for a pin to apply.").options(({ form })=>this.getModelOptions(form, capability.id)),
|
|
65
|
+
additionalInstructions: of.text().label("Additional instructions").renderer("textarea", {
|
|
66
|
+
rows: 5
|
|
67
|
+
}).disabledWhen(({ form })=>!isEnabled(form, capability.id)).description("Appended to this feature's prompt. Use this for house style and standing rules.").note("Appending keeps Webiny's prompt in place, including the output format the feature depends on.")
|
|
68
|
+
}))
|
|
62
69
|
}));
|
|
63
70
|
}
|
|
64
71
|
getConnections(form) {
|
|
@@ -67,7 +74,7 @@ class CapabilitiesSettingsImpl {
|
|
|
67
74
|
}
|
|
68
75
|
getOverride(form, capabilityId) {
|
|
69
76
|
const data = form.getData();
|
|
70
|
-
return data.capabilities?.
|
|
77
|
+
return data.capabilities?.items?.[capabilityId]?.overrides ?? {};
|
|
71
78
|
}
|
|
72
79
|
getPinnedConnection(form, capabilityId) {
|
|
73
80
|
const connectionId = this.getOverride(form, capabilityId).connectionId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/CapabilitiesSettings.js","sources":["../../../src/admin/presentation/CapabilitiesSettings.ts"],"sourcesContent":["import type { IAiPowerUpsConnectionPreset } from \"~/admin/features/settings/shared/abstractions.js\";\nimport { AiPowerUpsSettingsGroup } from \"./AiPowerUpsSettings/settingsGroup.js\";\nimport {\n ListCapabilitiesUseCase,\n ListCapabilitiesRepository\n} from \"~/admin/features/listCapabilities/abstractions.js\";\nimport {\n ListModelsUseCase,\n ListModelsRepository\n} from \"~/admin/features/listModels/abstractions.js\";\nimport { AI_MODEL_ROLE_DISPLAY, roleLabel } from \"./modelRoles.js\";\nimport type { AiCapability } from \"~/admin/features/listCapabilities/abstractions.js\";\nimport type { FormModel, FormModelFactory } from \"@webiny/app-admin\";\n\n/**\n * One row per AI feature, all of them empty by default.\n *\n * The rows come from the api's registered capabilities, so a feature that declares one appears here\n * without a change to this file. That is the point: the previous plan was a hand-maintained tab per\n * feature, which is the kind of list that stops matching reality on the second addition.\n */\nclass CapabilitiesSettingsImpl implements AiPowerUpsSettingsGroup.Interface {\n name = \"capabilities\";\n label = \"Capabilities\";\n description = \"Per-feature model and prompt overrides. Empty means inherit.\";\n\n constructor(\n private listCapabilities: ListCapabilitiesUseCase.Interface,\n private capabilitiesRepository: ListCapabilitiesRepository.Interface,\n private listModels: ListModelsUseCase.Interface,\n private modelsRepository: ListModelsRepository.Interface\n ) {}\n\n async init(): Promise<void> {\n await Promise.all([this.listCapabilities.execute(), this.listModels.execute()]);\n }\n\n /**\n * Alphabetical by the label people actually read, not by id or registration order.\n *\n * Registration order is whatever the container happened to do, which puts \"Page generation\"\n * above \"CMS entry generation\" for no reason a reader could infer. `localeCompare` rather than\n * `<` so accented labels from an extension sort where a person would expect.\n */\n private sortedCapabilities(): AiCapability[] {\n return [...this.capabilitiesRepository.getCapabilities()].sort((a, b) =>\n a.label.localeCompare(b.label)\n );\n }\n\n buildForm(form: AiPowerUpsSettingsGroup.FormBuilder): void {\n form.fields(fields => ({\n overrides: fields\n .object()\n .label(\"Capabilities\")\n .renderer(\"passthrough\")\n .fields(f =>\n Object.fromEntries(\n this.sortedCapabilities().map(capability => [\n capability.id,\n this.buildCapabilityField(f, capability)\n ])\n )\n )\n }));\n\n form.layout(layout => [layout.row(\"overrides\")]);\n }\n\n private buildCapabilityField(\n f: FormModelFactory.FieldBuilderRegistry,\n capability: AiCapability\n ): FormModelFactory.FieldBuilder {\n const defaultRoleLabel = roleLabel(capability.defaultRole);\n\n return (\n f\n .object()\n .label(capability.label)\n /*\n * Callbacks, not strings: a string is read as a field name, not as literal text. The\n * title happened to survive that because the renderer falls back to the field label,\n * but the description silently vanished.\n */\n .renderer(\"objectAccordionSingle\", {\n itemTitle: () => capability.label,\n itemDescription: () => capability.description,\n // Closed by default. Every row is empty until someone changes something, so an\n // expanded list of five would be five screens of nothing.\n open: false\n })\n .fields(cf => ({\n /*\n * The inherited role goes in the description, not in the option list. An option\n * with an empty value is dropped by the select renderer, so the \"Inherit (Fast)\"\n * entry never rendered and nothing said which role this feature falls back to.\n * Clearing the field is done with the select's own reset control.\n */\n roleId: cf\n .text()\n .label(\"Model role\")\n .description(\n `Which role supplies this feature's model. Left empty, it uses ${defaultRoleLabel}.`\n )\n .options(() =>\n AI_MODEL_ROLE_DISPLAY.map(role => ({\n label: role.label,\n value: role.id\n }))\n ),\n\n /*\n * Pinning a model bypasses roles for this one feature. It is the escape hatch, not\n * the mechanism: a project that pins everything has thrown away the indirection\n * that makes \"switch our cheap model\" a single edit.\n */\n connectionId: cf\n .text()\n .label(\"Pin a connection\")\n .description(\"Advanced. Overrides the role above for this feature only.\")\n .options(({ form }) => [\n { label: \"Use the role's connection\", value: \"\" },\n ...this.getConnections(form).map(c => ({ label: c.name, value: c.id }))\n ]),\n model: cf\n .text()\n .label(\"Pin a model\")\n .disabledWhen(({ form }) => !this.getPinnedConnection(form, capability.id))\n .description(\n \"Both the connection and the model must be set for a pin to apply.\"\n )\n .options(({ form }) => this.getModelOptions(form, capability.id)),\n\n additionalInstructions: cf\n .text()\n .label(\"Additional instructions\")\n .renderer(\"textarea\", { rows: 5 })\n .description(\n \"Appended to this feature's prompt. Use this for house style and standing rules.\"\n )\n .note(\n \"Appending keeps Webiny's prompt in place, including the output format the feature depends on.\"\n )\n }))\n );\n }\n\n private getConnections(form: FormModel.Interface): IAiPowerUpsConnectionPreset[] {\n const data = form.getData() as {\n connections?: { presets?: IAiPowerUpsConnectionPreset[] };\n };\n return (data.connections?.presets ?? []).filter(c => c.id && c.name);\n }\n\n private getOverride(\n form: FormModel.Interface,\n capabilityId: string\n ): { connectionId?: string } {\n const data = form.getData() as {\n capabilities?: { overrides?: Record<string, { connectionId?: string }> };\n };\n return data.capabilities?.overrides?.[capabilityId] ?? {};\n }\n\n private getPinnedConnection(\n form: FormModel.Interface,\n capabilityId: string\n ): IAiPowerUpsConnectionPreset | undefined {\n const connectionId = this.getOverride(form, capabilityId).connectionId;\n\n if (!connectionId) {\n return undefined;\n }\n\n return this.getConnections(form).find(c => c.id === connectionId);\n }\n\n private getModelOptions(form: FormModel.Interface, capabilityId: string) {\n const connection = this.getPinnedConnection(form, capabilityId);\n\n if (!connection) {\n return [];\n }\n\n return this.modelsRepository\n .getModels()\n .filter(model => model.providerId === connection.sdkName)\n .map(model => ({\n label: model.modelName,\n value: `${model.providerId}/${model.modelId}`\n }));\n }\n}\n\nexport const CapabilitiesSettings = AiPowerUpsSettingsGroup.createImplementation({\n implementation: CapabilitiesSettingsImpl,\n dependencies: [\n ListCapabilitiesUseCase,\n ListCapabilitiesRepository,\n ListModelsUseCase,\n ListModelsRepository\n ]\n});\n"],"names":["CapabilitiesSettingsImpl","listCapabilities","capabilitiesRepository","listModels","modelsRepository","Promise","a","b","form","fields","f","Object","capability","layout","defaultRoleLabel","roleLabel","cf","AI_MODEL_ROLE_DISPLAY","role","c","data","capabilityId","connectionId","connection","model","CapabilitiesSettings","AiPowerUpsSettingsGroup","ListCapabilitiesUseCase","ListCapabilitiesRepository","ListModelsUseCase","ListModelsRepository"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"admin/presentation/CapabilitiesSettings.js","sources":["../../../src/admin/presentation/CapabilitiesSettings.ts"],"sourcesContent":["import type { IAiPowerUpsConnectionPreset } from \"~/admin/features/settings/shared/abstractions.js\";\nimport { AiPowerUpsSettingsGroup } from \"./AiPowerUpsSettings/settingsGroup.js\";\nimport {\n ListCapabilitiesUseCase,\n ListCapabilitiesRepository\n} from \"~/admin/features/listCapabilities/abstractions.js\";\nimport {\n ListModelsUseCase,\n ListModelsRepository\n} from \"~/admin/features/listModels/abstractions.js\";\nimport { AI_MODEL_ROLE_DISPLAY, roleLabel } from \"./modelRoles.js\";\nimport type { AiCapability } from \"~/admin/features/listCapabilities/abstractions.js\";\nimport type { FormModel, FormModelFactory } from \"@webiny/app-admin\";\n\n/**\n * Absent means enabled, exactly as it does in storage and in the resolver.\n *\n * The form seeds an untouched switch to `true`, so in practice this only reads `false` after someone\n * flips one. Spelled `!== false` anyway, so it keeps agreeing with the other two if that default\n * ever goes away.\n */\nfunction isEnabled(form: FormModel.Interface, capabilityId: string): boolean {\n const data = form.getData() as {\n capabilities?: { items?: Record<string, { enabled?: boolean }> };\n };\n return data.capabilities?.items?.[capabilityId]?.enabled !== false;\n}\n\n/**\n * One row per AI feature, all of them empty by default.\n *\n * The rows come from the api's registered capabilities, so a feature that declares one appears here\n * without a change to this file. That is the point: the previous plan was a hand-maintained tab per\n * feature, which is the kind of list that stops matching reality on the second addition.\n */\nclass CapabilitiesSettingsImpl implements AiPowerUpsSettingsGroup.Interface {\n name = \"capabilities\";\n label = \"Capabilities\";\n description = \"Per-feature model and prompt overrides. Empty means inherit.\";\n\n constructor(\n private listCapabilities: ListCapabilitiesUseCase.Interface,\n private capabilitiesRepository: ListCapabilitiesRepository.Interface,\n private listModels: ListModelsUseCase.Interface,\n private modelsRepository: ListModelsRepository.Interface\n ) {}\n\n async init(): Promise<void> {\n await Promise.all([this.listCapabilities.execute(), this.listModels.execute()]);\n }\n\n /**\n * Alphabetical by the label people actually read, not by id or registration order.\n *\n * Registration order is whatever the container happened to do, which puts \"Page generation\"\n * above \"CMS entry generation\" for no reason a reader could infer. `localeCompare` rather than\n * `<` so accented labels from an extension sort where a person would expect.\n */\n private sortedCapabilities(): AiCapability[] {\n return [...this.capabilitiesRepository.getCapabilities()].sort((a, b) =>\n a.label.localeCompare(b.label)\n );\n }\n\n buildForm(form: AiPowerUpsSettingsGroup.FormBuilder): void {\n form.fields(fields => ({\n items: fields\n .object()\n .label(\"Capabilities\")\n .renderer(\"passthrough\")\n .fields(f =>\n Object.fromEntries(\n this.sortedCapabilities().map(capability => [\n capability.id,\n this.buildCapabilityField(f, capability)\n ])\n )\n )\n }));\n\n form.layout(layout => [layout.row(\"items\")]);\n }\n\n private buildCapabilityField(\n f: FormModelFactory.FieldBuilderRegistry,\n capability: AiCapability\n ): FormModelFactory.FieldBuilder {\n const defaultRoleLabel = roleLabel(capability.defaultRole);\n\n return (\n f\n .object()\n .label(capability.label)\n /*\n * Callbacks, not strings: a string is read as a field name, not as literal text. The\n * title happened to survive that because the renderer falls back to the field label,\n * but the description silently vanished.\n */\n .renderer(\"objectAccordionSingle\", {\n itemTitle: () => capability.label,\n itemDescription: () => capability.description,\n // Closed by default. Every row is empty until someone changes something, so an\n // expanded list of five would be five screens of nothing.\n open: false\n })\n .fields(cf => ({\n /*\n * On unless someone turns it off. A licence that grants a capability enables it\n * immediately, so nobody has to come here and opt in; the only thing this\n * records is a decision to switch one off.\n */\n enabled: cf\n .boolean()\n .label(\"Enabled\")\n /*\n * On unless storage explicitly says otherwise. Nothing is written down for a\n * capability a licence enabled, so the stored value is absent, and a switch\n * renders absent as off. Without this default every untouched capability\n * shows as disabled while actually running, which is the same `undefined`\n * confusion the storage side guards against, seen from the front.\n */\n .defaultValue(true)\n .description(\n \"Turn this off to remove the feature from the app. The settings below are kept, but ignored, while it is off.\"\n ),\n\n overrides: cf\n .object()\n .label(\"Overrides\")\n .renderer(\"passthrough\")\n .fields(of => ({\n /*\n * The inherited role goes in the description, not in the option list. An option\n * with an empty value is dropped by the select renderer, so the \"Inherit (Fast)\"\n * entry never rendered and nothing said which role this feature falls back to.\n * Clearing the field is done with the select's own reset control.\n */\n roleId: of\n .text()\n .label(\"Model role\")\n .disabledWhen(({ form }) => !isEnabled(form, capability.id))\n .description(\n `Which role supplies this feature's model. Left empty, it uses ${defaultRoleLabel}.`\n )\n .options(() =>\n AI_MODEL_ROLE_DISPLAY.map(role => ({\n label: role.label,\n value: role.id\n }))\n ),\n\n /*\n * Pinning a model bypasses roles for this one feature. It is the escape hatch, not\n * the mechanism: a project that pins everything has thrown away the indirection\n * that makes \"switch our cheap model\" a single edit.\n */\n connectionId: of\n .text()\n .label(\"Pin a connection\")\n .disabledWhen(({ form }) => !isEnabled(form, capability.id))\n .description(\n \"Advanced. Overrides the role above for this feature only.\"\n )\n .options(({ form }) => [\n { label: \"Use the role's connection\", value: \"\" },\n ...this.getConnections(form).map(c => ({\n label: c.name,\n value: c.id\n }))\n ]),\n model: of\n .text()\n .label(\"Pin a model\")\n .disabledWhen(\n ({ form }) =>\n !isEnabled(form, capability.id) ||\n !this.getPinnedConnection(form, capability.id)\n )\n .description(\n \"Both the connection and the model must be set for a pin to apply.\"\n )\n .options(({ form }) => this.getModelOptions(form, capability.id)),\n\n additionalInstructions: of\n .text()\n .label(\"Additional instructions\")\n .renderer(\"textarea\", { rows: 5 })\n .disabledWhen(({ form }) => !isEnabled(form, capability.id))\n .description(\n \"Appended to this feature's prompt. Use this for house style and standing rules.\"\n )\n .note(\n \"Appending keeps Webiny's prompt in place, including the output format the feature depends on.\"\n )\n }))\n }))\n );\n }\n\n private getConnections(form: FormModel.Interface): IAiPowerUpsConnectionPreset[] {\n const data = form.getData() as {\n connections?: { presets?: IAiPowerUpsConnectionPreset[] };\n };\n return (data.connections?.presets ?? []).filter(c => c.id && c.name);\n }\n\n private getOverride(\n form: FormModel.Interface,\n capabilityId: string\n ): { connectionId?: string } {\n const data = form.getData() as {\n capabilities?: { items?: Record<string, { overrides?: { connectionId?: string } }> };\n };\n return data.capabilities?.items?.[capabilityId]?.overrides ?? {};\n }\n\n private getPinnedConnection(\n form: FormModel.Interface,\n capabilityId: string\n ): IAiPowerUpsConnectionPreset | undefined {\n const connectionId = this.getOverride(form, capabilityId).connectionId;\n\n if (!connectionId) {\n return undefined;\n }\n\n return this.getConnections(form).find(c => c.id === connectionId);\n }\n\n private getModelOptions(form: FormModel.Interface, capabilityId: string) {\n const connection = this.getPinnedConnection(form, capabilityId);\n\n if (!connection) {\n return [];\n }\n\n return this.modelsRepository\n .getModels()\n .filter(model => model.providerId === connection.sdkName)\n .map(model => ({\n label: model.modelName,\n value: `${model.providerId}/${model.modelId}`\n }));\n }\n}\n\nexport const CapabilitiesSettings = AiPowerUpsSettingsGroup.createImplementation({\n implementation: CapabilitiesSettingsImpl,\n dependencies: [\n ListCapabilitiesUseCase,\n ListCapabilitiesRepository,\n ListModelsUseCase,\n ListModelsRepository\n ]\n});\n"],"names":["isEnabled","form","capabilityId","data","CapabilitiesSettingsImpl","listCapabilities","capabilitiesRepository","listModels","modelsRepository","Promise","a","b","fields","f","Object","capability","layout","defaultRoleLabel","roleLabel","cf","of","AI_MODEL_ROLE_DISPLAY","role","c","connectionId","connection","model","CapabilitiesSettings","AiPowerUpsSettingsGroup","ListCapabilitiesUseCase","ListCapabilitiesRepository","ListModelsUseCase","ListModelsRepository"],"mappings":"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"}
|
|
@@ -3,7 +3,7 @@ import type { CmsCompareEntryRevisionsPresenter } from "./abstractions.js";
|
|
|
3
3
|
interface CmsCompareEntryRevisionsDialogProps {
|
|
4
4
|
presenter: CmsCompareEntryRevisionsPresenter.Interface;
|
|
5
5
|
}
|
|
6
|
-
export declare const CmsCompareEntryRevisionsDialog: (({ presenter }: CmsCompareEntryRevisionsDialogProps) => React.JSX.Element) & {
|
|
7
|
-
|
|
6
|
+
export declare const CmsCompareEntryRevisionsDialog: (({ presenter }: CmsCompareEntryRevisionsDialogProps) => React.JSX.Element) & React.NamedExoticComponent<CmsCompareEntryRevisionsDialogProps> & {
|
|
7
|
+
readonly type: ({ presenter }: CmsCompareEntryRevisionsDialogProps) => React.JSX.Element;
|
|
8
8
|
};
|
|
9
9
|
export {};
|
|
@@ -3,7 +3,7 @@ import type { CmsCompareEntryRevisionsPresenter } from "./abstractions.js";
|
|
|
3
3
|
interface CmsCompareEntryRevisionsDrawerProps {
|
|
4
4
|
presenter: CmsCompareEntryRevisionsPresenter.Interface;
|
|
5
5
|
}
|
|
6
|
-
export declare const CmsCompareEntryRevisionsDrawer: (({ presenter }: CmsCompareEntryRevisionsDrawerProps) => React.JSX.Element) & {
|
|
7
|
-
|
|
6
|
+
export declare const CmsCompareEntryRevisionsDrawer: (({ presenter }: CmsCompareEntryRevisionsDrawerProps) => React.JSX.Element) & React.NamedExoticComponent<CmsCompareEntryRevisionsDrawerProps> & {
|
|
7
|
+
readonly type: ({ presenter }: CmsCompareEntryRevisionsDrawerProps) => React.JSX.Element;
|
|
8
8
|
};
|
|
9
9
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const CmsCompareEntryRevisionsMenuItem: (() => React.JSX.Element) & {
|
|
3
|
-
|
|
2
|
+
export declare const CmsCompareEntryRevisionsMenuItem: (() => React.JSX.Element) & React.NamedExoticComponent<unknown> & {
|
|
3
|
+
readonly type: () => React.JSX.Element;
|
|
4
4
|
};
|
|
@@ -4,7 +4,7 @@ import { CmsCompareEntryRevisionsPresenterImplementation } from "./CmsCompareEnt
|
|
|
4
4
|
const CmsCompareEntryRevisionsPresentationFeature = createFeature({
|
|
5
5
|
name: "AiPowerUps/CmsCompareEntryRevisionsPresenter",
|
|
6
6
|
register (container) {
|
|
7
|
-
container.register(CmsCompareEntryRevisionsPresenterImplementation).
|
|
7
|
+
container.register(CmsCompareEntryRevisionsPresenterImplementation).inContainerScope();
|
|
8
8
|
},
|
|
9
9
|
resolve (container) {
|
|
10
10
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/CmsCompareEntryRevisions/feature.js","sources":["../../../../src/admin/presentation/CmsCompareEntryRevisions/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { CmsCompareEntryRevisionsPresenter as Abstraction } from \"./abstractions.js\";\nimport { CmsCompareEntryRevisionsPresenterImplementation } from \"./CmsCompareEntryRevisionsPresenter.js\";\n\nexport const CmsCompareEntryRevisionsPresentationFeature = createFeature({\n name: \"AiPowerUps/CmsCompareEntryRevisionsPresenter\",\n register(container) {\n container.register(CmsCompareEntryRevisionsPresenterImplementation).
|
|
1
|
+
{"version":3,"file":"admin/presentation/CmsCompareEntryRevisions/feature.js","sources":["../../../../src/admin/presentation/CmsCompareEntryRevisions/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { CmsCompareEntryRevisionsPresenter as Abstraction } from \"./abstractions.js\";\nimport { CmsCompareEntryRevisionsPresenterImplementation } from \"./CmsCompareEntryRevisionsPresenter.js\";\n\nexport const CmsCompareEntryRevisionsPresentationFeature = createFeature({\n name: \"AiPowerUps/CmsCompareEntryRevisionsPresenter\",\n register(container) {\n // One per container, not a singleton. The presenter reads the revisions list, which only the\n // content entries view's child container registers. A container-scoped instance is built from\n // that child, and the header menu item and the overlays still share it.\n container.register(CmsCompareEntryRevisionsPresenterImplementation).inContainerScope();\n },\n resolve(container) {\n return {\n presenter: container.resolve(Abstraction)\n };\n }\n});\n"],"names":["CmsCompareEntryRevisionsPresentationFeature","createFeature","container","CmsCompareEntryRevisionsPresenterImplementation","Abstraction"],"mappings":";;;AAIO,MAAMA,8CAA8CC,cAAc;IACrE,MAAM;IACN,UAASC,SAAS;QAIdA,UAAU,QAAQ,CAACC,iDAAiD,gBAAgB;IACxF;IACA,SAAQD,SAAS;QACb,OAAO;YACH,WAAWA,UAAU,OAAO,CAACE;QACjC;IACJ;AACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const CmsGenerateContentButton: (() => React.JSX.Element | null) & {
|
|
3
|
-
|
|
2
|
+
export declare const CmsGenerateContentButton: (() => React.JSX.Element | null) & React.NamedExoticComponent<unknown> & {
|
|
3
|
+
readonly type: () => React.JSX.Element | null;
|
|
4
4
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export declare const CMS_GENERATE_CONTENT_DIALOG = "cms-generate-content";
|
|
3
|
-
export declare const CmsGenerateContentDialog: (() => React.JSX.Element) & {
|
|
4
|
-
|
|
3
|
+
export declare const CmsGenerateContentDialog: (() => React.JSX.Element) & React.NamedExoticComponent<unknown> & {
|
|
4
|
+
readonly type: () => React.JSX.Element;
|
|
5
5
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import react from "react";
|
|
2
|
-
import { AdminConfig, RegisterFeature,
|
|
2
|
+
import { AdminConfig, RegisterFeature, useFeatureFlags } from "@webiny/app-admin";
|
|
3
3
|
import { InternalContentEntryEditorConfig } from "@webiny/app-headless-cms/admin/config/contentEntries/index.js";
|
|
4
4
|
import { CmsGenerateContentButton } from "./CmsGenerateContentButton.js";
|
|
5
5
|
import { CMS_GENERATE_CONTENT_DIALOG, CmsGenerateContentDialog } from "./CmsGenerateContentDialog.js";
|
|
@@ -7,8 +7,8 @@ import { CmsGenerateContentFeature } from "./feature.js";
|
|
|
7
7
|
import { GenerateEntryContentFeature } from "../../features/generateEntryContent/index.js";
|
|
8
8
|
const { Actions: Actions } = InternalContentEntryEditorConfig;
|
|
9
9
|
const CmsContentGeneration = ()=>{
|
|
10
|
-
const
|
|
11
|
-
if (!
|
|
10
|
+
const featureFlags = useFeatureFlags();
|
|
11
|
+
if (!featureFlags.isEnabled("aiPowerups.cms.entryGeneration")) return null;
|
|
12
12
|
return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
13
13
|
feature: CmsGenerateContentFeature
|
|
14
14
|
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/CmsContentGeneration/Extension.js","sources":["../../../../src/admin/presentation/CmsContentGeneration/Extension.tsx"],"sourcesContent":["import React from \"react\";\nimport { AdminConfig, RegisterFeature,
|
|
1
|
+
{"version":3,"file":"admin/presentation/CmsContentGeneration/Extension.js","sources":["../../../../src/admin/presentation/CmsContentGeneration/Extension.tsx"],"sourcesContent":["import React from \"react\";\nimport { AdminConfig, RegisterFeature, useFeatureFlags } from \"@webiny/app-admin\";\nimport { InternalContentEntryEditorConfig } from \"@webiny/app-headless-cms/admin/config/contentEntries/index.js\";\nimport { CmsGenerateContentButton } from \"~/admin/presentation/CmsContentGeneration/CmsGenerateContentButton.js\";\nimport {\n CmsGenerateContentDialog,\n CMS_GENERATE_CONTENT_DIALOG\n} from \"~/admin/presentation/CmsContentGeneration/CmsGenerateContentDialog.js\";\nimport { CmsGenerateContentFeature } from \"~/admin/presentation/CmsContentGeneration/feature.js\";\nimport { GenerateEntryContentFeature } from \"~/admin/features/generateEntryContent/index.js\";\n\nconst { Actions } = InternalContentEntryEditorConfig;\n\nexport const CmsContentGeneration = () => {\n const featureFlags = useFeatureFlags();\n\n if (!featureFlags.isEnabled(\"aiPowerups.cms.entryGeneration\")) {\n return null;\n }\n\n return (\n <>\n <RegisterFeature feature={CmsGenerateContentFeature} />\n <RegisterFeature feature={GenerateEntryContentFeature} />\n <AdminConfig>\n <AdminConfig.Dialog\n name={CMS_GENERATE_CONTENT_DIALOG}\n element={<CmsGenerateContentDialog />}\n />\n </AdminConfig>\n <InternalContentEntryEditorConfig>\n <Actions.ButtonAction\n name={\"generateEntryContent\"}\n before={\"save\"}\n element={<CmsGenerateContentButton />}\n />\n </InternalContentEntryEditorConfig>\n </>\n );\n};\n"],"names":["Actions","InternalContentEntryEditorConfig","CmsContentGeneration","featureFlags","useFeatureFlags","RegisterFeature","CmsGenerateContentFeature","GenerateEntryContentFeature","AdminConfig","CMS_GENERATE_CONTENT_DIALOG","CmsGenerateContentDialog","CmsGenerateContentButton"],"mappings":";;;;;;;AAWA,MAAM,EAAEA,SAAAA,OAAO,EAAE,GAAGC;AAEb,MAAMC,uBAAuB;IAChC,MAAMC,eAAeC;IAErB,IAAI,CAACD,aAAa,SAAS,CAAC,mCACxB,OAAO;IAGX,OAAO,WAAP,GACI,wDACI,oBAACE,iBAAeA;QAAC,SAASC;sBAC1B,oBAACD,iBAAeA;QAAC,SAASE;sBAC1B,oBAACC,aAAWA,MAAAA,WAAAA,GACR,oBAACA,YAAY,MAAM;QACf,MAAMC;QACN,uBAAS,oBAACC,0BAAwBA;uBAG1C,oBAACT,kCAAgCA,MAAAA,WAAAA,GAC7B,oBAACD,QAAQ,YAAY;QACjB,MAAM;QACN,QAAQ;QACR,uBAAS,oBAACW,0BAAwBA;;AAKtD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const CmsEntryWizard: (() => React.JSX.Element) & {
|
|
3
|
-
|
|
2
|
+
export declare const CmsEntryWizard: (() => React.JSX.Element) & React.NamedExoticComponent<unknown> & {
|
|
3
|
+
readonly type: () => React.JSX.Element;
|
|
4
4
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const CmsEntryWizardGate: (() => React.JSX.Element) & {
|
|
3
|
-
|
|
2
|
+
export declare const CmsEntryWizardGate: (() => React.JSX.Element | null) & React.NamedExoticComponent<unknown> & {
|
|
3
|
+
readonly type: () => React.JSX.Element | null;
|
|
4
4
|
};
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import react, { useEffect } from "react";
|
|
2
2
|
import { observer } from "mobx-react-lite";
|
|
3
|
+
import { useFeatureFlags } from "@webiny/app-admin";
|
|
3
4
|
import { useModel } from "@webiny/app-headless-cms/admin/components/ModelProvider/useModel.js";
|
|
4
5
|
import { useContentEntryFormPresenter } from "@webiny/app-headless-cms/exports/admin/cms/entry/editor.js";
|
|
5
6
|
import { CmsEntryWizard } from "./CmsEntryWizard.js";
|
|
6
7
|
const CmsEntryWizardGate = observer(()=>{
|
|
8
|
+
const featureFlags = useFeatureFlags();
|
|
7
9
|
const { model } = useModel();
|
|
8
10
|
const formPresenter = useContentEntryFormPresenter();
|
|
9
|
-
const showWizard = model.settings?.aiEntryWizard === true;
|
|
11
|
+
const showWizard = model.settings?.aiEntryWizard === true && featureFlags.isEnabled("aiPowerups.cms.entryGeneration");
|
|
10
12
|
useEffect(()=>{
|
|
11
13
|
if (!showWizard) formPresenter.newEntry();
|
|
12
14
|
}, [
|
|
13
15
|
showWizard
|
|
14
16
|
]);
|
|
17
|
+
if (!showWizard) return null;
|
|
15
18
|
return /*#__PURE__*/ react.createElement(CmsEntryWizard, null);
|
|
16
19
|
});
|
|
17
20
|
export { CmsEntryWizardGate };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/CmsEntryWizard/CmsEntryWizardGate.js","sources":["../../../../src/admin/presentation/CmsEntryWizard/CmsEntryWizardGate.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { useModel } from \"@webiny/app-headless-cms/admin/components/ModelProvider/useModel.js\";\nimport { useContentEntryFormPresenter } from \"@webiny/app-headless-cms/exports/admin/cms/entry/editor.js\";\nimport { CmsEntryWizard } from \"./CmsEntryWizard.js\";\n\nexport const CmsEntryWizardGate = observer(() => {\n const { model } = useModel();\n const formPresenter = useContentEntryFormPresenter();\n\n const showWizard
|
|
1
|
+
{"version":3,"file":"admin/presentation/CmsEntryWizard/CmsEntryWizardGate.js","sources":["../../../../src/admin/presentation/CmsEntryWizard/CmsEntryWizardGate.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { useFeatureFlags } from \"@webiny/app-admin\";\nimport { useModel } from \"@webiny/app-headless-cms/admin/components/ModelProvider/useModel.js\";\nimport { useContentEntryFormPresenter } from \"@webiny/app-headless-cms/exports/admin/cms/entry/editor.js\";\nimport { CmsEntryWizard } from \"./CmsEntryWizard.js\";\n\nexport const CmsEntryWizardGate = observer(() => {\n const featureFlags = useFeatureFlags();\n const { model } = useModel();\n const formPresenter = useContentEntryFormPresenter();\n\n /**\n * The AI wizard depends on the CMS content generation feature, which is only registered\n * when AI entry generation is enabled.\n */\n const showWizard =\n model.settings?.aiEntryWizard === true &&\n featureFlags.isEnabled(\"aiPowerups.cms.entryGeneration\");\n\n useEffect(() => {\n if (!showWizard) {\n formPresenter.newEntry();\n }\n }, [showWizard]);\n\n if (!showWizard) {\n return null;\n }\n\n return <CmsEntryWizard />;\n});\n"],"names":["CmsEntryWizardGate","observer","featureFlags","useFeatureFlags","model","useModel","formPresenter","useContentEntryFormPresenter","showWizard","useEffect","CmsEntryWizard"],"mappings":";;;;;;AAOO,MAAMA,qBAAqBC,SAAS;IACvC,MAAMC,eAAeC;IACrB,MAAM,EAAEC,KAAK,EAAE,GAAGC;IAClB,MAAMC,gBAAgBC;IAMtB,MAAMC,aACFJ,MAAM,QAAQ,EAAE,kBAAkB,QAClCF,aAAa,SAAS,CAAC;IAE3BO,UAAU;QACN,IAAI,CAACD,YACDF,cAAc,QAAQ;IAE9B,GAAG;QAACE;KAAW;IAEf,IAAI,CAACA,YACD,OAAO;IAGX,OAAO,WAAP,GAAO,oBAACE,gBAAcA;AAC1B"}
|
|
@@ -16,6 +16,6 @@ export interface GeneratePageContentErrorMessage extends IncomingGenericData {
|
|
|
16
16
|
message: string;
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
export declare const GenerateContentDialog: (() => React.JSX.Element) & {
|
|
20
|
-
|
|
19
|
+
export declare const GenerateContentDialog: (() => React.JSX.Element) & React.NamedExoticComponent<unknown> & {
|
|
20
|
+
readonly type: () => React.JSX.Element;
|
|
21
21
|
};
|
|
@@ -6,11 +6,11 @@ const ROLE_TEXT = {
|
|
|
6
6
|
},
|
|
7
7
|
standard: {
|
|
8
8
|
label: "Standard",
|
|
9
|
-
description: "The workhorse. Anything that writes content a person will read, or has to follow a schema and call tools.
|
|
9
|
+
description: "The workhorse. Anything that writes content a person will read, or has to follow a schema and call tools. Fast falls back to this one when left empty."
|
|
10
10
|
},
|
|
11
11
|
vision: {
|
|
12
12
|
label: "Vision",
|
|
13
|
-
description: "Work that reads images. Pick a model that accepts image input.
|
|
13
|
+
description: "Work that reads images, such as image enrichment. Pick a model that accepts image input. There is no fallback: left empty, image features stop and say so."
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
const AI_MODEL_ROLE_DISPLAY = AI_MODEL_ROLE_IDS.map((id)=>({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/modelRoles.js","sources":["../../../src/admin/presentation/modelRoles.ts"],"sourcesContent":["import { AI_MODEL_ROLE_IDS } from \"~/admin/domain/modelRoles.js\";\nimport type { AiModelRoleId } from \"~/admin/domain/modelRoles.js\";\n\n/**\n * The model roles, as the settings screen presents them. The ids live in\n * `~/admin/domain/modelRoles.js`; this owns the words.\n *\n * Typed as a full record, so adding a role id without a label is a compile error.\n */\nconst ROLE_TEXT: Record<AiModelRoleId, { label: string; description: string }> = {\n fast: {\n label: \"Fast\",\n description:\n \"Cheap, low-latency work where a smaller model is good enough: summarising, classifying, comparing.\"\n },\n standard: {\n label: \"Standard\",\n description:\n \"The workhorse. Anything that writes content a person will read, or has to follow a schema and call tools.
|
|
1
|
+
{"version":3,"file":"admin/presentation/modelRoles.js","sources":["../../../src/admin/presentation/modelRoles.ts"],"sourcesContent":["import { AI_MODEL_ROLE_IDS } from \"~/admin/domain/modelRoles.js\";\nimport type { AiModelRoleId } from \"~/admin/domain/modelRoles.js\";\n\n/**\n * The model roles, as the settings screen presents them. The ids live in\n * `~/admin/domain/modelRoles.js`; this owns the words.\n *\n * Typed as a full record, so adding a role id without a label is a compile error.\n */\nconst ROLE_TEXT: Record<AiModelRoleId, { label: string; description: string }> = {\n fast: {\n label: \"Fast\",\n description:\n \"Cheap, low-latency work where a smaller model is good enough: summarising, classifying, comparing.\"\n },\n standard: {\n label: \"Standard\",\n description:\n \"The workhorse. Anything that writes content a person will read, or has to follow a schema and call tools. Fast falls back to this one when left empty.\"\n },\n vision: {\n label: \"Vision\",\n description:\n \"Work that reads images, such as image enrichment. Pick a model that accepts image input. There is no fallback: left empty, image features stop and say so.\"\n }\n};\n\nexport { AI_MODEL_ROLE_IDS };\nexport type { AiModelRoleId };\n\nexport const AI_MODEL_ROLE_DISPLAY = AI_MODEL_ROLE_IDS.map(id => ({ id, ...ROLE_TEXT[id] }));\n\nexport const roleLabel = (id: string): string =>\n id in ROLE_TEXT ? ROLE_TEXT[id as AiModelRoleId].label : id;\n"],"names":["ROLE_TEXT","AI_MODEL_ROLE_DISPLAY","AI_MODEL_ROLE_IDS","id","roleLabel"],"mappings":";AASA,MAAMA,YAA2E;IAC7E,MAAM;QACF,OAAO;QACP,aACI;IACR;IACA,UAAU;QACN,OAAO;QACP,aACI;IACR;IACA,QAAQ;QACJ,OAAO;QACP,aACI;IACR;AACJ;AAKO,MAAMC,wBAAwBC,kBAAkB,GAAG,CAACC,CAAAA,KAAO;QAAEA;QAAI,GAAGH,SAAS,CAACG,GAAG;IAAC;AAElF,MAAMC,YAAY,CAACD,KACtBA,MAAMH,YAAYA,SAAS,CAACG,GAAoB,CAAC,KAAK,GAAGA"}
|