@blocklet/pages-kit 0.2.285 → 0.2.287

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 (209) hide show
  1. package/lib/cjs/builtin/async/ai-runtime/api/assistant.js +26 -0
  2. package/lib/cjs/builtin/async/ai-runtime/api/dataset.js +127 -0
  3. package/lib/cjs/builtin/async/ai-runtime/api/message.js +33 -0
  4. package/lib/cjs/builtin/async/ai-runtime/api/request.js +47 -0
  5. package/lib/cjs/builtin/async/ai-runtime/api/session.js +121 -0
  6. package/lib/cjs/builtin/async/ai-runtime/api/subscription.js +32 -0
  7. package/lib/cjs/builtin/async/ai-runtime/components/ActionButton.js +63 -0
  8. package/lib/cjs/builtin/async/ai-runtime/components/GlobalLoading.js +60 -0
  9. package/lib/cjs/builtin/async/ai-runtime/components/LoadingButton.js +40 -0
  10. package/lib/cjs/builtin/async/ai-runtime/components/LoadingListItemButton.js +51 -0
  11. package/lib/cjs/builtin/async/ai-runtime/components/MarkdownRenderer.js +156 -0
  12. package/lib/cjs/builtin/async/ai-runtime/components/MenuButton.js +43 -0
  13. package/lib/cjs/builtin/async/ai-runtime/components/PoweredBy.js +30 -0
  14. package/lib/cjs/builtin/async/ai-runtime/components/RuntimeProvider.js +16 -0
  15. package/lib/cjs/builtin/async/ai-runtime/components/ScrollView.js +109 -0
  16. package/lib/cjs/builtin/async/ai-runtime/components/SocialShare.js +102 -0
  17. package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +193 -0
  18. package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +92 -0
  19. package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionListView.js +197 -0
  20. package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionView.js +122 -0
  21. package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentListView.js +152 -0
  22. package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentView.js +135 -0
  23. package/lib/cjs/builtin/async/ai-runtime/components/common/ChatBot.js +105 -0
  24. package/lib/cjs/builtin/async/ai-runtime/components/common/MessageMetadataRenderer.js +21 -0
  25. package/lib/cjs/builtin/async/ai-runtime/components/common/MessageSuggestedQuestions.js +35 -0
  26. package/lib/cjs/builtin/async/ai-runtime/components/common/index.js +12 -0
  27. package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterForm.js +48 -0
  28. package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +66 -0
  29. package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormFields.js +43 -0
  30. package/lib/cjs/builtin/async/ai-runtime/components/form/QuestionField.js +44 -0
  31. package/lib/cjs/builtin/async/ai-runtime/components/form/SettingButton.js +76 -0
  32. package/lib/cjs/builtin/async/ai-runtime/components/layout/index.js +15 -0
  33. package/lib/cjs/builtin/async/ai-runtime/components/lottie/index.js +34 -0
  34. package/lib/cjs/builtin/async/ai-runtime/components/message/MessageActions.js +38 -0
  35. package/lib/cjs/builtin/async/ai-runtime/components/message/MessageErrorView.js +30 -0
  36. package/lib/cjs/builtin/async/ai-runtime/components/message/MessageItemView.js +134 -0
  37. package/lib/cjs/builtin/async/ai-runtime/components/message/MessageListView.js +48 -0
  38. package/lib/cjs/builtin/async/ai-runtime/components/message/ReferenceLinks.js +11 -0
  39. package/lib/cjs/builtin/async/ai-runtime/components/parameters/LanguageField.js +55 -0
  40. package/lib/cjs/builtin/async/ai-runtime/components/parameters/NumberField.js +21 -0
  41. package/lib/cjs/builtin/async/ai-runtime/components/parameters/SelectField.js +24 -0
  42. package/lib/cjs/builtin/async/ai-runtime/components/parameters/StringField.js +21 -0
  43. package/lib/cjs/builtin/async/ai-runtime/components/parameters/index.js +37 -0
  44. package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +94 -0
  45. package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +48 -0
  46. package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHome.js +21 -0
  47. package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +67 -0
  48. package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/index.js +15 -0
  49. package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +103 -0
  50. package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.js +22 -0
  51. package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +72 -0
  52. package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.js +31 -0
  53. package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/index.js +22 -0
  54. package/lib/cjs/builtin/async/ai-runtime/components/session/CheckSession.js +62 -0
  55. package/lib/cjs/builtin/async/ai-runtime/components/session/SessionListView.js +88 -0
  56. package/lib/cjs/builtin/async/ai-runtime/constants.js +5 -0
  57. package/lib/cjs/builtin/async/ai-runtime/hooks/header.js +32 -0
  58. package/lib/cjs/builtin/async/ai-runtime/hooks/navigate.js +37 -0
  59. package/lib/cjs/builtin/async/ai-runtime/hooks/subscribe.js +35 -0
  60. package/lib/cjs/builtin/async/ai-runtime/index.js +75 -0
  61. package/lib/cjs/builtin/async/ai-runtime/locales/index.js +147 -0
  62. package/lib/cjs/builtin/async/ai-runtime/state/assistant.js +59 -0
  63. package/lib/cjs/builtin/async/ai-runtime/state/index.js +423 -0
  64. package/lib/cjs/builtin/async/ai-runtime/state/session.js +217 -0
  65. package/lib/cjs/builtin/async/ai-runtime/state/subscription.js +52 -0
  66. package/lib/cjs/builtin/async/ai-runtime/utils.js +49 -0
  67. package/lib/cjs/builtin/async/react-scroll-to-bottom.js +1 -1
  68. package/lib/cjs/utils/builtin.js +1 -0
  69. package/lib/cjs/utils/inject-global-components.js +2 -0
  70. package/lib/esm/builtin/async/ai-runtime/api/assistant.js +22 -0
  71. package/lib/esm/builtin/async/ai-runtime/api/dataset.js +113 -0
  72. package/lib/esm/builtin/async/ai-runtime/api/message.js +28 -0
  73. package/lib/esm/builtin/async/ai-runtime/api/request.js +43 -0
  74. package/lib/esm/builtin/async/ai-runtime/api/session.js +112 -0
  75. package/lib/esm/builtin/async/ai-runtime/api/subscription.js +27 -0
  76. package/lib/esm/builtin/async/ai-runtime/components/ActionButton.js +56 -0
  77. package/lib/esm/builtin/async/ai-runtime/components/GlobalLoading.js +56 -0
  78. package/lib/esm/builtin/async/ai-runtime/components/LoadingButton.js +38 -0
  79. package/lib/esm/builtin/async/ai-runtime/components/LoadingListItemButton.js +48 -0
  80. package/lib/esm/builtin/async/ai-runtime/components/MarkdownRenderer.js +129 -0
  81. package/lib/esm/builtin/async/ai-runtime/components/MenuButton.js +40 -0
  82. package/lib/esm/builtin/async/ai-runtime/components/PoweredBy.js +27 -0
  83. package/lib/esm/builtin/async/ai-runtime/components/RuntimeProvider.js +10 -0
  84. package/lib/esm/builtin/async/ai-runtime/components/ScrollView.js +101 -0
  85. package/lib/esm/builtin/async/ai-runtime/components/SocialShare.js +93 -0
  86. package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +190 -0
  87. package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +92 -0
  88. package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionListView.js +197 -0
  89. package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionView.js +122 -0
  90. package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentListView.js +152 -0
  91. package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentView.js +135 -0
  92. package/lib/esm/builtin/async/ai-runtime/components/common/ChatBot.js +99 -0
  93. package/lib/esm/builtin/async/ai-runtime/components/common/MessageMetadataRenderer.js +15 -0
  94. package/lib/esm/builtin/async/ai-runtime/components/common/MessageSuggestedQuestions.js +30 -0
  95. package/lib/esm/builtin/async/ai-runtime/components/common/index.js +3 -0
  96. package/lib/esm/builtin/async/ai-runtime/components/form/ParameterForm.js +42 -0
  97. package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +59 -0
  98. package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormFields.js +37 -0
  99. package/lib/esm/builtin/async/ai-runtime/components/form/QuestionField.js +38 -0
  100. package/lib/esm/builtin/async/ai-runtime/components/form/SettingButton.js +73 -0
  101. package/lib/esm/builtin/async/ai-runtime/components/layout/index.js +12 -0
  102. package/lib/esm/builtin/async/ai-runtime/components/lottie/index.js +8 -0
  103. package/lib/esm/builtin/async/ai-runtime/components/message/MessageActions.js +35 -0
  104. package/lib/esm/builtin/async/ai-runtime/components/message/MessageErrorView.js +24 -0
  105. package/lib/esm/builtin/async/ai-runtime/components/message/MessageItemView.js +105 -0
  106. package/lib/esm/builtin/async/ai-runtime/components/message/MessageListView.js +42 -0
  107. package/lib/esm/builtin/async/ai-runtime/components/message/ReferenceLinks.js +8 -0
  108. package/lib/esm/builtin/async/ai-runtime/components/parameters/LanguageField.js +53 -0
  109. package/lib/esm/builtin/async/ai-runtime/components/parameters/NumberField.js +19 -0
  110. package/lib/esm/builtin/async/ai-runtime/components/parameters/SelectField.js +22 -0
  111. package/lib/esm/builtin/async/ai-runtime/components/parameters/StringField.js +19 -0
  112. package/lib/esm/builtin/async/ai-runtime/components/parameters/index.js +31 -0
  113. package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +88 -0
  114. package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +22 -0
  115. package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHome.js +15 -0
  116. package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +61 -0
  117. package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/index.js +9 -0
  118. package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +97 -0
  119. package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.js +19 -0
  120. package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +66 -0
  121. package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.js +25 -0
  122. package/lib/esm/builtin/async/ai-runtime/components/runtime-form/index.js +16 -0
  123. package/lib/esm/builtin/async/ai-runtime/components/session/CheckSession.js +59 -0
  124. package/lib/esm/builtin/async/ai-runtime/components/session/SessionListView.js +88 -0
  125. package/lib/esm/builtin/async/ai-runtime/constants.js +2 -0
  126. package/lib/esm/builtin/async/ai-runtime/hooks/header.js +25 -0
  127. package/lib/esm/builtin/async/ai-runtime/hooks/navigate.js +31 -0
  128. package/lib/esm/builtin/async/ai-runtime/hooks/subscribe.js +31 -0
  129. package/lib/esm/builtin/async/ai-runtime/index.js +66 -0
  130. package/lib/esm/builtin/async/ai-runtime/locales/index.js +144 -0
  131. package/lib/esm/builtin/async/ai-runtime/state/assistant.js +54 -0
  132. package/lib/esm/builtin/async/ai-runtime/state/index.js +423 -0
  133. package/lib/esm/builtin/async/ai-runtime/state/session.js +209 -0
  134. package/lib/esm/builtin/async/ai-runtime/state/subscription.js +47 -0
  135. package/lib/esm/builtin/async/ai-runtime/utils.js +42 -0
  136. package/lib/esm/builtin/async/react-scroll-to-bottom.js +1 -1
  137. package/lib/esm/utils/builtin.js +1 -0
  138. package/lib/esm/utils/inject-global-components.js +2 -0
  139. package/lib/types/builtin/async/ai-runtime/api/assistant.d.ts +18 -0
  140. package/lib/types/builtin/async/ai-runtime/api/dataset.d.ts +39 -0
  141. package/lib/types/builtin/async/ai-runtime/api/message.d.ts +39 -0
  142. package/lib/types/builtin/async/ai-runtime/api/request.d.ts +5 -0
  143. package/lib/types/builtin/async/ai-runtime/api/session.d.ts +54 -0
  144. package/lib/types/builtin/async/ai-runtime/api/subscription.d.ts +15 -0
  145. package/lib/types/builtin/async/ai-runtime/components/ActionButton.d.ts +11 -0
  146. package/lib/types/builtin/async/ai-runtime/components/GlobalLoading.d.ts +33 -0
  147. package/lib/types/builtin/async/ai-runtime/components/LoadingButton.d.ts +3 -0
  148. package/lib/types/builtin/async/ai-runtime/components/LoadingListItemButton.d.ts +2 -0
  149. package/lib/types/builtin/async/ai-runtime/components/MarkdownRenderer.d.ts +2 -0
  150. package/lib/types/builtin/async/ai-runtime/components/MenuButton.d.ts +9 -0
  151. package/lib/types/builtin/async/ai-runtime/components/PoweredBy.d.ts +4 -0
  152. package/lib/types/builtin/async/ai-runtime/components/RuntimeProvider.d.ts +4 -0
  153. package/lib/types/builtin/async/ai-runtime/components/ScrollView.d.ts +61 -0
  154. package/lib/types/builtin/async/ai-runtime/components/SocialShare.d.ts +17 -0
  155. package/lib/types/builtin/async/ai-runtime/components/ThemeProvider.d.ts +6 -0
  156. package/lib/types/builtin/async/ai-runtime/components/collection/CollectionEditDialog.d.ts +0 -0
  157. package/lib/types/builtin/async/ai-runtime/components/collection/CollectionListView.d.ts +0 -0
  158. package/lib/types/builtin/async/ai-runtime/components/collection/CollectionView.d.ts +0 -0
  159. package/lib/types/builtin/async/ai-runtime/components/collection/DocumentListView.d.ts +0 -0
  160. package/lib/types/builtin/async/ai-runtime/components/collection/DocumentView.d.ts +0 -0
  161. package/lib/types/builtin/async/ai-runtime/components/common/ChatBot.d.ts +13 -0
  162. package/lib/types/builtin/async/ai-runtime/components/common/MessageMetadataRenderer.d.ts +4 -0
  163. package/lib/types/builtin/async/ai-runtime/components/common/MessageSuggestedQuestions.d.ts +7 -0
  164. package/lib/types/builtin/async/ai-runtime/components/common/index.d.ts +3 -0
  165. package/lib/types/builtin/async/ai-runtime/components/form/ParameterForm.d.ts +12 -0
  166. package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormDialog.d.ts +28 -0
  167. package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormFields.d.ts +8 -0
  168. package/lib/types/builtin/async/ai-runtime/components/form/QuestionField.d.ts +13 -0
  169. package/lib/types/builtin/async/ai-runtime/components/form/SettingButton.d.ts +4 -0
  170. package/lib/types/builtin/async/ai-runtime/components/layout/index.d.ts +7 -0
  171. package/lib/types/builtin/async/ai-runtime/components/lottie/index.d.ts +4 -0
  172. package/lib/types/builtin/async/ai-runtime/components/message/MessageActions.d.ts +4 -0
  173. package/lib/types/builtin/async/ai-runtime/components/message/MessageErrorView.d.ts +6 -0
  174. package/lib/types/builtin/async/ai-runtime/components/message/MessageItemView.d.ts +10 -0
  175. package/lib/types/builtin/async/ai-runtime/components/message/MessageListView.d.ts +5 -0
  176. package/lib/types/builtin/async/ai-runtime/components/message/ReferenceLinks.d.ts +4 -0
  177. package/lib/types/builtin/async/ai-runtime/components/parameters/LanguageField.d.ts +9 -0
  178. package/lib/types/builtin/async/ai-runtime/components/parameters/NumberField.d.ts +9 -0
  179. package/lib/types/builtin/async/ai-runtime/components/parameters/SelectField.d.ts +9 -0
  180. package/lib/types/builtin/async/ai-runtime/components/parameters/StringField.d.ts +9 -0
  181. package/lib/types/builtin/async/ai-runtime/components/parameters/index.d.ts +7 -0
  182. package/lib/types/builtin/async/ai-runtime/components/runtime-chat/InitialForm.d.ts +4 -0
  183. package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.d.ts +4 -0
  184. package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHome.d.ts +4 -0
  185. package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.d.ts +6 -0
  186. package/lib/types/builtin/async/ai-runtime/components/runtime-chat/index.d.ts +4 -0
  187. package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.d.ts +5 -0
  188. package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.d.ts +5 -0
  189. package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.d.ts +5 -0
  190. package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.d.ts +5 -0
  191. package/lib/types/builtin/async/ai-runtime/components/runtime-form/index.d.ts +4 -0
  192. package/lib/types/builtin/async/ai-runtime/components/session/CheckSession.d.ts +9 -0
  193. package/lib/types/builtin/async/ai-runtime/components/session/SessionListView.d.ts +0 -0
  194. package/lib/types/builtin/async/ai-runtime/constants.d.ts +2 -0
  195. package/lib/types/builtin/async/ai-runtime/hooks/header.d.ts +4 -0
  196. package/lib/types/builtin/async/ai-runtime/hooks/navigate.d.ts +25 -0
  197. package/lib/types/builtin/async/ai-runtime/hooks/subscribe.d.ts +6 -0
  198. package/lib/types/builtin/async/ai-runtime/index.d.ts +17 -0
  199. package/lib/types/builtin/async/ai-runtime/locales/index.d.ts +126 -0
  200. package/lib/types/builtin/async/ai-runtime/state/assistant.d.ts +17 -0
  201. package/lib/types/builtin/async/ai-runtime/state/index.d.ts +0 -0
  202. package/lib/types/builtin/async/ai-runtime/state/session.d.ts +40 -0
  203. package/lib/types/builtin/async/ai-runtime/state/subscription.d.ts +15 -0
  204. package/lib/types/builtin/async/ai-runtime/utils.d.ts +20 -0
  205. package/lib/types/builtin/async/react-scroll-to-bottom.d.ts +3 -2
  206. package/lib/types/builtin/session.d.ts +11 -1
  207. package/lib/types/utils/builtin.d.ts +1 -0
  208. package/package.json +13 -8
  209. package/tsconfig.json +5 -1
