@blocklet/pages-kit 0.2.299 → 0.2.301

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 (253) hide show
  1. package/lib/cjs/builtin/async/ai-runtime/api/{assistant.js → agent.js} +5 -7
  2. package/lib/cjs/builtin/async/ai-runtime/api/session.js +20 -18
  3. package/lib/cjs/builtin/async/ai-runtime/components/ActionButton.js +1 -2
  4. package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/index.js +2 -2
  5. package/lib/cjs/builtin/async/ai-runtime/components/{GlobalLoading.js → GlobalLoading/index.js} +5 -2
  6. package/lib/cjs/builtin/async/ai-runtime/components/{runtime-form/RuntimeFormHeader.js → Header/SimpleHeader.js} +9 -16
  7. package/lib/cjs/builtin/async/ai-runtime/components/{runtime-form/RuntimeFormSubmit.js → Layout/SimpleLayout.js} +6 -8
  8. package/lib/cjs/builtin/async/ai-runtime/components/MarkdownRenderer.js +2 -2
  9. package/lib/cjs/builtin/async/ai-runtime/components/{RuntimeProvider.js → RuntimeCommonProvider.js} +2 -2
  10. package/lib/cjs/builtin/async/ai-runtime/components/ScrollView.js +40 -57
  11. package/lib/cjs/builtin/async/ai-runtime/components/SocialShare.js +8 -3
  12. package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +0 -21
  13. package/lib/cjs/builtin/async/ai-runtime/components/{common/UserInfo.js → UserInfo.js} +1 -1
  14. package/lib/cjs/builtin/async/ai-runtime/constants.js +4 -1
  15. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentAgent.js +4 -4
  16. package/lib/cjs/builtin/async/ai-runtime/contexts/Runtime.js +32 -0
  17. package/lib/cjs/builtin/async/ai-runtime/index.js +16 -63
  18. package/lib/cjs/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +72 -0
  19. package/lib/cjs/builtin/async/ai-runtime/{components/runtime → runtime/Runtime}/index.js +11 -7
  20. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/AutoForm/index.js +4 -4
  21. package/lib/cjs/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/MessageActions.js +7 -4
  22. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageErrorView.js +2 -2
  23. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageItemView.js +6 -6
  24. package/lib/cjs/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageMetadataRenderer.js +1 -1
  25. package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +102 -0
  26. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/PhotoGalleryItem/index.js +17 -8
  27. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleChat/index.js +34 -22
  28. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleOutput/index.js +5 -3
  29. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimplePage/index.js +25 -12
  30. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/state/assistant.js → state/agent.js} +12 -12
  31. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/state → state}/runtime.js +5 -10
  32. package/lib/cjs/builtin/async/ai-runtime/state/session.js +91 -92
  33. package/lib/esm/builtin/async/ai-runtime/api/{assistant.js → agent.js} +3 -5
  34. package/lib/esm/builtin/async/ai-runtime/api/session.js +19 -17
  35. package/lib/esm/builtin/async/ai-runtime/components/ActionButton.js +1 -1
  36. package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/index.js +1 -1
  37. package/lib/esm/builtin/async/ai-runtime/components/{GlobalLoading.js → GlobalLoading/index.js} +2 -1
  38. package/lib/esm/builtin/async/ai-runtime/components/Header/SimpleHeader.js +23 -0
  39. package/lib/esm/builtin/async/ai-runtime/components/{runtime-form/RuntimeFormSubmit.js → Layout/SimpleLayout.js} +5 -4
  40. package/lib/esm/builtin/async/ai-runtime/components/MarkdownRenderer.js +1 -1
  41. package/lib/esm/builtin/async/ai-runtime/components/{RuntimeProvider.js → RuntimeCommonProvider.js} +1 -1
  42. package/lib/esm/builtin/async/ai-runtime/components/ScrollView.js +19 -57
  43. package/lib/esm/builtin/async/ai-runtime/components/SocialShare.js +8 -3
  44. package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +0 -21
  45. package/lib/esm/builtin/async/ai-runtime/components/{common/UserInfo.js → UserInfo.js} +1 -1
  46. package/lib/esm/builtin/async/ai-runtime/constants.js +3 -0
  47. package/lib/esm/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentAgent.js +3 -3
  48. package/lib/esm/builtin/async/ai-runtime/contexts/Runtime.js +26 -0
  49. package/lib/esm/builtin/async/ai-runtime/index.js +13 -58
  50. package/lib/esm/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +66 -0
  51. package/lib/esm/builtin/async/ai-runtime/{components/runtime → runtime/Runtime}/index.js +9 -5
  52. package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/AutoForm/index.js +4 -4
  53. package/lib/esm/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/MessageActions.js +2 -2
  54. package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageErrorView.js +2 -2
  55. package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageItemView.js +5 -5
  56. package/lib/esm/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageMetadataRenderer.js +1 -1
  57. package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +73 -0
  58. package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/PhotoGalleryItem/index.js +17 -8
  59. package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleChat/index.js +34 -22
  60. package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleOutput/index.js +5 -3
  61. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +63 -0
  62. package/lib/esm/builtin/async/ai-runtime/{components/runtime/state/assistant.js → state/agent.js} +9 -9
  63. package/lib/esm/builtin/async/ai-runtime/{components/runtime/state → state}/runtime.js +5 -10
  64. package/lib/esm/builtin/async/ai-runtime/state/session.js +91 -88
  65. package/lib/types/builtin/async/ai-runtime/api/{assistant.d.ts → agent.d.ts} +4 -4
  66. package/lib/types/builtin/async/ai-runtime/api/session.d.ts +7 -13
  67. package/lib/types/builtin/async/ai-runtime/components/ActionButton.d.ts +1 -1
  68. package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/index.d.ts +1 -1
  69. package/lib/types/builtin/async/ai-runtime/components/{GlobalLoading.d.ts → GlobalLoading/index.d.ts} +1 -0
  70. package/lib/types/builtin/async/ai-runtime/components/Header/SimpleHeader.d.ts +5 -0
  71. package/lib/types/builtin/async/ai-runtime/components/Layout/SimpleLayout.d.ts +2 -0
  72. package/lib/types/builtin/async/ai-runtime/components/LoadingButton.d.ts +2 -1
  73. package/lib/types/builtin/async/ai-runtime/components/{RuntimeProvider.d.ts → RuntimeCommonProvider.d.ts} +1 -1
  74. package/lib/types/builtin/async/ai-runtime/components/ScrollView.d.ts +8 -59
  75. package/lib/types/builtin/async/ai-runtime/constants.d.ts +3 -0
  76. package/lib/types/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentAgent.d.ts +1 -1
  77. package/lib/types/builtin/async/ai-runtime/contexts/Runtime.d.ts +14 -0
  78. package/lib/types/builtin/async/ai-runtime/index.d.ts +13 -24
  79. package/lib/types/builtin/async/ai-runtime/runtime/ChatBotButton/index.d.ts +5 -0
  80. package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.d.ts +4 -0
  81. package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.d.ts +1 -0
  82. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/index.d.ts +6 -0
  83. package/lib/types/builtin/async/ai-runtime/state/agent.d.ts +17 -0
  84. package/lib/types/builtin/async/ai-runtime/{components/runtime/state → state}/runtime.d.ts +2 -2
  85. package/lib/types/builtin/async/ai-runtime/state/session.d.ts +10 -18
  86. package/lib/types/builtin/async/react-scroll-to-bottom.d.ts +2 -2
  87. package/package.json +7 -7
  88. package/lib/cjs/builtin/async/ai-runtime/components/LoadingListItemButton.js +0 -49
  89. package/lib/cjs/builtin/async/ai-runtime/components/PoweredBy.js +0 -22
  90. package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +0 -92
  91. package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionListView.js +0 -197
  92. package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionView.js +0 -122
  93. package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentListView.js +0 -152
  94. package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentView.js +0 -135
  95. package/lib/cjs/builtin/async/ai-runtime/components/common/ChatBot.js +0 -104
  96. package/lib/cjs/builtin/async/ai-runtime/components/common/index.js +0 -12
  97. package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterForm.js +0 -89
  98. package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +0 -66
  99. package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormFields.js +0 -61
  100. package/lib/cjs/builtin/async/ai-runtime/components/form/QuestionField.js +0 -44
  101. package/lib/cjs/builtin/async/ai-runtime/components/form/SettingButton.js +0 -88
  102. package/lib/cjs/builtin/async/ai-runtime/components/lottie/index.js +0 -34
  103. package/lib/cjs/builtin/async/ai-runtime/components/message/MessageErrorView.js +0 -35
  104. package/lib/cjs/builtin/async/ai-runtime/components/message/MessageItemView.js +0 -177
  105. package/lib/cjs/builtin/async/ai-runtime/components/message/MessageListView.js +0 -48
  106. package/lib/cjs/builtin/async/ai-runtime/components/runtime/components/PhotoGallery/index.js +0 -121
  107. package/lib/cjs/builtin/async/ai-runtime/components/runtime/constants.js +0 -6
  108. package/lib/cjs/builtin/async/ai-runtime/components/runtime/state/session.js +0 -213
  109. package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +0 -133
  110. package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +0 -60
  111. package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +0 -59
  112. package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/index.js +0 -28
  113. package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +0 -138
  114. package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +0 -31
  115. package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/index.js +0 -54
  116. package/lib/cjs/builtin/async/ai-runtime/components/session/CheckSession.js +0 -74
  117. package/lib/cjs/builtin/async/ai-runtime/components/session/SessionListView.js +0 -88
  118. package/lib/cjs/builtin/async/ai-runtime/hooks/auth.js +0 -31
  119. package/lib/cjs/builtin/async/ai-runtime/hooks/header.js +0 -69
  120. package/lib/cjs/builtin/async/ai-runtime/hooks/navigate.js +0 -38
  121. package/lib/cjs/builtin/async/ai-runtime/hooks/subscribe.js +0 -37
  122. package/lib/cjs/builtin/async/ai-runtime/hooks/useAsync.js +0 -32
  123. package/lib/cjs/builtin/async/ai-runtime/state/assistant.js +0 -59
  124. package/lib/cjs/builtin/async/ai-runtime/state/index.js +0 -423
  125. package/lib/cjs/builtin/async/ai-runtime/state/subscription.js +0 -52
  126. package/lib/cjs/builtin/async/ai-runtime/utils.js +0 -49
  127. package/lib/esm/builtin/async/ai-runtime/components/LoadingListItemButton.js +0 -46
  128. package/lib/esm/builtin/async/ai-runtime/components/PoweredBy.js +0 -19
  129. package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +0 -92
  130. package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionListView.js +0 -197
  131. package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionView.js +0 -122
  132. package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentListView.js +0 -152
  133. package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentView.js +0 -135
  134. package/lib/esm/builtin/async/ai-runtime/components/common/ChatBot.js +0 -98
  135. package/lib/esm/builtin/async/ai-runtime/components/common/index.js +0 -3
  136. package/lib/esm/builtin/async/ai-runtime/components/form/ParameterForm.js +0 -60
  137. package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +0 -59
  138. package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormFields.js +0 -54
  139. package/lib/esm/builtin/async/ai-runtime/components/form/QuestionField.js +0 -38
  140. package/lib/esm/builtin/async/ai-runtime/components/form/SettingButton.js +0 -82
  141. package/lib/esm/builtin/async/ai-runtime/components/lottie/index.js +0 -8
  142. package/lib/esm/builtin/async/ai-runtime/components/message/MessageErrorView.js +0 -29
  143. package/lib/esm/builtin/async/ai-runtime/components/message/MessageItemView.js +0 -146
  144. package/lib/esm/builtin/async/ai-runtime/components/message/MessageListView.js +0 -42
  145. package/lib/esm/builtin/async/ai-runtime/components/runtime/components/PhotoGallery/index.js +0 -92
  146. package/lib/esm/builtin/async/ai-runtime/components/runtime/components/SimplePage/index.js +0 -50
  147. package/lib/esm/builtin/async/ai-runtime/components/runtime/constants.js +0 -3
  148. package/lib/esm/builtin/async/ai-runtime/components/runtime/state/session.js +0 -209
  149. package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +0 -102
  150. package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +0 -34
  151. package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +0 -53
  152. package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/index.js +0 -22
  153. package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +0 -132
  154. package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.js +0 -30
  155. package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +0 -25
  156. package/lib/esm/builtin/async/ai-runtime/components/runtime-form/index.js +0 -48
  157. package/lib/esm/builtin/async/ai-runtime/components/session/CheckSession.js +0 -68
  158. package/lib/esm/builtin/async/ai-runtime/components/session/SessionListView.js +0 -88
  159. package/lib/esm/builtin/async/ai-runtime/hooks/auth.js +0 -27
  160. package/lib/esm/builtin/async/ai-runtime/hooks/header.js +0 -62
  161. package/lib/esm/builtin/async/ai-runtime/hooks/navigate.js +0 -32
  162. package/lib/esm/builtin/async/ai-runtime/hooks/subscribe.js +0 -33
  163. package/lib/esm/builtin/async/ai-runtime/hooks/useAsync.js +0 -29
  164. package/lib/esm/builtin/async/ai-runtime/state/assistant.js +0 -54
  165. package/lib/esm/builtin/async/ai-runtime/state/index.js +0 -423
  166. package/lib/esm/builtin/async/ai-runtime/state/subscription.js +0 -47
  167. package/lib/esm/builtin/async/ai-runtime/utils.js +0 -42
  168. package/lib/types/builtin/async/ai-runtime/components/LoadingListItemButton.d.ts +0 -5
  169. package/lib/types/builtin/async/ai-runtime/components/PoweredBy.d.ts +0 -4
  170. package/lib/types/builtin/async/ai-runtime/components/collection/CollectionEditDialog.d.ts +0 -0
  171. package/lib/types/builtin/async/ai-runtime/components/collection/CollectionListView.d.ts +0 -0
  172. package/lib/types/builtin/async/ai-runtime/components/collection/CollectionView.d.ts +0 -0
  173. package/lib/types/builtin/async/ai-runtime/components/collection/DocumentListView.d.ts +0 -0
  174. package/lib/types/builtin/async/ai-runtime/components/collection/DocumentView.d.ts +0 -0
  175. package/lib/types/builtin/async/ai-runtime/components/common/ChatBot.d.ts +0 -13
  176. package/lib/types/builtin/async/ai-runtime/components/common/index.d.ts +0 -3
  177. package/lib/types/builtin/async/ai-runtime/components/form/ParameterForm.d.ts +0 -13
  178. package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormDialog.d.ts +0 -28
  179. package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormFields.d.ts +0 -11
  180. package/lib/types/builtin/async/ai-runtime/components/form/QuestionField.d.ts +0 -14
  181. package/lib/types/builtin/async/ai-runtime/components/form/SettingButton.d.ts +0 -9
  182. package/lib/types/builtin/async/ai-runtime/components/lottie/index.d.ts +0 -4
  183. package/lib/types/builtin/async/ai-runtime/components/message/MessageErrorView.d.ts +0 -5
  184. package/lib/types/builtin/async/ai-runtime/components/message/MessageItemView.d.ts +0 -15
  185. package/lib/types/builtin/async/ai-runtime/components/message/MessageListView.d.ts +0 -7
  186. package/lib/types/builtin/async/ai-runtime/components/runtime/components/PhotoGallery/index.d.ts +0 -5
  187. package/lib/types/builtin/async/ai-runtime/components/runtime/components/PhotoGalleryItem/index.d.ts +0 -1
  188. package/lib/types/builtin/async/ai-runtime/components/runtime/components/SimpleChat/index.d.ts +0 -3
  189. package/lib/types/builtin/async/ai-runtime/components/runtime/constants.d.ts +0 -3
  190. package/lib/types/builtin/async/ai-runtime/components/runtime/state/assistant.d.ts +0 -17
  191. package/lib/types/builtin/async/ai-runtime/components/runtime/state/session.d.ts +0 -29
  192. package/lib/types/builtin/async/ai-runtime/components/runtime-chat/InitialForm.d.ts +0 -10
  193. package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.d.ts +0 -5
  194. package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.d.ts +0 -6
  195. package/lib/types/builtin/async/ai-runtime/components/runtime-chat/index.d.ts +0 -5
  196. package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.d.ts +0 -5
  197. package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.d.ts +0 -5
  198. package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.d.ts +0 -5
  199. package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.d.ts +0 -5
  200. package/lib/types/builtin/async/ai-runtime/components/runtime-form/index.d.ts +0 -4
  201. package/lib/types/builtin/async/ai-runtime/components/session/CheckSession.d.ts +0 -8
  202. package/lib/types/builtin/async/ai-runtime/components/session/SessionListView.d.ts +0 -0
  203. package/lib/types/builtin/async/ai-runtime/hooks/auth.d.ts +0 -4
  204. package/lib/types/builtin/async/ai-runtime/hooks/header.d.ts +0 -5
  205. package/lib/types/builtin/async/ai-runtime/hooks/navigate.d.ts +0 -25
  206. package/lib/types/builtin/async/ai-runtime/hooks/subscribe.d.ts +0 -7
  207. package/lib/types/builtin/async/ai-runtime/hooks/useAsync.d.ts +0 -1
  208. package/lib/types/builtin/async/ai-runtime/state/assistant.d.ts +0 -15
  209. package/lib/types/builtin/async/ai-runtime/state/index.d.ts +0 -0
  210. package/lib/types/builtin/async/ai-runtime/state/subscription.d.ts +0 -15
  211. package/lib/types/builtin/async/ai-runtime/utils.d.ts +0 -20
  212. /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/LanguageField.js +0 -0
  213. /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/NumberField.js +0 -0
  214. /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/RadioField.js +0 -0
  215. /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/SelectField.js +0 -0
  216. /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/StringField.js +0 -0
  217. /package/lib/cjs/builtin/async/ai-runtime/{state/loading.js → components/GlobalLoading/state.js} +0 -0
  218. /package/lib/cjs/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentMessage.js +0 -0
  219. /package/lib/cjs/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageSuggestedQuestions.js +0 -0
  220. /package/lib/cjs/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/ReferenceLinks.js +0 -0
  221. /package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/index.js +0 -0
  222. /package/lib/cjs/builtin/async/ai-runtime/{components/runtime/utils → utils}/map-right.js +0 -0
  223. /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/LanguageField.js +0 -0
  224. /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/NumberField.js +0 -0
  225. /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/RadioField.js +0 -0
  226. /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/SelectField.js +0 -0
  227. /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/StringField.js +0 -0
  228. /package/lib/esm/builtin/async/ai-runtime/{state/loading.js → components/GlobalLoading/state.js} +0 -0
  229. /package/lib/esm/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentMessage.js +0 -0
  230. /package/lib/esm/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageSuggestedQuestions.js +0 -0
  231. /package/lib/esm/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/ReferenceLinks.js +0 -0
  232. /package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/index.js +0 -0
  233. /package/lib/esm/builtin/async/ai-runtime/{components/runtime/utils → utils}/map-right.js +0 -0
  234. /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/LanguageField.d.ts +0 -0
  235. /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/NumberField.d.ts +0 -0
  236. /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/RadioField.d.ts +0 -0
  237. /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/SelectField.d.ts +0 -0
  238. /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/StringField.d.ts +0 -0
  239. /package/lib/types/builtin/async/ai-runtime/{state/loading.d.ts → components/GlobalLoading/state.d.ts} +0 -0
  240. /package/lib/types/builtin/async/ai-runtime/components/{common/UserInfo.d.ts → UserInfo.d.ts} +0 -0
  241. /package/lib/types/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentMessage.d.ts +0 -0
  242. /package/lib/types/builtin/async/ai-runtime/{components/runtime → runtime/Runtime}/index.d.ts +0 -0
  243. /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/AutoForm/index.d.ts +0 -0
  244. /package/lib/types/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/MessageActions.d.ts +0 -0
  245. /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageErrorView.d.ts +0 -0
  246. /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageItemView.d.ts +0 -0
  247. /package/lib/types/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageMetadataRenderer.d.ts +0 -0
  248. /package/lib/types/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageSuggestedQuestions.d.ts +0 -0
  249. /package/lib/types/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/ReferenceLinks.d.ts +0 -0
  250. /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/index.d.ts +0 -0
  251. /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleOutput/index.d.ts +0 -0
  252. /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimplePage/index.d.ts +0 -0
  253. /package/lib/types/builtin/async/ai-runtime/{components/runtime/utils → utils}/map-right.d.ts +0 -0
