@webiny/ai-powerups 6.3.0 → 6.4.0-beta.0

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.
Files changed (274) hide show
  1. package/AiPowerups.js +8 -9
  2. package/AiPowerups.js.map +1 -1
  3. package/admin/Extension.js +28 -26
  4. package/admin/Extension.js.map +1 -1
  5. package/admin/domain/errors.d.ts +12 -0
  6. package/admin/domain/errors.js +21 -0
  7. package/admin/domain/errors.js.map +1 -0
  8. package/admin/features/feature.js +13 -12
  9. package/admin/features/feature.js.map +1 -1
  10. package/admin/features/generatePageContent/GeneratePageContentGateway.js +35 -16
  11. package/admin/features/generatePageContent/GeneratePageContentGateway.js.map +1 -1
  12. package/admin/features/generatePageContent/GeneratePageContentUseCase.js +13 -10
  13. package/admin/features/generatePageContent/GeneratePageContentUseCase.js.map +1 -1
  14. package/admin/features/generatePageContent/abstractions.d.ts +4 -0
  15. package/admin/features/generatePageContent/abstractions.js +3 -2
  16. package/admin/features/generatePageContent/abstractions.js.map +1 -1
  17. package/admin/features/generatePageContent/feature.js +7 -6
  18. package/admin/features/generatePageContent/feature.js.map +1 -1
  19. package/admin/features/generatePageContent/index.js +1 -3
  20. package/admin/features/listModels/ListModelsGateway.js +17 -14
  21. package/admin/features/listModels/ListModelsGateway.js.map +1 -1
  22. package/admin/features/listModels/ListModelsRepository.js +21 -18
  23. package/admin/features/listModels/ListModelsRepository.js.map +1 -1
  24. package/admin/features/listModels/ListModelsUseCase.js +13 -10
  25. package/admin/features/listModels/ListModelsUseCase.js.map +1 -1
  26. package/admin/features/listModels/abstractions.js +4 -3
  27. package/admin/features/listModels/abstractions.js.map +1 -1
  28. package/admin/features/listModels/feature.js +15 -14
  29. package/admin/features/listModels/feature.js.map +1 -1
  30. package/admin/features/listModels/index.js +1 -3
  31. package/admin/features/settings/getSettings/GetSettingsGateway.js +17 -14
  32. package/admin/features/settings/getSettings/GetSettingsGateway.js.map +1 -1
  33. package/admin/features/settings/getSettings/GetSettingsRepository.js +23 -23
  34. package/admin/features/settings/getSettings/GetSettingsRepository.js.map +1 -1
  35. package/admin/features/settings/getSettings/GetSettingsUseCase.js +13 -10
  36. package/admin/features/settings/getSettings/GetSettingsUseCase.js.map +1 -1
  37. package/admin/features/settings/getSettings/abstractions.js +4 -3
  38. package/admin/features/settings/getSettings/abstractions.js.map +1 -1
  39. package/admin/features/settings/getSettings/feature.js +15 -14
  40. package/admin/features/settings/getSettings/feature.js.map +1 -1
  41. package/admin/features/settings/getSettings/index.js +1 -3
  42. package/admin/features/settings/shared/SettingsCache.js +14 -13
  43. package/admin/features/settings/shared/SettingsCache.js.map +1 -1
  44. package/admin/features/settings/shared/abstractions.d.ts +32 -0
  45. package/admin/features/settings/shared/abstractions.js +2 -18
  46. package/admin/features/settings/shared/abstractions.js.map +1 -1
  47. package/admin/features/settings/shared/feature.js +11 -10
  48. package/admin/features/settings/shared/feature.js.map +1 -1
  49. package/admin/features/settings/shared/index.js +0 -2
  50. package/admin/features/settings/updateSettings/UpdateSettingsGateway.js +34 -18
  51. package/admin/features/settings/updateSettings/UpdateSettingsGateway.js.map +1 -1
  52. package/admin/features/settings/updateSettings/UpdateSettingsRepository.js +17 -13
  53. package/admin/features/settings/updateSettings/UpdateSettingsRepository.js.map +1 -1
  54. package/admin/features/settings/updateSettings/UpdateSettingsUseCase.js +13 -10
  55. package/admin/features/settings/updateSettings/UpdateSettingsUseCase.js.map +1 -1
  56. package/admin/features/settings/updateSettings/abstractions.js +4 -3
  57. package/admin/features/settings/updateSettings/abstractions.js.map +1 -1
  58. package/admin/features/settings/updateSettings/feature.js +15 -14
  59. package/admin/features/settings/updateSettings/feature.js.map +1 -1
  60. package/admin/features/settings/updateSettings/index.js +1 -3
  61. package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.d.ts +4 -0
  62. package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.js +50 -0
  63. package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.js.map +1 -0
  64. package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPresenter.d.ts +2 -1
  65. package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPresenter.js +133 -129
  66. package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPresenter.js.map +1 -1
  67. package/admin/presentation/AiPowerUpsSettings/abstractions.d.ts +2 -1
  68. package/admin/presentation/AiPowerUpsSettings/abstractions.js +2 -1
  69. package/admin/presentation/AiPowerUpsSettings/abstractions.js.map +1 -1
  70. package/admin/presentation/AiPowerUpsSettings/feature.js +20 -16
  71. package/admin/presentation/AiPowerUpsSettings/feature.js.map +1 -1
  72. package/admin/presentation/AiPowerUpsSettings/index.d.ts +0 -3
  73. package/admin/presentation/AiPowerUpsSettings/index.js +0 -5
  74. package/admin/presentation/AiPowerUpsSettings/settingsGroup.js +2 -1
  75. package/admin/presentation/AiPowerUpsSettings/settingsGroup.js.map +1 -1
  76. package/admin/presentation/AiPowerUpsSettings/useAiPowerUpsSettings.js +19 -20
  77. package/admin/presentation/AiPowerUpsSettings/useAiPowerUpsSettings.js.map +1 -1
  78. package/admin/presentation/{PersonasSettings.d.ts → ProjectsSettings.d.ts} +2 -2
  79. package/admin/presentation/ProjectsSettings.js +56 -0
  80. package/admin/presentation/ProjectsSettings.js.map +1 -0
  81. package/admin/presentation/ProvidersSettings.js +39 -33
  82. package/admin/presentation/ProvidersSettings.js.map +1 -1
  83. package/admin/presentation/ReaderPersonasSettings.d.ts +11 -0
  84. package/admin/presentation/ReaderPersonasSettings.js +37 -0
  85. package/admin/presentation/ReaderPersonasSettings.js.map +1 -0
  86. package/admin/presentation/WbContentGeneration/Extension.js +15 -16
  87. package/admin/presentation/WbContentGeneration/Extension.js.map +1 -1
  88. package/admin/presentation/WbContentGeneration/GenerateContentButton.js +12 -17
  89. package/admin/presentation/WbContentGeneration/GenerateContentButton.js.map +1 -1
  90. package/admin/presentation/WbContentGeneration/GenerateContentDialog.js +94 -127
  91. package/admin/presentation/WbContentGeneration/GenerateContentDialog.js.map +1 -1
  92. package/admin/presentation/WbContentGeneration/GenerateContentPresenter.d.ts +19 -5
  93. package/admin/presentation/WbContentGeneration/GenerateContentPresenter.js +214 -77
  94. package/admin/presentation/WbContentGeneration/GenerateContentPresenter.js.map +1 -1
  95. package/admin/presentation/WbContentGeneration/abstractions.d.ts +4 -2
  96. package/admin/presentation/WbContentGeneration/abstractions.js +2 -1
  97. package/admin/presentation/WbContentGeneration/abstractions.js.map +1 -1
  98. package/admin/presentation/WbContentGeneration/decompressGzipBase64.js +10 -11
  99. package/admin/presentation/WbContentGeneration/decompressGzipBase64.js.map +1 -1
  100. package/admin/presentation/WbContentGeneration/feature.js +11 -10
  101. package/admin/presentation/WbContentGeneration/feature.js.map +1 -1
  102. package/admin/presentation/WriterPersonasSettings.d.ts +11 -0
  103. package/admin/presentation/WriterPersonasSettings.js +37 -0
  104. package/admin/presentation/WriterPersonasSettings.js.map +1 -0
  105. package/admin/routes.d.ts +4 -0
  106. package/admin/routes.js +10 -0
  107. package/admin/routes.js.map +1 -0
  108. package/api/Extension.js +28 -11
  109. package/api/Extension.js.map +1 -1
  110. package/api/constants.js +2 -1
  111. package/api/constants.js.map +1 -1
  112. package/api/features/AiImageEnrichment/AiImageEnrichmentAfterCreateHandler.d.ts +11 -0
  113. package/api/features/AiImageEnrichment/AiImageEnrichmentAfterCreateHandler.js +27 -0
  114. package/api/features/AiImageEnrichment/AiImageEnrichmentAfterCreateHandler.js.map +1 -0
  115. package/api/features/AiImageEnrichment/AiImageEnrichmentTask.d.ts +34 -0
  116. package/api/features/AiImageEnrichment/AiImageEnrichmentTask.js +140 -0
  117. package/api/features/AiImageEnrichment/AiImageEnrichmentTask.js.map +1 -0
  118. package/api/features/AiImageEnrichment/feature.d.ts +4 -0
  119. package/api/features/AiImageEnrichment/feature.js +13 -0
  120. package/api/features/AiImageEnrichment/feature.js.map +1 -0
  121. package/api/features/AiPromptContext/AiPromptContextBuilder.d.ts +12 -0
  122. package/api/features/AiPromptContext/AiPromptContextBuilder.js +103 -0
  123. package/api/features/AiPromptContext/AiPromptContextBuilder.js.map +1 -0
  124. package/api/features/AiPromptContext/ProjectFileAssembler.d.ts +22 -0
  125. package/api/features/AiPromptContext/ProjectFileAssembler.js +76 -0
  126. package/api/features/AiPromptContext/ProjectFileAssembler.js.map +1 -0
  127. package/api/features/AiPromptContext/ProjectFileCache.d.ts +16 -0
  128. package/api/features/AiPromptContext/ProjectFileCache.js +61 -0
  129. package/api/features/AiPromptContext/ProjectFileCache.js.map +1 -0
  130. package/api/features/AiPromptContext/ProjectSection.d.ts +4 -0
  131. package/api/features/AiPromptContext/ProjectSection.js +35 -0
  132. package/api/features/AiPromptContext/ProjectSection.js.map +1 -0
  133. package/api/features/AiPromptContext/ReadProjectFileTool.d.ts +3 -0
  134. package/api/features/AiPromptContext/ReadProjectFileTool.js +36 -0
  135. package/api/features/AiPromptContext/ReadProjectFileTool.js.map +1 -0
  136. package/api/features/AiPromptContext/ReaderPersonaSection.d.ts +4 -0
  137. package/api/features/AiPromptContext/ReaderPersonaSection.js +10 -0
  138. package/api/features/AiPromptContext/ReaderPersonaSection.js.map +1 -0
  139. package/api/features/AiPromptContext/WriterPersonaSection.d.ts +4 -0
  140. package/api/features/AiPromptContext/WriterPersonaSection.js +10 -0
  141. package/api/features/AiPromptContext/WriterPersonaSection.js.map +1 -0
  142. package/api/features/AiPromptContext/abstractions.d.ts +68 -0
  143. package/api/features/AiPromptContext/abstractions.js +7 -0
  144. package/api/features/AiPromptContext/abstractions.js.map +1 -0
  145. package/api/features/AiPromptContext/feature.d.ts +4 -0
  146. package/api/features/AiPromptContext/feature.js +15 -0
  147. package/api/features/AiPromptContext/feature.js.map +1 -0
  148. package/api/features/AiPromptContext/index.d.ts +1 -0
  149. package/api/features/AiPromptContext/index.js +1 -0
  150. package/api/features/ExtractFrontmatter/ExtractFrontmatterBeforeCreateHandler.d.ts +11 -0
  151. package/api/features/ExtractFrontmatter/ExtractFrontmatterBeforeCreateHandler.js +34 -0
  152. package/api/features/ExtractFrontmatter/ExtractFrontmatterBeforeCreateHandler.js.map +1 -0
  153. package/api/features/ExtractFrontmatter/feature.d.ts +4 -0
  154. package/api/features/ExtractFrontmatter/feature.js +11 -0
  155. package/api/features/ExtractFrontmatter/feature.js.map +1 -0
  156. package/api/features/GetSettings/GetSettingsRepository.d.ts +3 -2
  157. package/api/features/GetSettings/GetSettingsRepository.js +29 -26
  158. package/api/features/GetSettings/GetSettingsRepository.js.map +1 -1
  159. package/api/features/GetSettings/GetSettingsUseCase.js +13 -10
  160. package/api/features/GetSettings/GetSettingsUseCase.js.map +1 -1
  161. package/api/features/GetSettings/abstractions.js +3 -2
  162. package/api/features/GetSettings/abstractions.js.map +1 -1
  163. package/api/features/GetSettings/feature.js +7 -6
  164. package/api/features/GetSettings/feature.js.map +1 -1
  165. package/api/features/GetSettings/index.js +0 -2
  166. package/api/features/Projects/ProjectsHandler.d.ts +31 -0
  167. package/api/features/Projects/ProjectsHandler.js +103 -0
  168. package/api/features/Projects/ProjectsHandler.js.map +1 -0
  169. package/api/features/Projects/feature.d.ts +4 -0
  170. package/api/features/Projects/feature.js +11 -0
  171. package/api/features/Projects/feature.js.map +1 -0
  172. package/api/features/Projects/types.d.ts +50 -0
  173. package/api/features/Projects/types.js +0 -0
  174. package/api/features/Providers/ProvidersGraphQLMapper.js +33 -30
  175. package/api/features/Providers/ProvidersGraphQLMapper.js.map +1 -1
  176. package/api/features/Providers/ProvidersHandler.js +67 -64
  177. package/api/features/Providers/ProvidersHandler.js.map +1 -1
  178. package/api/features/Providers/feature.js +7 -6
  179. package/api/features/Providers/feature.js.map +1 -1
  180. package/api/features/Providers/index.js +0 -3
  181. package/api/features/Providers/types.js +0 -3
  182. package/api/features/ReaderPersonas/ReaderPersonasHandler.d.ts +20 -0
  183. package/api/features/ReaderPersonas/ReaderPersonasHandler.js +43 -0
  184. package/api/features/ReaderPersonas/ReaderPersonasHandler.js.map +1 -0
  185. package/api/features/ReaderPersonas/feature.d.ts +4 -0
  186. package/api/features/ReaderPersonas/feature.js +11 -0
  187. package/api/features/ReaderPersonas/feature.js.map +1 -0
  188. package/api/features/ReaderPersonas/index.d.ts +2 -0
  189. package/api/features/ReaderPersonas/index.js +1 -0
  190. package/api/features/ReaderPersonas/types.d.ts +24 -0
  191. package/api/features/ReaderPersonas/types.js +0 -0
  192. package/api/features/UpdateSettings/UpdateSettingsRepository.d.ts +3 -2
  193. package/api/features/UpdateSettings/UpdateSettingsRepository.js +59 -62
  194. package/api/features/UpdateSettings/UpdateSettingsRepository.js.map +1 -1
  195. package/api/features/UpdateSettings/UpdateSettingsUseCase.js +23 -21
  196. package/api/features/UpdateSettings/UpdateSettingsUseCase.js.map +1 -1
  197. package/api/features/UpdateSettings/abstractions.js +5 -7
  198. package/api/features/UpdateSettings/abstractions.js.map +1 -1
  199. package/api/features/UpdateSettings/errors.d.ts +10 -0
  200. package/api/features/UpdateSettings/errors.js +14 -0
  201. package/api/features/UpdateSettings/errors.js.map +1 -0
  202. package/api/features/UpdateSettings/events.js +16 -11
  203. package/api/features/UpdateSettings/events.js.map +1 -1
  204. package/api/features/UpdateSettings/feature.js +7 -6
  205. package/api/features/UpdateSettings/feature.js.map +1 -1
  206. package/api/features/UpdateSettings/index.js +1 -3
  207. package/api/features/WbGeneratePageContent/WbGeneratePageContentTask.d.ts +4 -0
  208. package/api/features/WbGeneratePageContent/WbGeneratePageContentTask.js +63 -60
  209. package/api/features/WbGeneratePageContent/WbGeneratePageContentTask.js.map +1 -1
  210. package/api/features/WbGeneratePageContent/WbGeneratePageContentUseCase.d.ts +5 -3
  211. package/api/features/WbGeneratePageContent/WbGeneratePageContentUseCase.js +92 -53
  212. package/api/features/WbGeneratePageContent/WbGeneratePageContentUseCase.js.map +1 -1
  213. package/api/features/WbGeneratePageContent/abstractions.d.ts +15 -1
  214. package/api/features/WbGeneratePageContent/abstractions.js +2 -1
  215. package/api/features/WbGeneratePageContent/abstractions.js.map +1 -1
  216. package/api/features/WbGeneratePageContent/buildPrompt.d.ts +1 -1
  217. package/api/features/WbGeneratePageContent/buildPrompt.js +11 -10
  218. package/api/features/WbGeneratePageContent/buildPrompt.js.map +1 -1
  219. package/api/features/WbGeneratePageContent/feature.js +7 -6
  220. package/api/features/WbGeneratePageContent/feature.js.map +1 -1
  221. package/api/features/WbGeneratePageContent/index.js +0 -2
  222. package/api/features/WriterPersonas/WriterPersonasHandler.d.ts +20 -0
  223. package/api/features/WriterPersonas/WriterPersonasHandler.js +43 -0
  224. package/api/features/WriterPersonas/WriterPersonasHandler.js.map +1 -0
  225. package/api/features/WriterPersonas/feature.d.ts +4 -0
  226. package/api/features/WriterPersonas/feature.js +11 -0
  227. package/api/features/WriterPersonas/feature.js.map +1 -0
  228. package/api/features/WriterPersonas/index.d.ts +2 -0
  229. package/api/features/WriterPersonas/index.js +1 -0
  230. package/api/features/WriterPersonas/types.d.ts +24 -0
  231. package/api/features/WriterPersonas/types.js +0 -0
  232. package/api/features/shared/SettingsCache.d.ts +12 -0
  233. package/api/features/shared/SettingsCache.js +22 -0
  234. package/api/features/shared/SettingsCache.js.map +1 -0
  235. package/api/features/shared/abstractions.d.ts +13 -0
  236. package/api/features/shared/abstractions.js +4 -2
  237. package/api/features/shared/abstractions.js.map +1 -1
  238. package/api/features/shared/index.d.ts +3 -1
  239. package/api/features/shared/index.js +1 -3
  240. package/api/graphql/AiPowerUpsSettingsGraphQLMapper.js +35 -26
  241. package/api/graphql/AiPowerUpsSettingsGraphQLMapper.js.map +1 -1
  242. package/api/graphql/BaseGraphQLSchema.js +98 -81
  243. package/api/graphql/BaseGraphQLSchema.js.map +1 -1
  244. package/api/graphql/abstractions.js +2 -1
  245. package/api/graphql/abstractions.js.map +1 -1
  246. package/api/types.d.ts +1 -0
  247. package/api/types.js +1 -4
  248. package/index.js +0 -2
  249. package/package.json +26 -24
  250. package/admin/features/generatePageContent/index.js.map +0 -1
  251. package/admin/features/listModels/index.js.map +0 -1
  252. package/admin/features/settings/getSettings/index.js.map +0 -1
  253. package/admin/features/settings/shared/index.js.map +0 -1
  254. package/admin/features/settings/updateSettings/index.js.map +0 -1
  255. package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsConfig.d.ts +0 -2
  256. package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsConfig.js +0 -11
  257. package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsConfig.js.map +0 -1
  258. package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsDialog.d.ts +0 -5
  259. package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsDialog.js +0 -58
  260. package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsDialog.js.map +0 -1
  261. package/admin/presentation/AiPowerUpsSettings/index.js.map +0 -1
  262. package/admin/presentation/AiPowerUpsSettings/useAiPowerUpsSettingsDialog.d.ts +0 -1
  263. package/admin/presentation/AiPowerUpsSettings/useAiPowerUpsSettingsDialog.js +0 -12
  264. package/admin/presentation/AiPowerUpsSettings/useAiPowerUpsSettingsDialog.js.map +0 -1
  265. package/admin/presentation/PersonasSettings.js +0 -29
  266. package/admin/presentation/PersonasSettings.js.map +0 -1
  267. package/api/features/GetSettings/index.js.map +0 -1
  268. package/api/features/Providers/index.js.map +0 -1
  269. package/api/features/Providers/types.js.map +0 -1
  270. package/api/features/UpdateSettings/index.js.map +0 -1
  271. package/api/features/WbGeneratePageContent/index.js.map +0 -1
  272. package/api/features/shared/index.js.map +0 -1
  273. package/api/types.js.map +0 -1
  274. package/index.js.map +0 -1