@@ -0,0 +1,42 @@
1
+ import { Base64 } from 'js-base64';
2
+ export function parseIdentity(aid, options) {
3
+ let projectId;
4
+ let projectRef;
5
+ let assistantId;
6
+ try {
7
+ const s = Base64.decode(aid).split('/');
8
+ [projectId, projectRef, assistantId] = s.length === 3 ? s : s.length === 2 ? [s[0], 'main', s[1]] : [];
9
+ }
10
+ catch (error) {
11
+ console.error('parse assistantId error', { error });
12
+ }
13
+ if (projectId && projectRef && assistantId)
14
+ return { projectId, projectRef, assistantId };
15
+ if (options === null || options === void 0 ? void 0 : options.rejectWhenError)
16
+ throw new Error(`Invalid assistant identity ${aid}`);
17
+ return undefined;
18
+ }
19
+ export function stringifyIdentity({ projectId, projectRef, assistantId, }) {
20
+ return Base64.encodeURI([projectId, projectRef, assistantId].join('/'));
21
+ }
22
+ function isObject(obj) {
23
+ return typeof obj === 'object' && !Array.isArray(obj);
24
+ }
25
+ export function deepMerge(target, source) {
26
+ if (isObject(target) && isObject(source)) {
27
+ for (const key of Object.keys(source)) {
28
+ if (isObject(source[key])) {
29
+ if (!target[key] || !isObject(target[key]))
30
+ target[key] = source[key];
31
+ deepMerge(target[key], source[key]);
32
+ }
33
+ else {
34
+ target[key] = source[key];
35
+ }
36
+ }
37
+ }
38
+ }
39
+ export const mergeSx = (initial, sx) => {
40
+ const mergedSx = [initial, ...(Array.isArray(sx) ? sx : [sx])];
41
+ return mergedSx;
42
+ };
@@ -5,4 +5,4 @@ export default () => Promise.all([
5
5
  import('react-scroll-to-bottom/lib/esm/hooks/internal/useInternalContext')
6
6
  : // @ts-ignore
7
7
  import('react-scroll-to-bottom/lib/hooks/internal/useInternalContext'),
8
- ]).then(([mod, { default: useInternalContext }]) => (Object.assign(Object.assign({}, mod), { useInternalContext })));
8
+ ]).then(([mod, { default: useInternalContext }]) => (Object.assign(Object.assign({}, mod), { Composer: mod.Composer, useInternalContext })));
@@ -43,4 +43,5 @@ export const BuiltinModules = {
43
43
  '@blocklet/pages-kit/builtin/async/react-markdown': {},
44
44
  '@blocklet/pages-kit/builtin/async/react-syntax-highlighter': {},
45
45
  '@blocklet/pages-kit/builtin/async/image-preview': {},
46
+ '@blocklet/pages-kit/builtin/async/ai-runtime': {},
46
47
  };