@@ -1,423 +0,0 @@
1
- "use strict";
2
- // import { StoreApi, UseBoundStore, create } from 'zustand';
3
- // import { immer } from 'zustand/middleware/immer';
4
- // import { EventSourceParserStream } from '../../../stream';
5
- // import { getComponentMountPoint, joinURL } from '../../../utils';
6
- // import { Assistant, getAssistant } from '../api/assistant';
7
- // import {
8
- // Dataset,
9
- // createDataset,
10
- // createDocument,
11
- // deleteDataset,
12
- // deleteDocument,
13
- // getDataset,
14
- // getDatasets,
15
- // getDocuments,
16
- // updateDataset,
17
- // updateDocument,
18
- // } from '../api/dataset';
19
- // import { deleteMessages, getMessages } from '../api/message';
20
- // import { Session, createSession, getSessions, updateSession } from '../api/session';
21
- // import { Subscription, getSubscription } from '../api/subscription';
22
- // import { AI_STUDIO_DID } from '../constants';
23
- // import { parseIdentity } from '../utils';
24
- // const STATES: {
25
- // assistant: { [key: string]: UseBoundStore<StoreApi<State>> };
26
- // dataset: { [key: string]: ReturnType<typeof createDatasetState> };
27
- // datasetDetail: { [key: string]: ReturnType<typeof createDatasetDetailState> };
28
- // } = { assistant: {}, dataset: {}, datasetDetail: {} };
29
- // export interface State {
30
- // loading: boolean;
31
- // loaded: boolean;
32
- // assistant?: Assistant;
33
- // sessions?: Session[];
34
- // subscription?: Subscription;
35
- // sessionMap: { [sessionId: string]: { session: Session } };
36
- // computed: {
37
- // get isChat(): boolean | undefined;
38
- // get requireNewSubscription(): boolean | undefined;
39
- // };
40
- // }
41
- // export const createState = ({
42
- // releaseId,
43
- // preload: { assistant, sessions, subscription } = {},
44
- // }: {
45
- // releaseId: string;
46
- // preload?: {
47
- // assistant?: Assistant;
48
- // sessions?: Session[];
49
- // subscription?: Subscription;
50
- // };
51
- // }) => {
52
- // STATES.assistant[releaseId] ??= create<State>()(
53
- // immer<State>((set, get) => ({
54
- // loading: false,
55
- // loaded: false,
56
- // assistant,
57
- // sessions,
58
- // subscription,
59
- // sessionMap: Object.fromEntries((sessions ?? []).map((session) => [session.id, { session }])),
60
- // computed: {
61
- // get isChat() {
62
- // const parameters = get().assistant?.parameters;
63
- // return parameters?.some((i) => i.key === 'question');
64
- // },
65
- // get requireNewSubscription() {
66
- // // TODO: implement payment
67
- // // const { subscription } = get();
68
- // // const { paymentEnabled, paymentLinkId } = release;
69
- // // return !!paymentEnabled && !!paymentLinkId && !subscription;
70
- // return false;
71
- // },
72
- // get withCollection() {
73
- // const parameters = get().assistant?.parameters;
74
- // return parameters?.some((i) => i.key === 'datasetId');
75
- // },
76
- // },
77
- // getPaymentLink({ userId }: { userId: string }) {
78
- // // TODO: implement
79
- // // return withQuery(
80
- // // joinURL('/', getComponentMountPoint(PAYMENT_KIT_DID), '/checkout/pay', release.paymentLinkId),
81
- // // {
82
- // // 'metadata.releaseId': release.id,
83
- // // 'metadata.userId': userId,
84
- // // redirect: window.location.href,
85
- // // }
86
- // // );
87
- // },
88
- // getAssistant: async () => {
89
- // set((state) => {
90
- // state.loading = true;
91
- // });
92
- // try {
93
- // const { subscription } = await getSubscription({ releaseId });
94
- // const identity = parseIdentity(releaseId, { rejectWhenError: true });
95
- // const [assistant, { sessions }] = await Promise.all([getAssistant(identity), getSessions(identity)]);
96
- // set((state) => {
97
- // state.assistant = assistant;
98
- // state.sessions = sessions;
99
- // state.subscription = subscription;
100
- // state.sessionMap = Object.fromEntries(
101
- // (sessions ?? []).map((session) => [session.id, { ...state.sessionMap[session.id], session }])
102
- // );
103
- // });
104
- // } finally {
105
- // set((state) => {
106
- // state.loading = false;
107
- // state.loaded = true;
108
- // });
109
- // }
110
- // },
111
- // getSessions: async () => {
112
- // const identity = parseIdentity(releaseId, { rejectWhenError: true });
113
- // const { sessions } = await getSessions(identity);
114
- // set((state) => {
115
- // state.sessions = sessions;
116
- // state.sessionMap = Object.fromEntries(
117
- // (sessions ?? []).map((session) => [session.id, { ...state.sessionMap[session.id], session }])
118
- // );
119
- // });
120
- // },
121
- // reloadMessages: async ({ sessionId }) => {
122
- // set((state) => {
123
- // const s = state.sessionMap[sessionId];
124
- // if (!s) return;
125
- // s.loading = true;
126
- // });
127
- // try {
128
- // const { messages, count } = await getMessages({ sessionId });
129
- // set((state) => {
130
- // const s = state.sessionMap[sessionId];
131
- // if (!s) return;
132
- // s.messages = messages;
133
- // s.messageCount = count;
134
- // });
135
- // } finally {
136
- // set((state) => {
137
- // const s = state.sessionMap[sessionId];
138
- // if (!s) return;
139
- // s.loading = false;
140
- // });
141
- // }
142
- // },
143
- // cleanSession: async ({ sessionId }) => {
144
- // set((state) => {
145
- // const s = state.sessionMap[sessionId];
146
- // if (s) s.sessionReseting = true;
147
- // });
148
- // await deleteMessages({ sessionId });
149
- // set((state) => {
150
- // const s = state.sessionMap[sessionId];
151
- // if (s) {
152
- // s.sessionReseting = false;
153
- // s.messages = [];
154
- // }
155
- // });
156
- // },
157
- // createSession: async ({ name, parameters, entry }) => {
158
- // const identity = parseIdentity(releaseId);
159
- // const { sessions, created } = await createSession({ ...identity, name, parameters, entry });
160
- // set((state) => {
161
- // state.sessions = sessions;
162
- // state.sessionMap = Object.fromEntries(
163
- // (sessions ?? []).map((session) => [session.id, { ...state.sessionMap[session.id], session }])
164
- // );
165
- // });
166
- // return created;
167
- // },
168
- // updateSession: async ({ sessionId, parameters }) => {
169
- // set((state) => {
170
- // const s = state.sessionMap[sessionId].session;
171
- // if (s.parameters) Object.assign(s.parameters, parameters);
172
- // });
173
- // const { sessions } = await updateSession({ sessionId, parameters });
174
- // set((state) => {
175
- // state.sessions = sessions;
176
- // state.sessionMap = Object.fromEntries(
177
- // (sessions ?? []).map((session) => [session.id, { ...state.sessionMap[session.id], session }])
178
- // );
179
- // });
180
- // },
181
- // execute: async ({ sessionId, parameters, onResponseStart, assistantIdentity }) => {
182
- // const identity = parseIdentity(releaseId);
183
- // let message;
184
- // const childMessages = [];
185
- // const childMessagesMap = {};
186
- // set((state) => {
187
- // const session = state.sessionMap[sessionId];
188
- // if (session) session.executing = true;
189
- // });
190
- // try {
191
- // const res = await fetch(joinURL(getComponentMountPoint(AI_STUDIO_DID), '/api/ai/call'), {
192
- // method: 'POST',
193
- // headers: {
194
- // 'Content-Type': 'application/json',
195
- // Accept: 'text/event-stream',
196
- // },
197
- // body: JSON.stringify({
198
- // sessionId,
199
- // parameters: { ...parameters, $clientTime: new Date().toISOString() },
200
- // ...(assistantIdentity || identity),
201
- // ref: (assistantIdentity || identity).projectRef,
202
- // working: true,
203
- // }),
204
- // });
205
- // if (!(res.status >= 200 && res.status < 300)) {
206
- // let json: any;
207
- // try {
208
- // json = await res.json();
209
- // } catch (error) {}
210
- // const { message } = json.error;
211
- // if (typeof message === 'string') {
212
- // throw new Error(message);
213
- // }
214
- // throw new Error(`Unknown Error: ${res.status}`);
215
- // }
216
- // const stream = res
217
- // .body!.pipeThrough(new TextDecoderStream())
218
- // .pipeThrough(new EventSourceParserStream())
219
- // .getReader();
220
- // let responseStarted = false;
221
- // for (;;) {
222
- // const { value, done } = await stream.read();
223
- // if (!responseStarted) {
224
- // responseStarted = true;
225
- // onResponseStart?.();
226
- // }
227
- // if (value?.type === 'CHUNK') {
228
- // if (!message) {
229
- // message = {
230
- // taskId: value.taskId,
231
- // parameters,
232
- // loading: true,
233
- // createdAt: new Date().toISOString(),
234
- // };
235
- // set((state) => {
236
- // state.sessionMap[sessionId] ??= {};
237
- // state.sessionMap[sessionId].messages ??= [];
238
- // state.sessionMap[sessionId].messages.push(message);
239
- // });
240
- // }
241
- // if (message.taskId === value.taskId) {
242
- // set((state) => {
243
- // const msg = state.sessionMap[sessionId]?.messages?.findLast((i) => i.taskId === message.taskId);
244
- // if (!msg) return;
245
- // msg.result ??= {};
246
- // msg.result.content = (msg.result.content || '') + (value.delta.content || '');
247
- // if (value.delta.object) {
248
- // msg.result.objects ??= [];
249
- // msg.result.objects.push(value.delta.object);
250
- // if (value.delta.object.metadata) {
251
- // const session = state.sessionMap[sessionId];
252
- // session.metadata ??= {};
253
- // deepMerge(session.metadata, value.delta.object.metadata);
254
- // }
255
- // }
256
- // if (value.delta?.images?.length) {
257
- // msg.result.images = (msg.result.images ?? []).concat(value.delta.images);
258
- // }
259
- // });
260
- // } else if (value.respondAs && value.respondAs !== 'none') {
261
- // let childMessage = childMessagesMap[value.taskId];
262
- // if (!childMessage) {
263
- // childMessage = {
264
- // taskId: value.taskId,
265
- // createdAt: new Date().toISOString(),
266
- // respondAs: value.respondAs,
267
- // };
268
- // childMessagesMap[value.taskId] = childMessage;
269
- // childMessages.push(childMessage);
270
- // }
271
- // childMessage.result ??= {};
272
- // childMessage.result.content = (childMessage.result.content || '') + (value.delta.content || '');
273
- // if (value.delta?.images?.length) {
274
- // childMessage.result.images = (childMessage.result.images ?? []).concat(value.delta.images);
275
- // }
276
- // set((state) => {
277
- // const msg = state.sessionMap[sessionId]?.messages?.findLast((i) => i.taskId === message.taskId);
278
- // if (!msg) return;
279
- // msg.result ??= {};
280
- // msg.result.messages = JSON.parse(JSON.stringify(childMessages));
281
- // });
282
- // }
283
- // }
284
- // if (value?.type === 'ERROR') {
285
- // set((state) => {
286
- // const msg = state.sessionMap[sessionId]?.messages?.findLast((i) => i.taskId === message.taskId);
287
- // if (msg) msg.error = value.error;
288
- // else throw new Error(value.error.message);
289
- // });
290
- // }
291
- // if (done) break;
292
- // }
293
- // } finally {
294
- // set((state) => {
295
- // const session = state.sessionMap[sessionId];
296
- // session.executing = false;
297
- // if (session && message) {
298
- // const msg = session.messages?.findLast((i) => i.taskId === message.taskId);
299
- // if (msg) msg.loading = false;
300
- // }
301
- // });
302
- // }
303
- // },
304
- // }))
305
- // );
306
- // return STATES.assistant[releaseId]!;
307
- // };
308
- // export function createDatasetState({ releaseId, datasets }: { releaseId: string; datasets?: Dataset[] }) {
309
- // STATES.dataset[releaseId] ??= create()(
310
- // immer((set) => ({
311
- // loading: false,
312
- // list: datasets,
313
- // error: undefined,
314
- // creating: false,
315
- // async reload() {
316
- // try {
317
- // set((state) => {
318
- // state.loading = true;
319
- // });
320
- // const datasets = await getDatasets({ appId: releaseId });
321
- // set((state) => {
322
- // state.loading = false;
323
- // state.list = datasets;
324
- // state.error = undefined;
325
- // });
326
- // } catch (error) {
327
- // set((state) => {
328
- // state.loading = false;
329
- // state.error = error;
330
- // });
331
- // }
332
- // },
333
- // async createDataset({ name, description }: { name: string; description?: string }) {
334
- // try {
335
- // set((state) => {
336
- // state.creating = true;
337
- // });
338
- // const created = await createDataset({ appId: releaseId, name, description });
339
- // await this.reload();
340
- // return created;
341
- // } finally {
342
- // set((state) => {
343
- // state.creating = false;
344
- // });
345
- // }
346
- // },
347
- // async updateDataset(datasetId: string, { name, description }: { name: string; description?: string }) {
348
- // const updated = await updateDataset(datasetId, { name, description });
349
- // await this.reload();
350
- // return updated;
351
- // },
352
- // async deleteDataset(datasetId: string) {
353
- // await deleteDataset(datasetId);
354
- // await this.reload();
355
- // },
356
- // }))
357
- // );
358
- // return STATES.dataset[releaseId];
359
- // }
360
- // export function createDatasetDetailState({ datasetId, list }: { datasetId: string; list?: Document[] }) {
361
- // STATES.datasetDetail[datasetId] ??= create()(
362
- // immer((set, get) => ({
363
- // loading: false,
364
- // dataset: undefined,
365
- // list,
366
- // error: undefined,
367
- // creating: false,
368
- // async reload() {
369
- // if (get().loading) return;
370
- // set((state) => {
371
- // state.loading = true;
372
- // });
373
- // try {
374
- // const [dataset, { items }] = await Promise.all([getDataset({ datasetId }), getDocuments(datasetId)]);
375
- // set((state) => {
376
- // state.dataset = dataset;
377
- // state.loading = false;
378
- // state.list = items;
379
- // state.error = undefined;
380
- // });
381
- // } catch (error) {
382
- // set((state) => {
383
- // state.loading = false;
384
- // state.error = error;
385
- // });
386
- // }
387
- // },
388
- // async createDocument(type: 'text' | 'file', input: Parameters<typeof createDocument>[1]) {
389
- // try {
390
- // set((state) => {
391
- // state.creating = true;
392
- // });
393
- // const created = await createDocument(datasetId, type, input);
394
- // await this.reload();
395
- // return created;
396
- // } finally {
397
- // set((state) => {
398
- // state.creating = false;
399
- // });
400
- // }
401
- // },
402
- // async updateDocument(documentId: string, type: 'text', input: Parameters<typeof updateDocument>[1]) {
403
- // try {
404
- // set((state) => {
405
- // state.updating = true;
406
- // });
407
- // const updated = await updateDocument(datasetId, documentId, type, input);
408
- // await this.reload();
409
- // return updated;
410
- // } finally {
411
- // set((state) => {
412
- // state.updating = false;
413
- // });
414
- // }
415
- // },
416
- // async deleteDocument(documentId) {
417
- // await deleteDocument(datasetId, documentId);
418
- // await this.reload();
419
- // },
420
- // }))
421
- // );
422
- // return STATES.datasetDetail[datasetId];
423
- // }
@@ -1,52 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.useSubscriptionState = exports.createSubscriptionState = void 0;
13
- const zustand_1 = require("zustand");
14
- const immer_1 = require("zustand/middleware/immer");
15
- const subscription_1 = require("../api/subscription");
16
- const STATES = {};
17
- const createSubscriptionState = ({ aid }) => {
18
- var _a;
19
- (_a = STATES[aid]) !== null && _a !== void 0 ? _a : (STATES[aid] = (0, zustand_1.create)()((0, immer_1.immer)((set) => ({
20
- load: () => __awaiter(void 0, void 0, void 0, function* () {
21
- set((state) => {
22
- state.loading = true;
23
- });
24
- try {
25
- const [{ subscription }, release] = yield Promise.all([(0, subscription_1.getSubscription)({ aid }), (0, subscription_1.getRelease)({ aid })]);
26
- set((state) => {
27
- state.subscription = subscription;
28
- state.release = release;
29
- });
30
- }
31
- finally {
32
- set((state) => {
33
- state.loading = false;
34
- state.loaded = true;
35
- });
36
- }
37
- }),
38
- }))));
39
- return STATES[aid];
40
- };
41
- exports.createSubscriptionState = createSubscriptionState;
42
- const LOADING_TASKS = {};
43
- function useSubscriptionState({ aid }) {
44
- var _a;
45
- const state = (0, exports.createSubscriptionState)({ aid })();
46
- if (!state.loaded && !state.subscription) {
47
- (_a = LOADING_TASKS[aid]) !== null && _a !== void 0 ? _a : (LOADING_TASKS[aid] = state.load());
48
- throw LOADING_TASKS[aid];
49
- }
50
- return [state.subscription, state];
51
- }
52
- exports.useSubscriptionState = useSubscriptionState;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeSx = exports.deepMerge = exports.stringifyIdentity = exports.parseIdentity = void 0;
4
- const js_base64_1 = require("js-base64");
5
- function parseIdentity(aid, options) {
6
- let projectId;
7
- let projectRef;
8
- let assistantId;
9
- try {
10
- const s = js_base64_1.Base64.decode(aid).split('/');
11
- [projectId, projectRef, assistantId] = s.length === 3 ? s : s.length === 2 ? [s[0], 'main', s[1]] : [];
12
- }
13
- catch (error) {
14
- console.error('parse assistantId error', { error });
15
- }
16
- if (projectId && projectRef && assistantId)
17
- return { projectId, projectRef, assistantId };
18
- if (options === null || options === void 0 ? void 0 : options.rejectWhenError)
19
- throw new Error(`Invalid assistant identity ${aid}`);
20
- return undefined;
21
- }
22
- exports.parseIdentity = parseIdentity;
23
- function stringifyIdentity({ projectId, projectRef, assistantId, }) {
24
- return js_base64_1.Base64.encodeURI([projectId, projectRef, assistantId].join('/'));
25
- }
26
- exports.stringifyIdentity = stringifyIdentity;
27
- function isObject(obj) {
28
- return typeof obj === 'object' && !Array.isArray(obj);
29
- }
30
- function deepMerge(target, source) {
31
- if (isObject(target) && isObject(source)) {
32
- for (const key of Object.keys(source)) {
33
- if (isObject(source[key])) {
34
- if (!target[key] || !isObject(target[key]))
35
- target[key] = source[key];
36
- deepMerge(target[key], source[key]);
37
- }
38
- else {
39
- target[key] = source[key];
40
- }
41
- }
42
- }
43
- }
44
- exports.deepMerge = deepMerge;
45
- const mergeSx = (initial, sx) => {
46
- const mergedSx = [initial, ...(Array.isArray(sx) ? sx : [sx])];
47
- return mergedSx;
48
- };
49
- exports.mergeSx = mergeSx;
@@ -1,46 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __rest = (this && this.__rest) || function (s, e) {
11
- var t = {};
12
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
- t[p] = s[p];
14
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
- t[p[i]] = s[p[i]];
18
- }
19
- return t;
20
- };
21
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
- import { CircularProgress, ListItemButton, Stack } from '@mui/material';
23
- import { useState } from 'react';
24
- export default function LoadingListItemButton(_a) {
25
- var { children, confirmation } = _a, props = __rest(_a, ["children", "confirmation"]);
26
- const [clicked, setClicked] = useState(false);
27
- const [loading, setLoading] = useState(false);
28
- const handleClick = (e) => __awaiter(this, void 0, void 0, function* () {
29
- var _b;
30
- if (loading)
31
- return;
32
- if (!clicked && confirmation) {
33
- setClicked(true);
34
- return;
35
- }
36
- try {
37
- setLoading(true);
38
- yield ((_b = props.onClick) === null || _b === void 0 ? void 0 : _b.call(props, e));
39
- }
40
- finally {
41
- setClicked(false);
42
- setLoading(false);
43
- }
44
- });
45
- return (_jsxs(ListItemButton, Object.assign({}, props, { onClick: handleClick, sx: Object.assign(Object.assign({}, props.sx), { display: 'flex', alignItems: 'center', gap: 1 }), children: [(clicked && confirmation) || children, _jsx(Stack, { direction: "row", alignItems: "center", justifyContent: "flex-end", sx: { width: 18 }, children: loading && _jsx(CircularProgress, { size: 14 }) })] })));
46
- }
@@ -1,19 +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 { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
- import { Box, Link, Stack, Typography } from '@mui/material';
14
- import { useLocaleContext } from '../../../locale';
15
- export default function PoweredBy(_a) {
16
- var { assistantId } = _a, props = __rest(_a, ["assistantId"]);
17
- const { t } = useLocaleContext();
18
- return (_jsx(Stack, Object.assign({ py: 0.5 }, props, { children: _jsx(Stack, { className: "ai-chat-powered-by", direction: "row", justifyContent: "center", children: _jsxs(Typography, { variant: "caption", sx: { display: 'inline-flex', alignItems: 'center', a: { display: 'inline-flex', alignItems: 'center' } }, children: [_jsxs(Typography, { component: "span", fontSize: 12, color: "text.poweredBy", children: [t('poweredBy'), ' '] }), "\u00A0", _jsxs(Link, { href: "https://www.arcblock.io", target: "_blank", color: "text.poweredBy", children: [_jsx(Box, { component: "img", src: "https://www.arcblock.io/.well-known/service/blocklet/logo", sx: { height: 16, verticalAlign: 'middle', mr: 0.5, borderRadius: 0.5 } }), "ArcBlock"] }), "\u00A0\u00B7\u00A0", _jsxs(Link, { href: "https://www.aigne.io", target: "_blank", color: "text.poweredBy", children: [_jsx(Box, { component: "img", src: "https://www.aigne.io/.well-known/service/blocklet/logo", sx: { height: 16, verticalAlign: 'middle', mr: 0.5, borderRadius: 0.5 } }), "AIGNE"] })] }) }) })));
19
- }