@blocklet/pages-kit 0.2.433 → 0.2.435

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 (319) hide show
  1. package/lib/cjs/builtin/async/ai-runtime.js +17 -0
  2. package/lib/cjs/builtin/{async/ai-runtime/components/AgentInputField/LanguageField.js → components/LanguageField/index.js} +3 -3
  3. package/lib/cjs/builtin/{components.js → components/index.js} +1 -1
  4. package/lib/cjs/components/CustomComponentRenderer/context.js +13 -0
  5. package/lib/cjs/components/CustomComponentRenderer/index.js +5 -1
  6. package/lib/cjs/components/CustomComponentRenderer/state.js +20 -6
  7. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  8. package/lib/esm/builtin/async/ai-runtime.js +1 -0
  9. package/lib/esm/builtin/{async/ai-runtime/components/AgentInputField/LanguageField.js → components/LanguageField/index.js} +2 -2
  10. package/lib/esm/builtin/components/index.js +1 -0
  11. package/lib/esm/components/CustomComponentRenderer/context.js +9 -0
  12. package/lib/esm/components/CustomComponentRenderer/index.js +5 -1
  13. package/lib/esm/components/CustomComponentRenderer/state.js +21 -7
  14. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  15. package/lib/types/builtin/async/ai-runtime.d.ts +1 -0
  16. package/lib/types/builtin/components/index.d.ts +1 -0
  17. package/lib/types/components/CustomComponentRenderer/context.d.ts +14 -0
  18. package/lib/types/components/CustomComponentRenderer/index.d.ts +1 -0
  19. package/lib/types/components/CustomComponentRenderer/state.d.ts +5 -1
  20. package/lib/types/tsconfig.tsbuildinfo +1 -1
  21. package/package.json +12 -5
  22. package/tsconfig.json +1 -1
  23. package/lib/cjs/builtin/async/ai-runtime/api/agent.js +0 -24
  24. package/lib/cjs/builtin/async/ai-runtime/api/asset.js +0 -25
  25. package/lib/cjs/builtin/async/ai-runtime/api/dataset.js +0 -134
  26. package/lib/cjs/builtin/async/ai-runtime/api/message.js +0 -46
  27. package/lib/cjs/builtin/async/ai-runtime/api/request.js +0 -74
  28. package/lib/cjs/builtin/async/ai-runtime/api/secret.js +0 -24
  29. package/lib/cjs/builtin/async/ai-runtime/api/session.js +0 -137
  30. package/lib/cjs/builtin/async/ai-runtime/components/ActionButton.js +0 -62
  31. package/lib/cjs/builtin/async/ai-runtime/components/AgentErrorBoundary.js +0 -34
  32. package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/BooleanField.js +0 -21
  33. package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/NumberField.js +0 -21
  34. package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/RadioField.js +0 -39
  35. package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/SelectField.js +0 -24
  36. package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/StringField.js +0 -35
  37. package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/index.js +0 -44
  38. package/lib/cjs/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.js +0 -80
  39. package/lib/cjs/builtin/async/ai-runtime/components/GlobalLoading/index.js +0 -27
  40. package/lib/cjs/builtin/async/ai-runtime/components/GlobalLoading/state.js +0 -39
  41. package/lib/cjs/builtin/async/ai-runtime/components/Header/SimpleHeader.js +0 -49
  42. package/lib/cjs/builtin/async/ai-runtime/components/Layout/SimpleLayout.js +0 -21
  43. package/lib/cjs/builtin/async/ai-runtime/components/LoadingButton.js +0 -40
  44. package/lib/cjs/builtin/async/ai-runtime/components/MarkdownRenderer/index.js +0 -146
  45. package/lib/cjs/builtin/async/ai-runtime/components/MenuButton.js +0 -55
  46. package/lib/cjs/builtin/async/ai-runtime/components/OutputFieldContainer/index.js +0 -22
  47. package/lib/cjs/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.js +0 -49
  48. package/lib/cjs/builtin/async/ai-runtime/components/PopperMenuButton/index.js +0 -68
  49. package/lib/cjs/builtin/async/ai-runtime/components/RuntimeCommonProvider.js +0 -25
  50. package/lib/cjs/builtin/async/ai-runtime/components/ScrollView.js +0 -92
  51. package/lib/cjs/builtin/async/ai-runtime/components/ShareActions/Community.js +0 -6
  52. package/lib/cjs/builtin/async/ai-runtime/components/ShareActions/index.js +0 -255
  53. package/lib/cjs/builtin/async/ai-runtime/components/SocialShare.js +0 -108
  54. package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +0 -191
  55. package/lib/cjs/builtin/async/ai-runtime/components/UserInfo.js +0 -55
  56. package/lib/cjs/builtin/async/ai-runtime/constants.js +0 -43
  57. package/lib/cjs/builtin/async/ai-runtime/contexts/ActiveAgent.js +0 -27
  58. package/lib/cjs/builtin/async/ai-runtime/contexts/ComponentPreferences.js +0 -31
  59. package/lib/cjs/builtin/async/ai-runtime/contexts/CurrentAgent.js +0 -34
  60. package/lib/cjs/builtin/async/ai-runtime/contexts/CurrentMessage.js +0 -18
  61. package/lib/cjs/builtin/async/ai-runtime/contexts/Identity.js +0 -36
  62. package/lib/cjs/builtin/async/ai-runtime/contexts/Runtime.js +0 -52
  63. package/lib/cjs/builtin/async/ai-runtime/error.js +0 -10
  64. package/lib/cjs/builtin/async/ai-runtime/hooks/use-agent-admin.js +0 -13
  65. package/lib/cjs/builtin/async/ai-runtime/hooks/use-appearances.js +0 -109
  66. package/lib/cjs/builtin/async/ai-runtime/hooks/use-header-menu.js +0 -50
  67. package/lib/cjs/builtin/async/ai-runtime/index.js +0 -83
  68. package/lib/cjs/builtin/async/ai-runtime/locales/index.js +0 -237
  69. package/lib/cjs/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +0 -116
  70. package/lib/cjs/builtin/async/ai-runtime/runtime/Runtime/index.js +0 -48
  71. package/lib/cjs/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +0 -138
  72. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.js +0 -19
  73. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageItemView.js +0 -186
  74. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageMetadataRenderer.js +0 -24
  75. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageSuggestedQuestions.js +0 -34
  76. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/ReferenceLinks.js +0 -11
  77. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/index.js +0 -24
  78. package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.js +0 -85
  79. package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.js +0 -64
  80. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ImagesView/index.js +0 -30
  81. package/lib/cjs/builtin/async/ai-runtime/runtime-components/MarkdownView/index.js +0 -13
  82. package/lib/cjs/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.js +0 -46
  83. package/lib/cjs/builtin/async/ai-runtime/runtime-components/OutputFieldView/type.js +0 -2
  84. package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +0 -65
  85. package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.js +0 -150
  86. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.js +0 -26
  87. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ShareView/index.js +0 -16
  88. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.js +0 -38
  89. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/DrawerOpenCloseIcon.js +0 -42
  90. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.js +0 -94
  91. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +0 -79
  92. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.js +0 -34
  93. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.js +0 -45
  94. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.js +0 -28
  95. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +0 -82
  96. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +0 -69
  97. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +0 -55
  98. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.js +0 -54
  99. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Input.js +0 -189
  100. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Output.js +0 -252
  101. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Page.js +0 -300
  102. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +0 -158
  103. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.js +0 -60
  104. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/Loading.js +0 -153
  105. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.js +0 -80
  106. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/TransparentTooltip.js +0 -25
  107. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +0 -68
  108. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.js +0 -56
  109. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/index.js +0 -12
  110. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/utils.js +0 -13
  111. package/lib/cjs/builtin/async/ai-runtime/state/agent.js +0 -58
  112. package/lib/cjs/builtin/async/ai-runtime/state/runtime.js +0 -48
  113. package/lib/cjs/builtin/async/ai-runtime/state/session.js +0 -415
  114. package/lib/cjs/builtin/async/ai-runtime/utils/agent-inputs.js +0 -14
  115. package/lib/cjs/builtin/async/ai-runtime/utils/download-image.js +0 -40
  116. package/lib/cjs/builtin/async/ai-runtime/utils/fonts.js +0 -35
  117. package/lib/cjs/builtin/async/ai-runtime/utils/map-right.js +0 -10
  118. package/lib/cjs/builtin/async/ai-runtime/utils/runtime-output-schema.js +0 -7
  119. package/lib/cjs/builtin/async/ai-runtime/utils/zustand.js +0 -9
  120. package/lib/esm/builtin/async/ai-runtime/api/agent.js +0 -21
  121. package/lib/esm/builtin/async/ai-runtime/api/asset.js +0 -22
  122. package/lib/esm/builtin/async/ai-runtime/api/dataset.js +0 -121
  123. package/lib/esm/builtin/async/ai-runtime/api/message.js +0 -42
  124. package/lib/esm/builtin/async/ai-runtime/api/request.js +0 -68
  125. package/lib/esm/builtin/async/ai-runtime/api/secret.js +0 -21
  126. package/lib/esm/builtin/async/ai-runtime/api/session.js +0 -128
  127. package/lib/esm/builtin/async/ai-runtime/components/ActionButton.js +0 -56
  128. package/lib/esm/builtin/async/ai-runtime/components/AgentErrorBoundary.js +0 -30
  129. package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/BooleanField.js +0 -19
  130. package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/NumberField.js +0 -19
  131. package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/RadioField.js +0 -37
  132. package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/SelectField.js +0 -22
  133. package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/StringField.js +0 -33
  134. package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/index.js +0 -38
  135. package/lib/esm/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.js +0 -76
  136. package/lib/esm/builtin/async/ai-runtime/components/GlobalLoading/index.js +0 -22
  137. package/lib/esm/builtin/async/ai-runtime/components/GlobalLoading/state.js +0 -36
  138. package/lib/esm/builtin/async/ai-runtime/components/Header/SimpleHeader.js +0 -23
  139. package/lib/esm/builtin/async/ai-runtime/components/Layout/SimpleLayout.js +0 -18
  140. package/lib/esm/builtin/async/ai-runtime/components/LoadingButton.js +0 -38
  141. package/lib/esm/builtin/async/ai-runtime/components/MarkdownRenderer/index.js +0 -118
  142. package/lib/esm/builtin/async/ai-runtime/components/MenuButton.js +0 -52
  143. package/lib/esm/builtin/async/ai-runtime/components/OutputFieldContainer/index.js +0 -19
  144. package/lib/esm/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.js +0 -46
  145. package/lib/esm/builtin/async/ai-runtime/components/PopperMenuButton/index.js +0 -42
  146. package/lib/esm/builtin/async/ai-runtime/components/RuntimeCommonProvider.js +0 -18
  147. package/lib/esm/builtin/async/ai-runtime/components/ScrollView.js +0 -63
  148. package/lib/esm/builtin/async/ai-runtime/components/ShareActions/Community.js +0 -4
  149. package/lib/esm/builtin/async/ai-runtime/components/ShareActions/index.js +0 -226
  150. package/lib/esm/builtin/async/ai-runtime/components/SocialShare.js +0 -100
  151. package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +0 -185
  152. package/lib/esm/builtin/async/ai-runtime/components/UserInfo.js +0 -47
  153. package/lib/esm/builtin/async/ai-runtime/constants.js +0 -39
  154. package/lib/esm/builtin/async/ai-runtime/contexts/ActiveAgent.js +0 -23
  155. package/lib/esm/builtin/async/ai-runtime/contexts/ComponentPreferences.js +0 -24
  156. package/lib/esm/builtin/async/ai-runtime/contexts/CurrentAgent.js +0 -30
  157. package/lib/esm/builtin/async/ai-runtime/contexts/CurrentMessage.js +0 -14
  158. package/lib/esm/builtin/async/ai-runtime/contexts/Identity.js +0 -28
  159. package/lib/esm/builtin/async/ai-runtime/contexts/Runtime.js +0 -22
  160. package/lib/esm/builtin/async/ai-runtime/error.js +0 -6
  161. package/lib/esm/builtin/async/ai-runtime/hooks/use-agent-admin.js +0 -10
  162. package/lib/esm/builtin/async/ai-runtime/hooks/use-appearances.js +0 -103
  163. package/lib/esm/builtin/async/ai-runtime/hooks/use-header-menu.js +0 -44
  164. package/lib/esm/builtin/async/ai-runtime/index.js +0 -37
  165. package/lib/esm/builtin/async/ai-runtime/locales/index.js +0 -234
  166. package/lib/esm/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +0 -87
  167. package/lib/esm/builtin/async/ai-runtime/runtime/Runtime/index.js +0 -19
  168. package/lib/esm/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +0 -132
  169. package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.js +0 -13
  170. package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageItemView.js +0 -157
  171. package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageMetadataRenderer.js +0 -18
  172. package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageSuggestedQuestions.js +0 -30
  173. package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/ReferenceLinks.js +0 -8
  174. package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/index.js +0 -18
  175. package/lib/esm/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.js +0 -56
  176. package/lib/esm/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.js +0 -58
  177. package/lib/esm/builtin/async/ai-runtime/runtime-components/ImagesView/index.js +0 -24
  178. package/lib/esm/builtin/async/ai-runtime/runtime-components/MarkdownView/index.js +0 -7
  179. package/lib/esm/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.js +0 -40
  180. package/lib/esm/builtin/async/ai-runtime/runtime-components/OutputFieldView/type.js +0 -1
  181. package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +0 -59
  182. package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.js +0 -144
  183. package/lib/esm/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.js +0 -20
  184. package/lib/esm/builtin/async/ai-runtime/runtime-components/ShareView/index.js +0 -10
  185. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.js +0 -35
  186. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/DrawerOpenCloseIcon.js +0 -39
  187. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.js +0 -65
  188. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +0 -50
  189. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.js +0 -28
  190. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.js +0 -40
  191. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.js +0 -22
  192. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +0 -53
  193. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +0 -40
  194. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +0 -49
  195. package/lib/esm/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.js +0 -48
  196. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Input.js +0 -183
  197. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Output.js +0 -246
  198. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Page.js +0 -294
  199. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +0 -149
  200. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.js +0 -55
  201. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/Loading.js +0 -146
  202. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.js +0 -75
  203. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/TransparentTooltip.js +0 -23
  204. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +0 -42
  205. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.js +0 -52
  206. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/index.js +0 -3
  207. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/utils.js +0 -9
  208. package/lib/esm/builtin/async/ai-runtime/state/agent.js +0 -55
  209. package/lib/esm/builtin/async/ai-runtime/state/runtime.js +0 -45
  210. package/lib/esm/builtin/async/ai-runtime/state/session.js +0 -408
  211. package/lib/esm/builtin/async/ai-runtime/utils/agent-inputs.js +0 -10
  212. package/lib/esm/builtin/async/ai-runtime/utils/download-image.js +0 -36
  213. package/lib/esm/builtin/async/ai-runtime/utils/fonts.js +0 -32
  214. package/lib/esm/builtin/async/ai-runtime/utils/map-right.js +0 -7
  215. package/lib/esm/builtin/async/ai-runtime/utils/runtime-output-schema.js +0 -4
  216. package/lib/esm/builtin/async/ai-runtime/utils/zustand.js +0 -6
  217. package/lib/esm/builtin/components.js +0 -1
  218. package/lib/types/builtin/async/ai-runtime/api/agent.d.ts +0 -51
  219. package/lib/types/builtin/async/ai-runtime/api/asset.d.ts +0 -16
  220. package/lib/types/builtin/async/ai-runtime/api/dataset.d.ts +0 -39
  221. package/lib/types/builtin/async/ai-runtime/api/message.d.ts +0 -35
  222. package/lib/types/builtin/async/ai-runtime/api/request.d.ts +0 -12
  223. package/lib/types/builtin/async/ai-runtime/api/secret.d.ts +0 -12
  224. package/lib/types/builtin/async/ai-runtime/api/session.d.ts +0 -61
  225. package/lib/types/builtin/async/ai-runtime/components/ActionButton.d.ts +0 -14
  226. package/lib/types/builtin/async/ai-runtime/components/AgentErrorBoundary.d.ts +0 -7
  227. package/lib/types/builtin/async/ai-runtime/components/AgentInputField/BooleanField.d.ts +0 -8
  228. package/lib/types/builtin/async/ai-runtime/components/AgentInputField/NumberField.d.ts +0 -8
  229. package/lib/types/builtin/async/ai-runtime/components/AgentInputField/RadioField.d.ts +0 -8
  230. package/lib/types/builtin/async/ai-runtime/components/AgentInputField/SelectField.d.ts +0 -8
  231. package/lib/types/builtin/async/ai-runtime/components/AgentInputField/StringField.d.ts +0 -8
  232. package/lib/types/builtin/async/ai-runtime/components/AgentInputField/index.d.ts +0 -7
  233. package/lib/types/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.d.ts +0 -10
  234. package/lib/types/builtin/async/ai-runtime/components/GlobalLoading/index.d.ts +0 -3
  235. package/lib/types/builtin/async/ai-runtime/components/GlobalLoading/state.d.ts +0 -10
  236. package/lib/types/builtin/async/ai-runtime/components/Header/SimpleHeader.d.ts +0 -5
  237. package/lib/types/builtin/async/ai-runtime/components/Layout/SimpleLayout.d.ts +0 -2
  238. package/lib/types/builtin/async/ai-runtime/components/LoadingButton.d.ts +0 -3
  239. package/lib/types/builtin/async/ai-runtime/components/MarkdownRenderer/index.d.ts +0 -2
  240. package/lib/types/builtin/async/ai-runtime/components/MenuButton.d.ts +0 -10
  241. package/lib/types/builtin/async/ai-runtime/components/OutputFieldContainer/index.d.ts +0 -5
  242. package/lib/types/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.d.ts +0 -5
  243. package/lib/types/builtin/async/ai-runtime/components/PopperMenuButton/index.d.ts +0 -6
  244. package/lib/types/builtin/async/ai-runtime/components/RuntimeCommonProvider.d.ts +0 -7
  245. package/lib/types/builtin/async/ai-runtime/components/ScrollView.d.ts +0 -10
  246. package/lib/types/builtin/async/ai-runtime/components/ShareActions/Community.d.ts +0 -4
  247. package/lib/types/builtin/async/ai-runtime/components/ShareActions/index.d.ts +0 -2
  248. package/lib/types/builtin/async/ai-runtime/components/SocialShare.d.ts +0 -20
  249. package/lib/types/builtin/async/ai-runtime/components/ThemeProvider.d.ts +0 -4
  250. package/lib/types/builtin/async/ai-runtime/components/UserInfo.d.ts +0 -18
  251. package/lib/types/builtin/async/ai-runtime/constants.d.ts +0 -21
  252. package/lib/types/builtin/async/ai-runtime/contexts/ActiveAgent.d.ts +0 -9
  253. package/lib/types/builtin/async/ai-runtime/contexts/ComponentPreferences.d.ts +0 -11
  254. package/lib/types/builtin/async/ai-runtime/contexts/CurrentAgent.d.ts +0 -16
  255. package/lib/types/builtin/async/ai-runtime/contexts/CurrentMessage.d.ts +0 -15
  256. package/lib/types/builtin/async/ai-runtime/contexts/Identity.d.ts +0 -16
  257. package/lib/types/builtin/async/ai-runtime/contexts/Runtime.d.ts +0 -4
  258. package/lib/types/builtin/async/ai-runtime/error.d.ts +0 -4
  259. package/lib/types/builtin/async/ai-runtime/hooks/use-agent-admin.d.ts +0 -2
  260. package/lib/types/builtin/async/ai-runtime/hooks/use-appearances.d.ts +0 -78
  261. package/lib/types/builtin/async/ai-runtime/hooks/use-header-menu.d.ts +0 -1
  262. package/lib/types/builtin/async/ai-runtime/index.d.ts +0 -36
  263. package/lib/types/builtin/async/ai-runtime/locales/index.d.ts +0 -210
  264. package/lib/types/builtin/async/ai-runtime/runtime/ChatBotButton/index.d.ts +0 -5
  265. package/lib/types/builtin/async/ai-runtime/runtime/Runtime/index.d.ts +0 -5
  266. package/lib/types/builtin/async/ai-runtime/runtime-components/AutoForm/index.d.ts +0 -7
  267. package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.d.ts +0 -4
  268. package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageItemView.d.ts +0 -12
  269. package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageMetadataRenderer.d.ts +0 -4
  270. package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageSuggestedQuestions.d.ts +0 -7
  271. package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/ReferenceLinks.d.ts +0 -4
  272. package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/index.d.ts +0 -4
  273. package/lib/types/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.d.ts +0 -4
  274. package/lib/types/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.d.ts +0 -2
  275. package/lib/types/builtin/async/ai-runtime/runtime-components/ImagesView/index.d.ts +0 -2
  276. package/lib/types/builtin/async/ai-runtime/runtime-components/MarkdownView/index.d.ts +0 -5
  277. package/lib/types/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.d.ts +0 -2
  278. package/lib/types/builtin/async/ai-runtime/runtime-components/OutputFieldView/type.d.ts +0 -5
  279. package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.d.ts +0 -3
  280. package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.d.ts +0 -1
  281. package/lib/types/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.d.ts +0 -2
  282. package/lib/types/builtin/async/ai-runtime/runtime-components/ShareView/index.d.ts +0 -2
  283. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.d.ts +0 -1
  284. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/DrawerOpenCloseIcon.d.ts +0 -4
  285. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.d.ts +0 -2
  286. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.d.ts +0 -9
  287. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.d.ts +0 -2
  288. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.d.ts +0 -4
  289. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.d.ts +0 -1
  290. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/index.d.ts +0 -16
  291. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.d.ts +0 -1
  292. package/lib/types/builtin/async/ai-runtime/runtime-components/SimplePage/index.d.ts +0 -6
  293. package/lib/types/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.d.ts +0 -4
  294. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/Input.d.ts +0 -7
  295. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/Output.d.ts +0 -1
  296. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/Page.d.ts +0 -1
  297. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.d.ts +0 -20
  298. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.d.ts +0 -5
  299. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/Loading.d.ts +0 -3
  300. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.d.ts +0 -5
  301. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/TransparentTooltip.d.ts +0 -3
  302. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.d.ts +0 -3
  303. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.d.ts +0 -17
  304. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/index.d.ts +0 -3
  305. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/utils.d.ts +0 -7
  306. package/lib/types/builtin/async/ai-runtime/state/agent.d.ts +0 -12
  307. package/lib/types/builtin/async/ai-runtime/state/runtime.d.ts +0 -14
  308. package/lib/types/builtin/async/ai-runtime/state/session.d.ts +0 -60
  309. package/lib/types/builtin/async/ai-runtime/utils/agent-inputs.d.ts +0 -5
  310. package/lib/types/builtin/async/ai-runtime/utils/download-image.d.ts +0 -4
  311. package/lib/types/builtin/async/ai-runtime/utils/fonts.d.ts +0 -5
  312. package/lib/types/builtin/async/ai-runtime/utils/map-right.d.ts +0 -1
  313. package/lib/types/builtin/async/ai-runtime/utils/runtime-output-schema.d.ts +0 -3
  314. package/lib/types/builtin/async/ai-runtime/utils/zustand.d.ts +0 -2
  315. package/lib/types/builtin/components.d.ts +0 -1
  316. /package/lib/cjs/builtin/{async/ai-runtime/utils → components/LanguageField}/languages.js +0 -0
  317. /package/lib/esm/builtin/{async/ai-runtime/utils → components/LanguageField}/languages.js +0 -0
  318. /package/lib/types/builtin/{async/ai-runtime/components/AgentInputField/LanguageField.d.ts → components/LanguageField/index.d.ts} +0 -0
  319. /package/lib/types/builtin/{async/ai-runtime/utils → components/LanguageField}/languages.d.ts +0 -0