@@ -1,138 +1,105 @@
1
- import React, { useCallback, useEffect, useRef } from "react";
1
+ import react, { useCallback, useEffect, useRef } from "react";
2
2
  import { observer } from "mobx-react-lite";
3
- import { useDialog } from "@webiny/app-admin";
4
- import { Dialog, OverlayLoader, Textarea, useToast } from "@webiny/admin-ui";
3
+ import { FormView, useDialog } from "@webiny/app-admin";
4
+ import { Dialog, OverlayLoader, useToast } from "@webiny/admin-ui";
5
5
  import { useFeature } from "@webiny/app";
6
6
  import { useWebsockets } from "@webiny/app-websockets";
7
7
  import { useSelectFromEditor } from "@webiny/app-website-builder/BaseEditor/hooks/useSelectFromEditor.js";
8
8
  import { useCreateElement } from "@webiny/app-website-builder/BaseEditor/hooks/useCreateElement.js";
9
9
  import { GenerateContentFeature } from "./feature.js";
10
10
  import { decompressGzipBase64 } from "./decompressGzipBase64.js";
11
- export const GENERATE_CONTENT_DIALOG = "generate-content";
12
- export const WS_ACTION_CONTENT = "aiPowerUps.generatePageContent.content";
13
- export const WS_ACTION_ERROR = "aiPowerUps.generatePageContent.error";
14
- export const GenerateContentDialog = observer(() => {
15
- const {
16
- closeDialog
17
- } = useDialog();
18
- const {
19
- presenter
20
- } = useFeature(GenerateContentFeature);
21
- const vm = presenter.vm;
22
- const wasSubmitting = useRef(false);
23
- const websockets = useWebsockets();
24
- const toast = useToast();
25
- const components = useSelectFromEditor(state => state.components);
26
- const {
27
- createElement
28
- } = useCreateElement();
29
- const createElements = useCallback(elements => {
30
- elements.forEach(el => createElement(el));
31
- }, [createElement]);
32
- useEffect(() => {
33
- const aiComponents = Object.values(components).filter(c => c.useInAiContentGeneration !== false).map(c => {
34
- return {
35
- name: c.name,
36
- label: c.label,
37
- aiContext: c.aiContext,
38
- inputs: c.inputs.map(input => ({
39
- type: input.type,
40
- name: input.name,
41
- label: input.label,
42
- description: input.description
43
- }))
44
- };
45
- });
46
- presenter.init(aiComponents, createElements);
47
- }, [components, createElements]);
48
- useEffect(() => {
49
- const contentSubscription = websockets.onMessage(WS_ACTION_CONTENT, async message => {
50
- const responseText = await decompressGzipBase64(message.data.value);
51
- await presenter.processAiResponse(responseText);
52
- });
53
- const errorSubscription = websockets.onMessage(WS_ACTION_ERROR, async message => {
54
- toast.showWarningToast({
55
- title: "Failed to generate content",
56
- description: message.data.message
57
- });
58
- presenter.cancelPrompt();
59
- });
60
- return () => {
61
- contentSubscription.off();
62
- errorSubscription.off();
11
+ const GENERATE_CONTENT_DIALOG = "generate-content";
12
+ const WS_ACTION_CONTENT = "aiPowerUps.generatePageContent.content";
13
+ const WS_ACTION_ERROR = "aiPowerUps.generatePageContent.error";
14
+ const GenerateContentDialog = observer(()=>{
15
+ const { closeDialog } = useDialog();
16
+ const { presenter } = useFeature(GenerateContentFeature);
17
+ const vm = presenter.vm;
18
+ const wasSubmitting = useRef(false);
19
+ const websockets = useWebsockets();
20
+ const toast = useToast();
21
+ const components = useSelectFromEditor((state)=>state.components);
22
+ const { createElement } = useCreateElement();
23
+ const createElements = useCallback((elements)=>{
24
+ elements.forEach((el)=>createElement(el));
25
+ }, [
26
+ createElement
27
+ ]);
28
+ useEffect(()=>{
29
+ const aiComponents = Object.values(components).filter((c)=>false !== c.useInAiContentGeneration).map((c)=>({
30
+ name: c.name,
31
+ label: c.label,
32
+ aiContext: c.aiContext,
33
+ inputs: c.inputs.map((input)=>({
34
+ type: input.type,
35
+ name: input.name,
36
+ label: input.label,
37
+ description: input.description
38
+ }))
39
+ }));
40
+ presenter.init(aiComponents, createElements);
41
+ }, [
42
+ components,
43
+ createElements
44
+ ]);
45
+ useEffect(()=>{
46
+ const contentSubscription = websockets.onMessage(WS_ACTION_CONTENT, async (message)=>{
47
+ const responseText = await decompressGzipBase64(message.data.value);
48
+ await presenter.processAiResponse(responseText);
49
+ });
50
+ const errorSubscription = websockets.onMessage(WS_ACTION_ERROR, async (message)=>{
51
+ toast.showWarningToast({
52
+ title: "Failed to generate content",
53
+ description: message.data.message
54
+ });
55
+ presenter.cancelPrompt();
56
+ });
57
+ return ()=>{
58
+ contentSubscription.off();
59
+ errorSubscription.off();
60
+ };
61
+ }, []);
62
+ useEffect(()=>{
63
+ if (wasSubmitting.current && !vm.submitting && !vm.timedOut) closeDialog();
64
+ wasSubmitting.current = vm.submitting;
65
+ }, [
66
+ vm.submitting
67
+ ]);
68
+ useEffect(()=>{
69
+ if (vm.timedOut) toast.showWarningToast({
70
+ title: "Request timed out",
71
+ description: "The AI generation took too long. Please try again."
72
+ });
73
+ }, [
74
+ vm.timedOut
75
+ ]);
76
+ const handleSubmit = async ()=>{
77
+ await presenter.submit();
63
78
  };
64
- }, []);
65
- const submitHtml = () => {
66
- presenter.processAiResponse(JSON.stringify([{
67
- component: "Webiny/Lexical",
68
- inputs: {
69
- content: {
70
- tool: "textToLexical",
71
- params: {
72
- text: "<h1>Song of the Living Earth</h1><p>The morning opens gently, and the world begins to sing. From forest shadows to rolling tides, nature carries a melody that feels both timeless and new. This song celebrates the quiet power of the wild, where every breeze, birdcall, and wave becomes part of a larger harmony.</p><h2>Verse One: Dawn in the Forest</h2><p>The sun wakes softly through the pine,</p><p>And gold spills down the cedar line.</p><p>The brook hums low beneath the trees,</p><p>A silver thread in morning breeze.</p>"
73
- }
74
- }
75
- }
76
- }, {
77
- component: "Webiny/Lexical",
78
- inputs: {
79
- content: {
80
- tool: "textToLexical",
81
- params: {
82
- text: "<h2>Verse Two: The River’s Journey</h2><p>The river travels, clear and bold,</p><p>Through stone and root and fields of gold.</p><p>It teaches hearts to move, to flow,</p><p>To leave the banks and still grow whole.</p><h3>Chorus</h3><p>Oh, nature sings in every leaf,</p><p>In winds of joy and rains of grief.</p><p>We listen close, we learn, we stay,</p><p>And find our rhythm in its sway.</p><p>Like mountains holding up the sky,</p><p>And eagles carving paths to fly,</p><p>The earth reminds us, calm and free,</p><p>That life is meant for harmony.</p>"
83
- }
84
- }
85
- }
86
- }, {
87
- component: "Webiny/Lexical",
88
- inputs: {
89
- content: {
90
- tool: "textToLexical",
91
- params: {
92
- text: "<h2>Verse Three: Evening Wildflowers</h2><p>When daylight fades to amber sky,</p><p>The meadow blooms before goodbye.</p><p>The crickets tune the final part,</p><p>And dusk grows tender in the heart.</p><p>So let us walk with gentle feet,</p><p>And keep the wild, and keep it sweet.</p><p>For every branch, each shore, each stream,</p><p>Is nature’s voice inside the dream.</p><p><strong>Final refrain:</strong> Oh, nature sings in every leaf, in winds of joy and rains of grief. We listen close, we learn, we stay, and find our rhythm in its sway.</p><p><em>Let the earth be your song, and the song be your home.</em></p>"
93
- }
94
- }
95
- }
96
- }]));
97
- };
98
- useEffect(() => {
99
- if (wasSubmitting.current && !vm.submitting) {
100
- closeDialog();
101
- }
102
- wasSubmitting.current = vm.submitting;
103
- }, [vm.submitting]);
104
- const handleSubmit = async () => {
105
- await presenter.submit();
106
- };
107
- const isProcessing = vm.processing;
108
- const isSubmitting = vm.submitting;
109
- return /*#__PURE__*/React.createElement(Dialog, {
110
- open: true,
111
- onClose: closeDialog,
112
- title: "Generate Content",
113
- size: "lg",
114
- actions: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Dialog.CancelAction, {
115
- onClick: closeDialog,
116
- text: "Cancel"
117
- }), /*#__PURE__*/React.createElement(Dialog.ConfirmAction, {
118
- onClick: submitHtml,
119
- text: "Submit HTML"
120
- }), /*#__PURE__*/React.createElement(Dialog.ConfirmAction, {
121
- onClick: handleSubmit,
122
- text: "Generate",
123
- disabled: !vm.prompt.trim() || vm.submitting
124
- }))
125
- }, isSubmitting ? /*#__PURE__*/React.createElement(OverlayLoader, {
126
- text: "Generating content..."
127
- }) : null, isProcessing ? /*#__PURE__*/React.createElement(OverlayLoader, {
128
- text: "Processing content..."
129
- }) : null, /*#__PURE__*/React.createElement(Textarea, {
130
- label: "Prompt",
131
- description: "Describe the page content you want to generate.",
132
- value: vm.prompt,
133
- onChange: value => presenter.setPrompt(String(value ?? "")),
134
- rows: 6
135
- }));
79
+ return /*#__PURE__*/ react.createElement(Dialog, {
80
+ open: true,
81
+ onClose: closeDialog,
82
+ title: "Generate Content",
83
+ size: "lg",
84
+ actions: /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Dialog.CancelAction, {
85
+ onClick: closeDialog,
86
+ text: "Cancel"
87
+ }), /*#__PURE__*/ react.createElement(Dialog.ConfirmAction, {
88
+ onClick: handleSubmit,
89
+ text: "Generate",
90
+ disabled: vm.loading || vm.submitting
91
+ }))
92
+ }, vm.loading ? /*#__PURE__*/ react.createElement(OverlayLoader, {
93
+ text: "Loading..."
94
+ }) : null, vm.submitting ? /*#__PURE__*/ react.createElement(OverlayLoader, {
95
+ text: "Generating content..."
96
+ }) : null, vm.processing ? /*#__PURE__*/ react.createElement(OverlayLoader, {
97
+ text: "Processing content..."
98
+ }) : null, vm.form ? /*#__PURE__*/ react.createElement(FormView, {
99
+ name: "GenerateContent",
100
+ form: vm.form
101
+ }) : null);
136
102
  });
