@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.
- package/lib/cjs/builtin/async/ai-runtime/api/{assistant.js → agent.js} +5 -7
- package/lib/cjs/builtin/async/ai-runtime/api/session.js +20 -18
- package/lib/cjs/builtin/async/ai-runtime/components/ActionButton.js +1 -2
- package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/index.js +2 -2
- package/lib/cjs/builtin/async/ai-runtime/components/{GlobalLoading.js → GlobalLoading/index.js} +5 -2
- package/lib/cjs/builtin/async/ai-runtime/components/{runtime-form/RuntimeFormHeader.js → Header/SimpleHeader.js} +9 -16
- package/lib/cjs/builtin/async/ai-runtime/components/{runtime-form/RuntimeFormSubmit.js → Layout/SimpleLayout.js} +6 -8
- package/lib/cjs/builtin/async/ai-runtime/components/MarkdownRenderer.js +2 -2
- package/lib/cjs/builtin/async/ai-runtime/components/{RuntimeProvider.js → RuntimeCommonProvider.js} +2 -2
- package/lib/cjs/builtin/async/ai-runtime/components/ScrollView.js +40 -57
- package/lib/cjs/builtin/async/ai-runtime/components/SocialShare.js +8 -3
- package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +0 -21
- package/lib/cjs/builtin/async/ai-runtime/components/{common/UserInfo.js → UserInfo.js} +1 -1
- package/lib/cjs/builtin/async/ai-runtime/constants.js +4 -1
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentAgent.js +4 -4
- package/lib/cjs/builtin/async/ai-runtime/contexts/Runtime.js +32 -0
- package/lib/cjs/builtin/async/ai-runtime/index.js +16 -63
- package/lib/cjs/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +72 -0
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime → runtime/Runtime}/index.js +11 -7
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/AutoForm/index.js +4 -4
- package/lib/cjs/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/MessageActions.js +7 -4
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageErrorView.js +2 -2
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageItemView.js +6 -6
- package/lib/cjs/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageMetadataRenderer.js +1 -1
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +102 -0
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/PhotoGalleryItem/index.js +17 -8
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleChat/index.js +34 -22
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleOutput/index.js +5 -3
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimplePage/index.js +25 -12
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/state/assistant.js → state/agent.js} +12 -12
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/state → state}/runtime.js +5 -10
- package/lib/cjs/builtin/async/ai-runtime/state/session.js +91 -92
- package/lib/esm/builtin/async/ai-runtime/api/{assistant.js → agent.js} +3 -5
- package/lib/esm/builtin/async/ai-runtime/api/session.js +19 -17
- package/lib/esm/builtin/async/ai-runtime/components/ActionButton.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/index.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/components/{GlobalLoading.js → GlobalLoading/index.js} +2 -1
- package/lib/esm/builtin/async/ai-runtime/components/Header/SimpleHeader.js +23 -0
- package/lib/esm/builtin/async/ai-runtime/components/{runtime-form/RuntimeFormSubmit.js → Layout/SimpleLayout.js} +5 -4
- package/lib/esm/builtin/async/ai-runtime/components/MarkdownRenderer.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/components/{RuntimeProvider.js → RuntimeCommonProvider.js} +1 -1
- package/lib/esm/builtin/async/ai-runtime/components/ScrollView.js +19 -57
- package/lib/esm/builtin/async/ai-runtime/components/SocialShare.js +8 -3
- package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +0 -21
- package/lib/esm/builtin/async/ai-runtime/components/{common/UserInfo.js → UserInfo.js} +1 -1
- package/lib/esm/builtin/async/ai-runtime/constants.js +3 -0
- package/lib/esm/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentAgent.js +3 -3
- package/lib/esm/builtin/async/ai-runtime/contexts/Runtime.js +26 -0
- package/lib/esm/builtin/async/ai-runtime/index.js +13 -58
- package/lib/esm/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +66 -0
- package/lib/esm/builtin/async/ai-runtime/{components/runtime → runtime/Runtime}/index.js +9 -5
- package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/AutoForm/index.js +4 -4
- package/lib/esm/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/MessageActions.js +2 -2
- package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageErrorView.js +2 -2
- package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageItemView.js +5 -5
- package/lib/esm/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageMetadataRenderer.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +73 -0
- package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/PhotoGalleryItem/index.js +17 -8
- package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleChat/index.js +34 -22
- package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleOutput/index.js +5 -3
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +63 -0
- package/lib/esm/builtin/async/ai-runtime/{components/runtime/state/assistant.js → state/agent.js} +9 -9
- package/lib/esm/builtin/async/ai-runtime/{components/runtime/state → state}/runtime.js +5 -10
- package/lib/esm/builtin/async/ai-runtime/state/session.js +91 -88
- package/lib/types/builtin/async/ai-runtime/api/{assistant.d.ts → agent.d.ts} +4 -4
- package/lib/types/builtin/async/ai-runtime/api/session.d.ts +7 -13
- package/lib/types/builtin/async/ai-runtime/components/ActionButton.d.ts +1 -1
- package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/index.d.ts +1 -1
- package/lib/types/builtin/async/ai-runtime/components/{GlobalLoading.d.ts → GlobalLoading/index.d.ts} +1 -0
- package/lib/types/builtin/async/ai-runtime/components/Header/SimpleHeader.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/Layout/SimpleLayout.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/components/LoadingButton.d.ts +2 -1
- package/lib/types/builtin/async/ai-runtime/components/{RuntimeProvider.d.ts → RuntimeCommonProvider.d.ts} +1 -1
- package/lib/types/builtin/async/ai-runtime/components/ScrollView.d.ts +8 -59
- package/lib/types/builtin/async/ai-runtime/constants.d.ts +3 -0
- package/lib/types/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentAgent.d.ts +1 -1
- package/lib/types/builtin/async/ai-runtime/contexts/Runtime.d.ts +14 -0
- package/lib/types/builtin/async/ai-runtime/index.d.ts +13 -24
- package/lib/types/builtin/async/ai-runtime/runtime/ChatBotButton/index.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.d.ts +1 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/index.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/state/agent.d.ts +17 -0
- package/lib/types/builtin/async/ai-runtime/{components/runtime/state → state}/runtime.d.ts +2 -2
- package/lib/types/builtin/async/ai-runtime/state/session.d.ts +10 -18
- package/lib/types/builtin/async/react-scroll-to-bottom.d.ts +2 -2
- package/package.json +7 -7
- package/lib/cjs/builtin/async/ai-runtime/components/LoadingListItemButton.js +0 -49
- package/lib/cjs/builtin/async/ai-runtime/components/PoweredBy.js +0 -22
- package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +0 -92
- package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionListView.js +0 -197
- package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionView.js +0 -122
- package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentListView.js +0 -152
- package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentView.js +0 -135
- package/lib/cjs/builtin/async/ai-runtime/components/common/ChatBot.js +0 -104
- package/lib/cjs/builtin/async/ai-runtime/components/common/index.js +0 -12
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterForm.js +0 -89
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +0 -66
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormFields.js +0 -61
- package/lib/cjs/builtin/async/ai-runtime/components/form/QuestionField.js +0 -44
- package/lib/cjs/builtin/async/ai-runtime/components/form/SettingButton.js +0 -88
- package/lib/cjs/builtin/async/ai-runtime/components/lottie/index.js +0 -34
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageErrorView.js +0 -35
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageItemView.js +0 -177
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageListView.js +0 -48
- package/lib/cjs/builtin/async/ai-runtime/components/runtime/components/PhotoGallery/index.js +0 -121
- package/lib/cjs/builtin/async/ai-runtime/components/runtime/constants.js +0 -6
- package/lib/cjs/builtin/async/ai-runtime/components/runtime/state/session.js +0 -213
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +0 -133
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +0 -60
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +0 -59
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/index.js +0 -28
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +0 -138
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +0 -31
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/index.js +0 -54
- package/lib/cjs/builtin/async/ai-runtime/components/session/CheckSession.js +0 -74
- package/lib/cjs/builtin/async/ai-runtime/components/session/SessionListView.js +0 -88
- package/lib/cjs/builtin/async/ai-runtime/hooks/auth.js +0 -31
- package/lib/cjs/builtin/async/ai-runtime/hooks/header.js +0 -69
- package/lib/cjs/builtin/async/ai-runtime/hooks/navigate.js +0 -38
- package/lib/cjs/builtin/async/ai-runtime/hooks/subscribe.js +0 -37
- package/lib/cjs/builtin/async/ai-runtime/hooks/useAsync.js +0 -32
- package/lib/cjs/builtin/async/ai-runtime/state/assistant.js +0 -59
- package/lib/cjs/builtin/async/ai-runtime/state/index.js +0 -423
- package/lib/cjs/builtin/async/ai-runtime/state/subscription.js +0 -52
- package/lib/cjs/builtin/async/ai-runtime/utils.js +0 -49
- package/lib/esm/builtin/async/ai-runtime/components/LoadingListItemButton.js +0 -46
- package/lib/esm/builtin/async/ai-runtime/components/PoweredBy.js +0 -19
- package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +0 -92
- package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionListView.js +0 -197
- package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionView.js +0 -122
- package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentListView.js +0 -152
- package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentView.js +0 -135
- package/lib/esm/builtin/async/ai-runtime/components/common/ChatBot.js +0 -98
- package/lib/esm/builtin/async/ai-runtime/components/common/index.js +0 -3
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterForm.js +0 -60
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +0 -59
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormFields.js +0 -54
- package/lib/esm/builtin/async/ai-runtime/components/form/QuestionField.js +0 -38
- package/lib/esm/builtin/async/ai-runtime/components/form/SettingButton.js +0 -82
- package/lib/esm/builtin/async/ai-runtime/components/lottie/index.js +0 -8
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageErrorView.js +0 -29
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageItemView.js +0 -146
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageListView.js +0 -42
- package/lib/esm/builtin/async/ai-runtime/components/runtime/components/PhotoGallery/index.js +0 -92
- package/lib/esm/builtin/async/ai-runtime/components/runtime/components/SimplePage/index.js +0 -50
- package/lib/esm/builtin/async/ai-runtime/components/runtime/constants.js +0 -3
- package/lib/esm/builtin/async/ai-runtime/components/runtime/state/session.js +0 -209
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +0 -102
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +0 -34
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +0 -53
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/index.js +0 -22
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +0 -132
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.js +0 -30
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +0 -25
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/index.js +0 -48
- package/lib/esm/builtin/async/ai-runtime/components/session/CheckSession.js +0 -68
- package/lib/esm/builtin/async/ai-runtime/components/session/SessionListView.js +0 -88
- package/lib/esm/builtin/async/ai-runtime/hooks/auth.js +0 -27
- package/lib/esm/builtin/async/ai-runtime/hooks/header.js +0 -62
- package/lib/esm/builtin/async/ai-runtime/hooks/navigate.js +0 -32
- package/lib/esm/builtin/async/ai-runtime/hooks/subscribe.js +0 -33
- package/lib/esm/builtin/async/ai-runtime/hooks/useAsync.js +0 -29
- package/lib/esm/builtin/async/ai-runtime/state/assistant.js +0 -54
- package/lib/esm/builtin/async/ai-runtime/state/index.js +0 -423
- package/lib/esm/builtin/async/ai-runtime/state/subscription.js +0 -47
- package/lib/esm/builtin/async/ai-runtime/utils.js +0 -42
- package/lib/types/builtin/async/ai-runtime/components/LoadingListItemButton.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/PoweredBy.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/components/collection/CollectionEditDialog.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/CollectionListView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/CollectionView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/DocumentListView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/DocumentView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/common/ChatBot.d.ts +0 -13
- package/lib/types/builtin/async/ai-runtime/components/common/index.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/components/form/ParameterForm.d.ts +0 -13
- package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormDialog.d.ts +0 -28
- package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormFields.d.ts +0 -11
- package/lib/types/builtin/async/ai-runtime/components/form/QuestionField.d.ts +0 -14
- package/lib/types/builtin/async/ai-runtime/components/form/SettingButton.d.ts +0 -9
- package/lib/types/builtin/async/ai-runtime/components/lottie/index.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/components/message/MessageErrorView.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/message/MessageItemView.d.ts +0 -15
- package/lib/types/builtin/async/ai-runtime/components/message/MessageListView.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/components/runtime/components/PhotoGallery/index.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/runtime/components/PhotoGalleryItem/index.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/components/runtime/components/SimpleChat/index.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/components/runtime/constants.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/components/runtime/state/assistant.d.ts +0 -17
- package/lib/types/builtin/async/ai-runtime/components/runtime/state/session.d.ts +0 -29
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/InitialForm.d.ts +0 -10
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.d.ts +0 -6
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/index.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/index.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/components/session/CheckSession.d.ts +0 -8
- package/lib/types/builtin/async/ai-runtime/components/session/SessionListView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/hooks/auth.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/hooks/header.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/hooks/navigate.d.ts +0 -25
- package/lib/types/builtin/async/ai-runtime/hooks/subscribe.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/hooks/useAsync.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/state/assistant.d.ts +0 -15
- package/lib/types/builtin/async/ai-runtime/state/index.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/state/subscription.d.ts +0 -15
- package/lib/types/builtin/async/ai-runtime/utils.d.ts +0 -20
- /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/LanguageField.js +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/NumberField.js +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/RadioField.js +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/SelectField.js +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/StringField.js +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/{state/loading.js → components/GlobalLoading/state.js} +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentMessage.js +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageSuggestedQuestions.js +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/ReferenceLinks.js +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/index.js +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/{components/runtime/utils → utils}/map-right.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/LanguageField.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/NumberField.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/RadioField.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/SelectField.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/StringField.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/{state/loading.js → components/GlobalLoading/state.js} +0 -0
- /package/lib/esm/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentMessage.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageSuggestedQuestions.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/ReferenceLinks.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/index.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/{components/runtime/utils → utils}/map-right.js +0 -0
- /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/LanguageField.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/NumberField.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/RadioField.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/SelectField.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/StringField.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{state/loading.d.ts → components/GlobalLoading/state.d.ts} +0 -0
- /package/lib/types/builtin/async/ai-runtime/components/{common/UserInfo.d.ts → UserInfo.d.ts} +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentMessage.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/runtime → runtime/Runtime}/index.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/AutoForm/index.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/MessageActions.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageErrorView.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageItemView.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageMetadataRenderer.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageSuggestedQuestions.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/ReferenceLinks.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/index.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleOutput/index.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimplePage/index.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/runtime/utils → utils}/map-right.d.ts +0 -0
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Stack } from '@mui/material';
|
|
3
|
-
import
|
|
4
|
-
import MarkdownRenderer from '../../../MarkdownRenderer';
|
|
3
|
+
import MarkdownRenderer from '../../components/MarkdownRenderer';
|
|
5
4
|
import { useCurrentMessage } from '../../contexts/CurrentMessage';
|
|
5
|
+
import MessageErrorView from '../ChatOutput/MessageErrorView';
|
|
6
|
+
import MessageMetadataRenderer from '../ChatOutput/MessageMetadataRenderer';
|
|
6
7
|
export default function SimpleOutput() {
|
|
7
8
|
var _a, _b;
|
|
8
9
|
const { message } = useCurrentMessage();
|
|
9
10
|
const objects = (_a = message.result) === null || _a === void 0 ? void 0 : _a.objects;
|
|
10
|
-
|
|
11
|
+
const { error } = message;
|
|
12
|
+
return (_jsxs(Stack, { gap: 2, boxShadow: 1, borderRadius: 1, p: 2, children: [_jsx(MarkdownRenderer, { children: (_b = message.result) === null || _b === void 0 ? void 0 : _b.content }), error && _jsx(MessageErrorView, { error: error }), objects === null || objects === void 0 ? void 0 : objects.map((item) => _jsx(MessageMetadataRenderer, { object: item.data }))] }));
|
|
11
13
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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 { Stack, ThemeProvider, Typography, createTheme, useTheme } from '@mui/material';
|
|
14
|
+
import { Suspense, useMemo } from 'react';
|
|
15
|
+
import Balancer from 'react-wrap-balancer';
|
|
16
|
+
import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
|
|
17
|
+
import SimpleHeader from '../../components/Header/SimpleHeader';
|
|
18
|
+
import SimpleLayout from '../../components/Layout/SimpleLayout';
|
|
19
|
+
import CurrentAgentProvider, { useCurrentAgent } from '../../contexts/CurrentAgent';
|
|
20
|
+
import CurrentMessageProvider from '../../contexts/CurrentMessage';
|
|
21
|
+
import { useRuntimeState } from '../../state/runtime';
|
|
22
|
+
export default function SimplePage({ resultTitle, primaryColor }) {
|
|
23
|
+
const { childAgentId } = useRuntimeState();
|
|
24
|
+
const inheritedTheme = useTheme();
|
|
25
|
+
const theme = useMemo(() => {
|
|
26
|
+
let { primary } = inheritedTheme.palette;
|
|
27
|
+
try {
|
|
28
|
+
if (primaryColor) {
|
|
29
|
+
primary = inheritedTheme.palette.augmentColor({ color: { main: primaryColor } });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
console.error('augment primary color error', { error });
|
|
34
|
+
}
|
|
35
|
+
return createTheme(inheritedTheme, {
|
|
36
|
+
palette: { primary },
|
|
37
|
+
shape: {
|
|
38
|
+
borderRadius: 8,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
}, [inheritedTheme, primaryColor]);
|
|
42
|
+
return (_jsx(ThemeProvider, { theme: theme, children: _jsxs(SimpleLayout, { children: [_jsx(SimpleHeader, {}), _jsx(CurrentAgentProvider, { agentId: childAgentId, children: _jsx(AgentInputRender, { className: "aigne-inputs aigne-simple-page-inputs" }) }), _jsx(OutputView, { className: "aigne-outputs aigne-simple-page-outputs", resultTitle: resultTitle })] }) }));
|
|
43
|
+
}
|
|
44
|
+
function AgentInputRender(_a) {
|
|
45
|
+
var props = __rest(_a, []);
|
|
46
|
+
const { appearanceInput } = useCurrentAgent();
|
|
47
|
+
if (!(appearanceInput === null || appearanceInput === void 0 ? void 0 : appearanceInput.componentId))
|
|
48
|
+
return null;
|
|
49
|
+
return (_jsx(Stack, Object.assign({}, props, { children: _jsx(CustomComponentRenderer, { componentId: appearanceInput.componentId, properties: appearanceInput.componentProps }) })));
|
|
50
|
+
}
|
|
51
|
+
function OutputView(_a) {
|
|
52
|
+
var _b;
|
|
53
|
+
var { resultTitle } = _a, props = __rest(_a, ["resultTitle"]);
|
|
54
|
+
const { sessionState } = useRuntimeState();
|
|
55
|
+
const lastMessage = (_b = sessionState.messages) === null || _b === void 0 ? void 0 : _b.slice(-1)[0];
|
|
56
|
+
return (_jsx(Stack, Object.assign({ gap: 2, mt: 4 }, props, { children: lastMessage && (_jsxs(_Fragment, { children: [resultTitle && (_jsx(Typography, { width: "100%", component: "h5", fontSize: 36, fontWeight: 700, textAlign: "center", children: _jsx(Balancer, { children: resultTitle }) })), _jsx(Stack, { children: _jsx(CurrentAgentProvider, { agentId: lastMessage.assistantId, children: _jsx(CurrentMessageProvider, { message: lastMessage, children: _jsx(Suspense, { children: _jsx(OutputItemView, {}) }) }) }) })] })) })));
|
|
57
|
+
}
|
|
58
|
+
function OutputItemView() {
|
|
59
|
+
const { appearanceOutput } = useCurrentAgent();
|
|
60
|
+
if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId))
|
|
61
|
+
return null;
|
|
62
|
+
return (_jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProps }));
|
|
63
|
+
}
|
package/lib/esm/builtin/async/ai-runtime/{components/runtime/state/assistant.js → state/agent.js}
RENAMED
|
@@ -9,21 +9,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { create } from 'zustand';
|
|
11
11
|
import { immer } from 'zustand/middleware/immer';
|
|
12
|
-
import {
|
|
12
|
+
import { getAgent } from '../api/agent';
|
|
13
13
|
const STATES = {};
|
|
14
|
-
export const
|
|
14
|
+
export const createAgentState = ({ aid, working, agent }) => {
|
|
15
15
|
var _a;
|
|
16
16
|
const key = working ? `${aid}-working` : aid;
|
|
17
17
|
(_a = STATES[key]) !== null && _a !== void 0 ? _a : (STATES[key] = create()(immer((set) => ({
|
|
18
|
-
|
|
18
|
+
agent,
|
|
19
19
|
load: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
20
|
set((state) => {
|
|
21
21
|
state.loading = true;
|
|
22
22
|
});
|
|
23
23
|
try {
|
|
24
|
-
const
|
|
24
|
+
const agent = yield getAgent({ aid, working });
|
|
25
25
|
set((state) => {
|
|
26
|
-
state.
|
|
26
|
+
state.agent = agent;
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
catch (error) {
|
|
@@ -42,15 +42,15 @@ export const createAssistantState = ({ aid, working, assistant, }) => {
|
|
|
42
42
|
return STATES[key];
|
|
43
43
|
};
|
|
44
44
|
const LOADING_TASKS = {};
|
|
45
|
-
export function
|
|
45
|
+
export function useAgentState({ aid, working }) {
|
|
46
46
|
var _a;
|
|
47
|
-
const state =
|
|
48
|
-
if (!state.
|
|
47
|
+
const state = createAgentState({ aid, working })();
|
|
48
|
+
if (!state.agent) {
|
|
49
49
|
if (state.error)
|
|
50
50
|
throw state.error;
|
|
51
51
|
const key = working ? `${aid}-working` : aid;
|
|
52
52
|
(_a = LOADING_TASKS[key]) !== null && _a !== void 0 ? _a : (LOADING_TASKS[key] = state.load());
|
|
53
53
|
throw LOADING_TASKS[key];
|
|
54
54
|
}
|
|
55
|
-
return [state.
|
|
55
|
+
return [state.agent, state];
|
|
56
56
|
}
|
|
@@ -9,19 +9,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { RuntimeOutputVariable } from '@blocklet/ai-runtime/types';
|
|
11
11
|
import { useCallback, useEffect, useMemo } from 'react';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { useAssistantState } from './assistant';
|
|
12
|
+
import { useSessionContext } from '../../../session';
|
|
13
|
+
import { useRuntimeContext } from '../contexts/Runtime';
|
|
14
|
+
import { useAgentState } from './agent';
|
|
16
15
|
import { createSessionState } from './session';
|
|
17
16
|
export function useRuntimeState() {
|
|
18
17
|
var _a;
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
if (!aid)
|
|
22
|
-
throw new CustomError(404, 'Missing required query parameters `aid`');
|
|
23
|
-
const working = query.get('working') === 'true';
|
|
24
|
-
const [agent] = useAssistantState({ aid, working });
|
|
18
|
+
const { aid, working } = useRuntimeContext();
|
|
19
|
+
const [agent] = useAgentState({ aid, working });
|
|
25
20
|
const sessionState = createSessionState({ aid })();
|
|
26
21
|
const { session: authSession } = useSessionContext();
|
|
27
22
|
// reset state after logged out
|
|
@@ -14,36 +14,46 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
|
14
14
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
15
15
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
16
16
|
};
|
|
17
|
-
import {
|
|
18
|
-
import pick from 'lodash/pick';
|
|
17
|
+
import { parseIdentity } from '@blocklet/ai-runtime/common/aid';
|
|
19
18
|
import { create } from 'zustand';
|
|
20
19
|
import { immer } from 'zustand/middleware/immer';
|
|
21
20
|
import { getMessages } from '../api/message';
|
|
22
|
-
import {
|
|
23
|
-
import { deepMerge, parseIdentity } from '../utils';
|
|
21
|
+
import { createSession, getSessions, runAgent } from '../api/session';
|
|
24
22
|
const STATES = {};
|
|
25
|
-
|
|
23
|
+
const GET_MESSAGES_LIMIT = 100;
|
|
24
|
+
const GET_MESSAGES_ORDER_DIRECTION = 'desc';
|
|
25
|
+
export const createSessionState = ({ aid }) => {
|
|
26
26
|
var _a;
|
|
27
|
-
(_a = STATES[
|
|
28
|
-
|
|
29
|
-
updateSession: (_b) => __awaiter(void 0, [_b], void 0, function* ({ parameters }) {
|
|
30
|
-
const { updated } = yield updateSession({ sessionId, parameters });
|
|
27
|
+
(_a = STATES[aid]) !== null && _a !== void 0 ? _a : (STATES[aid] = create()(immer((set, get) => ({
|
|
28
|
+
reset: () => {
|
|
31
29
|
set((state) => {
|
|
32
|
-
state.
|
|
30
|
+
state.loading = undefined;
|
|
31
|
+
state.loaded = undefined;
|
|
32
|
+
state.running = undefined;
|
|
33
|
+
state.session = undefined;
|
|
34
|
+
state.messages = undefined;
|
|
35
|
+
state.noMoreMessage = undefined;
|
|
36
|
+
state.messageLoading = undefined;
|
|
37
|
+
state.error = undefined;
|
|
33
38
|
});
|
|
34
|
-
}
|
|
39
|
+
},
|
|
35
40
|
load: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
var _b;
|
|
36
42
|
set((state) => {
|
|
37
43
|
state.loading = true;
|
|
38
44
|
});
|
|
39
45
|
try {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
const { sessions } = yield getSessions({ aid });
|
|
47
|
+
const session = (_b = sessions[0]) !== null && _b !== void 0 ? _b : (yield createSession({ aid })).created;
|
|
48
|
+
const { messages } = yield getMessages({
|
|
49
|
+
sessionId: session.id,
|
|
50
|
+
orderDirection: GET_MESSAGES_ORDER_DIRECTION,
|
|
51
|
+
limit: GET_MESSAGES_LIMIT,
|
|
52
|
+
});
|
|
44
53
|
set((state) => {
|
|
45
54
|
state.session = session;
|
|
46
|
-
state.messages = messages;
|
|
55
|
+
state.messages = messages.toReversed();
|
|
56
|
+
state.noMoreMessage = messages.length < GET_MESSAGES_LIMIT;
|
|
47
57
|
});
|
|
48
58
|
}
|
|
49
59
|
catch (error) {
|
|
@@ -54,37 +64,67 @@ export const createSessionState = ({ sessionId, session }) => {
|
|
|
54
64
|
}
|
|
55
65
|
finally {
|
|
56
66
|
set((state) => {
|
|
67
|
+
state.loaded = true;
|
|
57
68
|
state.loading = false;
|
|
58
69
|
});
|
|
59
70
|
}
|
|
60
71
|
}),
|
|
61
|
-
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
loadMoreMessages: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
+
var _c;
|
|
74
|
+
set((state) => {
|
|
75
|
+
state.messageLoading = true;
|
|
76
|
+
});
|
|
77
|
+
const { session, messages } = get();
|
|
78
|
+
if (!session)
|
|
79
|
+
return;
|
|
80
|
+
try {
|
|
81
|
+
const result = yield getMessages({
|
|
82
|
+
sessionId: session.id,
|
|
83
|
+
before: (_c = messages === null || messages === void 0 ? void 0 : messages.slice(-1)[0]) === null || _c === void 0 ? void 0 : _c.id,
|
|
84
|
+
orderDirection: GET_MESSAGES_ORDER_DIRECTION,
|
|
85
|
+
limit: GET_MESSAGES_LIMIT,
|
|
86
|
+
});
|
|
87
|
+
set((state) => {
|
|
88
|
+
var _a;
|
|
89
|
+
state.messages = ((_a = state.messages) !== null && _a !== void 0 ? _a : []).concat(result.messages.toReversed());
|
|
90
|
+
state.noMoreMessage = result.messages.length < GET_MESSAGES_LIMIT;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
finally {
|
|
94
|
+
set((state) => {
|
|
95
|
+
state.messageLoading = false;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}),
|
|
99
|
+
execute: (_d) => __awaiter(void 0, [_d], void 0, function* ({ aid, working, parameters, onResponseStart, }) {
|
|
100
|
+
var _e, e_1, _f, _g;
|
|
101
|
+
let { session } = get();
|
|
102
|
+
if (!session) {
|
|
103
|
+
yield get().load();
|
|
104
|
+
session = get().session;
|
|
105
|
+
}
|
|
106
|
+
if (!session)
|
|
107
|
+
throw new Error('This session is not initialized');
|
|
108
|
+
const { id: sessionId } = session;
|
|
109
|
+
const identity = parseIdentity(aid, { rejectWhenError: true });
|
|
65
110
|
let message;
|
|
66
|
-
const childMessages = [];
|
|
67
|
-
const childMessagesMap = {};
|
|
68
111
|
set((state) => {
|
|
69
112
|
state.running = true;
|
|
70
113
|
state.error = undefined;
|
|
71
114
|
});
|
|
72
|
-
let realParameters = Object.assign(Object.assign({}, parameters), { $clientTime: new Date().toISOString() });
|
|
73
|
-
if (includeSessionParameters) {
|
|
74
|
-
realParameters = Object.assign(Object.assign({}, (_g = get().session) === null || _g === void 0 ? void 0 : _g.parameters), parameters);
|
|
75
|
-
}
|
|
76
115
|
try {
|
|
77
|
-
const stream =
|
|
116
|
+
const stream = runAgent({
|
|
117
|
+
aid,
|
|
78
118
|
sessionId,
|
|
79
|
-
|
|
80
|
-
parameters:
|
|
119
|
+
working,
|
|
120
|
+
parameters: Object.assign(Object.assign({}, parameters), { $clientTime: new Date().toISOString() }),
|
|
81
121
|
});
|
|
82
122
|
let responseStarted = false;
|
|
83
123
|
try {
|
|
84
|
-
for (var
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const value =
|
|
124
|
+
for (var _h = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield stream_1.next(), _e = stream_1_1.done, !_e; _h = true) {
|
|
125
|
+
_g = stream_1_1.value;
|
|
126
|
+
_h = false;
|
|
127
|
+
const value = _g;
|
|
88
128
|
if (!responseStarted) {
|
|
89
129
|
responseStarted = true;
|
|
90
130
|
onResponseStart === null || onResponseStart === void 0 ? void 0 : onResponseStart();
|
|
@@ -93,8 +133,8 @@ export const createSessionState = ({ sessionId, session }) => {
|
|
|
93
133
|
if (!message) {
|
|
94
134
|
message = {
|
|
95
135
|
taskId: value.taskId,
|
|
96
|
-
sessionId,
|
|
97
136
|
assistantId: identity.assistantId,
|
|
137
|
+
sessionId,
|
|
98
138
|
parameters,
|
|
99
139
|
createdAt: new Date().toISOString(),
|
|
100
140
|
updatedAt: new Date().toISOString(),
|
|
@@ -107,49 +147,23 @@ export const createSessionState = ({ sessionId, session }) => {
|
|
|
107
147
|
});
|
|
108
148
|
}
|
|
109
149
|
if (message.taskId === value.taskId) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
(_f = (_h = msg.result).objects) !== null && _f !== void 0 ? _f : (_h.objects = []);
|
|
123
|
-
msg.result.objects.push({ taskId: value.taskId, data: value.delta.object });
|
|
150
|
+
requestAnimationFrame(() => {
|
|
151
|
+
set((state) => {
|
|
152
|
+
var _a, _b, _c, _d, _e, _f;
|
|
153
|
+
var _g;
|
|
154
|
+
const msg = (_a = state.messages) === null || _a === void 0 ? void 0 : _a.findLast((i) => i.taskId === message.taskId);
|
|
155
|
+
if (!msg)
|
|
156
|
+
return;
|
|
157
|
+
(_b = msg.result) !== null && _b !== void 0 ? _b : (msg.result = {});
|
|
158
|
+
msg.result.content = (msg.result.content || '') + (value.delta.content || '');
|
|
159
|
+
if ((_d = (_c = value.delta) === null || _c === void 0 ? void 0 : _c.images) === null || _d === void 0 ? void 0 : _d.length) {
|
|
160
|
+
msg.result.images = ((_e = msg.result.images) !== null && _e !== void 0 ? _e : []).concat(value.delta.images);
|
|
161
|
+
}
|
|
124
162
|
if (value.delta.object) {
|
|
125
|
-
(_g =
|
|
126
|
-
|
|
163
|
+
(_f = (_g = msg.result).objects) !== null && _f !== void 0 ? _f : (_g.objects = []);
|
|
164
|
+
msg.result.objects.push({ taskId: value.taskId, data: value.delta.object });
|
|
127
165
|
}
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
else if (value.respondAs && value.respondAs !== 'none') {
|
|
132
|
-
let childMessage = childMessagesMap[value.taskId];
|
|
133
|
-
if (!childMessage) {
|
|
134
|
-
childMessage = {
|
|
135
|
-
taskId: value.taskId,
|
|
136
|
-
respondAs: value.respondAs,
|
|
137
|
-
};
|
|
138
|
-
childMessagesMap[value.taskId] = childMessage;
|
|
139
|
-
childMessages.push(childMessage);
|
|
140
|
-
}
|
|
141
|
-
(_h = childMessage.result) !== null && _h !== void 0 ? _h : (childMessage.result = {});
|
|
142
|
-
childMessage.result.content = (childMessage.result.content || '') + (value.delta.content || '');
|
|
143
|
-
if ((_k = (_j = value.delta) === null || _j === void 0 ? void 0 : _j.images) === null || _k === void 0 ? void 0 : _k.length) {
|
|
144
|
-
childMessage.result.images = ((_l = childMessage.result.images) !== null && _l !== void 0 ? _l : []).concat(value.delta.images);
|
|
145
|
-
}
|
|
146
|
-
set((state) => {
|
|
147
|
-
var _a, _b;
|
|
148
|
-
const msg = (_a = state.messages) === null || _a === void 0 ? void 0 : _a.findLast((i) => i.taskId === message.taskId);
|
|
149
|
-
if (!msg)
|
|
150
|
-
return;
|
|
151
|
-
(_b = msg.result) !== null && _b !== void 0 ? _b : (msg.result = {});
|
|
152
|
-
msg.result.messages = JSON.parse(JSON.stringify(childMessages));
|
|
166
|
+
});
|
|
153
167
|
});
|
|
154
168
|
}
|
|
155
169
|
}
|
|
@@ -168,7 +182,7 @@ export const createSessionState = ({ sessionId, session }) => {
|
|
|
168
182
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
169
183
|
finally {
|
|
170
184
|
try {
|
|
171
|
-
if (!
|
|
185
|
+
if (!_h && !_e && (_f = stream_1.return)) yield _f.call(stream_1);
|
|
172
186
|
}
|
|
173
187
|
finally { if (e_1) throw e_1.error; }
|
|
174
188
|
}
|
|
@@ -191,16 +205,5 @@ export const createSessionState = ({ sessionId, session }) => {
|
|
|
191
205
|
}
|
|
192
206
|
}),
|
|
193
207
|
}))));
|
|
194
|
-
return STATES[
|
|
208
|
+
return STATES[aid];
|
|
195
209
|
};
|
|
196
|
-
const LOADING_TASKS = {};
|
|
197
|
-
export function useSessionState({ sessionId, required }) {
|
|
198
|
-
var _a;
|
|
199
|
-
const state = createSessionState({ sessionId })();
|
|
200
|
-
if (!state.session) {
|
|
201
|
-
(_a = LOADING_TASKS[sessionId]) !== null && _a !== void 0 ? _a : (LOADING_TASKS[sessionId] = state.load());
|
|
202
|
-
if (required)
|
|
203
|
-
throw LOADING_TASKS[sessionId];
|
|
204
|
-
}
|
|
205
|
-
return [state.session, state];
|
|
206
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AssistantBase, OutputVariable, Parameter } from '@blocklet/ai-runtime/types';
|
|
2
|
-
export interface
|
|
2
|
+
export interface Agent {
|
|
3
3
|
id: string;
|
|
4
4
|
name?: string;
|
|
5
5
|
description?: string;
|
|
@@ -15,7 +15,7 @@ export interface Assistant {
|
|
|
15
15
|
release?: AssistantBase['release'];
|
|
16
16
|
createdBy?: string;
|
|
17
17
|
}
|
|
18
|
-
export declare function
|
|
19
|
-
|
|
18
|
+
export declare function getAgent({ aid, working }: {
|
|
19
|
+
aid: string;
|
|
20
20
|
working?: boolean;
|
|
21
|
-
}): Promise<
|
|
21
|
+
}): Promise<Agent>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { RunAssistantResponse } from '@blocklet/ai-runtime/types';
|
|
2
|
-
import { Identity } from '../utils';
|
|
3
2
|
export interface Session {
|
|
4
3
|
id: string;
|
|
5
4
|
userId: string;
|
|
@@ -12,10 +11,8 @@ export interface Session {
|
|
|
12
11
|
title?: string;
|
|
13
12
|
};
|
|
14
13
|
}
|
|
15
|
-
export declare function getSessions({
|
|
16
|
-
|
|
17
|
-
projectRef: string;
|
|
18
|
-
assistantId: string;
|
|
14
|
+
export declare function getSessions({ aid }: {
|
|
15
|
+
aid: string;
|
|
19
16
|
}): Promise<{
|
|
20
17
|
sessions: Session[];
|
|
21
18
|
}>;
|
|
@@ -24,19 +21,16 @@ export declare function getSession({ sessionId }: {
|
|
|
24
21
|
}): Promise<{
|
|
25
22
|
session: Session;
|
|
26
23
|
}>;
|
|
27
|
-
export declare function createSession({
|
|
28
|
-
|
|
24
|
+
export declare function createSession({ aid, name, }: {
|
|
25
|
+
aid: string;
|
|
29
26
|
name?: string;
|
|
30
|
-
parameters?: any;
|
|
31
|
-
entry?: any;
|
|
32
27
|
}): Promise<{
|
|
33
28
|
created: Session;
|
|
34
29
|
sessions: Session[];
|
|
35
30
|
}>;
|
|
36
|
-
export declare function updateSession({ sessionId, name,
|
|
31
|
+
export declare function updateSession({ sessionId, name, }: {
|
|
37
32
|
sessionId: string;
|
|
38
33
|
name?: string;
|
|
39
|
-
parameters?: any;
|
|
40
34
|
}): Promise<{
|
|
41
35
|
updated: Session;
|
|
42
36
|
sessions: Session[];
|
|
@@ -47,9 +41,9 @@ export declare function deleteSession({ sessionId, }: {
|
|
|
47
41
|
deleted: Session;
|
|
48
42
|
sessions: Session[];
|
|
49
43
|
}>;
|
|
50
|
-
export declare function
|
|
44
|
+
export declare function runAgent({ aid, sessionId, working, parameters, }: {
|
|
45
|
+
aid: string;
|
|
51
46
|
sessionId: string;
|
|
52
|
-
identity: Identity;
|
|
53
47
|
working?: boolean;
|
|
54
48
|
parameters: any;
|
|
55
49
|
}): AsyncGenerator<RunAssistantResponse, void, unknown>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LoadingButtonProps } from '@mui/lab';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
export
|
|
3
|
+
export default function ActionButton({ tip, tipSucceed, title, titleSucceed, icon, iconSucceed, autoReset, placement, ...props }: {
|
|
4
4
|
tip?: ReactNode;
|
|
5
5
|
tipSucceed?: ReactNode;
|
|
6
6
|
title?: ReactNode;
|
package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/index.d.ts
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Parameter } from '@blocklet/ai-runtime/types';
|
|
2
2
|
import { TextFieldProps } from '@mui/material';
|
|
3
|
-
export default function
|
|
3
|
+
export default function AgentInputField({ parameter, ...props }: {
|
|
4
4
|
readOnly?: boolean;
|
|
5
5
|
parameter: Parameter;
|
|
6
6
|
onChange: (value: string | number | undefined) => void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { StackProps, TypographyProps } from '@mui/material';
|
|
2
|
+
export default function SimpleHeader({ TitleProps, DescriptionProps, ...props }: {
|
|
3
|
+
TitleProps?: TypographyProps;
|
|
4
|
+
DescriptionProps?: TypographyProps;
|
|
5
|
+
} & StackProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { LoadingButtonProps } from '@mui/lab';
|
|
3
|
+
declare const LoadingButton: import("react").ForwardRefExoticComponent<Omit<Partial<LoadingButtonProps>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
3
4
|
export default LoadingButton;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
export default function
|
|
2
|
+
export default function RuntimeCommonProvider({ children }: {
|
|
3
3
|
children?: ReactNode;
|
|
4
4
|
}): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export declare function RuntimeLocaleProvider({ children }: {
|
|
@@ -1,61 +1,10 @@
|
|
|
1
1
|
import { BoxProps } from '@mui/material';
|
|
2
2
|
import { ComponentProps } from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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;
|
|
3
|
+
import * as scrollToBottom from 'react-scroll-to-bottom';
|
|
4
|
+
declare const Composer: typeof scrollToBottom.default;
|
|
5
|
+
export default function ScrollView({ disabled, children, scroll, component, initialScrollBehavior, ...props }: BoxProps & {
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
scroll?: 'window';
|
|
8
|
+
initialScrollBehavior?: ComponentProps<typeof Composer>['initialScrollBehavior'];
|
|
9
|
+
}): string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
10
|
+
export {};
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export declare const AI_STUDIO_DID = "z8iZpog7mcgcgBZzTiXJCWESvmnRrQmnd3XBB";
|
|
2
2
|
export declare const PAYMENT_KIT_DID = "z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk";
|
|
3
|
+
export declare const DEFAULT_PAGE_COMPONENT_ID = "ctnxha29uu8cx4xv";
|
|
4
|
+
export declare const DEFAULT_INPUT_COMPONENT_ID = "1wwtemqcdio6nqf0";
|
|
5
|
+
export declare const DEFAULT_OUTPUT_COMPONENT_ID = "q0ckknkxph4hfwas";
|
|
@@ -8,7 +8,7 @@ export default function CurrentAgentProvider({ agentId, children }: {
|
|
|
8
8
|
children?: ReactNode;
|
|
9
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export declare function useCurrentAgent(): {
|
|
11
|
-
agent: import("
|
|
11
|
+
agent: import("../api/agent").Agent;
|
|
12
12
|
appearanceInput: RuntimeOutputAppearance;
|
|
13
13
|
appearanceOutput: RuntimeOutputAppearance;
|
|
14
14
|
aid: string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface RuntimeContext {
|
|
3
|
+
aid: string;
|
|
4
|
+
working?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function useRuntimeContext(): RuntimeContext;
|
|
7
|
+
export default function RuntimeProvider({ aid, working, children, }: {
|
|
8
|
+
aid: string;
|
|
9
|
+
working?: boolean;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function RuntimeProviderFromUrl({ children }: {
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}): import("react/jsx-runtime").JSX.Element;
|