@@ -1,4 +1,5 @@
1
1
  import * as arcblockUx from '../builtin/arcblock/ux';
2
+ import * as aiRuntime from '../builtin/async/ai-runtime';
2
3
  import * as imagePreview from '../builtin/async/image-preview';
3
4
  import * as reactMarkdown from '../builtin/async/react-markdown';
4
5
  import * as reactScrollToBottom from '../builtin/async/react-scroll-to-bottom';
@@ -50,6 +51,7 @@ function injectGlobalComponents() {
50
51
  '@blocklet/pages-kit/builtin/async/react-markdown': reactMarkdown,
51
52
  '@blocklet/pages-kit/builtin/async/react-syntax-highlighter': reactSyntaxHighlighter,
52
53
  '@blocklet/pages-kit/builtin/async/image-preview': imagePreview,
54
+ '@blocklet/pages-kit/builtin/async/ai-runtime': aiRuntime,
53
55
  },
54
56
  require(module) {
55
57
  return win[BuiltinModulesGlobalVariableName].modules[module];
@@ -0,0 +1,18 @@
1
+ import { AssistantBase, Parameter } from '@blocklet/ai-runtime/types';
2
+ export interface Assistant {
3
+ id: string;
4
+ name?: string;
5
+ description?: string;
6
+ parameters?: Parameter[];
7
+ entries?: {
8
+ id: string;
9
+ title?: string;
10
+ parameters?: {
11
+ [key: string]: any;
12
+ };
13
+ }[];
14
+ release?: AssistantBase['release'];
15
+ }
16
+ export declare function getAssistant({ assistantId: id }: {
17
+ assistantId: string;
18
+ }): Promise<Assistant>;
@@ -0,0 +1,39 @@
1
+ export interface Dataset {
2
+ id: string;
3
+ name?: string;
4
+ description?: string;
5
+ }
6
+ export declare function getDataset({ datasetId }: {
7
+ datasetId: string;
8
+ }): Promise<Dataset>;
9
+ export declare function getDatasets({ appId }: {
10
+ appId: string;
11
+ }): Promise<Array<Dataset>>;
12
+ export declare function createDataset({ appId, name, description, }: {
13
+ appId: string;
14
+ name: string;
15
+ description?: string;
16
+ }): Promise<unknown>;
17
+ export declare function updateDataset(datasetId: string, input: Pick<Dataset, 'name' | 'description'>): Promise<Dataset>;
18
+ export declare function deleteDataset(datasetId: string): Promise<void>;
19
+ export interface Document {
20
+ id: string;
21
+ name?: string;
22
+ }
23
+ export declare function deleteDocument(datasetId: string, documentId: string): Promise<void>;
24
+ export declare function getDocuments(datasetId: string): Promise<{
25
+ items: Array<Document>;
26
+ total: number;
27
+ }>;
28
+ export declare function getDocument(datasetId: string, documentId: string): Promise<{
29
+ document: Document;
30
+ }>;
31
+ export declare function createDocument(datasetId: string, type: 'text' | 'file', input: {
32
+ name: string;
33
+ content: string;
34
+ } | File): Promise<any>;
35
+ export declare function createDocumentFile(datasetId: string, file: File): Promise<any>;
36
+ export declare function updateDocument(datasetId: string, documentId: string, type: 'text', input: {
37
+ name: string;
38
+ content: string;
39
+ }): Promise<unknown>;
@@ -0,0 +1,39 @@
1
+ import { ExecuteBlock, RuntimeOutputVariablesSchema } from '@blocklet/ai-runtime/types';
2
+ export interface Message {
3
+ id: string;
4
+ taskId: string;
5
+ sessionId: string;
6
+ createdAt: string;
7
+ updatedAt: string;
8
+ parameters?: {
9
+ [key: string]: any;
10
+ };
11
+ result?: {
12
+ content?: string;
13
+ images?: {
14
+ url: string;
15
+ }[];
16
+ messages?: {
17
+ taskId: string;
18
+ respondAs?: ExecuteBlock['respondAs'];
19
+ result?: Pick<NonNullable<Message['result']>, 'content' | 'images'>;
20
+ }[];
21
+ objects?: {
22
+ taskId: string;
23
+ data: RuntimeOutputVariablesSchema;
24
+ }[];
25
+ } | null;
26
+ error?: {
27
+ type?: string;
28
+ message: string;
29
+ };
30
+ }
31
+ export declare function getMessages({ sessionId, }: {
32
+ sessionId: string;
33
+ }): Promise<{
34
+ messages: Message[];
35
+ count: number;
36
+ }>;
37
+ export declare function deleteMessages({ sessionId }: {
38
+ sessionId: string;
39
+ }): Promise<void>;
@@ -0,0 +1,5 @@
1
+ export declare const fetch: (input: string | URL | Request, options?: RequestInit | undefined) => Promise<Response>;
2
+ export declare function request<T>({ url, body, ...init }: {
3
+ url: string;
4
+ body?: any;
5
+ } & Omit<RequestInit, 'body'>): Promise<T>;
@@ -0,0 +1,54 @@
1
+ import { RunAssistantResponse } from '@blocklet/ai-runtime/types';
2
+ import { Identity } from '../utils';
3
+ export interface Session {
4
+ id: string;
5
+ userId: string;
6
+ projectId: string;
7
+ projectRef: string;
8
+ assistantId: string;
9
+ createdAt: string;
10
+ parameters?: any;
11
+ entry?: {
12
+ title?: string;
13
+ };
14
+ }
15
+ export declare function getSessions({ projectId, projectRef, assistantId, }: {
16
+ projectId: string;
17
+ projectRef: string;
18
+ assistantId: string;
19
+ }): Promise<{
20
+ sessions: Session[];
21
+ }>;
22
+ export declare function getSession({ sessionId }: {
23
+ sessionId: string;
24
+ }): Promise<{
25
+ session: Session;
26
+ }>;
27
+ export declare function createSession({ assistantId, name, parameters, entry, }: {
28
+ assistantId: string;
29
+ name?: string;
30
+ parameters?: any;
31
+ entry?: any;
32
+ }): Promise<{
33
+ created: Session;
34
+ sessions: Session[];
35
+ }>;
36
+ export declare function updateSession({ sessionId, name, parameters, }: {
37
+ sessionId: string;
38
+ name?: string;
39
+ parameters?: any;
40
+ }): Promise<{
41
+ updated: Session;
42
+ sessions: Session[];
43
+ }>;
44
+ export declare function deleteSession({ sessionId, }: {
45
+ sessionId: string;
46
+ }): Promise<{
47
+ deleted: Session;
48
+ sessions: Session[];
49
+ }>;
50
+ export declare function runAssistant({ sessionId, identity, parameters, }: {
51
+ sessionId: string;
52
+ identity: Identity;
53
+ parameters: any;
54
+ }): AsyncGenerator<RunAssistantResponse, void, unknown>;
@@ -0,0 +1,15 @@
1
+ export interface Subscription {
2
+ }
3
+ export declare function getSubscription({ aid }: {
4
+ aid: string;
5
+ }): Promise<{
6
+ subscription?: Subscription;
7
+ }>;
8
+ export interface Release {
9
+ paymentProductId?: string;
10
+ paymentLinkId?: string;
11
+ paymentUnitAmount?: string;
12
+ }
13
+ export declare function getRelease({ aid }: {
14
+ aid: string;
15
+ }): Promise<Release>;
@@ -0,0 +1,11 @@
1
+ import { LoadingButtonProps } from '@mui/lab';
2
+ import { ReactNode } from 'react';
3
+ export declare function ActionButton({ tip, tipSucceed, title, titleSucceed, icon, iconSucceed, autoReset, ...props }: {
4
+ tip?: ReactNode;
5
+ tipSucceed?: ReactNode;
6
+ title?: ReactNode;
7
+ titleSucceed?: ReactNode;
8
+ icon?: ReactNode;
9
+ iconSucceed?: ReactNode;
10
+ autoReset?: boolean;
11
+ } & Omit<Partial<LoadingButtonProps>, 'title'>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,33 @@
1
+ import { LinearProgressProps } from '@mui/material';
2
+ export default function GlobalLoading({ ...props }: LinearProgressProps): import("react/jsx-runtime").JSX.Element | null;
3
+ interface Run<T = any> {
4
+ (fn: Promise<T> | (() => Promise<T>)): Promise<T>;
5
+ }
6
+ export declare const globalLoadingState: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<{
7
+ loading: boolean;
8
+ count: number;
9
+ run: Run;
10
+ start: () => void;
11
+ end: () => void;
12
+ }>, "setState"> & {
13
+ setState(nextStateOrUpdater: {
14
+ loading: boolean;
15
+ count: number;
16
+ run: Run;
17
+ start: () => void;
18
+ end: () => void;
19
+ } | Partial<{
20
+ loading: boolean;
21
+ count: number;
22
+ run: Run;
23
+ start: () => void;
24
+ end: () => void;
25
+ }> | ((state: {
26
+ loading: boolean;
27
+ count: number;
28
+ run: Run;
29
+ start: () => void;
30
+ end: () => void;
31
+ }) => void), shouldReplace?: boolean | undefined): void;
32
+ }>;
33
+ export {};
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const LoadingButton: import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
3
+ export default LoadingButton;
@@ -0,0 +1,2 @@
1
+ import { ListItemButtonProps } from '@mui/material';
2
+ export default function LoadingListItemButton({ ...props }: ListItemButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ declare const MarkdownRenderer: import("@emotion/styled").StyledComponent<Readonly<import("react-markdown/lib").Options> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
2
+ export default MarkdownRenderer;
@@ -0,0 +1,9 @@
1
+ import { BoxProps } from '@mui/material';
2
+ import React from 'react';
3
+ interface Props {
4
+ sx?: BoxProps;
5
+ menus?: React.ReactNode | (() => React.ReactNode);
6
+ children?: React.ReactNode;
7
+ }
8
+ export default function MenuButton({ sx, menus, children }: Props): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,4 @@
1
+ import { StackProps } from '@mui/material';
2
+ export default function PoweredBy({ assistantId, ...props }: {
3
+ assistantId: string;
4
+ } & StackProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { ReactNode } from 'react';
2
+ export default function RuntimeProvider({ children }: {
3
+ children?: ReactNode;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,61 @@
1
+ import { BoxProps } from '@mui/material';
2
+ import { ComponentProps } from 'react';
3
+ export declare function useScrollToBottomModule(): {
4
+ Composer: typeof import("react-scroll-to-bottom").default;
5
+ useInternalContext: any;
6
+ default(props: import("react").PropsWithChildren<{
7
+ checkInterval?: number | undefined;
8
+ className?: string | undefined;
9
+ debounce?: number | undefined;
10
+ debug?: boolean | undefined;
11
+ followButtonClassName?: string | undefined;
12
+ initialScrollBehavior?: "auto" | "smooth" | undefined;
13
+ mode?: "bottom" | "top" | undefined;
14
+ nonce?: string | undefined;
15
+ scroller?: ((values: {
16
+ maxValue: number;
17
+ minValue: number;
18
+ offsetHeight: number;
19
+ scrollHeight: number;
20
+ scrollTop: number;
21
+ }) => number) | undefined;
22
+ scrollViewClassName?: string | undefined;
23
+ }>): null;
24
+ useScrollTo(): (scrollTop: number | "100%") => void;
25
+ useScrollToBottom(): (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
26
+ useScrollToEnd(): (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
27
+ useScrollToStart(): (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
28
+ useScrollToTop(): (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
29
+ useObserveScrollPosition(observer: false | (({ scrollTop }: {
30
+ scrollTop: number;
31
+ }) => void)): void;
32
+ useAnimating(): [boolean];
33
+ useAnimatingToEnd(): [boolean];
34
+ useAtBottom(): [boolean];
35
+ useAtEnd(): [boolean];
36
+ useAtStart(): [boolean];
37
+ useAtTop(): [boolean];
38
+ useMode(): ["bottom" | "top"];
39
+ useSticky(): [boolean];
40
+ FunctionContext: import("react").Context<{
41
+ scrollTo: (scrollTop: number | "100%") => void;
42
+ scrollToBottom: (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
43
+ scrollToEnd: (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
44
+ scrollToStart: (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
45
+ scrollToTop: (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
46
+ }>;
47
+ StateContext: import("react").Context<{
48
+ animating: boolean;
49
+ animatingToEnd: boolean;
50
+ atBottom: boolean;
51
+ atEnd: boolean;
52
+ atStart: boolean;
53
+ atTop: boolean;
54
+ mode: string;
55
+ sticky: boolean;
56
+ }>;
57
+ };
58
+ export default function ScrollView({ children, initialScrollBehavior, ...props }: BoxProps & {
59
+ scroller?: 'window';
60
+ initialScrollBehavior?: ComponentProps<(typeof import('react-scroll-to-bottom'))['default']>['initialScrollBehavior'];
61
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { BoxProps } from '@mui/material';
2
+ interface SocialShareMenuProps extends BoxProps {
3
+ url?: string;
4
+ content: string;
5
+ }
6
+ interface SocialShareButtonsProps extends SocialShareMenuProps {
7
+ itemSx?: BoxProps['sx'];
8
+ onClick?: () => void;
9
+ bgFill?: string;
10
+ iconFill?: string;
11
+ }
12
+ export default function SocialShare(props: SocialShareMenuProps & SocialShareButtonsProps & {
13
+ type?: 'menu' | 'buttons';
14
+ }): import("react/jsx-runtime").JSX.Element;
15
+ export declare function SocialShareMenu({ url, content, ...restProps }: SocialShareMenuProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function SocialShareButtons({ url, content, sx, itemSx, onClick, bgFill, iconFill, ...rest }: SocialShareButtonsProps): import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ export default function ThemeProvider({ children, template, transparentHeaderBg, }: {
3
+ children?: ReactNode;
4
+ template?: string;
5
+ transparentHeaderBg?: boolean;
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ type SizeProps = number | string;
3
+ export interface ChatBotProps {
4
+ assistantId: string;
5
+ size?: SizeProps;
6
+ bottom?: SizeProps;
7
+ right?: SizeProps;
8
+ popperHeight?: SizeProps;
9
+ popperWidth?: SizeProps;
10
+ children?: React.ReactNode;
11
+ }
12
+ export default function ChatBot({ assistantId, size, bottom, right, children, popperWidth, popperHeight, }: ChatBotProps): import("react/jsx-runtime").JSX.Element | null;
13
+ export {};
@@ -0,0 +1,4 @@
1
+ import { RuntimeOutputVariablesSchema } from '@blocklet/ai-runtime/types';
2
+ export default function MessageMetadataRenderer({ object }: {
3
+ object: RuntimeOutputVariablesSchema;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { RuntimeOutputVariable, RuntimeOutputVariablesSchema } from '@blocklet/ai-runtime/types';
2
+ import { TypographyProps } from '@mui/material';
3
+ export default function MessageSuggestedQuestions({ dataSource, onClick, }: {
4
+ dataSource: RuntimeOutputVariablesSchema[RuntimeOutputVariable.suggestedQuestions];
5
+ onClick?: (item: NonNullable<typeof dataSource>[number]) => void;
6
+ }): import("react/jsx-runtime").JSX.Element | null;
7
+ export declare function MessageSuggestedQuestion({ ...props }: TypographyProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export { default as MessageMetadataRenderer } from './MessageMetadataRenderer';
2
+ export { default as MessageSuggestedQuestions } from './MessageSuggestedQuestions';
3
+ export { default as ChatBot } from './ChatBot';
@@ -0,0 +1,12 @@
1
+ import { Assistant } from '../../api/assistant';
2
+ export default function ParameterForm({ sessionId, disabled, readOnly, onSubmit, defaultValues, hideSubmit, isSubmitting, assistant, submitButtonTitle, }: {
3
+ sessionId?: string;
4
+ disabled?: boolean;
5
+ readOnly?: boolean;
6
+ onSubmit?: (parameters: any) => any;
7
+ defaultValues?: any;
8
+ hideSubmit?: boolean;
9
+ isSubmitting?: boolean;
10
+ assistant: Assistant;
11
+ submitButtonTitle?: string;
12
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,28 @@
1
+ export default function ParameterFormDialog({ assistantId, sessionId, DialogProps, }: {
2
+ assistantId: string;
3
+ sessionId: string;
4
+ DialogProps?: any;
5
+ }): import("react/jsx-runtime").JSX.Element;
6
+ export declare const parameterFormDialogState: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<{
7
+ isOpen: boolean;
8
+ callback?: (() => any) | undefined;
9
+ open: () => any;
10
+ close: () => void;
11
+ }>, "setState"> & {
12
+ setState(nextStateOrUpdater: {
13
+ isOpen: boolean;
14
+ callback?: (() => any) | undefined;
15
+ open: () => any;
16
+ close: () => void;
17
+ } | Partial<{
18
+ isOpen: boolean;
19
+ callback?: (() => any) | undefined;
20
+ open: () => any;
21
+ close: () => void;
22
+ }> | ((state: {
23
+ isOpen: boolean;
24
+ callback?: (() => any) | undefined;
25
+ open: () => any;
26
+ close: () => void;
27
+ }) => void), shouldReplace?: boolean | undefined): void;
28
+ }>;
@@ -0,0 +1,8 @@
1
+ import { Parameter } from '@blocklet/ai-runtime/types';
2
+ import { UseFormReturn } from 'react-hook-form';
3
+ export default function ParameterFormFields({ disabled, readOnly, parameters, form, }: {
4
+ disabled?: boolean;
5
+ readOnly?: boolean;
6
+ parameters?: Parameter[];
7
+ form: UseFormReturn;
8
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { UseFormReturn } from 'react-hook-form';
2
+ import { Assistant } from '../../api/assistant';
3
+ export default function QuestionField({ sessionId, assistant, showSettingButton, form, isSubmitting, autoFocus, readOnly, disabled, submitButtonTitle, }: {
4
+ sessionId?: string;
5
+ assistant: Assistant;
6
+ readOnly?: boolean;
7
+ disabled?: boolean;
8
+ form: UseFormReturn;
9
+ submitButtonTitle?: string;
10
+ autoFocus?: boolean;
11
+ isSubmitting?: boolean;
12
+ showSettingButton?: boolean;
13
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { ButtonProps } from '@mui/material';
2
+ export default function SettingButton({ sessionId, ...props }: {
3
+ sessionId: string;
4
+ } & ButtonProps): import("react/jsx-runtime").JSX.Element[];
@@ -0,0 +1,7 @@
1
+ import { BoxProps } from '@mui/material';
2
+ import { ReactNode } from 'react';
3
+ export default function Layout({ children, disableBottomPadding, containerProps, }: {
4
+ children: ReactNode;
5
+ disableBottomPadding?: boolean;
6
+ containerProps?: BoxProps;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export interface LottieProps {
2
+ src: string;
3
+ }
4
+ export default function Lottie({ src }: LottieProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { StackProps } from '@mui/material';
2
+ export default function MessageActions({ content, ...props }: {
3
+ content: string;
4
+ } & StackProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { Assistant } from '../../api/assistant';
2
+ export default function MessageErrorView({ assistantId, assistant, error, }: {
3
+ assistantId: string;
4
+ assistant: Assistant;
5
+ error: any;
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { Assistant } from '../../api/assistant';
2
+ import { MessageItem } from '../../state/session';
3
+ export default function MessageItemView({ assistantId, assistant, message, previousMessageTime, messageTimeType, hideAvatar, }: {
4
+ assistantId: string;
5
+ assistant: Assistant;
6
+ message: MessageItem;
7
+ previousMessageTime?: string;
8
+ messageTimeType?: 'user' | 'previous';
9
+ hideAvatar?: boolean;
10
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { StackProps } from '@mui/material';
2
+ export default function MessageListView({ assistantId, sessionId, ...props }: {
3
+ assistantId: string;
4
+ sessionId: string;
5
+ } & StackProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,4 @@
1
+ import { RuntimeOutputVariablesSchema } from '@blocklet/ai-runtime/types';
2
+ export default function ReferenceLinks({ links }: {
3
+ links: RuntimeOutputVariablesSchema['$reference.links'];
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { SelectParameter } from '@blocklet/ai-runtime/types';
3
+ import { TextFieldProps } from '@mui/material';
4
+ declare const LanguageField: import("react").ForwardRefExoticComponent<Omit<{
5
+ readOnly?: boolean | undefined;
6
+ parameter?: SelectParameter | undefined;
7
+ onChange: (value: string | undefined) => void;
8
+ } & Omit<TextFieldProps, "onChange">, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
9
+ export default LanguageField;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { NumberParameter } from '@blocklet/ai-runtime/types';
3
+ import { TextFieldProps } from '@mui/material';
4
+ declare const NumberField: import("react").ForwardRefExoticComponent<Omit<{
5
+ readOnly?: boolean | undefined;
6
+ parameter?: NumberParameter | undefined;
7
+ onChange: (value: number) => void;
8
+ } & Omit<TextFieldProps, "onChange">, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
9
+ export default NumberField;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { SelectParameter } from '@blocklet/ai-runtime/types';
3
+ import { TextFieldProps } from '@mui/material';
4
+ declare const SelectField: import("react").ForwardRefExoticComponent<Omit<{
5
+ readOnly?: boolean | undefined;
6
+ parameter?: SelectParameter | undefined;
7
+ onChange: (value: string) => void;
8
+ } & Omit<TextFieldProps, "onChange">, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
9
+ export default SelectField;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { StringParameter } from '@blocklet/ai-runtime/types';
3
+ import { TextFieldProps } from '@mui/material';
4
+ declare const StringField: import("react").ForwardRefExoticComponent<Omit<{
5
+ readOnly?: boolean | undefined;
6
+ parameter?: StringParameter | undefined;
7
+ onChange: (value: string) => void;
8
+ } & Omit<TextFieldProps, "onChange">, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
9
+ export default StringField;