103
+ export { GENERATE_CONTENT_DIALOG, GenerateContentDialog, WS_ACTION_CONTENT, WS_ACTION_ERROR };
137
104
 
138
105
  //# sourceMappingURL=GenerateContentDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","useCallback","useEffect","useRef","observer","useDialog","Dialog","OverlayLoader","Textarea","useToast","useFeature","useWebsockets","useSelectFromEditor","useCreateElement","GenerateContentFeature","decompressGzipBase64","GENERATE_CONTENT_DIALOG","WS_ACTION_CONTENT","WS_ACTION_ERROR","GenerateContentDialog","closeDialog","presenter","vm","wasSubmitting","websockets","toast","components","state","createElement","createElements","elements","forEach","el","aiComponents","Object","values","filter","c","useInAiContentGeneration","map","name","label","aiContext","inputs","input","type","description","init","contentSubscription","onMessage","message","responseText","data","value","processAiResponse","errorSubscription","showWarningToast","title","cancelPrompt","off","submitHtml","JSON","stringify","component","content","tool","params","text","current","submitting","handleSubmit","submit","isProcessing","processing","isSubmitting","open","onClose","size","actions","Fragment","CancelAction","onClick","ConfirmAction","disabled","prompt","trim","onChange","setPrompt","String","rows"],"sources":["GenerateContentDialog.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { useDialog } from \"@webiny/app-admin\";\nimport { Dialog, OverlayLoader, Textarea, useToast } from \"@webiny/admin-ui\";\nimport { useFeature } from \"@webiny/app\";\nimport type { IncomingGenericData } from \"@webiny/app-websockets\";\nimport { useWebsockets } from \"@webiny/app-websockets\";\nimport { useSelectFromEditor } from \"@webiny/app-website-builder/BaseEditor/hooks/useSelectFromEditor.js\";\nimport { useCreateElement } from \"@webiny/app-website-builder/BaseEditor/hooks/useCreateElement.js\";\nimport { GenerateContentFeature } from \"./feature.js\";\nimport { decompressGzipBase64 } from \"./decompressGzipBase64.js\";\nimport type { CreateElementParams } from \"./abstractions.js\";\n\nexport const GENERATE_CONTENT_DIALOG = \"generate-content\";\n\nexport const WS_ACTION_CONTENT = \"aiPowerUps.generatePageContent.content\";\nexport const WS_ACTION_ERROR = \"aiPowerUps.generatePageContent.error\";\n\nexport interface GeneratePageContentMessage extends IncomingGenericData {\n action: typeof WS_ACTION_CONTENT;\n data: {\n compression: \"gzip\";\n value: string;\n };\n}\n\nexport interface GeneratePageContentErrorMessage extends IncomingGenericData {\n action: typeof WS_ACTION_ERROR;\n data: {\n message: string;\n };\n}\n\nexport const GenerateContentDialog = observer(() => {\n const { closeDialog } = useDialog();\n const { presenter } = useFeature(GenerateContentFeature);\n const vm = presenter.vm;\n const wasSubmitting = useRef(false);\n const websockets = useWebsockets();\n const toast = useToast();\n\n const components = useSelectFromEditor(state => state.components);\n const { createElement } = useCreateElement();\n\n const createElements = useCallback(\n (elements: CreateElementParams[]) => {\n elements.forEach(el => createElement(el));\n },\n [createElement]\n );\n\n useEffect(() => {\n const aiComponents = Object.values(components)\n .filter(c => c.useInAiContentGeneration !== false)\n .map(c => {\n return {\n name: c.name,\n label: c.label,\n aiContext: c.aiContext,\n inputs: c.inputs.map(input => ({\n type: input.type,\n name: input.name,\n label: input.label,\n description: input.description\n }))\n };\n });\n presenter.init(aiComponents, createElements);\n }, [components, createElements]);\n\n useEffect(() => {\n const contentSubscription = websockets.onMessage<GeneratePageContentMessage>(\n WS_ACTION_CONTENT,\n async message => {\n const responseText = await decompressGzipBase64(message.data.value);\n await presenter.processAiResponse(responseText);\n }\n );\n\n const errorSubscription = websockets.onMessage<GeneratePageContentErrorMessage>(\n WS_ACTION_ERROR,\n async message => {\n toast.showWarningToast({\n title: \"Failed to generate content\",\n description: message.data.message\n });\n presenter.cancelPrompt();\n }\n );\n\n return () => {\n contentSubscription.off();\n errorSubscription.off();\n };\n }, []);\n\n const submitHtml = () => {\n presenter.processAiResponse(\n JSON.stringify([\n {\n component: \"Webiny/Lexical\",\n inputs: {\n content: {\n tool: \"textToLexical\",\n params: {\n text: \"<h1>Song of the Living Earth</h1><p>The morning opens gently, and the world begins to sing. From forest shadows to rolling tides, nature carries a melody that feels both timeless and new. This song celebrates the quiet power of the wild, where every breeze, birdcall, and wave becomes part of a larger harmony.</p><h2>Verse One: Dawn in the Forest</h2><p>The sun wakes softly through the pine,</p><p>And gold spills down the cedar line.</p><p>The brook hums low beneath the trees,</p><p>A silver thread in morning breeze.</p>\"\n }\n }\n }\n },\n {\n component: \"Webiny/Lexical\",\n inputs: {\n content: {\n tool: \"textToLexical\",\n params: {\n text: \"<h2>Verse Two: The River’s Journey</h2><p>The river travels, clear and bold,</p><p>Through stone and root and fields of gold.</p><p>It teaches hearts to move, to flow,</p><p>To leave the banks and still grow whole.</p><h3>Chorus</h3><p>Oh, nature sings in every leaf,</p><p>In winds of joy and rains of grief.</p><p>We listen close, we learn, we stay,</p><p>And find our rhythm in its sway.</p><p>Like mountains holding up the sky,</p><p>And eagles carving paths to fly,</p><p>The earth reminds us, calm and free,</p><p>That life is meant for harmony.</p>\"\n }\n }\n }\n },\n {\n component: \"Webiny/Lexical\",\n inputs: {\n content: {\n tool: \"textToLexical\",\n params: {\n text: \"<h2>Verse Three: Evening Wildflowers</h2><p>When daylight fades to amber sky,</p><p>The meadow blooms before goodbye.</p><p>The crickets tune the final part,</p><p>And dusk grows tender in the heart.</p><p>So let us walk with gentle feet,</p><p>And keep the wild, and keep it sweet.</p><p>For every branch, each shore, each stream,</p><p>Is nature’s voice inside the dream.</p><p><strong>Final refrain:</strong> Oh, nature sings in every leaf, in winds of joy and rains of grief. We listen close, we learn, we stay, and find our rhythm in its sway.</p><p><em>Let the earth be your song, and the song be your home.</em></p>\"\n }\n }\n }\n }\n ])\n );\n };\n\n useEffect(() => {\n if (wasSubmitting.current && !vm.submitting) {\n closeDialog();\n }\n wasSubmitting.current = vm.submitting;\n }, [vm.submitting]);\n\n const handleSubmit = async () => {\n await presenter.submit();\n };\n\n const isProcessing = vm.processing;\n const isSubmitting = vm.submitting;\n\n return (\n <Dialog\n open={true}\n onClose={closeDialog}\n title=\"Generate Content\"\n size={\"lg\"}\n actions={\n <>\n <Dialog.CancelAction onClick={closeDialog} text=\"Cancel\" />\n <Dialog.ConfirmAction onClick={submitHtml} text=\"Submit HTML\" />\n <Dialog.ConfirmAction\n onClick={handleSubmit}\n text=\"Generate\"\n disabled={!vm.prompt.trim() || vm.submitting}\n />\n </>\n }\n >\n {isSubmitting ? <OverlayLoader text={\"Generating content...\"} /> : null}\n {isProcessing ? <OverlayLoader text={\"Processing content...\"} /> : null}\n <Textarea\n label=\"Prompt\"\n description=\"Describe the page content you want to generate.\"\n value={vm.prompt}\n onChange={value => presenter.setPrompt(String(value ?? \"\"))}\n rows={6}\n />\n </Dialog>\n );\n});\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAC7D,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,MAAM,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,kBAAkB;AAC5E,SAASC,UAAU,QAAQ,aAAa;AAExC,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SAASC,mBAAmB,QAAQ,qEAAqE;AACzG,SAASC,gBAAgB,QAAQ,kEAAkE;AACnG,SAASC,sBAAsB;AAC/B,SAASC,oBAAoB;AAG7B,OAAO,MAAMC,uBAAuB,GAAG,kBAAkB;AAEzD,OAAO,MAAMC,iBAAiB,GAAG,wCAAwC;AACzE,OAAO,MAAMC,eAAe,GAAG,sCAAsC;AAiBrE,OAAO,MAAMC,qBA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QAAQ,EAAE,CAAC7D,EAAE,CAAC8D,MAAM,CAACC,IAAI,CAAC,CAAC,IAAI/D,EAAE,CAAC+C;IAAW,CAChD,CACH;EACL,GAEAK,YAAY,gBAAG1E,KAAA,CAAA4B,aAAA,CAACrB,aAAa;IAAC4D,IAAI,EAAE;EAAwB,CAAE,CAAC,GAAG,IAAI,EACtEK,YAAY,gBAAGxE,KAAA,CAAA4B,aAAA,CAACrB,aAAa;IAAC4D,IAAI,EAAE;EAAwB,CAAE,CAAC,GAAG,IAAI,eACvEnE,KAAA,CAAA4B,aAAA,CAACpB,QAAQ;IACLiC,KAAK,EAAC,QAAQ;IACdK,WAAW,EAAC,iDAAiD;IAC7DO,KAAK,EAAE/B,EAAE,CAAC8D,MAAO;IACjBE,QAAQ,EAAEjC,KAAK,IAAIhC,SAAS,CAACkE,SAAS,CAACC,MAAM,CAACnC,KAAK,IAAI,EAAE,CAAC,CAAE;IAC5DoC,IAAI,EAAE;EAAE,CACX,CACG,CAAC;AAEjB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"admin/presentation/WbContentGeneration/GenerateContentDialog.js","sources":["../../../../src/admin/presentation/WbContentGeneration/GenerateContentDialog.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { useDialog, FormView } from \"@webiny/app-admin\";\nimport { Dialog, OverlayLoader, useToast } from \"@webiny/admin-ui\";\nimport { useFeature } from \"@webiny/app\";\nimport type { IncomingGenericData } from \"@webiny/app-websockets\";\nimport { useWebsockets } from \"@webiny/app-websockets\";\nimport { useSelectFromEditor } from \"@webiny/app-website-builder/BaseEditor/hooks/useSelectFromEditor.js\";\nimport { useCreateElement } from \"@webiny/app-website-builder/BaseEditor/hooks/useCreateElement.js\";\nimport { GenerateContentFeature } from \"./feature.js\";\nimport { decompressGzipBase64 } from \"./decompressGzipBase64.js\";\nimport type { CreateElementParams } from \"./abstractions.js\";\n\nexport const GENERATE_CONTENT_DIALOG = \"generate-content\";\n\nexport const WS_ACTION_CONTENT = \"aiPowerUps.generatePageContent.content\";\nexport const WS_ACTION_ERROR = \"aiPowerUps.generatePageContent.error\";\n\nexport interface GeneratePageContentMessage extends IncomingGenericData {\n action: typeof WS_ACTION_CONTENT;\n data: {\n compression: \"gzip\";\n value: string;\n };\n}\n\nexport interface GeneratePageContentErrorMessage extends IncomingGenericData {\n action: typeof WS_ACTION_ERROR;\n data: {\n message: string;\n };\n}\n\nexport const GenerateContentDialog = observer(() => {\n const { closeDialog } = useDialog();\n const { presenter } = useFeature(GenerateContentFeature);\n const vm = presenter.vm;\n const wasSubmitting = useRef(false);\n const websockets = useWebsockets();\n const toast = useToast();\n\n const components = useSelectFromEditor(state => state.components);\n const { createElement } = useCreateElement();\n\n const createElements = useCallback(\n (elements: CreateElementParams[]) => {\n elements.forEach(el => createElement(el));\n },\n [createElement]\n );\n\n useEffect(() => {\n const aiComponents = Object.values(components)\n .filter(c => c.useInAiContentGeneration !== false)\n .map(c => {\n return {\n name: c.name,\n label: c.label,\n aiContext: c.aiContext,\n inputs: c.inputs.map(input => ({\n type: input.type,\n name: input.name,\n label: input.label,\n description: input.description\n }))\n };\n });\n presenter.init(aiComponents, createElements);\n }, [components, createElements]);\n\n useEffect(() => {\n const contentSubscription = websockets.onMessage<GeneratePageContentMessage>(\n WS_ACTION_CONTENT,\n async message => {\n const responseText = await decompressGzipBase64(message.data.value);\n await presenter.processAiResponse(responseText);\n }\n );\n\n const errorSubscription = websockets.onMessage<GeneratePageContentErrorMessage>(\n WS_ACTION_ERROR,\n async message => {\n toast.showWarningToast({\n title: \"Failed to generate content\",\n description: message.data.message\n });\n presenter.cancelPrompt();\n }\n );\n\n return () => {\n contentSubscription.off();\n errorSubscription.off();\n };\n }, []);\n\n useEffect(() => {\n if (wasSubmitting.current && !vm.submitting && !vm.timedOut) {\n closeDialog();\n }\n wasSubmitting.current = vm.submitting;\n }, [vm.submitting]);\n\n useEffect(() => {\n if (vm.timedOut) {\n toast.showWarningToast({\n title: \"Request timed out\",\n description: \"The AI generation took too long. Please try again.\"\n });\n }\n }, [vm.timedOut]);\n\n const handleSubmit = async () => {\n await presenter.submit();\n };\n\n return (\n <Dialog\n open={true}\n onClose={closeDialog}\n title=\"Generate Content\"\n size={\"lg\"}\n actions={\n <>\n <Dialog.CancelAction onClick={closeDialog} text=\"Cancel\" />\n <Dialog.ConfirmAction\n onClick={handleSubmit}\n text=\"Generate\"\n disabled={vm.loading || vm.submitting}\n />\n </>\n }\n >\n {vm.loading ? <OverlayLoader text={\"Loading...\"} /> : null}\n {vm.submitting ? <OverlayLoader text={\"Generating content...\"} /> : null}\n {vm.processing ? <OverlayLoader text={\"Processing content...\"} /> : null}\n {vm.form ? <FormView name=\"GenerateContent\" form={vm.form} /> : null}\n </Dialog>\n );\n});\n"],"names":["GENERATE_CONTENT_DIALOG","WS_ACTION_CONTENT","WS_ACTION_ERROR","GenerateContentDialog","observer","closeDialog","useDialog","presenter","useFeature","GenerateContentFeature","vm","wasSubmitting","useRef","websockets","useWebsockets","toast","useToast","components","useSelectFromEditor","state","createElement","useCreateElement","createElements","useCallback","elements","el","useEffect","aiComponents","Object","c","input","contentSubscription","message","responseText","decompressGzipBase64","errorSubscription","handleSubmit","Dialog","OverlayLoader","FormView"],"mappings":";;;;;;;;;;AAaO,MAAMA,0BAA0B;AAEhC,MAAMC,oBAAoB;AAC1B,MAAMC,kBAAkB;AAiBxB,MAAMC,wBAAwBC,SAAS;IAC1C,MAAM,EAAEC,WAAW,EAAE,GAAGC;IACxB,MAAM,EAAEC,SAAS,EAAE,GAAGC,WAAWC;IACjC,MAAMC,KAAKH,UAAU,EAAE;IACvB,MAAMI,gBAAgBC,OAAO;IAC7B,MAAMC,aAAaC;IACnB,MAAMC,QAAQC;IAEd,MAAMC,aAAaC,oBAAoBC,CAAAA,QAASA,MAAM,UAAU;IAChE,MAAM,EAAEC,aAAa,EAAE,GAAGC;IAE1B,MAAMC,iBAAiBC,YACnB,CAACC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GAAG;QAACL,GAAG,QAAQ;KAAC;IAEhB,MAAM0B,eAAe;QACjB,MAAM7B,UAAU,MAAM;IAC1B;IAEA,OAAO,WAAP,GACI,oBAAC8B,QAAMA;QACH,MAAM;QACN,SAAShC;QACT,OAAM;QACN,MAAM;QACN,uBACI,wDACI,oBAACgC,OAAO,YAAY;YAAC,SAAShC;YAAa,MAAK;0BAChD,oBAACgC,OAAO,aAAa;YACjB,SAASD;YACT,MAAK;YACL,UAAU1B,GAAG,OAAO,IAAIA,GAAG,UAAU;;OAKhDA,GAAG,OAAO,GAAG,WAAH,GAAG,oBAAC4B,eAAaA;QAAC,MAAM;SAAmB,MACrD5B,GAAG,UAAU,GAAG,WAAH,GAAG,oBAAC4B,eAAaA;QAAC,MAAM;SAA8B,MACnE5B,GAAG,UAAU,GAAG,WAAH,GAAG,oBAAC4B,eAAaA;QAAC,MAAM;SAA8B,MACnE5B,GAAG,IAAI,GAAG,WAAH,GAAG,oBAAC6B,UAAQA;QAAC,MAAK;QAAkB,MAAM7B,GAAG,IAAI;SAAO;AAG5E"}