@@ -1,59 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { Masonry } from '@mui/lab';
14
- import { Box, Skeleton, Stack, Typography } from '@mui/material';
15
- import { Suspense, memo, useRef } from 'react';
16
- import Balancer from 'react-wrap-balancer';
17
- import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
18
- import { useLocaleContext } from '../../../../locale';
19
- import { AgentErrorView } from '../../components/AgentErrorBoundary';
20
- import SimpleHeader from '../../components/Header/SimpleHeader';
21
- import LoadingButton from '../../components/LoadingButton';
22
- import { useActiveAgent } from '../../contexts/ActiveAgent';
23
- import CurrentAgentProvider from '../../contexts/CurrentAgent';
24
- import CurrentMessageProvider from '../../contexts/CurrentMessage';
25
- import useAppearances from '../../hooks/use-appearances';
26
- import { useAutoLoadSessionState, useCurrentSessionState, useSessionState } from '../../state/session';
27
- export default function PhotoGallery({ resultTitle }) {
28
- const { activeAgentId } = useActiveAgent();
29
- useAutoLoadSessionState();
30
- return (_jsxs(Stack, { className: "aigne-layout aigne-photo-wall-layout", children: [_jsx(SimpleHeader, { TitleProps: { fontSize: 48 }, DescriptionProps: { fontSize: 20 }, maxWidth: "md", mx: "auto", width: "100%", px: { xs: 2, sm: 3 } }), _jsx(CurrentAgentProvider, { agentId: activeAgentId, children: _jsx(AgentInputRender, { className: "aigne-inputs aigne-photo-wall-inputs", maxWidth: "md", mx: "auto", width: "100%", px: { xs: 2, sm: 3 } }) }), _jsx(OutputView, { resultTitle: resultTitle, className: "aigne-outputs aigne-photo-wall-outputs", gap: 2 })] }));
31
- }
32
- function AgentInputRender(_a) {
33
- var props = __rest(_a, []);
34
- const { appearanceInput } = useAppearances();
35
- if (!(appearanceInput === null || appearanceInput === void 0 ? void 0 : appearanceInput.componentId))
36
- return null;
37
- return (_jsx(Stack, Object.assign({}, props, { children: _jsx(CustomComponentRenderer, { componentId: appearanceInput.componentId, properties: appearanceInput.componentProperties }) })));
38
- }
39
- function NoOutputs() {
40
- return (_jsx(Stack, { mt: 10, children: _jsx(Typography, { color: "text.disabled", children: "You haven't generated any pictures yet." }) }));
41
- }
42
- function OutputView(_a) {
43
- var _b, _c, _d, _e;
44
- var { resultTitle } = _a, props = __rest(_a, ["resultTitle"]);
45
- const { t } = useLocaleContext();
46
- const ref = useRef(null);
47
- const { messages = [], running, loaded, noMoreMessage } = (_b = useCurrentSessionState((s) => s)) !== null && _b !== void 0 ? _b : {};
48
- const loadMoreMessages = useSessionState((s) => s.loadMoreMessages);
49
- return (_jsxs(Stack, Object.assign({ width: "100%", alignItems: "center", px: { xs: 2, sm: 3 }, mt: { xs: 2, sm: 3 } }, props, { children: [resultTitle && (_jsx(Typography, { width: "100%", component: "h2", fontSize: 36, fontWeight: 700, textAlign: "center", children: _jsx(Balancer, { children: resultTitle }) })), loaded && !messages.length && _jsx(NoOutputs, {}), _jsxs(Masonry, { ref: ref, columns: { xs: 2, sm: 3, md: 4, lg: 5 }, spacing: 1, sequential: true, sx: { width: '100%', overflow: 'hidden', '> *': { borderRadius: 1 } }, children: [running && (_jsx(Skeleton, { variant: "rectangular", sx: {
50
- // FIXME: default using history height
51
- height: (_e = (_d = (_c = ref.current) === null || _c === void 0 ? void 0 : _c.querySelector('*')) === null || _d === void 0 ? void 0 : _d.clientHeight) !== null && _e !== void 0 ? _e : 200,
52
- } })), messages.map((message) => (_jsx(OutputItemView, { message: message }, message.id)))] }), _jsx(Box, { my: 4, children: !!messages.length && !noMoreMessage && (_jsx(LoadingButton, { variant: "outlined", onClick: () => loadMoreMessages(), children: t('loadMore') })) })] })));
53
- }
54
- const OutputItemView = memo(({ message }) => {
55
- const { appearanceOutput } = useAppearances({ agentId: message.agentId });
56
- if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId))
57
- return null;
58
- return (_jsx(CurrentAgentProvider, { agentId: message.agentId, children: _jsx(CurrentMessageProvider, { message: message, children: _jsx(Suspense, { children: _jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties, fallbackRender: AgentErrorView }, message.id) }) }) }, message.id));
59
- });
@@ -1,144 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { RuntimeOutputVariable } from '@blocklet/ai-runtime/types';
14
- import { Icon } from '@iconify/react';
15
- import { Box, Button, Dialog, DialogContent, DialogTitle, Stack, Typography, alpha } from '@mui/material';
16
- import { useMemo, useState } from 'react';
17
- import { withQuery } from 'ufo';
18
- import { RelativeTime } from '../../../../arcblock/ux';
19
- import { useLocaleContext } from '../../../../locale';
20
- import { useSessionContext } from '../../../../session';
21
- import ActionButton from '../../components/ActionButton';
22
- import ShareActions from '../../components/ShareActions';
23
- import UserInfo from '../../components/UserInfo';
24
- import { useCurrentAgent } from '../../contexts/CurrentAgent';
25
- import { useCurrentMessage } from '../../contexts/CurrentMessage';
26
- import { isValidInput } from '../../utils/agent-inputs';
27
- const getLineClamp = (line) => ({
28
- display: '-webkit-box',
29
- WebkitLineClamp: line,
30
- WebkitBoxOrient: 'vertical',
31
- overflow: 'hidden',
32
- overflowWrap: 'break-word',
33
- textOverflow: 'ellipsis',
34
- whiteSpace: 'wrap',
35
- });
36
- export default function PhotoGalleryItem() {
37
- var _a, _b;
38
- const { message } = useCurrentMessage();
39
- const [openDialog, setOpenDialog] = useState(false);
40
- const objects = (_b = (_a = message.outputs) === null || _a === void 0 ? void 0 : _a.objects) !== null && _b !== void 0 ? _b : [];
41
- const images = objects.flatMap((i) => { var _a; return (_a = i === null || i === void 0 ? void 0 : i[RuntimeOutputVariable.images]) !== null && _a !== void 0 ? _a : []; });
42
- if (!images.length && message.error)
43
- throw message.error;
44
- return images.map(({ url }, index) => {
45
- var _a;
46
- return (_jsxs(Box, { sx: {
47
- position: 'relative',
48
- overflow: 'hidden',
49
- cursor: 'pointer',
50
- '&:hover': {
51
- '.photo-wall-item-alt': {
52
- opacity: 1,
53
- },
54
- },
55
- }, onClick: () => setOpenDialog(true), children: [_jsx(Box, { component: "img", src: withQuery(url, { imageFilter: 'resize', w: 500 }), alt: "", width: "100%", height: "100%",
56
- // 首屏 image 不能用 lazy,会闪烁乱序
57
- loading: index < 12 ? 'eager' : 'lazy' }), _jsx(Box, { className: "photo-wall-item-alt", sx: {
58
- position: 'absolute',
59
- top: 0,
60
- bottom: 0,
61
- left: 0,
62
- right: 0,
63
- width: '100%',
64
- height: '100%',
65
- px: 1.5,
66
- py: 1,
67
- display: 'flex',
68
- alignItems: 'flex-end',
69
- fontWeight: 500,
70
- fontSize: 13,
71
- color: 'white',
72
- background: 'linear-gradient(to bottom, rgba(2, 7, 19, 0) 0%, rgba(2, 7, 19, 0.8) 100%)',
73
- opacity: 0,
74
- transition: 'opacity 0.3s',
75
- }, children: _jsx(Box, { sx: Object.assign({ lineHeight: 1.5 }, getLineClamp(3)), children: (_a = message.inputs) === null || _a === void 0 ? void 0 : _a.question }) }), openDialog && (_jsx(PromptDialog, { open: true, url: url, onClose: (e) => {
76
- e.stopPropagation();
77
- e.preventDefault();
78
- setOpenDialog(false);
79
- } }))] }, url));
80
- });
81
- }
82
- function RenderSubTitle({ children }) {
83
- return (_jsx(Typography, { variant: "caption", sx: { fontSize: 14 }, children: children }));
84
- }
85
- function PromptView() {
86
- var _a;
87
- const { message } = useCurrentMessage();
88
- const { agent } = useCurrentAgent();
89
- const params = useMemo(() => {
90
- var _a;
91
- return (_a = agent.parameters) === null || _a === void 0 ? void 0 : _a.filter(isValidInput).map((i) => { var _a, _b; return [((_a = i.label) === null || _a === void 0 ? void 0 : _a.trim()) || i.key, (_b = message.inputs) === null || _b === void 0 ? void 0 : _b[i.key]]; }).filter((i) => i[1]);
92
- }, [agent.parameters, message.inputs]);
93
- if ((params === null || params === void 0 ? void 0 : params.length) === 1) {
94
- return (_a = params[0]) === null || _a === void 0 ? void 0 : _a[1];
95
- }
96
- return params === null || params === void 0 ? void 0 : params.map(([key, value]) => (_jsxs(Typography, { sx: { wordWrap: 'break-word' }, children: [_jsx(Box, { component: "span", sx: { color: 'text.secondary' }, children: key }), "\u00A0\u00A0", _jsx("span", { children: value })] }, key)));
97
- }
98
- function PromptDialog(_a) {
99
- var _b, _c, _d;
100
- var { url } = _a, props = __rest(_a, ["url"]);
101
- const { message } = useCurrentMessage();
102
- const { inputs: parameters } = message;
103
- const { t } = useLocaleContext();
104
- const { session: authSession } = useSessionContext();
105
- const borderRadius = 1;
106
- return (_jsxs(Dialog, Object.assign({ fullWidth: true, maxWidth: "xl", scroll: "paper", slotProps: {
107
- backdrop: {
108
- sx: {
109
- bgcolor: 'rgba(255, 255, 255, 0.4)',
110
- backdropFilter: 'blur(12px)',
111
- },
112
- },
113
- } }, props, { children: [_jsxs(DialogTitle, { sx: {
114
- display: 'flex',
115
- justifyContent: 'space-between',
116
- }, children: [_jsx(Typography, { component: "h5", sx: { fontSize: 24, fontWeight: 700, color: 'primary.main' }, children: t('photoWall.dialog.title') }), _jsx(Box, { children: _jsx(Button, { onClick: (e) => { var _a; return (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props, e, 'backdropClick'); }, variant: "contained", disableElevation: true, sx: {
117
- bgcolor: (theme) => alpha(theme.palette.primary.light, 0.2),
118
- minWidth: 32,
119
- minHeight: 32,
120
- p: 0,
121
- fontSize: 22,
122
- color: 'primary.main',
123
- ':hover': {
124
- bgcolor: (theme) => alpha(theme.palette.primary.light, 0.3),
125
- },
126
- }, children: _jsx(Icon, { icon: "tabler:x" }) }) })] }), _jsx(DialogContent, { children: _jsxs(Stack, { gap: 2.5, sx: { flexDirection: { md: 'row' } }, children: [_jsx(Stack, { sx: { flex: 3, width: { xs: '100%', md: 0 }, gap: 1 }, children: _jsx(Box, { component: "img", src: url, alt: "", loading: "lazy", sx: {
127
- display: 'block',
128
- width: '100%',
129
- borderRadius,
130
- } }) }), _jsxs(Stack, { sx: { flex: 2, width: { xs: '100%', md: 0 }, gap: 1 }, children: [_jsx(RenderSubTitle, { children: t('photoWall.dialog.author') }), _jsx(UserInfo, { showDID: true, name: (_b = authSession.user) === null || _b === void 0 ? void 0 : _b.fullName, did: (_c = authSession.user) === null || _c === void 0 ? void 0 : _c.did, avatar: (_d = authSession.user) === null || _d === void 0 ? void 0 : _d.avatar }), _jsx(Box, {}), _jsx(Box, { sx: { fontSize: 14, color: 'text.secondary' }, children: _jsx(RelativeTime, { value: message.createdAt }) }), _jsx(Box, {}), _jsx(RenderSubTitle, { children: t('photoWall.dialog.prompt') }), _jsx(Box, { sx: {
131
- backgroundColor: 'background.paper',
132
- borderRadius,
133
- p: 1,
134
- fontSize: 16,
135
- border: 1,
136
- borderColor: 'divider',
137
- overflow: 'auto',
138
- maxHeight: { xs: 'unset', md: '40vh' },
139
- }, children: _jsx(PromptView, {}) }), _jsx(Box, { children: _jsx(ActionButton, { autoReset: true, size: "small", variant: "contained", placement: "right", tip: t('copyToClipboard'), title: t('copy'), titleSucceed: t('copied'), icon: "tabler:copy", iconSucceed: "tabler:copy-check-filled", onClick: () => {
140
- window.navigator.clipboard.writeText(parameters === null || parameters === void 0 ? void 0 : parameters.question);
141
- }, sx: {
142
- borderRadius,
143
- } }) }), _jsx(ShareActions, { direction: "row", justifyContent: "flex-end", sx: { mt: 2 } })] })] }) })] })));
144
- }
@@ -1,20 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Link, Stack } from '@mui/material';
3
- import Joi from 'joi';
4
- import { useMemo } from 'react';
5
- import OutputFieldContainer from '../../components/OutputFieldContainer';
6
- const referencedLinksSchema = Joi.array().items(Joi.object({
7
- title: Joi.string().required(),
8
- url: Joi.string().required(),
9
- }));
10
- export default function SuggestedQuestionsView({ output, outputValue }) {
11
- const links = useMemo(() => {
12
- const result = referencedLinksSchema.validate(outputValue, { allowUnknown: true });
13
- if (result.error)
14
- return undefined;
15
- return result.value;
16
- }, [outputValue]);
17
- if (!(links === null || links === void 0 ? void 0 : links.length))
18
- return null;
19
- return (_jsx(OutputFieldContainer, { output: output, children: _jsx(Stack, { gap: 1, children: links.map((item) => (_jsx(Link, { href: item.url, children: item.title }))) }) }));
20
- }
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import OutputFieldContainer from '../../components/OutputFieldContainer';
3
- import ShareActions from '../../components/ShareActions';
4
- import { useCurrentMessage } from '../../contexts/CurrentMessage';
5
- export default function ShareView({ output }) {
6
- const message = useCurrentMessage({ optional: true });
7
- if (message === null || message === void 0 ? void 0 : message.message.loading)
8
- return null;
9
- return (_jsx(OutputFieldContainer, { output: output, children: _jsx(ShareActions, { flexDirection: "row", justifyContent: "flex-end" }) }));
10
- }
@@ -1,35 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Box } from '@mui/material';
3
- import { getAssetUrl } from '../../api/asset';
4
- import { useComponentPreferences } from '../../contexts/ComponentPreferences';
5
- import { useRuntimeState } from '../../state/runtime';
6
- export default function BackgroundImage() {
7
- var _a, _b;
8
- const { blockletDid, aid } = useRuntimeState();
9
- const preferences = useComponentPreferences();
10
- if (!((_a = preferences === null || preferences === void 0 ? void 0 : preferences.backgroundImage) === null || _a === void 0 ? void 0 : _a.url))
11
- return null;
12
- return (_jsx(Box, { sx: {
13
- position: 'fixed',
14
- left: 0,
15
- top: 0,
16
- right: 0,
17
- bottom: 0,
18
- backgroundImage: `url(${getAssetUrl({ blockletDid, aid, filename: (_b = preferences.backgroundImage) === null || _b === void 0 ? void 0 : _b.url })}) !important`,
19
- backgroundRepeat: 'no-repeat',
20
- backgroundSize: 'cover',
21
- backgroundPosition: 'center',
22
- pointerEvents: 'none',
23
- zIndex: -1,
24
- '&::after': {
25
- content: '""',
26
- position: 'absolute',
27
- top: 0,
28
- left: 0,
29
- right: 0,
30
- bottom: 0,
31
- backgroundColor: 'rgba(0, 0, 0, 0.12)',
32
- pointerEvents: 'none',
33
- },
34
- } }));
35
- }
@@ -1,39 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import { cx } from '@emotion/css';
14
- import { Stack } from '@mui/material';
15
- export default function DrawerOpenCloseIcon(_a) {
16
- var { arrowDirection } = _a, props = __rest(_a, ["arrowDirection"]);
17
- return (_jsx(Stack, Object.assign({ direction: "row", position: "relative" }, props, { className: cx(props.className, `drawer-open-close-icon-${arrowDirection || 'up'}`), sx: Object.assign({ p: 1, cursor: 'pointer', ':hover': {
18
- opacity: 0.7,
19
- }, ':before,:after': {
20
- content: '""',
21
- display: 'block',
22
- bgcolor: 'currentColor',
23
- width: 22,
24
- height: 6,
25
- borderRadius: 100,
26
- position: 'relative',
27
- }, ':before': {
28
- transform: 'translateX(2px) rotateZ(-8deg)',
29
- }, ':after': {
30
- transform: 'translateX(-2px) rotateZ(8deg)',
31
- }, '&.drawer-open-close-icon-down': {
32
- ':before': {
33
- transform: 'translateX(2px) rotateZ(8deg)',
34
- },
35
- ':after': {
36
- transform: 'translateX(-2px) rotateZ(-8deg)',
37
- },
38
- } }, props.sx) })));
39
- }
@@ -1,65 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { RuntimeOutputVariable } from '@blocklet/ai-runtime/types';
14
- import { Avatar, Collapse, IconButton, Stack } from '@mui/material';
15
- import { memo, useMemo, useState } from 'react';
16
- import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
17
- import { getAssetUrl } from '../../api/asset';
18
- import { useActiveAgent } from '../../contexts/ActiveAgent';
19
- import CurrentAgentProvider, { useCurrentAgent } from '../../contexts/CurrentAgent';
20
- import useAppearances, { useProfile } from '../../hooks/use-appearances';
21
- import { useRuntimeState } from '../../state/runtime';
22
- import { isValidInput } from '../../utils/agent-inputs';
23
- import { getOutputVariableInitialValue } from '../../utils/runtime-output-schema';
24
- import DrawerOpenCloseIcon from './DrawerOpenCloseIcon';
25
- const COLLAPSED_SIZE = 80;
26
- export default function InputsView(_a) {
27
- var props = __rest(_a, []);
28
- const { activeAgentId } = useActiveAgent();
29
- const { agent } = useCurrentAgent({ agentId: activeAgentId });
30
- const inputs = useMemo(() => { var _a; return (_a = agent.parameters) === null || _a === void 0 ? void 0 : _a.filter(isValidInput); }, [agent]);
31
- const enableCollapse = !!inputs && inputs.length > 1;
32
- const [open, setOpen] = useState(true);
33
- return (_jsxs(Stack, Object.assign({ gap: 1, py: 1 }, props, { children: [enableCollapse && (_jsx(Stack, { direction: "row", justifyContent: "center", onClick: () => setOpen(!open), mb: -1, children: _jsx(DrawerOpenCloseIcon, { color: "grey.500", arrowDirection: open ? 'down' : 'up' }) })), _jsx(AgentList, { sx: { px: { xs: 2, sm: 3 } } }), _jsx(Collapse, { in: !enableCollapse || open, orientation: "vertical", collapsedSize: enableCollapse ? COLLAPSED_SIZE : 0, sx: {
34
- py: 1,
35
- maxHeight: '40vh',
36
- px: { xs: 2, sm: 3 },
37
- overflow: 'auto',
38
- }, children: _jsx(CurrentAgentProvider, { agentId: activeAgentId, children: _jsx(AgentInput, {}) }) }, inputs === null || inputs === void 0 ? void 0 : inputs.length)] })));
39
- }
40
- const AgentList = memo((_a) => {
41
- var props = __rest(_a, []);
42
- const { activeAgentId, setActiveAgentId } = useActiveAgent();
43
- const { agent: runtimeAgent } = useRuntimeState();
44
- const children = useMemo(() => { var _a, _b; return (_b = (_a = getOutputVariableInitialValue(runtimeAgent, RuntimeOutputVariable.children)) === null || _a === void 0 ? void 0 : _a.agents) === null || _b === void 0 ? void 0 : _b.filter((i) => !!i.id); }, [runtimeAgent]);
45
- if (!(children === null || children === void 0 ? void 0 : children.length) || children.length <= 1)
46
- return null;
47
- return (_jsx(Stack, Object.assign({ direction: "row", gap: 2, py: 1, overflow: "auto" }, props, { children: children === null || children === void 0 ? void 0 : children.map((child) => (_jsx(CurrentAgentProvider, { agentId: child.id, children: _jsx(AgentAvatar, { selected: activeAgentId === child.id, onClick: () => setActiveAgentId(child.id) }) }, child.id))) })));
48
- });
49
- function AgentAvatar(_a) {
50
- var _b;
51
- var { selected } = _a, props = __rest(_a, ["selected"]);
52
- const { blockletDid, aid } = useRuntimeState();
53
- const { appearanceInput } = useAppearances();
54
- const profile = useProfile();
55
- if (!(appearanceInput === null || appearanceInput === void 0 ? void 0 : appearanceInput.componentId))
56
- return null;
57
- return (_jsx(IconButton, Object.assign({}, props, { sx: Object.assign({ p: 0, outline: selected ? 3 : 0, outlineColor: 'primary.light' }, props.sx), children: _jsx(Avatar, { src: getAssetUrl({ blockletDid, aid, filename: profile === null || profile === void 0 ? void 0 : profile.avatar, preset: 'avatar' }), children: (_b = profile.name) === null || _b === void 0 ? void 0 : _b.slice(0, 1) }) })));
58
- }
59
- function AgentInput() {
60
- const { aid } = useCurrentAgent();
61
- const { appearanceInput } = useAppearances({ aid });
62
- if (!(appearanceInput === null || appearanceInput === void 0 ? void 0 : appearanceInput.componentId))
63
- return null;
64
- return (_jsx(CustomComponentRenderer, { componentId: appearanceInput.componentId, properties: appearanceInput.componentProperties }));
65
- }
@@ -1,50 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { cx } from '@emotion/css';
14
- import { Box, Stack } from '@mui/material';
15
- import { Suspense, memo } from 'react';
16
- import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
17
- import { useSessionContext } from '../../../../session';
18
- import { getAssetUrl } from '../../api/asset';
19
- import AgentErrorBoundary, { AgentErrorView } from '../../components/AgentErrorBoundary';
20
- import UserInfo from '../../components/UserInfo';
21
- import { useComponentPreferences } from '../../contexts/ComponentPreferences';
22
- import CurrentAgentProvider from '../../contexts/CurrentAgent';
23
- import CurrentMessageProvider from '../../contexts/CurrentMessage';
24
- import useAppearances, { useProfile } from '../../hooks/use-appearances';
25
- import { useRuntimeState } from '../../state/runtime';
26
- import UserMessageView from './UserMessageView';
27
- const MessageView = memo(({ message }) => {
28
- var _a, _b, _c, _d, _e, _f;
29
- const { aid, blockletDid } = useRuntimeState();
30
- const preferences = useComponentPreferences();
31
- const hasBg = !!((_a = preferences === null || preferences === void 0 ? void 0 : preferences.backgroundImage) === null || _a === void 0 ? void 0 : _a.url);
32
- const { session: authSession } = useSessionContext();
33
- const { appearanceOutput } = useAppearances({ agentId: message.agentId });
34
- const profile = useProfile({ agentId: message.agentId });
35
- const { hideAgentAvatar, hideUserInputs } = (_b = useComponentPreferences()) !== null && _b !== void 0 ? _b : {};
36
- if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId))
37
- return null;
38
- const agentMessage = (_jsx(MessageBodyContainer, { messageRole: "assistant", children: _jsx(Suspense, { children: _jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties, fallbackRender: AgentErrorView }, message.id) }) }));
39
- return (_jsx(CurrentAgentProvider, { agentId: message.agentId, children: _jsx(CurrentMessageProvider, { message: message, children: _jsxs(Stack, { gap: 2, className: "message-item", "data-testid": `message-${message.id}`, children: [!hideUserInputs && (_jsx(Box, { children: _jsx(UserInfo, { name: (_c = authSession.user) === null || _c === void 0 ? void 0 : _c.fullName, did: (_d = authSession.user) === null || _d === void 0 ? void 0 : _d.did, avatar: getAssetUrl({ filename: (_e = authSession.user) === null || _e === void 0 ? void 0 : _e.avatar, preset: 'avatar' }), time: message.createdAt, reverse: true, alignItems: "flex-start", UserNameProps: { sx: { color: hasBg ? 'white' : undefined } }, children: _jsx(Stack, { sx: { alignItems: 'flex-end' }, children: _jsx(MessageBodyContainer, { messageRole: "user", children: _jsx(AgentErrorBoundary, { children: _jsx(Suspense, { children: _jsx(UserMessageView, {}) }) }) }) }) }) })), _jsx(Box, { children: !hideAgentAvatar ? (_jsx(UserInfo, { name: profile.name, did: (_f = globalThis.blocklet) === null || _f === void 0 ? void 0 : _f.appId, avatar: getAssetUrl({ blockletDid, aid, filename: profile.avatar, preset: 'avatar' }), time: message.createdAt, alignItems: "flex-start", UserNameProps: { sx: { color: hasBg ? 'white' : undefined } }, children: agentMessage })) : (agentMessage) })] }) }) }));
40
- });
41
- export default MessageView;
42
- export function MessageBodyContainer(_a) {
43
- var _b;
44
- var { messageRole } = _a, props = __rest(_a, ["messageRole"]);
45
- const preferences = useComponentPreferences();
46
- const hasBg = !!((_b = preferences === null || preferences === void 0 ? void 0 : preferences.backgroundImage) === null || _b === void 0 ? void 0 : _b.url);
47
- const hideUserMessage = preferences === null || preferences === void 0 ? void 0 : preferences.hideUserInputs;
48
- return (_jsx(Box, Object.assign({}, props, { className: cx(props.className, 'message-content', `${messageRole}-message-content`), sx: hasBg
49
- ? Object.assign({ borderRadius: 1, borderTopRightRadius: messageRole === 'user' ? 2 : undefined, borderTopLeftRadius: messageRole !== 'user' ? 2 : undefined, px: 2, py: 1, marginTop: 0.5, maxWidth: hideUserMessage ? 'unset' : 'calc(100% - 40px)', bgcolor: 'rgba(255, 255, 255, 0.8)', backdropFilter: 'blur(16px)' }, props.sx) : Object.assign({}, props.sx) })));
50
- }
@@ -1,28 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { Divider, Stack } from '@mui/material';
14
- import React from 'react';
15
- import { useComponentPreferences } from '../../contexts/ComponentPreferences';
16
- import { useCurrentSessionState, useSessionState } from '../../state/session';
17
- import mapRight from '../../utils/map-right';
18
- import MessageView from './MessageView';
19
- import OpeningMessageView from './OpeningMessageView';
20
- export default function MessagesView(_a) {
21
- var _b, _c;
22
- var props = __rest(_a, []);
23
- const messages = (_b = useCurrentSessionState((s) => s === null || s === void 0 ? void 0 : s.messages)) !== null && _b !== void 0 ? _b : [];
24
- const loaded = useSessionState((s) => s.loaded);
25
- const showOpening = useCurrentSessionState((s) => !s || (s === null || s === void 0 ? void 0 : s.loaded)) && loaded;
26
- const divider = (_c = useComponentPreferences()) === null || _c === void 0 ? void 0 : _c.divider;
27
- return (_jsxs(Stack, Object.assign({ gap: 2 }, props, { children: [showOpening && _jsx(OpeningMessageView, { isMessagesEmpty: !(messages === null || messages === void 0 ? void 0 : messages.length) }), mapRight(messages, (message, index) => (_jsxs(React.Fragment, { children: [_jsx(MessageView, { message: message }), divider && index !== messages.length - 1 ? _jsx(Divider, { sx: { my: 2 } }) : undefined] }, message.id)))] })));
28
- }
@@ -1,40 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { RuntimeOutputVariable } from '@blocklet/ai-runtime/types';
3
- import { memo, useMemo } from 'react';
4
- import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
5
- import { getAssetUrl } from '../../api/asset';
6
- import UserInfo from '../../components/UserInfo';
7
- import { DEFAULT_OUTPUT_COMPONENTS } from '../../constants';
8
- import { useComponentPreferences } from '../../contexts/ComponentPreferences';
9
- import { useCurrentAgent } from '../../contexts/CurrentAgent';
10
- import { useOpeningMessage, useOpeningQuestions, useProfile } from '../../hooks/use-appearances';
11
- import { useRuntimeState } from '../../state/runtime';
12
- import { MessageBodyContainer } from './MessageView';
13
- const OpeningMessageView = memo(({ isMessagesEmpty }) => {
14
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
15
- const { blockletDid, aid } = useRuntimeState();
16
- const { hideAgentAvatar, backgroundImage } = (_a = useComponentPreferences()) !== null && _a !== void 0 ? _a : {};
17
- const hasBg = !!(backgroundImage === null || backgroundImage === void 0 ? void 0 : backgroundImage.url);
18
- const openingMessage = useOpeningMessage();
19
- const openingMessageOutput = useMemo(() => { var _a; return (_a = openingMessage === null || openingMessage === void 0 ? void 0 : openingMessage.agent.outputVariables) === null || _a === void 0 ? void 0 : _a.find((i) => i.name === RuntimeOutputVariable.openingMessage); }, [openingMessage === null || openingMessage === void 0 ? void 0 : openingMessage.agent]);
20
- const openingMessageComponentId = ((_b = openingMessageOutput === null || openingMessageOutput === void 0 ? void 0 : openingMessageOutput.appearance) === null || _b === void 0 ? void 0 : _b.componentId) ||
21
- ((_c = DEFAULT_OUTPUT_COMPONENTS[RuntimeOutputVariable.openingMessage]) === null || _c === void 0 ? void 0 : _c.componentId);
22
- const profile = useProfile();
23
- const { agent } = useCurrentAgent();
24
- const openingQuestions = useOpeningQuestions();
25
- const openingQuestionsOutput = useMemo(() => { var _a; return (_a = agent.outputVariables) === null || _a === void 0 ? void 0 : _a.find((i) => i.name === RuntimeOutputVariable.openingQuestions); }, [agent.outputVariables]);
26
- const openingQuestionsComponentId = ((_d = openingQuestionsOutput === null || openingQuestionsOutput === void 0 ? void 0 : openingQuestionsOutput.appearance) === null || _d === void 0 ? void 0 : _d.componentId) ||
27
- ((_e = DEFAULT_OUTPUT_COMPONENTS[RuntimeOutputVariable.openingQuestions]) === null || _e === void 0 ? void 0 : _e.componentId);
28
- if ((!(openingMessage === null || openingMessage === void 0 ? void 0 : openingMessage.message) || !openingMessageComponentId) &&
29
- (!openingQuestionsComponentId || !(openingQuestions === null || openingQuestions === void 0 ? void 0 : openingQuestions.questions.length) || !isMessagesEmpty)) {
30
- return null;
31
- }
32
- const children = (_jsxs(MessageBodyContainer, { children: [openingMessage && openingMessageOutput && openingMessageComponentId && (_jsx(CustomComponentRenderer, { instanceId: openingMessageOutput.id, componentId: openingMessageComponentId, properties: (_f = openingMessageOutput.appearance) === null || _f === void 0 ? void 0 : _f.componentProperties, props: { output: openingMessageOutput, outputValue: openingMessage.message } })), isMessagesEmpty && openingQuestionsComponentId && (_jsx(CustomComponentRenderer, { instanceId: agent.id, componentId: openingQuestionsComponentId, properties: (_g = openingQuestionsOutput === null || openingQuestionsOutput === void 0 ? void 0 : openingQuestionsOutput.appearance) === null || _g === void 0 ? void 0 : _g.componentProperties, props: { output: openingQuestionsOutput } }))] }));
33
- return hideAgentAvatar ? (children) : (_jsx(UserInfo, { name: ((_h = openingMessage === null || openingMessage === void 0 ? void 0 : openingMessage.profile) !== null && _h !== void 0 ? _h : profile).name, did: (_j = globalThis.blocklet) === null || _j === void 0 ? void 0 : _j.appId, avatar: getAssetUrl({
34
- blockletDid,
35
- aid,
36
- filename: ((_k = openingMessage === null || openingMessage === void 0 ? void 0 : openingMessage.profile) !== null && _k !== void 0 ? _k : profile).avatar,
37
- preset: 'avatar',
38
- }), alignItems: "flex-start", UserNameProps: { sx: { color: hasBg ? 'white' : undefined } }, children: children }));
39
- });
40
- export default OpeningMessageView;
@@ -1,22 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Typography } from '@mui/material';
3
- import { useMemo } from 'react';
4
- import MarkdownRenderer from '../../components/MarkdownRenderer';
5
- import { useCurrentAgent } from '../../contexts/CurrentAgent';
6
- import { useCurrentMessage } from '../../contexts/CurrentMessage';
7
- import { isValidInput } from '../../utils/agent-inputs';
8
- export default function UserMessageView() {
9
- var _a;
10
- const { message } = useCurrentMessage();
11
- const { agent } = useCurrentAgent();
12
- const params = useMemo(() => {
13
- var _a;
14
- const inputs = (_a = agent.parameters) === null || _a === void 0 ? void 0 : _a.filter(isValidInput).map((i) => { var _a, _b; return [((_a = i.label) === null || _a === void 0 ? void 0 : _a.trim()) || i.key, (_b = message.inputs) === null || _b === void 0 ? void 0 : _b[i.key]]; }).filter((i) => i[1]);
15
- const q = inputs === null || inputs === void 0 ? void 0 : inputs.find((i) => i[0] === 'question');
16
- return q ? [q] : inputs;
17
- }, [agent.parameters, message.inputs]);
18
- if ((params === null || params === void 0 ? void 0 : params.length) === 1) {
19
- return _jsx(MarkdownRenderer, { children: (_a = params[0]) === null || _a === void 0 ? void 0 : _a[1] });
20
- }
21
- return params === null || params === void 0 ? void 0 : params.map(([key, value]) => (_jsxs(Typography, { sx: { wordWrap: 'break-word' }, children: [_jsx(Box, { component: "span", sx: { color: 'text.secondary' }, children: key }), "\u00A0\u00A0", _jsx("span", { children: value })] }, key)));
22
- }
@@ -1,53 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
- import { Box, CircularProgress, alpha } from '@mui/material';
14
- import { useEffect } from 'react';
15
- import { useScrollToBottom } from 'react-scroll-to-bottom';
16
- import SimpleHeader from '../../components/Header/SimpleHeader';
17
- import SimpleLayout from '../../components/Layout/SimpleLayout';
18
- import ScrollView from '../../components/ScrollView';
19
- import { useActiveAgent } from '../../contexts/ActiveAgent';
20
- import ComponentPreferencesProvider, { useComponentPreferences, } from '../../contexts/ComponentPreferences';
21
- import CurrentAgentProvider from '../../contexts/CurrentAgent';
22
- import { useAutoLoadSessionState, useCurrentSessionState, useSessionState } from '../../state/session';
23
- import BackgroundImage from './BackgroundImage';
24
- import InputsView from './InputsView';
25
- import MessagesView from './MessagesView';
26
- export default function SimpleChat(_a) {
27
- var { scrollViewProps = { scroll: 'window', initialScrollBehavior: 'auto' } } = _a, preferences = __rest(_a, ["scrollViewProps"]);
28
- useAutoLoadSessionState();
29
- return (_jsx(ComponentPreferencesProvider, Object.assign({}, preferences, { children: _jsxs(ScrollView, Object.assign({}, scrollViewProps, { children: [_jsx(BackgroundImage, {}), _jsx(SimpleChatView, {})] })) })));
30
- }
31
- function SimpleChatView() {
32
- var _a;
33
- const preferences = useComponentPreferences();
34
- const hasBg = !!((_a = preferences === null || preferences === void 0 ? void 0 : preferences.backgroundImage) === null || _a === void 0 ? void 0 : _a.url);
35
- const { activeAgentId } = useActiveAgent();
36
- // auto scroll to bottom when new message is sent
37
- const running = useCurrentSessionState((s) => s === null || s === void 0 ? void 0 : s.running);
38
- const scrollToBottom = useScrollToBottom();
39
- useEffect(() => {
40
- if (running)
41
- scrollToBottom({ behavior: 'smooth' });
42
- }, [scrollToBottom, running]);
43
- const sessionLoading = useCurrentSessionState((s) => s === null || s === void 0 ? void 0 : s.loading);
44
- const loading = useSessionState((s) => s === null || s === void 0 ? void 0 : s.loading) || sessionLoading;
45
- return (_jsxs(SimpleLayout, { px: 0, children: [_jsx(SimpleHeader, { px: 4, sx: { color: hasBg ? 'white' : undefined } }), loading ? (_jsx(Box, { textAlign: "center", my: 10, children: _jsx(CircularProgress, { size: 24 }) })) : (_jsxs(_Fragment, { children: [_jsx(CurrentAgentProvider, { agentId: activeAgentId, children: _jsx(MessagesView, { className: "aigne-outputs aigne-simple-chat-outputs", flexGrow: 1, pb: 10, px: { xs: 2, sm: 3 } }) }), _jsx(CurrentAgentProvider, { agentId: activeAgentId, children: _jsx(InputsView, { className: "aigne-inputs aigne-simple-chat-inputs", sx: {
46
- position: 'sticky',
47
- bottom: 0,
48
- zIndex: 10,
49
- borderRadius: 1,
50
- bgcolor: (theme) => alpha(theme.palette.background.paper, 0.8),
51
- backdropFilter: 'blur(16px)',
52
- } }) })] }))] }));
53
- }
@@ -1,40 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { RuntimeOutputVariable } from '@blocklet/ai-runtime/types';
3
- import { Stack } from '@mui/material';
4
- import { Suspense, useMemo } from 'react';
5
- import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
6
- import AgentErrorBoundary, { AgentErrorView } from '../../components/AgentErrorBoundary';
7
- import { getDefaultOutputComponent } from '../../constants';
8
- import { useComponentPreferences } from '../../contexts/ComponentPreferences';
9
- import { useCurrentAgent } from '../../contexts/CurrentAgent';
10
- import { useCurrentMessage } from '../../contexts/CurrentMessage';
11
- const ignoredOutputs = new Set([
12
- RuntimeOutputVariable.appearancePage,
13
- RuntimeOutputVariable.appearanceInput,
14
- RuntimeOutputVariable.appearanceOutput,
15
- RuntimeOutputVariable.openingQuestions,
16
- RuntimeOutputVariable.openingMessage,
17
- ]);
18
- export default function SimpleOutput() {
19
- const preferences = useComponentPreferences();
20
- const CustomComponentActionsComponent = preferences === null || preferences === void 0 ? void 0 : preferences.customOutputActionsComponent;
21
- const { message } = useCurrentMessage();
22
- const { agent } = useCurrentAgent();
23
- const outputs = useMemo(() => {
24
- var _a;
25
- return (_a = agent.outputVariables) === null || _a === void 0 ? void 0 : _a.map((i) => {
26
- var _a, _b;
27
- return (Object.assign(Object.assign({}, i), { appearance: Object.assign(Object.assign({}, i.appearance), { componentId: ((_a = i.appearance) === null || _a === void 0 ? void 0 : _a.componentId) || ((_b = getDefaultOutputComponent(i)) === null || _b === void 0 ? void 0 : _b.componentId) }) }));
28
- }).filter((i) => { var _a; return !!((_a = i.appearance) === null || _a === void 0 ? void 0 : _a.componentId) && !ignoredOutputs.has(i.name); });
29
- }, [agent.outputVariables]);
30
- if (!(outputs === null || outputs === void 0 ? void 0 : outputs.length))
31
- return null;
32
- return (_jsxs(Stack, { gap: 2, children: [outputs.map((output) => {
33
- var _a, _b, _c, _d, _e, _f, _g, _h;
34
- const value = output.name === RuntimeOutputVariable.text
35
- ? ((_a = message.outputs) === null || _a === void 0 ? void 0 : _a.content) ||
36
- ((_d = (_c = (_b = message.outputs) === null || _b === void 0 ? void 0 : _b.objects) === null || _c === void 0 ? void 0 : _c.find((i) => i === null || i === void 0 ? void 0 : i[RuntimeOutputVariable.text])) === null || _d === void 0 ? void 0 : _d[RuntimeOutputVariable.text])
37
- : (_g = (_f = (_e = message.outputs) === null || _e === void 0 ? void 0 : _e.objects) === null || _f === void 0 ? void 0 : _f.find((i) => i === null || i === void 0 ? void 0 : i[output.name])) === null || _g === void 0 ? void 0 : _g[output.name];
38
- return (_jsx(CustomComponentRenderer, { instanceId: output.id, componentId: output.appearance.componentId, properties: output.appearance.componentProperties, props: Object.assign({ output, outputValue: value, writing: output.name === RuntimeOutputVariable.text && message.loading }, (((_h = output === null || output === void 0 ? void 0 : output.appearance) === null || _h === void 0 ? void 0 : _h.componentProps) || {})) }, output.id));
39
- }), message.error && _jsx(AgentErrorView, { error: message.error }), CustomComponentActionsComponent && (_jsx(AgentErrorBoundary, { children: _jsx(Suspense, { children: _jsx(CustomComponentActionsComponent, {}) }) }))] }));
40
- }