@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
|
@@ -16,7 +16,6 @@ import { useCallback } from 'react';
|
|
|
16
16
|
import { FacebookIcon, FacebookShareButton, LinkedinIcon, LinkedinShareButton, RedditIcon, RedditShareButton, TelegramIcon, TelegramShareButton, WeiboIcon, WeiboShareButton, XIcon, TwitterShareButton as XShareButton, } from 'react-share';
|
|
17
17
|
import { LocaleProvider, useLocaleContext } from '../../../locale';
|
|
18
18
|
import { translations } from '../locales';
|
|
19
|
-
import { mergeSx } from '../utils';
|
|
20
19
|
import MenuButton from './MenuButton';
|
|
21
20
|
const getFormattedUrl = (url) => {
|
|
22
21
|
// remove page & sessionId query params
|
|
@@ -80,8 +79,14 @@ export function SocialShareMenu(_a) {
|
|
|
80
79
|
}
|
|
81
80
|
export function SocialShareButtons(_a) {
|
|
82
81
|
var { url = getFormattedUrl(window.location.href), content, sx, itemSx, onClick, bgFill, iconFill } = _a, rest = __rest(_a, ["url", "content", "sx", "itemSx", "onClick", "bgFill", "iconFill"]);
|
|
83
|
-
const mergedSx =
|
|
84
|
-
|
|
82
|
+
const mergedSx = [
|
|
83
|
+
{ display: 'flex', alignItems: 'center', gap: 0.5, lineHeight: 1 },
|
|
84
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
85
|
+
];
|
|
86
|
+
const mergedItemSx = [
|
|
87
|
+
{ width: { xs: 24, sm: 28 }, height: { xs: 24, sm: 28 }, borderRadius: 1 },
|
|
88
|
+
...(Array.isArray(itemSx) ? itemSx : [itemSx]),
|
|
89
|
+
];
|
|
85
90
|
const iconProps = {
|
|
86
91
|
bgStyle: { fill: bgFill || '#bbb' },
|
|
87
92
|
iconFillColor: iconFill || '#fff',
|
|
@@ -96,27 +96,6 @@ export default function ThemeProvider({ children, template, transparentHeaderBg,
|
|
|
96
96
|
},
|
|
97
97
|
],
|
|
98
98
|
},
|
|
99
|
-
MuiDialog: {
|
|
100
|
-
variants: [
|
|
101
|
-
{
|
|
102
|
-
props: {},
|
|
103
|
-
style: ({ theme }) => theme.unstable_sx({
|
|
104
|
-
'.MuiDialogTitle-root': {
|
|
105
|
-
px: 2.5,
|
|
106
|
-
py: 2,
|
|
107
|
-
},
|
|
108
|
-
'.MuiDialogContent-root': {
|
|
109
|
-
px: 2.5,
|
|
110
|
-
py: 2,
|
|
111
|
-
},
|
|
112
|
-
'.MuiDialogActions-root': {
|
|
113
|
-
px: 2.5,
|
|
114
|
-
py: 2,
|
|
115
|
-
},
|
|
116
|
-
}),
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
},
|
|
120
99
|
},
|
|
121
100
|
};
|
|
122
101
|
const paletteTheme = createTheme({
|
|
@@ -14,7 +14,7 @@ import DID from '@arcblock/ux/lib/DID';
|
|
|
14
14
|
import { Box, Stack, Typography } from '@mui/material';
|
|
15
15
|
import dayjs from 'dayjs';
|
|
16
16
|
import { useMemo } from 'react';
|
|
17
|
-
import { Avatar } from '
|
|
17
|
+
import { Avatar } from '../../../arcblock/ux';
|
|
18
18
|
export default function UserInfo(_a) {
|
|
19
19
|
var { avatar, showDID, did, name, time, children, reverse } = _a, restProps = __rest(_a, ["avatar", "showDID", "did", "name", "time", "children", "reverse"]);
|
|
20
20
|
return (_jsxs(Stack, Object.assign({ className: "user-info", alignItems: "center", direction: reverse ? 'row-reverse' : 'row', gap: 1.5 }, restProps, { children: [(avatar || did) && (_jsx(Box, { sx: {
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export const AI_STUDIO_DID = 'z8iZpog7mcgcgBZzTiXJCWESvmnRrQmnd3XBB';
|
|
2
2
|
export const PAYMENT_KIT_DID = 'z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk';
|
|
3
|
+
export const DEFAULT_PAGE_COMPONENT_ID = 'ctnxha29uu8cx4xv';
|
|
4
|
+
export const DEFAULT_INPUT_COMPONENT_ID = '1wwtemqcdio6nqf0';
|
|
5
|
+
export const DEFAULT_OUTPUT_COMPONENT_ID = 'q0ckknkxph4hfwas';
|
package/lib/esm/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentAgent.js
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { parseIdentity, stringifyIdentity } from '@blocklet/ai-runtime/common/aid';
|
|
2
3
|
import { RuntimeOutputVariable } from '@blocklet/ai-runtime/types';
|
|
3
4
|
import { createContext, useContext, useMemo } from 'react';
|
|
4
|
-
import { parseIdentity, stringifyIdentity } from '../../../utils';
|
|
5
5
|
import { DEFAULT_INPUT_COMPONENT_ID, DEFAULT_OUTPUT_COMPONENT_ID } from '../constants';
|
|
6
|
-
import {
|
|
6
|
+
import { useAgentState } from '../state/agent';
|
|
7
7
|
import { useRuntimeState } from '../state/runtime';
|
|
8
8
|
const context = createContext(undefined);
|
|
9
9
|
export default function CurrentAgentProvider({ agentId, children }) {
|
|
@@ -19,7 +19,7 @@ export function useCurrentAgent() {
|
|
|
19
19
|
if (!current) {
|
|
20
20
|
throw new Error('No such current agent state. You should use `useCurrentAgent` within the `CurrentAgentProvider`');
|
|
21
21
|
}
|
|
22
|
-
const [agent] =
|
|
22
|
+
const [agent] = useAgentState({ aid: current.aid, working });
|
|
23
23
|
const appearanceInput = useMemo(() => {
|
|
24
24
|
var _a, _b, _c;
|
|
25
25
|
return (_c = (_b = (_a = agent.outputVariables) === null || _a === void 0 ? void 0 : _a.find((i) => i.name === RuntimeOutputVariable.appearanceInput)) === null || _b === void 0 ? void 0 : _b.initialValue) !== null && _c !== void 0 ? _c : { componentId: DEFAULT_INPUT_COMPONENT_ID };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useMemo } from 'react';
|
|
3
|
+
import { useSearchParams } from 'react-router-dom';
|
|
4
|
+
import { CustomError } from '../error';
|
|
5
|
+
const runtimeContext = createContext(undefined);
|
|
6
|
+
export function useRuntimeContext() {
|
|
7
|
+
const context = useContext(runtimeContext);
|
|
8
|
+
if (!context) {
|
|
9
|
+
throw new Error('No such runtime context. You should use `useRuntimeContext` within the `RuntimeProvider`');
|
|
10
|
+
}
|
|
11
|
+
return context;
|
|
12
|
+
}
|
|
13
|
+
export default function RuntimeProvider({ aid, working, children, }) {
|
|
14
|
+
if (!aid)
|
|
15
|
+
throw new Error('Missing required props `aid`');
|
|
16
|
+
const value = useMemo(() => ({ aid, working }), [aid, working]);
|
|
17
|
+
return _jsx(runtimeContext.Provider, { value: value, children: children });
|
|
18
|
+
}
|
|
19
|
+
export function RuntimeProviderFromUrl({ children }) {
|
|
20
|
+
const [query] = useSearchParams();
|
|
21
|
+
const aid = query.get('aid');
|
|
22
|
+
const working = query.get('working') === 'true';
|
|
23
|
+
if (!aid)
|
|
24
|
+
throw new CustomError(404, 'Missing required query parameters `aid`');
|
|
25
|
+
return (_jsx(RuntimeProvider, { aid: aid, working: working, children: children }));
|
|
26
|
+
}
|
|
@@ -1,58 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import { useAssistantState } from './state/assistant';
|
|
15
|
-
export * from './components/runtime/contexts/CurrentAgent';
|
|
16
|
-
export * from './components/runtime/contexts/CurrentMessage';
|
|
17
|
-
export * from './components/runtime/state/runtime';
|
|
18
|
-
export * from './components/runtime/state/session';
|
|
19
|
-
export { default as Runtime } from './components/runtime';
|
|
20
|
-
export { default as SimplePage } from './components/runtime/components/SimplePage';
|
|
21
|
-
export { default as SimpleChat } from './components/runtime/components/SimpleChat';
|
|
22
|
-
export { default as PhotoGallery } from './components/runtime/components/PhotoGallery';
|
|
23
|
-
export { default as AutoForm } from './components/runtime/components/AutoForm';
|
|
24
|
-
export { default as SimpleOutput } from './components/runtime/components/SimpleOutput';
|
|
25
|
-
export { default as ChatOutput } from './components/runtime/components/ChatOutput';
|
|
26
|
-
export { default as PhotoGalleryItem } from './components/runtime/components/PhotoGalleryItem';
|
|
27
|
-
export default function App(props) {
|
|
28
|
-
const cacheId = useId();
|
|
29
|
-
return (_jsx(RuntimeProvider, { children: _jsx(AIRuntime, Object.assign({}, props, { cacheId: cacheId })) }));
|
|
30
|
-
}
|
|
31
|
-
export function AIRuntime({ cacheId }) {
|
|
32
|
-
var _a;
|
|
33
|
-
const page = useCurrentPage();
|
|
34
|
-
const { assistantId } = page;
|
|
35
|
-
const [assistant] = useAssistantState({ assistantId });
|
|
36
|
-
useSetHeader({ assistant, assistantId });
|
|
37
|
-
return (_jsx(CheckSession, { cacheId: cacheId, page: page, children: _jsx(ScrollView, { scroller: "window", initialScrollBehavior: "auto", children: _jsx(Stack, { flexGrow: 1, height: "100%", className: "ai-runtime-root", children: ((_a = assistant.release) === null || _a === void 0 ? void 0 : _a.template) === 'form' ? _jsx(RuntimeForm, { page: page }) : _jsx(RuntimeChat, { page: page }) }) }) }));
|
|
38
|
-
}
|
|
39
|
-
export function ChatBot(props) {
|
|
40
|
-
if (!props.assistantId)
|
|
41
|
-
throw new Error('Missing required parameter assistantId');
|
|
42
|
-
const navigate = useCallback((page) => {
|
|
43
|
-
setPage((state) => (Object.assign(Object.assign({}, state), page)));
|
|
44
|
-
}, []);
|
|
45
|
-
const [page, setPage] = useState({
|
|
46
|
-
page: 'assistant',
|
|
47
|
-
assistantId: props.assistantId,
|
|
48
|
-
navigate,
|
|
49
|
-
});
|
|
50
|
-
const cacheId = useId();
|
|
51
|
-
return (_jsx(RuntimeProvider, { children: _jsx(ErrorBoundary, { FallbackComponent: ChatBotErrorView, children: _jsx(Suspense, { children: _jsx(ChatBotWrapper, Object.assign({}, props, { children: _jsx(CheckSession, { cacheId: cacheId, autoCreateSession: true, page: page, children: _jsx(RuntimeChat, { page: page }) }) })) }) }) }));
|
|
52
|
-
}
|
|
53
|
-
function ChatBotErrorView({ error }) {
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
Toast.error(error.message);
|
|
56
|
-
}, [error]);
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
1
|
+
export * from './contexts/CurrentAgent';
|
|
2
|
+
export * from './contexts/CurrentMessage';
|
|
3
|
+
export * from './state/runtime';
|
|
4
|
+
export * from './state/session';
|
|
5
|
+
export { default as Runtime } from './runtime/Runtime';
|
|
6
|
+
export { default as ChatBotButton } from './runtime/ChatBotButton';
|
|
7
|
+
export { default as SimplePage } from './runtime-components/SimplePage';
|
|
8
|
+
export { default as SimpleChat } from './runtime-components/SimpleChat';
|
|
9
|
+
export { default as PhotoGallery } from './runtime-components/PhotoGallery';
|
|
10
|
+
export { default as AutoForm } from './runtime-components/AutoForm';
|
|
11
|
+
export { default as SimpleOutput } from './runtime-components/SimpleOutput';
|
|
12
|
+
export { default as ChatOutput } from './runtime-components/ChatOutput';
|
|
13
|
+
export { default as PhotoGalleryItem } from './runtime-components/PhotoGalleryItem';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from '@iconify/react';
|
|
3
|
+
import { ArrowBackIosNewRounded } from '@mui/icons-material';
|
|
4
|
+
import { Box, Button, CircularProgress, ClickAwayListener, Dialog, DialogContent, DialogTitle, Fab, IconButton, Popper, Stack, Typography, useMediaQuery, useTheme, } from '@mui/material';
|
|
5
|
+
import { Suspense, useEffect, useRef, useState } from 'react';
|
|
6
|
+
import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
|
|
7
|
+
import { Avatar } from '../../../../arcblock/ux';
|
|
8
|
+
import RuntimeCommonProvider from '../../components/RuntimeCommonProvider';
|
|
9
|
+
import ScrollView from '../../components/ScrollView';
|
|
10
|
+
import { DEFAULT_PAGE_COMPONENT_ID } from '../../constants';
|
|
11
|
+
import RuntimeProvider from '../../contexts/Runtime';
|
|
12
|
+
import { useRuntimeState } from '../../state/runtime';
|
|
13
|
+
export default function ChatBotButton({ aid, working }) {
|
|
14
|
+
return (_jsx(RuntimeProvider, { aid: aid, working: working, children: _jsx(RuntimeCommonProvider, { children: _jsx(ChatBotContent, {}) }) }));
|
|
15
|
+
}
|
|
16
|
+
function ChatBotContent() {
|
|
17
|
+
var _a, _b, _c;
|
|
18
|
+
const anchorEl = useRef(null);
|
|
19
|
+
const { appearancePage, sessionState } = useRuntimeState();
|
|
20
|
+
const [open, setOpen] = useState(false);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
sessionState.load();
|
|
23
|
+
}, []);
|
|
24
|
+
const componentId = (_a = appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentId) !== null && _a !== void 0 ? _a : DEFAULT_PAGE_COMPONENT_ID;
|
|
25
|
+
return (_jsxs(Box, { sx: { position: 'fixed', bottom: 32, right: 16, zIndex: 'fab' }, children: [_jsx(Fab, { sx: { width: 44, height: 44, boxShadow: open ? 0 : undefined }, onClick: () => setOpen(true), children: _jsx(Avatar, { size: 44, did: (_b = globalThis.blocklet) === null || _b === void 0 ? void 0 : _b.appId, variant: "circle", shape: "circle", src: (_c = appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.logo) === null || _c === void 0 ? void 0 : _c.url }) }), _jsx(Stack, { width: "100%", ref: anchorEl }), anchorEl.current && (_jsx(ResponsiveChatBotContainer, { anchorEl: anchorEl.current, open: open, onClose: () => setOpen(false), children: _jsx(ScrollView, { initialScrollBehavior: "auto", component: Stack, sx: {
|
|
26
|
+
overscrollBehavior: 'contain',
|
|
27
|
+
height: '100%',
|
|
28
|
+
width: '100%',
|
|
29
|
+
overflow: 'auto',
|
|
30
|
+
'.aigne-layout': {
|
|
31
|
+
px: 2,
|
|
32
|
+
},
|
|
33
|
+
}, children: _jsx(Suspense, { fallback: _jsx(Stack, { flexGrow: 1, alignItems: "center", justifyContent: "center", children: _jsx(CircularProgress, { size: 24 }) }), children: _jsx(CustomComponentRenderer, { componentId: componentId, properties: appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentProps, props: { scrollViewProps: { disabled: true } } }) }) }) }))] }));
|
|
34
|
+
}
|
|
35
|
+
function ResponsiveChatBotContainer({ open, anchorEl, children, onClose, }) {
|
|
36
|
+
const theme = useTheme();
|
|
37
|
+
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
|
|
38
|
+
const { agent, appearancePage } = useRuntimeState();
|
|
39
|
+
const title = (appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.name) || agent.name;
|
|
40
|
+
if (isMobile) {
|
|
41
|
+
return (_jsx(ChatBotDialog, { title: title, open: open, onClose: onClose, children: children }));
|
|
42
|
+
}
|
|
43
|
+
return (_jsx(ChatBotPopper, { anchorEl: anchorEl, title: title, open: open, onClose: onClose, children: children }));
|
|
44
|
+
}
|
|
45
|
+
function ChatBotPopper({ title, anchorEl, open, children, onClose, }) {
|
|
46
|
+
return (_jsx(Popper, { anchorEl: anchorEl, open: open, placement: "top-end", sx: {
|
|
47
|
+
zIndex: 'modal',
|
|
48
|
+
maxWidth: 500,
|
|
49
|
+
maxHeight: '80vh',
|
|
50
|
+
width: '100%',
|
|
51
|
+
height: '100%',
|
|
52
|
+
}, children: _jsx(ClickAwayListener, { onClickAway: (e) => {
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
e.stopPropagation();
|
|
55
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
56
|
+
}, children: _jsxs(Stack, { sx: {
|
|
57
|
+
height: '100%',
|
|
58
|
+
boxShadow: 1,
|
|
59
|
+
position: 'relative',
|
|
60
|
+
background: 'white',
|
|
61
|
+
borderRadius: 1,
|
|
62
|
+
}, children: [_jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", borderBottom: 1, borderColor: "divider", p: 2, gap: 2, children: [_jsx(Typography, { variant: "h6", noWrap: true, children: title }), _jsx(Button, { sx: { minWidth: 28, minHeight: 28, p: 0 }, onClick: onClose, children: _jsx(Icon, { icon: "tabler:x", fontSize: 24, color: "rgba(75, 85, 99, 1)" }) })] }), children] }) }) }));
|
|
63
|
+
}
|
|
64
|
+
function ChatBotDialog({ title, open, children, onClose, }) {
|
|
65
|
+
return (_jsxs(Dialog, { open: open, onClose: onClose, fullScreen: true, children: [_jsx(DialogTitle, { sx: { pl: 0 }, children: _jsxs(Stack, { direction: "row", alignItems: "center", gap: 2, children: [_jsx(IconButton, { size: "small", onClick: onClose, children: _jsx(ArrowBackIosNewRounded, { fontSize: "inherit" }) }), _jsx(Typography, { variant: "h6", noWrap: true, children: title })] }) }), _jsx(DialogContent, { sx: { p: 0 }, dividers: true, children: children })] }));
|
|
66
|
+
}
|
|
@@ -6,16 +6,20 @@ import CustomComponentRenderer from '../../../../../components/CustomComponentRe
|
|
|
6
6
|
import { Avatar, DID } from '../../../../arcblock/ux';
|
|
7
7
|
import { useLocaleContext } from '../../../../locale';
|
|
8
8
|
import { useHeaderState } from '../../../../page/header';
|
|
9
|
-
import
|
|
10
|
-
import SocialShare from '
|
|
11
|
-
import { DEFAULT_PAGE_COMPONENT_ID } from '
|
|
12
|
-
import {
|
|
9
|
+
import RuntimeCommonProvider, { RuntimeLocaleProvider } from '../../components/RuntimeCommonProvider';
|
|
10
|
+
import SocialShare from '../../components/SocialShare';
|
|
11
|
+
import { DEFAULT_PAGE_COMPONENT_ID } from '../../constants';
|
|
12
|
+
import { RuntimeProviderFromUrl } from '../../contexts/Runtime';
|
|
13
|
+
import { useRuntimeState } from '../../state/runtime';
|
|
13
14
|
const logoSize = 44;
|
|
14
15
|
function AgentCreatedBy({ agent }) {
|
|
15
16
|
const { t } = useLocaleContext();
|
|
16
17
|
return (_jsxs(_Fragment, { children: [t('by'), " ", _jsx(Box, { component: DID, did: agent.createdBy, copyable: false, responsive: true })] }));
|
|
17
18
|
}
|
|
18
19
|
export default function Runtime() {
|
|
20
|
+
return (_jsx(RuntimeProviderFromUrl, { children: _jsx(RuntimeView, {}) }));
|
|
21
|
+
}
|
|
22
|
+
function RuntimeView() {
|
|
19
23
|
var _a;
|
|
20
24
|
const { agent, appearancePage, sessionState } = useRuntimeState();
|
|
21
25
|
const theme = useTheme();
|
|
@@ -62,5 +66,5 @@ export default function Runtime() {
|
|
|
62
66
|
sessionState.load();
|
|
63
67
|
}, []);
|
|
64
68
|
const componentId = (_a = appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentId) !== null && _a !== void 0 ? _a : DEFAULT_PAGE_COMPONENT_ID;
|
|
65
|
-
return (_jsxs(
|
|
69
|
+
return (_jsxs(RuntimeCommonProvider, { children: [appearancePage && (_jsxs(Helmet, { children: [appearancePage.name && _jsx("title", { children: appearancePage.name }), appearancePage.description && _jsx("meta", { name: "description", content: appearancePage.description })] })), _jsx(CustomComponentRenderer, { componentId: componentId, properties: appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentProps })] }));
|
|
66
70
|
}
|
|
@@ -14,9 +14,9 @@ import isEmpty from 'lodash/isEmpty';
|
|
|
14
14
|
import omit from 'lodash/omit';
|
|
15
15
|
import { useEffect, useMemo, useState } from 'react';
|
|
16
16
|
import { Controller, useForm } from 'react-hook-form';
|
|
17
|
-
import { useLocaleContext } from '
|
|
18
|
-
import
|
|
19
|
-
import
|
|
17
|
+
import { useLocaleContext } from '../../../../locale';
|
|
18
|
+
import AgentInputField from '../../components/AgentInputField';
|
|
19
|
+
import LoadingButton from '../../components/LoadingButton';
|
|
20
20
|
import { useCurrentAgent } from '../../contexts/CurrentAgent';
|
|
21
21
|
import { useRuntimeState } from '../../state/runtime';
|
|
22
22
|
export const SUPPORTED_PARAMETER_TYPES = ['string', 'number', 'select', 'language'];
|
|
@@ -67,7 +67,7 @@ export default function AutoForm({ submitText, inlineLabel, autoFillLastForm = t
|
|
|
67
67
|
: undefined,
|
|
68
68
|
}, render: ({ field, fieldState }) => {
|
|
69
69
|
var _a;
|
|
70
|
-
return (_jsxs(Stack, { className: "form-item", children: [parameter.label && _jsx(FormLabel, { children: parameter.label }), _jsx(
|
|
70
|
+
return (_jsxs(Stack, { className: "form-item", children: [parameter.label && _jsx(FormLabel, { children: parameter.label }), _jsx(AgentInputField, { inputRef: field.ref, autoFocus: index === 0, size: "small", hiddenLabel: true, fullWidth: true, label: undefined, parameter: parameter, maxRows: !(parameter === null || parameter === void 0 ? void 0 : parameter.type) || (parameter === null || parameter === void 0 ? void 0 : parameter.type) === 'string' ? 5 : undefined, value: field.value || '', onChange: (value) => field.onChange({ target: { value } }), error: Boolean(fieldState.error), helperText: ((_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message) || (parameter === null || parameter === void 0 ? void 0 : parameter.helper), InputProps: parameter.key === 'question' && submitInQuestionField
|
|
71
71
|
? {
|
|
72
72
|
endAdornment: (_jsx(InputAdornment, { position: "end", sx: { py: 3, mr: -0.75 }, children: _jsx(LoadingButton, { type: "submit", variant: "contained", loading: sessionState.running, sx: { borderRadius: 100 }, children: submitText }) })),
|
|
73
73
|
}
|
|
@@ -12,8 +12,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { Stack } from '@mui/material';
|
|
14
14
|
import { useLocaleContext } from '../../../../locale';
|
|
15
|
-
import
|
|
16
|
-
import { SocialShareMenu } from '
|
|
15
|
+
import ActionButton from '../../components/ActionButton';
|
|
16
|
+
import { SocialShareMenu } from '../../components/SocialShare';
|
|
17
17
|
export default function MessageActions(_a) {
|
|
18
18
|
var { content } = _a, props = __rest(_a, ["content"]);
|
|
19
19
|
const { t } = useLocaleContext();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Alert, Box } from '@mui/material';
|
|
3
|
-
import { useLocaleContext } from '
|
|
4
|
-
import MarkdownRenderer from '
|
|
3
|
+
import { useLocaleContext } from '../../../../locale';
|
|
4
|
+
import MarkdownRenderer from '../../components/MarkdownRenderer';
|
|
5
5
|
export default function MessageErrorView({ error }) {
|
|
6
6
|
const { t } = useLocaleContext();
|
|
7
7
|
if (!error)
|
|
@@ -16,13 +16,13 @@ import { Box, Skeleton, Stack, Tooltip, Typography, styled, useMediaQuery, useTh
|
|
|
16
16
|
import dayjs from 'dayjs';
|
|
17
17
|
import isEmpty from 'lodash/isEmpty';
|
|
18
18
|
import React, { memo, useMemo, useState } from 'react';
|
|
19
|
-
import { Avatar } from '
|
|
20
|
-
import { useSessionContext } from '
|
|
21
|
-
import
|
|
22
|
-
import MarkdownRenderer from '../../../MarkdownRenderer';
|
|
23
|
-
import MessageActions from '../../../message/MessageActions';
|
|
19
|
+
import { Avatar } from '../../../../arcblock/ux';
|
|
20
|
+
import { useSessionContext } from '../../../../session';
|
|
21
|
+
import MarkdownRenderer from '../../components/MarkdownRenderer';
|
|
24
22
|
import { useRuntimeState } from '../../state/runtime';
|
|
23
|
+
import MessageActions from './MessageActions';
|
|
25
24
|
import MessageErrorView from './MessageErrorView';
|
|
25
|
+
import MessageMetadataRenderer from './MessageMetadataRenderer';
|
|
26
26
|
const MessageItemView = memo((_a) => {
|
|
27
27
|
var _b;
|
|
28
28
|
var { message, hideAvatar } = _a, props = __rest(_a, ["message", "hideAvatar"]);
|
|
@@ -3,7 +3,7 @@ import ImagePreview from '@blocklet/ai-kit/components/image-preview';
|
|
|
3
3
|
import { RuntimeOutputVariable } from '@blocklet/ai-runtime/types';
|
|
4
4
|
import { Stack } from '@mui/material';
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
|
-
import ReferenceLinks from '
|
|
6
|
+
import ReferenceLinks from './ReferenceLinks';
|
|
7
7
|
export default function MessageMetadataRenderer({ object }) {
|
|
8
8
|
const referenceLinks = object[RuntimeOutputVariable.referenceLinks];
|
|
9
9
|
const images = useMemo(() => {
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Masonry } from '@mui/lab';
|
|
14
|
+
import { Box, Skeleton, Stack, ThemeProvider, Typography, createTheme, useTheme } from '@mui/material';
|
|
15
|
+
import { Suspense, useMemo, useRef } from 'react';
|
|
16
|
+
import Balancer from 'react-wrap-balancer';
|
|
17
|
+
import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
|
|
18
|
+
import { useLocaleContext } from '../../../../locale';
|
|
19
|
+
import SimpleHeader from '../../components/Header/SimpleHeader';
|
|
20
|
+
import LoadingButton from '../../components/LoadingButton';
|
|
21
|
+
import CurrentAgentProvider, { useCurrentAgent } from '../../contexts/CurrentAgent';
|
|
22
|
+
import CurrentMessageProvider from '../../contexts/CurrentMessage';
|
|
23
|
+
import { useRuntimeState } from '../../state/runtime';
|
|
24
|
+
import mapRight from '../../utils/map-right';
|
|
25
|
+
export default function PhotoGallery({ resultTitle, primaryColor }) {
|
|
26
|
+
const { childAgentId } = useRuntimeState();
|
|
27
|
+
const inheritedTheme = useTheme();
|
|
28
|
+
const theme = useMemo(() => {
|
|
29
|
+
let { primary } = inheritedTheme.palette;
|
|
30
|
+
try {
|
|
31
|
+
if (primaryColor) {
|
|
32
|
+
primary = inheritedTheme.palette.augmentColor({ color: { main: primaryColor } });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
console.error('augment primary color error', { error });
|
|
37
|
+
}
|
|
38
|
+
return createTheme(inheritedTheme, {
|
|
39
|
+
palette: { primary },
|
|
40
|
+
shape: {
|
|
41
|
+
borderRadius: 8,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}, [inheritedTheme, primaryColor]);
|
|
45
|
+
return (_jsx(ThemeProvider, { theme: theme, children: _jsxs(Stack, { className: "aigne-layout aigne-photo-wall-layout", children: [_jsx(SimpleHeader, { TitleProps: { fontSize: 48 }, DescriptionProps: { fontSize: 20 }, maxWidth: "md", mx: "auto", width: "100%", px: { xs: 2, sm: 3 } }), _jsx(CurrentAgentProvider, { agentId: childAgentId, children: _jsx(AgentInputRender, { className: "aigne-inputs aigne-photo-wall-inputs", maxWidth: "md", mx: "auto", width: "100%", px: { xs: 2, sm: 3 } }) }), _jsx(OutputView, { resultTitle: resultTitle, className: "aigne-outputs aigne-photo-wall-outputs", gap: 2 })] }) }));
|
|
46
|
+
}
|
|
47
|
+
function AgentInputRender(_a) {
|
|
48
|
+
var props = __rest(_a, []);
|
|
49
|
+
const { appearanceInput } = useCurrentAgent();
|
|
50
|
+
if (!(appearanceInput === null || appearanceInput === void 0 ? void 0 : appearanceInput.componentId))
|
|
51
|
+
return null;
|
|
52
|
+
return (_jsx(Stack, Object.assign({}, props, { children: _jsx(CustomComponentRenderer, { componentId: appearanceInput.componentId, properties: appearanceInput.componentProps }) })));
|
|
53
|
+
}
|
|
54
|
+
function NoOutputs() {
|
|
55
|
+
return (_jsx(Stack, { mt: 10, children: _jsx(Typography, { color: "text.disabled", children: "You haven't generated any pictures yet." }) }));
|
|
56
|
+
}
|
|
57
|
+
function OutputView(_a) {
|
|
58
|
+
var _b, _c, _d, _e, _f, _g;
|
|
59
|
+
var { resultTitle } = _a, props = __rest(_a, ["resultTitle"]);
|
|
60
|
+
const { t } = useLocaleContext();
|
|
61
|
+
const { sessionState } = useRuntimeState();
|
|
62
|
+
const ref = useRef(null);
|
|
63
|
+
return (_jsxs(Stack, Object.assign({ width: "100%", alignItems: "center", px: { xs: 2, sm: 3 }, mt: { xs: 2, sm: 3 } }, props, { children: [resultTitle && (_jsx(Typography, { width: "100%", component: "h2", fontSize: 36, fontWeight: 700, textAlign: "center", children: _jsx(Balancer, { children: resultTitle }) })), sessionState.loaded && !((_b = sessionState.messages) === null || _b === void 0 ? void 0 : _b.length) && _jsx(NoOutputs, {}), _jsxs(Masonry, { ref: ref, columns: { xs: 2, sm: 3, md: 4, lg: 5 }, spacing: 1, sequential: true, sx: { width: '100%', overflow: 'hidden', '> *': { borderRadius: 1 } }, children: [sessionState.running && (_jsx(Skeleton, { variant: "rectangular", sx: {
|
|
64
|
+
// FIXME: default using history height
|
|
65
|
+
height: (_e = (_d = (_c = ref.current) === null || _c === void 0 ? void 0 : _c.querySelector('*')) === null || _d === void 0 ? void 0 : _d.clientHeight) !== null && _e !== void 0 ? _e : 200,
|
|
66
|
+
} })), mapRight((_f = sessionState.messages) !== null && _f !== void 0 ? _f : [], (message) => (_jsx(CurrentAgentProvider, { agentId: message.assistantId, children: _jsx(CurrentMessageProvider, { message: message, children: _jsx(Suspense, { children: _jsx(OutputItemView, {}) }) }) }, message.taskId)))] }), _jsx(Box, { my: 4, children: !!((_g = sessionState.messages) === null || _g === void 0 ? void 0 : _g.length) && !sessionState.noMoreMessage && (_jsx(LoadingButton, { variant: "outlined", onClick: sessionState.loadMoreMessages, children: t('loadMore') })) })] })));
|
|
67
|
+
}
|
|
68
|
+
function OutputItemView() {
|
|
69
|
+
const { appearanceOutput } = useCurrentAgent();
|
|
70
|
+
if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId))
|
|
71
|
+
return null;
|
|
72
|
+
return (_jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProps }));
|
|
73
|
+
}
|
|
@@ -12,13 +12,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { RuntimeOutputVariable } from '@blocklet/ai-runtime/types';
|
|
14
14
|
import { Icon } from '@iconify/react';
|
|
15
|
-
import { Box, Button, Dialog, DialogContent, DialogTitle, Stack, Typography, alpha } from '@mui/material';
|
|
15
|
+
import { Alert, Box, Button, Dialog, DialogContent, DialogTitle, Stack, Typography, alpha, } from '@mui/material';
|
|
16
16
|
import { useState } from 'react';
|
|
17
|
-
import { RelativeTime } from '
|
|
18
|
-
import { useLocaleContext } from '
|
|
19
|
-
import { useSessionContext } from '
|
|
20
|
-
import
|
|
21
|
-
import UserInfo from '
|
|
17
|
+
import { RelativeTime } from '../../../../arcblock/ux';
|
|
18
|
+
import { useLocaleContext } from '../../../../locale';
|
|
19
|
+
import { useSessionContext } from '../../../../session';
|
|
20
|
+
import ActionButton from '../../components/ActionButton';
|
|
21
|
+
import UserInfo from '../../components/UserInfo';
|
|
22
22
|
import { useCurrentMessage } from '../../contexts/CurrentMessage';
|
|
23
23
|
const getLineClamp = (line) => ({
|
|
24
24
|
display: '-webkit-box',
|
|
@@ -35,9 +35,18 @@ export default function PhotoGalleryItem() {
|
|
|
35
35
|
const [openDialog, setOpenDialog] = useState(false);
|
|
36
36
|
const objects = (_b = (_a = message.result) === null || _a === void 0 ? void 0 : _a.objects) !== null && _b !== void 0 ? _b : [];
|
|
37
37
|
const images = objects.flatMap((i) => { var _a; return (_a = i.data[RuntimeOutputVariable.images]) !== null && _a !== void 0 ? _a : []; });
|
|
38
|
+
if (!images.length && message.error) {
|
|
39
|
+
return (_jsx(Stack, { alignItems: "center", justifyContent: "center", sx: {
|
|
40
|
+
aspectRatio: 1,
|
|
41
|
+
bgcolor: 'grey.50',
|
|
42
|
+
borderRadius: 1,
|
|
43
|
+
overflow: 'hidden',
|
|
44
|
+
wordBreak: 'break-word',
|
|
45
|
+
}, children: _jsx(Alert, { severity: "error", sx: { bgcolor: 'transparent' }, children: message.error.message }) }));
|
|
46
|
+
}
|
|
38
47
|
return images.map(({ url }, index) => {
|
|
39
48
|
var _a;
|
|
40
|
-
return (_jsxs(Box, {
|
|
49
|
+
return (_jsxs(Box, { sx: {
|
|
41
50
|
position: 'relative',
|
|
42
51
|
overflow: 'hidden',
|
|
43
52
|
cursor: 'pointer',
|
|
@@ -84,7 +93,7 @@ function PromptDialog(_a) {
|
|
|
84
93
|
const { t } = useLocaleContext();
|
|
85
94
|
const { session: authSession } = useSessionContext();
|
|
86
95
|
const borderRadius = 1;
|
|
87
|
-
return (_jsxs(Dialog, Object.assign({ fullWidth: true, maxWidth:
|
|
96
|
+
return (_jsxs(Dialog, Object.assign({ fullWidth: true, maxWidth: "xl", scroll: "paper", slotProps: {
|
|
88
97
|
backdrop: {
|
|
89
98
|
sx: {
|
|
90
99
|
bgcolor: 'rgba(255, 255, 255, 0.4)',
|
|
@@ -1,17 +1,30 @@
|
|
|
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
|
+
};
|
|
1
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
13
|
import { RuntimeOutputVariable } from '@blocklet/ai-runtime/types';
|
|
3
|
-
import { Box, Stack, ThemeProvider,
|
|
14
|
+
import { Box, Stack, ThemeProvider, createTheme, useTheme } from '@mui/material';
|
|
4
15
|
import { Suspense, useEffect, useMemo } from 'react';
|
|
5
|
-
import
|
|
6
|
-
import CustomComponentRenderer from '
|
|
7
|
-
import { useSessionContext } from '
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import ScrollView
|
|
16
|
+
import { useScrollToBottom } from 'react-scroll-to-bottom';
|
|
17
|
+
import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
|
|
18
|
+
import { useSessionContext } from '../../../../session';
|
|
19
|
+
import SimpleHeader from '../../components/Header/SimpleHeader';
|
|
20
|
+
import SimpleLayout from '../../components/Layout/SimpleLayout';
|
|
21
|
+
import ScrollView from '../../components/ScrollView';
|
|
22
|
+
import UserInfo from '../../components/UserInfo';
|
|
11
23
|
import CurrentAgentProvider, { useCurrentAgent } from '../../contexts/CurrentAgent';
|
|
12
24
|
import CurrentMessageProvider, { useCurrentMessage } from '../../contexts/CurrentMessage';
|
|
13
25
|
import { useRuntimeState } from '../../state/runtime';
|
|
14
|
-
|
|
26
|
+
import MessageSuggestedQuestions from '../ChatOutput/MessageSuggestedQuestions';
|
|
27
|
+
export default function SimpleChat({ primaryColor, scrollViewProps = { scroll: 'window', initialScrollBehavior: 'auto' }, }) {
|
|
15
28
|
const inheritedTheme = useTheme();
|
|
16
29
|
const theme = useMemo(() => {
|
|
17
30
|
let { primary } = inheritedTheme.palette;
|
|
@@ -30,30 +43,30 @@ export default function SimpleChat({ primaryColor }) {
|
|
|
30
43
|
},
|
|
31
44
|
});
|
|
32
45
|
}, [inheritedTheme, primaryColor]);
|
|
33
|
-
return (_jsx(
|
|
46
|
+
return (_jsx(ScrollView, Object.assign({}, scrollViewProps, { children: _jsx(ThemeProvider, { theme: theme, children: _jsx(SimpleChatView, {}) }) })));
|
|
34
47
|
}
|
|
35
48
|
function SimpleChatView() {
|
|
36
|
-
const {
|
|
37
|
-
const scrollToBottom =
|
|
49
|
+
const { childAgentId, sessionState } = useRuntimeState();
|
|
50
|
+
const scrollToBottom = useScrollToBottom();
|
|
38
51
|
useEffect(() => {
|
|
39
52
|
if (sessionState.running)
|
|
40
|
-
scrollToBottom();
|
|
53
|
+
scrollToBottom({ behavior: 'smooth' });
|
|
41
54
|
}, [scrollToBottom, sessionState.running]);
|
|
42
|
-
|
|
43
|
-
const description = (appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.description) || agent.description;
|
|
44
|
-
return (_jsxs(Stack, { flexGrow: 1, maxWidth: "md", width: "100%", mx: "auto", px: { xs: 2, sm: 3 }, children: [_jsx(Stack, { gap: 2, mt: 8, mb: 4, children: _jsxs(Provider, { children: [title && (_jsx(Typography, { component: "h5", fontSize: 30, fontWeight: 700, textAlign: "center", children: _jsx(Balancer, { children: title }) })), description && (_jsx(Typography, { textAlign: "center", children: _jsx(Balancer, { children: description }) }))] }) }), _jsx(Stack, { children: _jsx(OutputView, {}) }), _jsx(Box, { flexGrow: 1, minHeight: 200 }), _jsx(Stack, { sx: { position: 'sticky', bottom: 0, py: 1, bgcolor: 'background.paper', zIndex: 10 }, children: _jsx(CurrentAgentProvider, { agentId: childAgentId, children: _jsx(AgentInputRender, {}) }) })] }));
|
|
55
|
+
return (_jsxs(SimpleLayout, { children: [_jsx(SimpleHeader, {}), _jsx(OutputView, { className: "aigne-outputs aigne-simple-chat-outputs", flexGrow: 1, pb: 10 }), _jsx(CurrentAgentProvider, { agentId: childAgentId, children: _jsx(AgentInputRender, { className: "aigne-inputs aigne-simple-chat-inputs", sx: { position: 'sticky', bottom: 0, pt: 1, pb: 2, bgcolor: 'background.paper', zIndex: 10 } }) })] }));
|
|
45
56
|
}
|
|
46
|
-
function AgentInputRender() {
|
|
57
|
+
function AgentInputRender(_a) {
|
|
58
|
+
var props = __rest(_a, []);
|
|
47
59
|
const { appearanceInput } = useCurrentAgent();
|
|
48
60
|
if (!(appearanceInput === null || appearanceInput === void 0 ? void 0 : appearanceInput.componentId))
|
|
49
61
|
return null;
|
|
50
|
-
return (_jsx(Stack, { children: _jsx(CustomComponentRenderer, { componentId: appearanceInput.componentId, properties: appearanceInput.componentProps }) }));
|
|
62
|
+
return (_jsx(Stack, Object.assign({}, props, { children: _jsx(CustomComponentRenderer, { componentId: appearanceInput.componentId, properties: appearanceInput.componentProps }) })));
|
|
51
63
|
}
|
|
52
|
-
function OutputView() {
|
|
53
|
-
var
|
|
64
|
+
function OutputView(_a) {
|
|
65
|
+
var _b, _c;
|
|
66
|
+
var props = __rest(_a, []);
|
|
54
67
|
const { sessionState } = useRuntimeState();
|
|
55
|
-
const lastMessage = (
|
|
56
|
-
return (_jsxs(Stack, { gap: 2, children: [(
|
|
68
|
+
const lastMessage = (_b = sessionState.messages) === null || _b === void 0 ? void 0 : _b.slice(-1)[0];
|
|
69
|
+
return (_jsxs(Stack, Object.assign({ gap: 2 }, props, { children: [(_c = sessionState.messages) === null || _c === void 0 ? void 0 : _c.map((message) => (_jsx(Stack, { children: _jsx(CurrentAgentProvider, { agentId: message.assistantId, children: _jsx(CurrentMessageProvider, { message: message, children: _jsx(Suspense, { children: _jsx(OutputItemView, {}) }) }) }) }))), lastMessage && (_jsx(CurrentAgentProvider, { agentId: lastMessage.assistantId, children: _jsx(CurrentMessageProvider, { message: lastMessage, children: _jsx(SuggestedQuestionsView, {}) }) }))] })));
|
|
57
70
|
}
|
|
58
71
|
function OutputItemView() {
|
|
59
72
|
var _a, _b, _c, _d, _e;
|
|
@@ -63,7 +76,6 @@ function OutputItemView() {
|
|
|
63
76
|
const { session: authSession } = useSessionContext();
|
|
64
77
|
if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId))
|
|
65
78
|
return null;
|
|
66
|
-
// return <CustomComponentRenderer componentId={input.componentId} properties={input.componentProps} props={{hideAvatar: false}} />;
|
|
67
79
|
return (_jsxs(Stack, { gap: 2, children: [_jsx(Box, { children: _jsx(UserInfo, { name: (_a = authSession.user) === null || _a === void 0 ? void 0 : _a.fullName, did: (_b = authSession.user) === null || _b === void 0 ? void 0 : _b.did, avatar: (_c = authSession.user) === null || _c === void 0 ? void 0 : _c.avatar, time: message.createdAt, reverse: true, alignItems: "flex-start", children: _jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProps, props: {
|
|
68
80
|
renderType: 'parameters',
|
|
69
81
|
} }) }) }), _jsx(Box, { children: _jsx(UserInfo, { name: appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.name, did: (_d = globalThis.blocklet) === null || _d === void 0 ? void 0 : _d.appId, avatar: (_e = appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.logo) === null || _e === void 0 ? void 0 : _e.url, time: message.createdAt, alignItems: "flex-start", children: _jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProps, props: {
|