@@ -1,22 +1,36 @@
1
- import { ToolRegistry, ToolPipelineRunner } from "@webiny/app-admin";
1
+ import { FormModelFactory, ToolRegistry, ToolPipelineRunner } from "@webiny/app-admin";
2
2
  import { GenerateContentPresenter, type CreateElementsFn } from "./abstractions.js";
3
3
  import { GeneratePageContentUseCase } from "../../../admin/features/generatePageContent/index.js";
4
+ import { GetSettingsUseCase } from "../../../admin/features/settings/getSettings/abstractions.js";
4
5
  declare class GenerateContentPresenterImpl implements GenerateContentPresenter.Interface {
5
6
  private toolRegistry;
6
7
  private pipelineRunner;
7
8
  private generatePageContent;
8
- private _prompt;
9
+ private formModelFactory;
10
+ private getSettings;
11
+ private _loading;
9
12
  private _submitting;
10
13
  private _processing;
14
+ private _timedOut;
11
15
  private _components;
12
16
  private _createElements;
13
- constructor(toolRegistry: ToolRegistry.Interface, pipelineRunner: ToolPipelineRunner.Interface, generatePageContent: GeneratePageContentUseCase.Interface);
17
+ private _form;
18
+ private _settings;
19
+ private _timeoutId;
20
+ constructor(toolRegistry: ToolRegistry.Interface, pipelineRunner: ToolPipelineRunner.Interface, generatePageContent: GeneratePageContentUseCase.Interface, formModelFactory: FormModelFactory.Interface, getSettings: GetSettingsUseCase.Interface);
14
21
  get vm(): GenerateContentPresenter.ViewModel;
15
- init(components: Record<string, any>[], createElements: CreateElementsFn): void;
16
- setPrompt(value: string): void;
22
+ init(components: Record<string, any>[], createElements: CreateElementsFn): Promise<void>;
17
23
  submit(): Promise<void>;
18
24
  processAiResponse(responseText: string): Promise<void>;
19
25
  cancelPrompt(): void;
26
+ private startTimeout;
27
+ private clearTimeout;
28
+ private buildForm;
29
+ private getSelectedProject;
30
+ private getProjectFileOptions;
31
+ private computeExcludedFileIds;
32
+ private getProjectOptions;
33
+ private getPersonaOptions;
20
34
  }
