@webiny/ai-powerups 0.0.0-unstable.e6f0dc8ca7
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 +2 -0
- package/AiPowerups.js +12 -0
- package/AiPowerups.js.map +1 -0
- package/LICENSE +36 -0
- package/README.md +11 -0
- package/admin/Extension.d.ts +2 -0
- package/admin/Extension.js +39 -0
- package/admin/Extension.js.map +1 -0
- package/admin/domain/errors.d.ts +12 -0
- package/admin/domain/errors.js +22 -0
- package/admin/domain/errors.js.map +1 -0
- package/admin/features/feature.d.ts +1 -0
- package/admin/features/feature.js +21 -0
- package/admin/features/feature.js.map +1 -0
- package/admin/features/generatePageContent/GeneratePageContentGateway.d.ts +12 -0
- package/admin/features/generatePageContent/GeneratePageContentGateway.js +42 -0
- package/admin/features/generatePageContent/GeneratePageContentGateway.js.map +1 -0
- package/admin/features/generatePageContent/GeneratePageContentUseCase.d.ts +11 -0
- package/admin/features/generatePageContent/GeneratePageContentUseCase.js +15 -0
- package/admin/features/generatePageContent/GeneratePageContentUseCase.js.map +1 -0
- package/admin/features/generatePageContent/abstractions.d.ts +24 -0
- package/admin/features/generatePageContent/abstractions.js +5 -0
- package/admin/features/generatePageContent/abstractions.js.map +1 -0
- package/admin/features/generatePageContent/feature.d.ts +1 -0
- package/admin/features/generatePageContent/feature.js +12 -0
- package/admin/features/generatePageContent/feature.js.map +1 -0
- package/admin/features/generatePageContent/index.d.ts +3 -0
- package/admin/features/generatePageContent/index.js +4 -0
- package/admin/features/generatePageContent/index.js.map +1 -0
- package/admin/features/listModels/ListModelsGateway.d.ts +12 -0
- package/admin/features/listModels/ListModelsGateway.js +31 -0
- package/admin/features/listModels/ListModelsGateway.js.map +1 -0
- package/admin/features/listModels/ListModelsRepository.d.ts +13 -0
- package/admin/features/listModels/ListModelsRepository.js +24 -0
- package/admin/features/listModels/ListModelsRepository.js.map +1 -0
- package/admin/features/listModels/ListModelsUseCase.d.ts +10 -0
- package/admin/features/listModels/ListModelsUseCase.js +15 -0
- package/admin/features/listModels/ListModelsUseCase.js.map +1 -0
- package/admin/features/listModels/abstractions.d.ts +28 -0
- package/admin/features/listModels/abstractions.js +6 -0
- package/admin/features/listModels/abstractions.js.map +1 -0
- package/admin/features/listModels/feature.d.ts +3 -0
- package/admin/features/listModels/feature.js +20 -0
- package/admin/features/listModels/feature.js.map +1 -0
- package/admin/features/listModels/index.d.ts +2 -0
- package/admin/features/listModels/index.js +4 -0
- package/admin/features/listModels/index.js.map +1 -0
- package/admin/features/settings/getSettings/GetSettingsGateway.d.ts +12 -0
- package/admin/features/settings/getSettings/GetSettingsGateway.js +26 -0
- package/admin/features/settings/getSettings/GetSettingsGateway.js.map +1 -0
- package/admin/features/settings/getSettings/GetSettingsRepository.d.ts +14 -0
- package/admin/features/settings/getSettings/GetSettingsRepository.js +31 -0
- package/admin/features/settings/getSettings/GetSettingsRepository.js.map +1 -0
- package/admin/features/settings/getSettings/GetSettingsUseCase.d.ts +11 -0
- package/admin/features/settings/getSettings/GetSettingsUseCase.js +15 -0
- package/admin/features/settings/getSettings/GetSettingsUseCase.js.map +1 -0
- package/admin/features/settings/getSettings/abstractions.d.ts +22 -0
- package/admin/features/settings/getSettings/abstractions.js +6 -0
- package/admin/features/settings/getSettings/abstractions.js.map +1 -0
- package/admin/features/settings/getSettings/feature.d.ts +3 -0
- package/admin/features/settings/getSettings/feature.js +20 -0
- package/admin/features/settings/getSettings/feature.js.map +1 -0
- package/admin/features/settings/getSettings/index.d.ts +2 -0
- package/admin/features/settings/getSettings/index.js +4 -0
- package/admin/features/settings/getSettings/index.js.map +1 -0
- package/admin/features/settings/shared/SettingsCache.d.ts +10 -0
- package/admin/features/settings/shared/SettingsCache.js +18 -0
- package/admin/features/settings/shared/SettingsCache.js.map +1 -0
- package/admin/features/settings/shared/abstractions.d.ts +50 -0
- package/admin/features/settings/shared/abstractions.js +4 -0
- package/admin/features/settings/shared/abstractions.js.map +1 -0
- package/admin/features/settings/shared/feature.d.ts +3 -0
- package/admin/features/settings/shared/feature.js +16 -0
- package/admin/features/settings/shared/feature.js.map +1 -0
- package/admin/features/settings/shared/index.d.ts +2 -0
- package/admin/features/settings/shared/index.js +4 -0
- package/admin/features/settings/shared/index.js.map +1 -0
- package/admin/features/settings/updateSettings/UpdateSettingsGateway.d.ts +12 -0
- package/admin/features/settings/updateSettings/UpdateSettingsGateway.js +44 -0
- package/admin/features/settings/updateSettings/UpdateSettingsGateway.js.map +1 -0
- package/admin/features/settings/updateSettings/UpdateSettingsRepository.d.ts +13 -0
- package/admin/features/settings/updateSettings/UpdateSettingsRepository.js +19 -0
- package/admin/features/settings/updateSettings/UpdateSettingsRepository.js.map +1 -0
- package/admin/features/settings/updateSettings/UpdateSettingsUseCase.d.ts +11 -0
- package/admin/features/settings/updateSettings/UpdateSettingsUseCase.js +15 -0
- package/admin/features/settings/updateSettings/UpdateSettingsUseCase.js.map +1 -0
- package/admin/features/settings/updateSettings/abstractions.d.ts +22 -0
- package/admin/features/settings/updateSettings/abstractions.js +6 -0
- package/admin/features/settings/updateSettings/abstractions.js.map +1 -0
- package/admin/features/settings/updateSettings/feature.d.ts +3 -0
- package/admin/features/settings/updateSettings/feature.js +20 -0
- package/admin/features/settings/updateSettings/feature.js.map +1 -0
- package/admin/features/settings/updateSettings/index.d.ts +2 -0
- package/admin/features/settings/updateSettings/index.js +4 -0
- package/admin/features/settings/updateSettings/index.js.map +1 -0
- package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.d.ts +4 -0
- package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.js +53 -0
- package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.js.map +1 -0
- package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPresenter.d.ts +26 -0
- package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPresenter.js +158 -0
- package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPresenter.js.map +1 -0
- package/admin/presentation/AiPowerUpsSettings/abstractions.d.ts +18 -0
- package/admin/presentation/AiPowerUpsSettings/abstractions.js +4 -0
- package/admin/presentation/AiPowerUpsSettings/abstractions.js.map +1 -0
- package/admin/presentation/AiPowerUpsSettings/feature.d.ts +3 -0
- package/admin/presentation/AiPowerUpsSettings/feature.js +24 -0
- package/admin/presentation/AiPowerUpsSettings/feature.js.map +1 -0
- package/admin/presentation/AiPowerUpsSettings/index.d.ts +3 -0
- package/admin/presentation/AiPowerUpsSettings/index.js +5 -0
- package/admin/presentation/AiPowerUpsSettings/index.js.map +1 -0
- package/admin/presentation/AiPowerUpsSettings/settingsGroup.d.ts +17 -0
- package/admin/presentation/AiPowerUpsSettings/settingsGroup.js +4 -0
- package/admin/presentation/AiPowerUpsSettings/settingsGroup.js.map +1 -0
- package/admin/presentation/AiPowerUpsSettings/useAiPowerUpsSettings.d.ts +4 -0
- package/admin/presentation/AiPowerUpsSettings/useAiPowerUpsSettings.js +28 -0
- package/admin/presentation/AiPowerUpsSettings/useAiPowerUpsSettings.js.map +1 -0
- package/admin/presentation/ProjectsSettings.d.ts +11 -0
- package/admin/presentation/ProjectsSettings.js +55 -0
- package/admin/presentation/ProjectsSettings.js.map +1 -0
- package/admin/presentation/ProvidersSettings.d.ts +16 -0
- package/admin/presentation/ProvidersSettings.js +40 -0
- package/admin/presentation/ProvidersSettings.js.map +1 -0
- package/admin/presentation/ReaderPersonasSettings.d.ts +11 -0
- package/admin/presentation/ReaderPersonasSettings.js +32 -0
- package/admin/presentation/ReaderPersonasSettings.js.map +1 -0
- package/admin/presentation/WbContentGeneration/Extension.d.ts +2 -0
- package/admin/presentation/WbContentGeneration/Extension.js +23 -0
- package/admin/presentation/WbContentGeneration/Extension.js.map +1 -0
- package/admin/presentation/WbContentGeneration/GenerateContentButton.d.ts +2 -0
- package/admin/presentation/WbContentGeneration/GenerateContentButton.js +24 -0
- package/admin/presentation/WbContentGeneration/GenerateContentButton.js.map +1 -0
- package/admin/presentation/WbContentGeneration/GenerateContentDialog.d.ts +21 -0
- package/admin/presentation/WbContentGeneration/GenerateContentDialog.js +107 -0
- package/admin/presentation/WbContentGeneration/GenerateContentDialog.js.map +1 -0
- package/admin/presentation/WbContentGeneration/GenerateContentPresenter.d.ts +38 -0
- package/admin/presentation/WbContentGeneration/GenerateContentPresenter.js +231 -0
- package/admin/presentation/WbContentGeneration/GenerateContentPresenter.js.map +1 -0
- package/admin/presentation/WbContentGeneration/PROCESS_IDEA.md +190 -0
- package/admin/presentation/WbContentGeneration/abstractions.d.ts +30 -0
- package/admin/presentation/WbContentGeneration/abstractions.js +4 -0
- package/admin/presentation/WbContentGeneration/abstractions.js.map +1 -0
- package/admin/presentation/WbContentGeneration/decompressGzipBase64.d.ts +1 -0
- package/admin/presentation/WbContentGeneration/decompressGzipBase64.js +14 -0
- package/admin/presentation/WbContentGeneration/decompressGzipBase64.js.map +1 -0
- package/admin/presentation/WbContentGeneration/feature.d.ts +3 -0
- package/admin/presentation/WbContentGeneration/feature.js +16 -0
- package/admin/presentation/WbContentGeneration/feature.js.map +1 -0
- package/admin/presentation/WriterPersonasSettings.d.ts +11 -0
- package/admin/presentation/WriterPersonasSettings.js +32 -0
- package/admin/presentation/WriterPersonasSettings.js.map +1 -0
- package/admin/routes.d.ts +4 -0
- package/admin/routes.js +9 -0
- package/admin/routes.js.map +1 -0
- package/api/Extension.d.ts +4 -0
- package/api/Extension.js +36 -0
- package/api/Extension.js.map +1 -0
- package/api/constants.d.ts +1 -0
- package/api/constants.js +3 -0
- package/api/constants.js.map +1 -0
- package/api/features/AiImageEnrichment/AiImageEnrichmentAfterCreateHandler.d.ts +11 -0
- package/api/features/AiImageEnrichment/AiImageEnrichmentAfterCreateHandler.js +28 -0
- package/api/features/AiImageEnrichment/AiImageEnrichmentAfterCreateHandler.js.map +1 -0
- package/api/features/AiImageEnrichment/AiImageEnrichmentTask.d.ts +34 -0
- package/api/features/AiImageEnrichment/AiImageEnrichmentTask.js +132 -0
- package/api/features/AiImageEnrichment/AiImageEnrichmentTask.js.map +1 -0
- package/api/features/AiImageEnrichment/feature.d.ts +4 -0
- package/api/features/AiImageEnrichment/feature.js +12 -0
- package/api/features/AiImageEnrichment/feature.js.map +1 -0
- package/api/features/AiPromptContext/AiPromptContextBuilder.d.ts +19 -0
- package/api/features/AiPromptContext/AiPromptContextBuilder.js +154 -0
- package/api/features/AiPromptContext/AiPromptContextBuilder.js.map +1 -0
- package/api/features/AiPromptContext/ProjectSection.d.ts +4 -0
- package/api/features/AiPromptContext/ProjectSection.js +22 -0
- package/api/features/AiPromptContext/ProjectSection.js.map +1 -0
- package/api/features/AiPromptContext/ReaderPersonaSection.d.ts +4 -0
- package/api/features/AiPromptContext/ReaderPersonaSection.js +11 -0
- package/api/features/AiPromptContext/ReaderPersonaSection.js.map +1 -0
- package/api/features/AiPromptContext/WriterPersonaSection.d.ts +4 -0
- package/api/features/AiPromptContext/WriterPersonaSection.js +11 -0
- package/api/features/AiPromptContext/WriterPersonaSection.js.map +1 -0
- package/api/features/AiPromptContext/abstractions.d.ts +37 -0
- package/api/features/AiPromptContext/abstractions.js +4 -0
- package/api/features/AiPromptContext/abstractions.js.map +1 -0
- package/api/features/AiPromptContext/feature.d.ts +4 -0
- package/api/features/AiPromptContext/feature.js +10 -0
- package/api/features/AiPromptContext/feature.js.map +1 -0
- package/api/features/AiPromptContext/index.d.ts +1 -0
- package/api/features/AiPromptContext/index.js +3 -0
- package/api/features/AiPromptContext/index.js.map +1 -0
- package/api/features/GetSettings/GetSettingsRepository.d.ts +16 -0
- package/api/features/GetSettings/GetSettingsRepository.js +40 -0
- package/api/features/GetSettings/GetSettingsRepository.js.map +1 -0
- package/api/features/GetSettings/GetSettingsUseCase.d.ts +10 -0
- package/api/features/GetSettings/GetSettingsUseCase.js +15 -0
- package/api/features/GetSettings/GetSettingsUseCase.js.map +1 -0
- package/api/features/GetSettings/abstractions.d.ts +16 -0
- package/api/features/GetSettings/abstractions.js +5 -0
- package/api/features/GetSettings/abstractions.js.map +1 -0
- package/api/features/GetSettings/feature.d.ts +4 -0
- package/api/features/GetSettings/feature.js +12 -0
- package/api/features/GetSettings/feature.js.map +1 -0
- package/api/features/GetSettings/index.d.ts +1 -0
- package/api/features/GetSettings/index.js +3 -0
- package/api/features/GetSettings/index.js.map +1 -0
- package/api/features/Projects/ProjectsHandler.d.ts +31 -0
- package/api/features/Projects/ProjectsHandler.js +101 -0
- package/api/features/Projects/ProjectsHandler.js.map +1 -0
- package/api/features/Projects/feature.d.ts +4 -0
- package/api/features/Projects/feature.js +10 -0
- package/api/features/Projects/feature.js.map +1 -0
- package/api/features/Projects/types.d.ts +50 -0
- package/api/features/Projects/types.js +3 -0
- package/api/features/Projects/types.js.map +1 -0
- package/api/features/Providers/ProvidersGraphQLMapper.d.ts +21 -0
- package/api/features/Providers/ProvidersGraphQLMapper.js +36 -0
- package/api/features/Providers/ProvidersGraphQLMapper.js.map +1 -0
- package/api/features/Providers/ProvidersHandler.d.ts +26 -0
- package/api/features/Providers/ProvidersHandler.js +76 -0
- package/api/features/Providers/ProvidersHandler.js.map +1 -0
- package/api/features/Providers/feature.d.ts +4 -0
- package/api/features/Providers/feature.js +12 -0
- package/api/features/Providers/feature.js.map +1 -0
- package/api/features/Providers/index.d.ts +1 -0
- package/api/features/Providers/index.js +3 -0
- package/api/features/Providers/index.js.map +1 -0
- package/api/features/Providers/types.d.ts +29 -0
- package/api/features/Providers/types.js +3 -0
- package/api/features/Providers/types.js.map +1 -0
- package/api/features/ReaderPersonas/ReaderPersonasHandler.d.ts +20 -0
- package/api/features/ReaderPersonas/ReaderPersonasHandler.js +42 -0
- package/api/features/ReaderPersonas/ReaderPersonasHandler.js.map +1 -0
- package/api/features/ReaderPersonas/feature.d.ts +4 -0
- package/api/features/ReaderPersonas/feature.js +10 -0
- package/api/features/ReaderPersonas/feature.js.map +1 -0
- package/api/features/ReaderPersonas/index.d.ts +2 -0
- package/api/features/ReaderPersonas/index.js +3 -0
- package/api/features/ReaderPersonas/index.js.map +1 -0
- package/api/features/ReaderPersonas/types.d.ts +24 -0
- package/api/features/ReaderPersonas/types.js +3 -0
- package/api/features/ReaderPersonas/types.js.map +1 -0
- package/api/features/UpdateSettings/UpdateSettingsRepository.d.ts +16 -0
- package/api/features/UpdateSettings/UpdateSettingsRepository.js +77 -0
- package/api/features/UpdateSettings/UpdateSettingsRepository.js.map +1 -0
- package/api/features/UpdateSettings/UpdateSettingsUseCase.d.ts +13 -0
- package/api/features/UpdateSettings/UpdateSettingsUseCase.js +28 -0
- package/api/features/UpdateSettings/UpdateSettingsUseCase.js.map +1 -0
- package/api/features/UpdateSettings/abstractions.d.ts +36 -0
- package/api/features/UpdateSettings/abstractions.js +10 -0
- package/api/features/UpdateSettings/abstractions.js.map +1 -0
- package/api/features/UpdateSettings/errors.d.ts +10 -0
- package/api/features/UpdateSettings/errors.js +14 -0
- package/api/features/UpdateSettings/errors.js.map +1 -0
- package/api/features/UpdateSettings/events.d.ts +10 -0
- package/api/features/UpdateSettings/events.js +16 -0
- package/api/features/UpdateSettings/events.js.map +1 -0
- package/api/features/UpdateSettings/feature.d.ts +4 -0
- package/api/features/UpdateSettings/feature.js +12 -0
- package/api/features/UpdateSettings/feature.js.map +1 -0
- package/api/features/UpdateSettings/index.d.ts +1 -0
- package/api/features/UpdateSettings/index.js +3 -0
- package/api/features/UpdateSettings/index.js.map +1 -0
- package/api/features/WbGeneratePageContent/WbGeneratePageContentTask.d.ts +33 -0
- package/api/features/WbGeneratePageContent/WbGeneratePageContentTask.js +76 -0
- package/api/features/WbGeneratePageContent/WbGeneratePageContentTask.js.map +1 -0
- package/api/features/WbGeneratePageContent/WbGeneratePageContentUseCase.d.ts +21 -0
- package/api/features/WbGeneratePageContent/WbGeneratePageContentUseCase.js +79 -0
- package/api/features/WbGeneratePageContent/WbGeneratePageContentUseCase.js.map +1 -0
- package/api/features/WbGeneratePageContent/abstractions.d.ts +18 -0
- package/api/features/WbGeneratePageContent/abstractions.js +4 -0
- package/api/features/WbGeneratePageContent/abstractions.js.map +1 -0
- package/api/features/WbGeneratePageContent/buildPrompt.d.ts +1 -0
- package/api/features/WbGeneratePageContent/buildPrompt.js +142 -0
- package/api/features/WbGeneratePageContent/buildPrompt.js.map +1 -0
- package/api/features/WbGeneratePageContent/feature.d.ts +4 -0
- package/api/features/WbGeneratePageContent/feature.js +12 -0
- package/api/features/WbGeneratePageContent/feature.js.map +1 -0
- package/api/features/WbGeneratePageContent/index.d.ts +1 -0
- package/api/features/WbGeneratePageContent/index.js +3 -0
- package/api/features/WbGeneratePageContent/index.js.map +1 -0
- package/api/features/WriterPersonas/WriterPersonasHandler.d.ts +20 -0
- package/api/features/WriterPersonas/WriterPersonasHandler.js +42 -0
- package/api/features/WriterPersonas/WriterPersonasHandler.js.map +1 -0
- package/api/features/WriterPersonas/feature.d.ts +4 -0
- package/api/features/WriterPersonas/feature.js +10 -0
- package/api/features/WriterPersonas/feature.js.map +1 -0
- package/api/features/WriterPersonas/index.d.ts +2 -0
- package/api/features/WriterPersonas/index.js +3 -0
- package/api/features/WriterPersonas/index.js.map +1 -0
- package/api/features/WriterPersonas/types.d.ts +24 -0
- package/api/features/WriterPersonas/types.js +3 -0
- package/api/features/WriterPersonas/types.js.map +1 -0
- package/api/features/shared/SettingsCache.d.ts +12 -0
- package/api/features/shared/SettingsCache.js +19 -0
- package/api/features/shared/SettingsCache.js.map +1 -0
- package/api/features/shared/abstractions.d.ts +33 -0
- package/api/features/shared/abstractions.js +6 -0
- package/api/features/shared/abstractions.js.map +1 -0
- package/api/features/shared/index.d.ts +3 -0
- package/api/features/shared/index.js +5 -0
- package/api/features/shared/index.js.map +1 -0
- package/api/graphql/AiPowerUpsSettingsGraphQLMapper.d.ts +13 -0
- package/api/graphql/AiPowerUpsSettingsGraphQLMapper.js +35 -0
- package/api/graphql/AiPowerUpsSettingsGraphQLMapper.js.map +1 -0
- package/api/graphql/BaseGraphQLSchema.d.ts +8 -0
- package/api/graphql/BaseGraphQLSchema.js +141 -0
- package/api/graphql/BaseGraphQLSchema.js.map +1 -0
- package/api/graphql/abstractions.d.ts +9 -0
- package/api/graphql/abstractions.js +4 -0
- package/api/graphql/abstractions.js.map +1 -0
- package/api/types.d.ts +5 -0
- package/api/types.js +7 -0
- package/api/types.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +3 -0
- package/index.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# PROMPT (sent to AI via generateObject)
|
|
2
|
+
|
|
3
|
+
## System Prompt
|
|
4
|
+
|
|
5
|
+
You are a page content generator. Given a user prompt, generate structured page
|
|
6
|
+
content using the provided component catalog and available actions.
|
|
7
|
+
|
|
8
|
+
### Component Catalog
|
|
9
|
+
|
|
10
|
+
```json
|
|
11
|
+
{
|
|
12
|
+
"components": {
|
|
13
|
+
"Webiny/Hero": {
|
|
14
|
+
"name": "Webiny/Hero",
|
|
15
|
+
"label": "Hero",
|
|
16
|
+
"inputs": [
|
|
17
|
+
{ "type": "text", "name": "title", "required": true },
|
|
18
|
+
{ "type": "lexical", "name": "description" },
|
|
19
|
+
{ "type": "image", "name": "heroImage" },
|
|
20
|
+
{ "type": "lexical", "name": "footerText" }
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"Webiny/Grid": {
|
|
24
|
+
"name": "Webiny/Grid",
|
|
25
|
+
"label": "Grid",
|
|
26
|
+
"inputs": [
|
|
27
|
+
{ "type": "text", "name": "gridLayout" },
|
|
28
|
+
{ "type": "number", "name": "rowCount", "minValue": 1 },
|
|
29
|
+
{ "type": "number", "name": "columnGap" },
|
|
30
|
+
{ "type": "number", "name": "rowGap" },
|
|
31
|
+
{
|
|
32
|
+
"type": "select",
|
|
33
|
+
"name": "stackAtBreakpoint",
|
|
34
|
+
"options": ["tablet", "mobile"]
|
|
35
|
+
},
|
|
36
|
+
{ "type": "boolean", "name": "reverseWhenStacked" },
|
|
37
|
+
{
|
|
38
|
+
"type": "object",
|
|
39
|
+
"name": "columns",
|
|
40
|
+
"list": true,
|
|
41
|
+
"fields": [
|
|
42
|
+
{
|
|
43
|
+
"type": "slot",
|
|
44
|
+
"list": false,
|
|
45
|
+
"name": "children",
|
|
46
|
+
"components": ["Webiny/GridColumn"]
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"Webiny/GridColumn": {
|
|
53
|
+
"name": "Webiny/GridColumn",
|
|
54
|
+
"label": "Column",
|
|
55
|
+
"inputs": [{ "type": "slot", "list": true, "name": "children" }]
|
|
56
|
+
},
|
|
57
|
+
"Webiny/Lexical": {
|
|
58
|
+
"name": "Webiny/Lexical",
|
|
59
|
+
"label": "Rich Text",
|
|
60
|
+
"inputs": [{ "type": "lexical", "name": "content" }]
|
|
61
|
+
},
|
|
62
|
+
"Webiny/Box": {
|
|
63
|
+
"name": "Webiny/Box",
|
|
64
|
+
"label": "Box",
|
|
65
|
+
"inputs": [{ "type": "slot", "list": true, "name": "children" }]
|
|
66
|
+
},
|
|
67
|
+
"Webiny/ProductCard": {
|
|
68
|
+
"name": "Webiny/ProductCard",
|
|
69
|
+
"label": "Product Card",
|
|
70
|
+
"inputs": [
|
|
71
|
+
{ "type": "product", "name": "product" },
|
|
72
|
+
{ "type": "boolean", "name": "showPrice" },
|
|
73
|
+
{ "type": "boolean", "name": "showRating" }
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Grid layout options: `12`, `6-6`, `4-4-4`, `8-4`, `4-8`, `3-3-3-3`
|
|
81
|
+
|
|
82
|
+
### Available Tools
|
|
83
|
+
|
|
84
|
+
For input fields that require post-processing, wrap the value in a tool
|
|
85
|
+
envelope: `{ "tool": "<toolName>", "params": { ... } }`.
|
|
86
|
+
|
|
87
|
+
Plain values (text, number, boolean, select) should be set directly without
|
|
88
|
+
an envelope.
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"tools": {
|
|
93
|
+
"htmlToLexical": {
|
|
94
|
+
"description": "Converts an HTML string into Lexical editor state. Use for all 'lexical' type inputs.",
|
|
95
|
+
"inputSchema": {
|
|
96
|
+
"type": "object",
|
|
97
|
+
"properties": {
|
|
98
|
+
"html": { "type": "string", "description": "HTML content" }
|
|
99
|
+
},
|
|
100
|
+
"required": ["html"]
|
|
101
|
+
},
|
|
102
|
+
"outputSchema": {
|
|
103
|
+
"type": "object",
|
|
104
|
+
"description": "Lexical editor state JSON"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"resolveImage": {
|
|
108
|
+
"description": "Fetches an image from the DAM matching the given tags and constraints.",
|
|
109
|
+
"inputSchema": {
|
|
110
|
+
"type": "object",
|
|
111
|
+
"properties": {
|
|
112
|
+
"tags": {
|
|
113
|
+
"type": "array",
|
|
114
|
+
"items": { "type": "string" },
|
|
115
|
+
"description": "Semantic tags describing the desired image"
|
|
116
|
+
},
|
|
117
|
+
"aspect": {
|
|
118
|
+
"type": "string",
|
|
119
|
+
"description": "Desired aspect ratio, e.g. '16:9', '1:1'"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"required": ["tags"]
|
|
123
|
+
},
|
|
124
|
+
"outputSchema": {
|
|
125
|
+
"type": "object",
|
|
126
|
+
"properties": {
|
|
127
|
+
"id": { "type": "string" },
|
|
128
|
+
"name": { "type": "string" },
|
|
129
|
+
"src": { "type": "string" },
|
|
130
|
+
"width": { "type": "number" },
|
|
131
|
+
"height": { "type": "number" },
|
|
132
|
+
"mimeType": { "type": "string" }
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"resolveProduct": {
|
|
137
|
+
"description": "Fetches a product reference from the e-commerce catalog.",
|
|
138
|
+
"inputSchema": {
|
|
139
|
+
"type": "object",
|
|
140
|
+
"properties": {
|
|
141
|
+
"query": {
|
|
142
|
+
"type": "string",
|
|
143
|
+
"description": "Search query or product name"
|
|
144
|
+
},
|
|
145
|
+
"sku": { "type": "string", "description": "Exact SKU if known" },
|
|
146
|
+
"category": {
|
|
147
|
+
"type": "string",
|
|
148
|
+
"description": "Product category to filter by"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"outputSchema": {
|
|
153
|
+
"type": "object",
|
|
154
|
+
"properties": {
|
|
155
|
+
"id": { "type": "string" },
|
|
156
|
+
"name": { "type": "string" },
|
|
157
|
+
"sku": { "type": "string" },
|
|
158
|
+
"price": { "type": "number" },
|
|
159
|
+
"currency": { "type": "string" },
|
|
160
|
+
"imageUrl": { "type": "string" }
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Page Schema
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
type ElementSchema = {
|
|
172
|
+
component: string;
|
|
173
|
+
inputs: Record<string, unknown>;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
type CreateElementAction = {
|
|
177
|
+
action: "CreateElement";
|
|
178
|
+
params: ElementSchema;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
type PageSchema = ElementSchema[];
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
For slot inputs, use `{ "action": "CreateElement", "params": { "component": "...", "inputs": { ... } } }`.
|
|
185
|
+
Note: `CreateElement` uses "action" — it is a structural instruction for the page builder, not a tool invocation.
|
|
186
|
+
|
|
187
|
+
## User Prompt
|
|
188
|
+
|
|
189
|
+
"Create a landing page for Nike Air Max 90 sneakers. Include a hero section
|
|
190
|
+
with a tagline, a features grid, and a section showing 3 related products."
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { IFormVM } from "@webiny/app-admin/features/formModel/abstractions.js";
|
|
2
|
+
export type CreateElementParams = {
|
|
3
|
+
componentName: string;
|
|
4
|
+
parentId: string;
|
|
5
|
+
slot: string;
|
|
6
|
+
index?: number;
|
|
7
|
+
bindings?: {
|
|
8
|
+
inputs?: Record<string, unknown>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export type CreateElementsFn = (elements: CreateElementParams[]) => void;
|
|
12
|
+
export interface IGenerateContentVm {
|
|
13
|
+
form: IFormVM | null;
|
|
14
|
+
loading: boolean;
|
|
15
|
+
submitting: boolean;
|
|
16
|
+
processing: boolean;
|
|
17
|
+
timedOut: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface IGenerateContentPresenter {
|
|
20
|
+
readonly vm: IGenerateContentVm;
|
|
21
|
+
init(components: Record<string, any>[], createElements: CreateElementsFn): void;
|
|
22
|
+
submit(): Promise<void>;
|
|
23
|
+
cancelPrompt(): void;
|
|
24
|
+
processAiResponse(responseText: string): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export declare const GenerateContentPresenter: import("@webiny/di").Abstraction<IGenerateContentPresenter>;
|
|
27
|
+
export declare namespace GenerateContentPresenter {
|
|
28
|
+
type Interface = IGenerateContentPresenter;
|
|
29
|
+
type ViewModel = IGenerateContentVm;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createAbstraction","GenerateContentPresenter"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { IFormVM } from \"@webiny/app-admin/features/formModel/abstractions.js\";\n\nexport type CreateElementParams = {\n componentName: string;\n parentId: string;\n slot: string;\n index?: number;\n bindings?: { inputs?: Record<string, unknown> };\n};\n\nexport type CreateElementsFn = (elements: CreateElementParams[]) => void;\n\nexport interface IGenerateContentVm {\n form: IFormVM | null;\n loading: boolean;\n submitting: boolean;\n processing: boolean;\n timedOut: boolean;\n}\n\nexport interface IGenerateContentPresenter {\n readonly vm: IGenerateContentVm;\n init(components: Record<string, any>[], createElements: CreateElementsFn): void;\n submit(): Promise<void>;\n cancelPrompt(): void;\n processAiResponse(responseText: string): Promise<void>;\n}\n\nexport const GenerateContentPresenter = createAbstraction<IGenerateContentPresenter>(\n \"WbContentGeneration/Presenter\"\n);\n\nexport namespace GenerateContentPresenter {\n export type Interface = IGenerateContentPresenter;\n export type ViewModel = IGenerateContentVm;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,uBAAuB;AA6BzD,OAAO,MAAMC,wBAAwB,GAAGD,iBAAiB,CACrD,+BACJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function decompressGzipBase64(base64: string): Promise<string>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export async function decompressGzipBase64(base64) {
|
|
2
|
+
const binary = atob(base64);
|
|
3
|
+
const bytes = new Uint8Array(binary.length);
|
|
4
|
+
for (let i = 0; i < binary.length; i++) {
|
|
5
|
+
bytes[i] = binary.charCodeAt(i);
|
|
6
|
+
}
|
|
7
|
+
const ds = new DecompressionStream("gzip");
|
|
8
|
+
const writer = ds.writable.getWriter();
|
|
9
|
+
writer.write(bytes);
|
|
10
|
+
writer.close();
|
|
11
|
+
return new Response(ds.readable).text();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=decompressGzipBase64.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["decompressGzipBase64","base64","binary","atob","bytes","Uint8Array","length","i","charCodeAt","ds","DecompressionStream","writer","writable","getWriter","write","close","Response","readable","text"],"sources":["decompressGzipBase64.ts"],"sourcesContent":["export async function decompressGzipBase64(base64: string): Promise<string> {\n const binary = atob(base64);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n const ds = new DecompressionStream(\"gzip\");\n const writer = ds.writable.getWriter();\n writer.write(bytes);\n writer.close();\n return new Response(ds.readable).text();\n}\n"],"mappings":"AAAA,OAAO,eAAeA,oBAAoBA,CAACC,MAAc,EAAmB;EACxE,MAAMC,MAAM,GAAGC,IAAI,CAACF,MAAM,CAAC;EAC3B,MAAMG,KAAK,GAAG,IAAIC,UAAU,CAACH,MAAM,CAACI,MAAM,CAAC;EAC3C,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,MAAM,CAACI,MAAM,EAAEC,CAAC,EAAE,EAAE;IACpCH,KAAK,CAACG,CAAC,CAAC,GAAGL,MAAM,CAACM,UAAU,CAACD,CAAC,CAAC;EACnC;EACA,MAAME,EAAE,GAAG,IAAIC,mBAAmB,CAAC,MAAM,CAAC;EAC1C,MAAMC,MAAM,GAAGF,EAAE,CAACG,QAAQ,CAACC,SAAS,CAAC,CAAC;EACtCF,MAAM,CAACG,KAAK,CAACV,KAAK,CAAC;EACnBO,MAAM,CAACI,KAAK,CAAC,CAAC;EACd,OAAO,IAAIC,QAAQ,CAACP,EAAE,CAACQ,QAAQ,CAAC,CAACC,IAAI,CAAC,CAAC;AAC3C","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/admin";
|
|
2
|
+
import { GenerateContentPresenter } from "./abstractions.js";
|
|
3
|
+
import { GenerateContentPresenterRegistration } from "./GenerateContentPresenter.js";
|
|
4
|
+
export const GenerateContentFeature = createFeature({
|
|
5
|
+
name: "WbContentGeneration/Presenter",
|
|
6
|
+
register(container) {
|
|
7
|
+
container.register(GenerateContentPresenterRegistration);
|
|
8
|
+
},
|
|
9
|
+
resolve(container) {
|
|
10
|
+
return {
|
|
11
|
+
presenter: container.resolve(GenerateContentPresenter)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createFeature","GenerateContentPresenter","GenerateContentPresenterRegistration","GenerateContentFeature","name","register","container","resolve","presenter"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { GenerateContentPresenter } from \"./abstractions.js\";\nimport { GenerateContentPresenterRegistration } from \"./GenerateContentPresenter.js\";\n\nexport const GenerateContentFeature = createFeature({\n name: \"WbContentGeneration/Presenter\",\n register(container) {\n container.register(GenerateContentPresenterRegistration);\n },\n resolve(container) {\n return {\n presenter: container.resolve(GenerateContentPresenter)\n };\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,uBAAuB;AACrD,SAASC,wBAAwB;AACjC,SAASC,oCAAoC;AAE7C,OAAO,MAAMC,sBAAsB,GAAGH,aAAa,CAAC;EAChDI,IAAI,EAAE,+BAA+B;EACrCC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACH,oCAAoC,CAAC;EAC5D,CAAC;EACDK,OAAOA,CAACD,SAAS,EAAE;IACf,OAAO;MACHE,SAAS,EAAEF,SAAS,CAACC,OAAO,CAACN,wBAAwB;IACzD,CAAC;EACL;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AiPowerUpsSettingsGroup } from "./AiPowerUpsSettings/settingsGroup.js";
|
|
2
|
+
declare class WriterPersonasSettingsImpl implements AiPowerUpsSettingsGroup.Interface {
|
|
3
|
+
name: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
buildForm(form: AiPowerUpsSettingsGroup.FormBuilder): void;
|
|
7
|
+
}
|
|
8
|
+
export declare const WriterPersonasSettings: typeof WriterPersonasSettingsImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("./AiPowerUpsSettings/settingsGroup.js").IAiPowerUpsSettingsGroup>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { generateAlphaNumericId } from "@webiny/utils";
|
|
2
|
+
import { AiPowerUpsSettingsGroup } from "./AiPowerUpsSettings/settingsGroup.js";
|
|
3
|
+
class WriterPersonasSettingsImpl {
|
|
4
|
+
name = "writerPersonas";
|
|
5
|
+
label = "Writer Personas";
|
|
6
|
+
description = "Define how text should be written.";
|
|
7
|
+
buildForm(form) {
|
|
8
|
+
form.fields(fields => ({
|
|
9
|
+
presets: fields.object().label("Presets").renderer("objectAccordionMultiple", {
|
|
10
|
+
container: false,
|
|
11
|
+
addItemLabel: "Add writer persona",
|
|
12
|
+
itemTitle: (data, index) => String(data.name || `Writer Persona #${index + 1}`)
|
|
13
|
+
}).fields(f => ({
|
|
14
|
+
id: f.text().hidden().defaultValue(() => generateAlphaNumericId(10)),
|
|
15
|
+
name: f.text().label("Name").required("Name is required").description("This name will be used to identify the writer persona in the UI."),
|
|
16
|
+
description: f.text().label("Description").required("Description is required").description("Describe how this persona writes and communicates. This will be used when prompting AI.").renderer("textarea", {
|
|
17
|
+
rows: 8
|
|
18
|
+
}),
|
|
19
|
+
style: f.text().label("Style").description("Optional hints about the tone or style this persona should adopt when writing.").renderer("textarea", {
|
|
20
|
+
rows: 3
|
|
21
|
+
})
|
|
22
|
+
})).list()
|
|
23
|
+
}));
|
|
24
|
+
form.layout(layout => [layout.row("presets")]);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export const WriterPersonasSettings = AiPowerUpsSettingsGroup.createImplementation({
|
|
28
|
+
implementation: WriterPersonasSettingsImpl,
|
|
29
|
+
dependencies: []
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=WriterPersonasSettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["generateAlphaNumericId","AiPowerUpsSettingsGroup","WriterPersonasSettingsImpl","name","label","description","buildForm","form","fields","presets","object","renderer","container","addItemLabel","itemTitle","data","index","String","f","id","text","hidden","defaultValue","required","rows","style","list","layout","row","WriterPersonasSettings","createImplementation","implementation","dependencies"],"sources":["WriterPersonasSettings.ts"],"sourcesContent":["import { generateAlphaNumericId } from \"@webiny/utils\";\nimport { AiPowerUpsSettingsGroup } from \"./AiPowerUpsSettings/settingsGroup.js\";\n\nclass WriterPersonasSettingsImpl implements AiPowerUpsSettingsGroup.Interface {\n name = \"writerPersonas\";\n label = \"Writer Personas\";\n description = \"Define how text should be written.\";\n\n buildForm(form: AiPowerUpsSettingsGroup.FormBuilder): void {\n form.fields(fields => ({\n presets: fields\n .object()\n .label(\"Presets\")\n .renderer(\"objectAccordionMultiple\", {\n container: false,\n addItemLabel: \"Add writer persona\",\n itemTitle: (data, index) => String(data.name || `Writer Persona #${index + 1}`)\n })\n .fields(f => ({\n id: f\n .text()\n .hidden()\n .defaultValue(() => generateAlphaNumericId(10)),\n name: f\n .text()\n .label(\"Name\")\n .required(\"Name is required\")\n .description(\n \"This name will be used to identify the writer persona in the UI.\"\n ),\n description: f\n .text()\n .label(\"Description\")\n .required(\"Description is required\")\n .description(\n \"Describe how this persona writes and communicates. This will be used when prompting AI.\"\n )\n .renderer(\"textarea\", { rows: 8 }),\n style: f\n .text()\n .label(\"Style\")\n .description(\n \"Optional hints about the tone or style this persona should adopt when writing.\"\n )\n .renderer(\"textarea\", { rows: 3 })\n }))\n .list()\n }));\n\n form.layout(layout => [layout.row(\"presets\")]);\n }\n}\n\nexport const WriterPersonasSettings = AiPowerUpsSettingsGroup.createImplementation({\n implementation: WriterPersonasSettingsImpl,\n dependencies: []\n});\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,eAAe;AACtD,SAASC,uBAAuB;AAEhC,MAAMC,0BAA0B,CAA8C;EAC1EC,IAAI,GAAG,gBAAgB;EACvBC,KAAK,GAAG,iBAAiB;EACzBC,WAAW,GAAG,oCAAoC;EAElDC,SAASA,CAACC,IAAyC,EAAQ;IACvDA,IAAI,CAACC,MAAM,CAACA,MAAM,KAAK;MACnBC,OAAO,EAAED,MAAM,CACVE,MAAM,CAAC,CAAC,CACRN,KAAK,CAAC,SAAS,CAAC,CAChBO,QAAQ,CAAC,yBAAyB,EAAE;QACjCC,SAAS,EAAE,KAAK;QAChBC,YAAY,EAAE,oBAAoB;QAClCC,SAAS,EAAEA,CAACC,IAAI,EAAEC,KAAK,KAAKC,MAAM,CAACF,IAAI,CAACZ,IAAI,IAAI,mBAAmBa,KAAK,GAAG,CAAC,EAAE;MAClF,CAAC,CAAC,CACDR,MAAM,CAACU,CAAC,KAAK;QACVC,EAAE,EAAED,CAAC,CACAE,IAAI,CAAC,CAAC,CACNC,MAAM,CAAC,CAAC,CACRC,YAAY,CAAC,MAAMtB,sBAAsB,CAAC,EAAE,CAAC,CAAC;QACnDG,IAAI,EAAEe,CAAC,CACFE,IAAI,CAAC,CAAC,CACNhB,KAAK,CAAC,MAAM,CAAC,CACbmB,QAAQ,CAAC,kBAAkB,CAAC,CAC5BlB,WAAW,CACR,kEACJ,CAAC;QACLA,WAAW,EAAEa,CAAC,CACTE,IAAI,CAAC,CAAC,CACNhB,KAAK,CAAC,aAAa,CAAC,CACpBmB,QAAQ,CAAC,yBAAyB,CAAC,CACnClB,WAAW,CACR,yFACJ,CAAC,CACAM,QAAQ,CAAC,UAAU,EAAE;UAAEa,IAAI,EAAE;QAAE,CAAC,CAAC;QACtCC,KAAK,EAAEP,CAAC,CACHE,IAAI,CAAC,CAAC,CACNhB,KAAK,CAAC,OAAO,CAAC,CACdC,WAAW,CACR,gFACJ,CAAC,CACAM,QAAQ,CAAC,UAAU,EAAE;UAAEa,IAAI,EAAE;QAAE,CAAC;MACzC,CAAC,CAAC,CAAC,CACFE,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;IAEHnB,IAAI,CAACoB,MAAM,CAACA,MAAM,IAAI,CAACA,MAAM,CAACC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;EAClD;AACJ;AAEA,OAAO,MAAMC,sBAAsB,GAAG5B,uBAAuB,CAAC6B,oBAAoB,CAAC;EAC/EC,cAAc,EAAE7B,0BAA0B;EAC1C8B,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
|
package/admin/routes.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Route","Routes","Settings","name","path"],"sources":["routes.ts"],"sourcesContent":["import { Route } from \"@webiny/app-admin\";\n\nexport const Routes = {\n Settings: new Route({\n name: \"AiPowerUps/Settings\",\n path: \"/settings/ai-powerups\"\n })\n};\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,mBAAmB;AAEzC,OAAO,MAAMC,MAAM,GAAG;EAClBC,QAAQ,EAAE,IAAIF,KAAK,CAAC;IAChBG,IAAI,EAAE,qBAAqB;IAC3BC,IAAI,EAAE;EACV,CAAC;AACL,CAAC","ignoreList":[]}
|
package/api/Extension.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { WcpContext } from "@webiny/api-core/features/wcp/WcpContext/index.js";
|
|
3
|
+
import { BaseGraphQLSchema } from "./graphql/BaseGraphQLSchema.js";
|
|
4
|
+
import AiPowerUpsSettingsGraphQLMapperImpl from "./graphql/AiPowerUpsSettingsGraphQLMapper.js";
|
|
5
|
+
import { AiPowerUpsSettingsCache } from "./features/shared/SettingsCache.js";
|
|
6
|
+
import { GetSettingsFeature } from "./features/GetSettings/feature.js";
|
|
7
|
+
import { UpdateSettingsFeature } from "./features/UpdateSettings/feature.js";
|
|
8
|
+
import { WbGeneratePageContentFeature } from "./features/WbGeneratePageContent/feature.js";
|
|
9
|
+
import { ProvidersFeature } from "./features/Providers/feature.js";
|
|
10
|
+
import { ReaderPersonasFeature } from "./features/ReaderPersonas/feature.js";
|
|
11
|
+
import { WriterPersonasFeature } from "./features/WriterPersonas/feature.js";
|
|
12
|
+
import { ProjectsFeature } from "./features/Projects/feature.js";
|
|
13
|
+
import { AiPromptContextFeature } from "./features/AiPromptContext/feature.js";
|
|
14
|
+
import { AiImageEnrichmentFeature } from "./features/AiImageEnrichment/feature.js";
|
|
15
|
+
export const Extension = createFeature({
|
|
16
|
+
name: "AiPowerUps",
|
|
17
|
+
register(container) {
|
|
18
|
+
container.register(AiPowerUpsSettingsCache).inSingletonScope();
|
|
19
|
+
GetSettingsFeature.register(container);
|
|
20
|
+
UpdateSettingsFeature.register(container);
|
|
21
|
+
ProvidersFeature.register(container);
|
|
22
|
+
ReaderPersonasFeature.register(container);
|
|
23
|
+
WriterPersonasFeature.register(container);
|
|
24
|
+
ProjectsFeature.register(container);
|
|
25
|
+
AiPromptContextFeature.register(container);
|
|
26
|
+
WbGeneratePageContentFeature.register(container);
|
|
27
|
+
const wcp = container.resolve(WcpContext);
|
|
28
|
+
if (wcp.canUseAiImageEnrichment()) {
|
|
29
|
+
AiImageEnrichmentFeature.register(container);
|
|
30
|
+
}
|
|
31
|
+
container.register(AiPowerUpsSettingsGraphQLMapperImpl).inSingletonScope();
|
|
32
|
+
container.register(BaseGraphQLSchema);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=Extension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createFeature","WcpContext","BaseGraphQLSchema","AiPowerUpsSettingsGraphQLMapperImpl","AiPowerUpsSettingsCache","GetSettingsFeature","UpdateSettingsFeature","WbGeneratePageContentFeature","ProvidersFeature","ReaderPersonasFeature","WriterPersonasFeature","ProjectsFeature","AiPromptContextFeature","AiImageEnrichmentFeature","Extension","name","register","container","inSingletonScope","wcp","resolve","canUseAiImageEnrichment"],"sources":["Extension.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { WcpContext } from \"@webiny/api-core/features/wcp/WcpContext/index.js\";\nimport { BaseGraphQLSchema } from \"./graphql/BaseGraphQLSchema.js\";\nimport AiPowerUpsSettingsGraphQLMapperImpl from \"./graphql/AiPowerUpsSettingsGraphQLMapper.js\";\nimport { AiPowerUpsSettingsCache } from \"./features/shared/SettingsCache.js\";\nimport { GetSettingsFeature } from \"./features/GetSettings/feature.js\";\nimport { UpdateSettingsFeature } from \"./features/UpdateSettings/feature.js\";\nimport { WbGeneratePageContentFeature } from \"./features/WbGeneratePageContent/feature.js\";\nimport { ProvidersFeature } from \"./features/Providers/feature.js\";\nimport { ReaderPersonasFeature } from \"./features/ReaderPersonas/feature.js\";\nimport { WriterPersonasFeature } from \"./features/WriterPersonas/feature.js\";\nimport { ProjectsFeature } from \"./features/Projects/feature.js\";\nimport { AiPromptContextFeature } from \"./features/AiPromptContext/feature.js\";\nimport { AiImageEnrichmentFeature } from \"./features/AiImageEnrichment/feature.js\";\n\nexport const Extension = createFeature({\n name: \"AiPowerUps\",\n register(container) {\n container.register(AiPowerUpsSettingsCache).inSingletonScope();\n\n GetSettingsFeature.register(container);\n UpdateSettingsFeature.register(container);\n ProvidersFeature.register(container);\n ReaderPersonasFeature.register(container);\n WriterPersonasFeature.register(container);\n ProjectsFeature.register(container);\n AiPromptContextFeature.register(container);\n WbGeneratePageContentFeature.register(container);\n\n const wcp = container.resolve(WcpContext);\n if (wcp.canUseAiImageEnrichment()) {\n AiImageEnrichmentFeature.register(container);\n }\n\n container.register(AiPowerUpsSettingsGraphQLMapperImpl).inSingletonScope();\n container.register(BaseGraphQLSchema);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,UAAU,QAAQ,mDAAmD;AAC9E,SAASC,iBAAiB;AAC1B,OAAOC,mCAAmC;AAC1C,SAASC,uBAAuB;AAChC,SAASC,kBAAkB;AAC3B,SAASC,qBAAqB;AAC9B,SAASC,4BAA4B;AACrC,SAASC,gBAAgB;AACzB,SAASC,qBAAqB;AAC9B,SAASC,qBAAqB;AAC9B,SAASC,eAAe;AACxB,SAASC,sBAAsB;AAC/B,SAASC,wBAAwB;AAEjC,OAAO,MAAMC,SAAS,GAAGd,aAAa,CAAC;EACnCe,IAAI,EAAE,YAAY;EAClBC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACZ,uBAAuB,CAAC,CAACc,gBAAgB,CAAC,CAAC;IAE9Db,kBAAkB,CAACW,QAAQ,CAACC,SAAS,CAAC;IACtCX,qBAAqB,CAACU,QAAQ,CAACC,SAAS,CAAC;IACzCT,gBAAgB,CAACQ,QAAQ,CAACC,SAAS,CAAC;IACpCR,qBAAqB,CAACO,QAAQ,CAACC,SAAS,CAAC;IACzCP,qBAAqB,CAACM,QAAQ,CAACC,SAAS,CAAC;IACzCN,eAAe,CAACK,QAAQ,CAACC,SAAS,CAAC;IACnCL,sBAAsB,CAACI,QAAQ,CAACC,SAAS,CAAC;IAC1CV,4BAA4B,CAACS,QAAQ,CAACC,SAAS,CAAC;IAEhD,MAAME,GAAG,GAAGF,SAAS,CAACG,OAAO,CAACnB,UAAU,CAAC;IACzC,IAAIkB,GAAG,CAACE,uBAAuB,CAAC,CAAC,EAAE;MAC/BR,wBAAwB,CAACG,QAAQ,CAACC,SAAS,CAAC;IAChD;IAEAA,SAAS,CAACD,QAAQ,CAACb,mCAAmC,CAAC,CAACe,gBAAgB,CAAC,CAAC;IAC1ED,SAAS,CAACD,QAAQ,CAACd,iBAAiB,CAAC;EACzC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AI_POWER_UPS_SETTINGS = "AiPowerUps/Settings";
|
package/api/constants.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AI_POWER_UPS_SETTINGS"],"sources":["constants.ts"],"sourcesContent":["export const AI_POWER_UPS_SETTINGS = \"AiPowerUps/Settings\";\n"],"mappings":"AAAA,OAAO,MAAMA,qBAAqB,GAAG,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FileAfterCreateEventHandler } from "@webiny/api-file-manager/features/file/CreateFile/events.js";
|
|
2
|
+
import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
3
|
+
declare class AiImageEnrichmentAfterCreateHandlerImpl implements FileAfterCreateEventHandler.Interface {
|
|
4
|
+
private taskService;
|
|
5
|
+
constructor(taskService: TaskService.Interface);
|
|
6
|
+
handle(event: FileAfterCreateEventHandler.Event): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare const AiImageEnrichmentAfterCreateHandler: typeof AiImageEnrichmentAfterCreateHandlerImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher/abstractions.js").IEventHandler<import("@webiny/api-file-manager/features/file/CreateFile/events.js").FileAfterCreateEvent>>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FileAfterCreateEventHandler } from "@webiny/api-file-manager/features/file/CreateFile/events.js";
|
|
2
|
+
import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
3
|
+
import { AI_IMAGE_ENRICHMENT_TASK_ID } from "./AiImageEnrichmentTask.js";
|
|
4
|
+
class AiImageEnrichmentAfterCreateHandlerImpl {
|
|
5
|
+
constructor(taskService) {
|
|
6
|
+
this.taskService = taskService;
|
|
7
|
+
}
|
|
8
|
+
async handle(event) {
|
|
9
|
+
const {
|
|
10
|
+
file
|
|
11
|
+
} = event.payload;
|
|
12
|
+
if (!file.type.startsWith("image/")) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
await this.taskService.trigger({
|
|
16
|
+
definition: AI_IMAGE_ENRICHMENT_TASK_ID,
|
|
17
|
+
input: {
|
|
18
|
+
fileId: file.id
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export const AiImageEnrichmentAfterCreateHandler = FileAfterCreateEventHandler.createImplementation({
|
|
24
|
+
implementation: AiImageEnrichmentAfterCreateHandlerImpl,
|
|
25
|
+
dependencies: [TaskService]
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=AiImageEnrichmentAfterCreateHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FileAfterCreateEventHandler","TaskService","AI_IMAGE_ENRICHMENT_TASK_ID","AiImageEnrichmentAfterCreateHandlerImpl","constructor","taskService","handle","event","file","payload","type","startsWith","trigger","definition","input","fileId","id","AiImageEnrichmentAfterCreateHandler","createImplementation","implementation","dependencies"],"sources":["AiImageEnrichmentAfterCreateHandler.ts"],"sourcesContent":["import { FileAfterCreateEventHandler } from \"@webiny/api-file-manager/features/file/CreateFile/events.js\";\nimport { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport type { IAiImageEnrichmentTaskInput } from \"./AiImageEnrichmentTask.js\";\nimport { AI_IMAGE_ENRICHMENT_TASK_ID } from \"./AiImageEnrichmentTask.js\";\n\nclass AiImageEnrichmentAfterCreateHandlerImpl implements FileAfterCreateEventHandler.Interface {\n constructor(private taskService: TaskService.Interface) {}\n\n async handle(event: FileAfterCreateEventHandler.Event): Promise<void> {\n const { file } = event.payload;\n\n if (!file.type.startsWith(\"image/\")) {\n return;\n }\n\n await this.taskService.trigger<IAiImageEnrichmentTaskInput>({\n definition: AI_IMAGE_ENRICHMENT_TASK_ID,\n input: {\n fileId: file.id\n }\n });\n }\n}\n\nexport const AiImageEnrichmentAfterCreateHandler = FileAfterCreateEventHandler.createImplementation(\n {\n implementation: AiImageEnrichmentAfterCreateHandlerImpl,\n dependencies: [TaskService]\n }\n);\n"],"mappings":"AAAA,SAASA,2BAA2B,QAAQ,6DAA6D;AACzG,SAASC,WAAW,QAAQ,qDAAqD;AAEjF,SAASC,2BAA2B;AAEpC,MAAMC,uCAAuC,CAAkD;EAC3FC,WAAWA,CAASC,WAAkC,EAAE;IAAA,KAApCA,WAAkC,GAAlCA,WAAkC;EAAG;EAEzD,MAAMC,MAAMA,CAACC,KAAwC,EAAiB;IAClE,MAAM;MAAEC;IAAK,CAAC,GAAGD,KAAK,CAACE,OAAO;IAE9B,IAAI,CAACD,IAAI,CAACE,IAAI,CAACC,UAAU,CAAC,QAAQ,CAAC,EAAE;MACjC;IACJ;IAEA,MAAM,IAAI,CAACN,WAAW,CAACO,OAAO,CAA8B;MACxDC,UAAU,EAAEX,2BAA2B;MACvCY,KAAK,EAAE;QACHC,MAAM,EAAEP,IAAI,CAACQ;MACjB;IACJ,CAAC,CAAC;EACN;AACJ;AAEA,OAAO,MAAMC,mCAAmC,GAAGjB,2BAA2B,CAACkB,oBAAoB,CAC/F;EACIC,cAAc,EAAEhB,uCAAuC;EACvDiB,YAAY,EAAE,CAACnB,WAAW;AAC9B,CACJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
|
+
import { Ai } from "@webiny/api-core/features/ai/index.js";
|
|
3
|
+
import { Encryption } from "@webiny/api-core/features/encryption/index.js";
|
|
4
|
+
import { GetFileUseCase } from "@webiny/api-file-manager/features/file/GetFile/index.js";
|
|
5
|
+
import { UpdateFileUseCase } from "@webiny/api-file-manager/features/file/UpdateFile/index.js";
|
|
6
|
+
import { GetSettingsUseCase as FmGetSettingsUseCase } from "@webiny/api-file-manager/features/settings/GetSettings/abstractions.js";
|
|
7
|
+
import { WebsocketService } from "@webiny/api-websockets/features/WebsocketService/index.js";
|
|
8
|
+
import { GetSettingsUseCase } from "../../../api/features/GetSettings/index.js";
|
|
9
|
+
export declare const AI_IMAGE_ENRICHMENT_TASK_ID = "fmAiImageEnrichment";
|
|
10
|
+
export interface IAiImageEnrichmentTaskInput {
|
|
11
|
+
fileId: string;
|
|
12
|
+
}
|
|
13
|
+
declare class AiImageEnrichmentTaskImpl implements TaskDefinition.Interface<IAiImageEnrichmentTaskInput> {
|
|
14
|
+
private getFile;
|
|
15
|
+
private fmSettings;
|
|
16
|
+
private updateFile;
|
|
17
|
+
private ai;
|
|
18
|
+
private getSettings;
|
|
19
|
+
private encryption;
|
|
20
|
+
private websocketService?;
|
|
21
|
+
id: string;
|
|
22
|
+
title: string;
|
|
23
|
+
description: string;
|
|
24
|
+
maxIterations: number;
|
|
25
|
+
isPrivate: boolean;
|
|
26
|
+
databaseLogs: boolean;
|
|
27
|
+
readonly selfCleanup: ("onAbort" | "onSuccess")[];
|
|
28
|
+
constructor(getFile: GetFileUseCase.Interface, fmSettings: FmGetSettingsUseCase.Interface, updateFile: UpdateFileUseCase.Interface, ai: Ai.Interface, getSettings: GetSettingsUseCase.Interface, encryption: Encryption.Interface, websocketService?: WebsocketService.Interface | undefined);
|
|
29
|
+
run({ input, controller }: TaskDefinition.RunParams<IAiImageEnrichmentTaskInput>): Promise<TaskDefinition.Result<IAiImageEnrichmentTaskInput>>;
|
|
30
|
+
}
|
|
31
|
+
export declare const AiImageEnrichmentTask: typeof AiImageEnrichmentTaskImpl & {
|
|
32
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskDefinition<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
33
|
+
};
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Output } from "ai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
4
|
+
import { Ai } from "@webiny/api-core/features/ai/index.js";
|
|
5
|
+
import { Encryption } from "@webiny/api-core/features/encryption/index.js";
|
|
6
|
+
import { GetFileUseCase } from "@webiny/api-file-manager/features/file/GetFile/index.js";
|
|
7
|
+
import { UpdateFileUseCase } from "@webiny/api-file-manager/features/file/UpdateFile/index.js";
|
|
8
|
+
import { GetSettingsUseCase as FmGetSettingsUseCase } from "@webiny/api-file-manager/features/settings/GetSettings/abstractions.js";
|
|
9
|
+
import { WebsocketService } from "@webiny/api-websockets/features/WebsocketService/index.js";
|
|
10
|
+
import { GetSettingsUseCase } from "../GetSettings/index.js";
|
|
11
|
+
export const AI_IMAGE_ENRICHMENT_TASK_ID = "fmAiImageEnrichment";
|
|
12
|
+
const AI_PROMPT = "Analyze this image and return up to 5 lowercase descriptive tags and one short sentence describing the image.";
|
|
13
|
+
const aiOutputSchema = Output.object({
|
|
14
|
+
schema: z.object({
|
|
15
|
+
tags: z.array(z.string()),
|
|
16
|
+
description: z.string()
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
class AiImageEnrichmentTaskImpl {
|
|
20
|
+
id = AI_IMAGE_ENRICHMENT_TASK_ID;
|
|
21
|
+
title = "File Manager - AI Image Enrichment";
|
|
22
|
+
description = "Automatically enriches uploaded images with AI-generated tags and description.";
|
|
23
|
+
maxIterations = 1;
|
|
24
|
+
isPrivate = true;
|
|
25
|
+
databaseLogs = false;
|
|
26
|
+
selfCleanup = ["onSuccess", "onAbort"];
|
|
27
|
+
constructor(getFile, fmSettings, updateFile, ai, getSettings, encryption, websocketService) {
|
|
28
|
+
this.getFile = getFile;
|
|
29
|
+
this.fmSettings = fmSettings;
|
|
30
|
+
this.updateFile = updateFile;
|
|
31
|
+
this.ai = ai;
|
|
32
|
+
this.getSettings = getSettings;
|
|
33
|
+
this.encryption = encryption;
|
|
34
|
+
this.websocketService = websocketService;
|
|
35
|
+
}
|
|
36
|
+
async run({
|
|
37
|
+
input,
|
|
38
|
+
controller
|
|
39
|
+
}) {
|
|
40
|
+
if (controller.runtime.isAborted()) {
|
|
41
|
+
return controller.response.aborted();
|
|
42
|
+
}
|
|
43
|
+
const fileResult = await this.getFile.execute(input.fileId);
|
|
44
|
+
if (fileResult.isFail()) {
|
|
45
|
+
return controller.response.error({
|
|
46
|
+
message: `File not found: ${input.fileId}`
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const file = fileResult.value;
|
|
50
|
+
if (!file.type.startsWith("image/")) {
|
|
51
|
+
return controller.response.done("File is not an image; skipping AI enrichment.");
|
|
52
|
+
}
|
|
53
|
+
const settingsResult = await this.fmSettings.execute();
|
|
54
|
+
const srcPrefix = settingsResult.isOk() ? settingsResult.value.srcPrefix ?? "" : "";
|
|
55
|
+
const imageUrl = `${srcPrefix}${file.key}`;
|
|
56
|
+
const aiSettingsResult = await this.getSettings.execute();
|
|
57
|
+
if (aiSettingsResult.isFail()) {
|
|
58
|
+
return controller.response.error({
|
|
59
|
+
message: "No AI provider configured. Add a provider in AI Power Ups settings."
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
const aiSettings = aiSettingsResult.value;
|
|
63
|
+
const firstProvider = aiSettings.providers.presets[0];
|
|
64
|
+
if (!firstProvider) {
|
|
65
|
+
return controller.response.done({
|
|
66
|
+
message: "No AI provider configured. Add a provider in AI Power Ups settings."
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
let tags = [];
|
|
70
|
+
let description = "";
|
|
71
|
+
try {
|
|
72
|
+
const aiResult = await this.ai.generateText({
|
|
73
|
+
model: firstProvider.model,
|
|
74
|
+
output: aiOutputSchema,
|
|
75
|
+
connection: {
|
|
76
|
+
sdkName: firstProvider.model.split("/")[0],
|
|
77
|
+
apiKey: this.encryption.decrypt(firstProvider.apiKeyEncrypted)
|
|
78
|
+
},
|
|
79
|
+
messages: [{
|
|
80
|
+
role: "user",
|
|
81
|
+
content: [{
|
|
82
|
+
type: "image",
|
|
83
|
+
image: new URL(imageUrl)
|
|
84
|
+
}, {
|
|
85
|
+
type: "text",
|
|
86
|
+
text: AI_PROMPT
|
|
87
|
+
}]
|
|
88
|
+
}]
|
|
89
|
+
});
|
|
90
|
+
tags = aiResult.output.tags;
|
|
91
|
+
description = aiResult.output.description;
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.log("error", error.message);
|
|
94
|
+
return controller.response.error({
|
|
95
|
+
message: `AI enrichment failed: ${error instanceof Error ? error.message : String(error)}`
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
const mergedTags = [...new Set([...file.tags, ...tags])];
|
|
99
|
+
const updateResult = await this.updateFile.execute({
|
|
100
|
+
id: file.id,
|
|
101
|
+
tags: mergedTags,
|
|
102
|
+
description
|
|
103
|
+
});
|
|
104
|
+
if (updateResult.isFail()) {
|
|
105
|
+
return controller.response.error({
|
|
106
|
+
message: `Failed to update file: ${updateResult.error.message}`
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (this.websocketService) {
|
|
110
|
+
const connectionsResult = await this.websocketService.listConnections();
|
|
111
|
+
if (connectionsResult.isOk() && connectionsResult.value.length > 0) {
|
|
112
|
+
await this.websocketService.sendToConnections(connectionsResult.value, {
|
|
113
|
+
action: "fm.file.enrichment",
|
|
114
|
+
data: {
|
|
115
|
+
id: file.id,
|
|
116
|
+
tags: mergedTags,
|
|
117
|
+
description
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return controller.response.done("AI image enrichment completed successfully.");
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
export const AiImageEnrichmentTask = TaskDefinition.createImplementation({
|
|
126
|
+
implementation: AiImageEnrichmentTaskImpl,
|
|
127
|
+
dependencies: [GetFileUseCase, FmGetSettingsUseCase, UpdateFileUseCase, Ai, GetSettingsUseCase, Encryption, [WebsocketService, {
|
|
128
|
+
optional: true
|
|
129
|
+
}]]
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
//# sourceMappingURL=AiImageEnrichmentTask.js.map
|