21
35
  export declare const GenerateContentPresenterRegistration: typeof GenerateContentPresenterImpl & {
22
36
  __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGenerateContentPresenter>;
@@ -1,91 +1,228 @@
1
- import { makeAutoObservable, computed, toJS } from "mobx";
1
+ import { computed, makeAutoObservable, runInAction, toJS } from "mobx";
2
2
  import { z } from "zod";
3
3
  import pick from "lodash/pick.js";
4
- import { ToolRegistry, ToolPipelineRunner } from "@webiny/app-admin";
4
+ import { FormModelFactory, ToolPipelineRunner, ToolRegistry } from "@webiny/app-admin";
5
5
  import { GenerateContentPresenter } from "./abstractions.js";
6
6
  import { GeneratePageContentUseCase } from "../../features/generatePageContent/index.js";
7
- import { runInAction } from "mobx";
7
+ import { GetSettingsUseCase } from "../../features/settings/getSettings/abstractions.js";
8
+ const SUBMIT_TIMEOUT_MS = 300000;
8
9
  class GenerateContentPresenterImpl {
9
- _prompt = "";
10
- _submitting = false;
11
- _processing = false;
12
- _components = [];
13
- _createElements = () => {};
14
- constructor(toolRegistry, pipelineRunner, generatePageContent) {
15
- this.toolRegistry = toolRegistry;
16
- this.pipelineRunner = pipelineRunner;
17
- this.generatePageContent = generatePageContent;
18
- makeAutoObservable(this, {
19
- vm: computed
20
- }, {
21
- autoBind: true
22
- });
23
- }
24
- get vm() {
25
- return {
26
- prompt: this._prompt,
27
- submitting: this._submitting,
28
- processing: this._processing
29
- };
30
- }
31
- init(components, createElements) {
32
- this._components = components;
33
- this._createElements = createElements;
34
- }
35
- setPrompt(value) {
36
- this._prompt = value;
37
- }
38
- async submit() {
39
- this._submitting = true;
40
- try {
41
- const tools = this.toolRegistry.getTools().map(tool => ({
42
- name: tool.name,
43
- description: tool.description,
44
- inputSchema: pick(z.toJSONSchema(tool.inputSchema), ["properties", "type"]),
45
- outputSchema: pick(z.toJSONSchema(tool.outputSchema), ["properties", "type"])
46
- }));
47
- await this.generatePageContent.execute({
48
- prompt: this._prompt,
49
- components: toJS(this._components),
50
- tools
51
- });
52
- } catch {
53
- runInAction(() => {
10
+ constructor(toolRegistry, pipelineRunner, generatePageContent, formModelFactory, getSettings){
11
+ this.toolRegistry = toolRegistry;
12
+ this.pipelineRunner = pipelineRunner;
13
+ this.generatePageContent = generatePageContent;
14
+ this.formModelFactory = formModelFactory;
15
+ this.getSettings = getSettings;
16
+ this._loading = false;
54
17
  this._submitting = false;
55
- });
18
+ this._processing = false;
19
+ this._timedOut = false;
20
+ this._components = [];
21
+ this._createElements = ()=>{};
22
+ this._form = null;
23
+ this._settings = null;
24
+ this._timeoutId = null;
25
+ makeAutoObservable(this, {
26
+ vm: computed
27
+ }, {
28
+ autoBind: true
29
+ });
30
+ }
31
+ get vm() {
32
+ return {
33
+ form: this._form ? this._form.vm : null,
34
+ loading: this._loading,
35
+ submitting: this._submitting,
36
+ processing: this._processing,
37
+ timedOut: this._timedOut
38
+ };
56
39
  }
57
- }
58
- async processAiResponse(responseText) {
59
- this._processing = true;
60
- this._submitting = false;
61
- try {
62
- const aiResponseJson = JSON.parse(responseText);
63
- const resolved = await this.pipelineRunner.resolve(aiResponseJson);
64
- const items = Array.isArray(resolved) ? resolved : [resolved];
65
- this._createElements(items.map(element => ({
66
- componentName: element.component,
67
- parentId: "root",
68
- slot: "children",
69
- bindings: {
70
- inputs: element.inputs
40
+ async init(components, createElements) {
41
+ this._components = components;
42
+ this._createElements = createElements;
43
+ this._loading = true;
44
+ try {
45
+ const settings = await this.getSettings.execute();
46
+ runInAction(()=>{
47
+ this._settings = settings;
48
+ this._form = this.buildForm();
49
+ });
50
+ } finally{
51
+ runInAction(()=>{
52
+ this._loading = false;
53
+ });
71
54
  }
72
- })));
73
- } catch (e) {
74
- console.error(e);
75
- } finally {
76
- runInAction(() => {
55
+ }
56
+ async submit() {
57
+ if (!this._form) return;
58
+ const data = await this._form.submit();
59
+ if (!data) return;
60
+ runInAction(()=>{
61
+ this._submitting = true;
62
+ this._timedOut = false;
63
+ });
64
+ this.startTimeout();
65
+ try {
66
+ const tools = this.toolRegistry.getTools().map((tool)=>({
67
+ name: tool.name,
68
+ description: tool.description,
69
+ inputSchema: pick(z.toJSONSchema(tool.inputSchema), [
70
+ "properties",
71
+ "type"
72
+ ]),
73
+ outputSchema: pick(z.toJSONSchema(tool.outputSchema), [
74
+ "properties",
75
+ "type"
76
+ ])
77
+ }));
78
+ const excludedFileIds = this.computeExcludedFileIds(data.project, data.includedFiles);
79
+ await this.generatePageContent.execute({
80
+ prompt: data.prompt,
81
+ components: toJS(this._components),
82
+ tools,
83
+ projectId: data.project || null,
84
+ excludedFileIds,
85
+ readerPersonaId: data.readerPersona || null,
86
+ writerPersonaId: data.writerPersona || null
87
+ });
88
+ } catch {
89
+ this.clearTimeout();
90
+ runInAction(()=>{
91
+ this._submitting = false;
92
+ });
93
+ }
94
+ }
95
+ async processAiResponse(responseText) {
96
+ this.clearTimeout();
97
+ runInAction(()=>{
98
+ this._processing = true;
99
+ this._submitting = false;
100
+ });
101
+ try {
102
+ const aiResponseJson = JSON.parse(responseText);
103
+ const resolved = await this.pipelineRunner.resolve(aiResponseJson);
104
+ const items = Array.isArray(resolved) ? resolved : [
105
+ resolved
106
+ ];
107
+ this._createElements(items.map((element)=>({
108
+ componentName: element.component,
109
+ parentId: "root",
110
+ slot: "children",
111
+ bindings: {
112
+ inputs: element.inputs
113
+ }
114
+ })));
115
+ } catch (e) {
116
+ console.error(e);
117
+ } finally{
118
+ runInAction(()=>{
119
+ this._processing = false;
120
+ });
121
+ }
122
+ }
123
+ cancelPrompt() {
124
+ this.clearTimeout();
77
125
  this._processing = false;
78
- });
126
+ this._submitting = false;
127
+ }
128
+ startTimeout() {
129
+ this.clearTimeout();
130
+ this._timeoutId = setTimeout(()=>{
131
+ runInAction(()=>{
132
+ this._submitting = false;
133
+ this._timedOut = true;
134
+ });
135
+ }, SUBMIT_TIMEOUT_MS);
136
+ }
137
+ clearTimeout() {
138
+ if (null !== this._timeoutId) {
139
+ clearTimeout(this._timeoutId);
140
+ this._timeoutId = null;
141
+ }
142
+ }
143
+ buildForm() {
144
+ return this.formModelFactory.create({
145
+ fields: (fields)=>({
146
+ project: fields.text().label("Project").description("Select a predefined context to attach.").options(()=>this.getProjectOptions()).afterChange((value, form)=>{
147
+ const projectId = value;
148
+ const project = projectId ? this._settings?.projects?.presets?.find((p)=>p.id === projectId) : void 0;
149
+ if (project?.defaultReaderPersonaId) form.field("readerPersona").setValue(project.defaultReaderPersonaId);
150
+ if (project?.defaultWriterPersonaId) form.field("writerPersona").setValue(project.defaultWriterPersonaId);
151
+ const fileIds = (project?.files ?? []).map((f)=>f.id);
152
+ form.field("includedFiles").setValue(fileIds);
153
+ }),
154
+ includedFiles: fields.text().label("Files included").description("Uncheck files to exclude them from this generation only.").options(()=>this.getProjectFileOptions()).renderer("checkboxes").list().hiddenWhen((form)=>{
155
+ const projectId = form.field("project").as("text").getValue();
156
+ if (!projectId) return true;
157
+ const project = this._settings?.projects?.presets?.find((p)=>p.id === projectId);
158
+ return !project?.files || 0 === project.files.length;
159
+ }),
160
+ readerPersona: fields.text().label("Reader Persona").description("Select the target audience for the generated content.").options(()=>this.getPersonaOptions("reader")),
161
+ writerPersona: fields.text().label("Writer Persona").description("Select the writing style for the generated content.").options(()=>this.getPersonaOptions("writer")),
162
+ prompt: fields.text().label("Prompt").description("Describe the page content you want to generate.").required("Prompt is required").renderer("textarea", {
163
+ rows: 6
164
+ })
165
+ }),
166
+ layout: (layout)=>[
167
+ layout.row("project"),
168
+ layout.row("includedFiles"),
169
+ layout.row("readerPersona"),
170
+ layout.row("writerPersona"),
171
+ layout.row("prompt")
172
+ ]
173
+ });
174
+ }
175
+ getSelectedProject() {
176
+ if (!this._form || !this._settings) return;
177
+ const projectId = this._form.field("project").getValue();
178
+ if (!projectId) return;
179
+ return this._settings.projects?.presets?.find((p)=>p.id === projectId);
180
+ }
181
+ getProjectFileOptions() {
182
+ const project = this.getSelectedProject();
183
+ const files = project?.files;
184
+ if (!files || 0 === files.length) return [];
185
+ return files.map((f)=>({
186
+ label: f.name,
187
+ value: f.id
188
+ }));
189
+ }
190
+ computeExcludedFileIds(projectId, includedFiles) {
191
+ if (!projectId) return null;
192
+ const project = this._settings?.projects?.presets?.find((p)=>p.id === projectId);
193
+ const allFileIds = (project?.files ?? []).map((f)=>f.id);
194
+ if (0 === allFileIds.length) return null;
195
+ const included = new Set(includedFiles ?? []);
196
+ const excluded = allFileIds.filter((id)=>!included.has(id));
197
+ return excluded.length > 0 ? excluded : null;
198
+ }
199
+ getProjectOptions() {
200
+ const presets = this._settings?.projects?.presets;
201
+ if (!presets || 0 === presets.length) return [];
202
+ return presets.map((preset)=>({
203
+ label: preset.name,
204
+ value: preset.id
205
+ }));
206
+ }
207
+ getPersonaOptions(type) {
208
+ const presets = "reader" === type ? this._settings?.readerPersonas?.presets : this._settings?.writerPersonas?.presets;
209
+ if (!presets || 0 === presets.length) return [];
210
+ return presets.map((preset)=>({
211
+ label: preset.name,
212
+ value: preset.id
213
+ }));
79
214
  }
80
- }
81
- cancelPrompt() {
82
- this._processing = false;
83
- this._submitting = false;
84
- }
85
215
  }
86
- export const GenerateContentPresenterRegistration = GenerateContentPresenter.createImplementation({
87
- implementation: GenerateContentPresenterImpl,
88
- dependencies: [ToolRegistry, ToolPipelineRunner, GeneratePageContentUseCase]
216
+ const GenerateContentPresenterRegistration = GenerateContentPresenter.createImplementation({
217
+ implementation: GenerateContentPresenterImpl,
218
+ dependencies: [
219
+ ToolRegistry,
220
+ ToolPipelineRunner,
221
+ GeneratePageContentUseCase,
222
+ FormModelFactory,
223
+ GetSettingsUseCase
224
+ ]
89
225
  });
226
+ export { GenerateContentPresenterRegistration };
90
227
 
91
228
  //# sourceMappingURL=GenerateContentPresenter.js.map