@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
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("@iconify/react");
|
|
8
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
9
|
+
const material_1 = require("@mui/material");
|
|
10
|
+
const react_2 = require("react");
|
|
11
|
+
const CustomComponentRenderer_1 = __importDefault(require("../../../../../components/CustomComponentRenderer"));
|
|
12
|
+
const ux_1 = require("../../../../arcblock/ux");
|
|
13
|
+
const RuntimeCommonProvider_1 = __importDefault(require("../../components/RuntimeCommonProvider"));
|
|
14
|
+
const ScrollView_1 = __importDefault(require("../../components/ScrollView"));
|
|
15
|
+
const constants_1 = require("../../constants");
|
|
16
|
+
const Runtime_1 = __importDefault(require("../../contexts/Runtime"));
|
|
17
|
+
const runtime_1 = require("../../state/runtime");
|
|
18
|
+
function ChatBotButton({ aid, working }) {
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(Runtime_1.default, { aid: aid, working: working, children: (0, jsx_runtime_1.jsx)(RuntimeCommonProvider_1.default, { children: (0, jsx_runtime_1.jsx)(ChatBotContent, {}) }) }));
|
|
20
|
+
}
|
|
21
|
+
exports.default = ChatBotButton;
|
|
22
|
+
function ChatBotContent() {
|
|
23
|
+
var _a, _b, _c;
|
|
24
|
+
const anchorEl = (0, react_2.useRef)(null);
|
|
25
|
+
const { appearancePage, sessionState } = (0, runtime_1.useRuntimeState)();
|
|
26
|
+
const [open, setOpen] = (0, react_2.useState)(false);
|
|
27
|
+
(0, react_2.useEffect)(() => {
|
|
28
|
+
sessionState.load();
|
|
29
|
+
}, []);
|
|
30
|
+
const componentId = (_a = appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentId) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_PAGE_COMPONENT_ID;
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { position: 'fixed', bottom: 32, right: 16, zIndex: 'fab' }, children: [(0, jsx_runtime_1.jsx)(material_1.Fab, { sx: { width: 44, height: 44, boxShadow: open ? 0 : undefined }, onClick: () => setOpen(true), children: (0, jsx_runtime_1.jsx)(ux_1.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 }) }), (0, jsx_runtime_1.jsx)(material_1.Stack, { width: "100%", ref: anchorEl }), anchorEl.current && ((0, jsx_runtime_1.jsx)(ResponsiveChatBotContainer, { anchorEl: anchorEl.current, open: open, onClose: () => setOpen(false), children: (0, jsx_runtime_1.jsx)(ScrollView_1.default, { initialScrollBehavior: "auto", component: material_1.Stack, sx: {
|
|
32
|
+
overscrollBehavior: 'contain',
|
|
33
|
+
height: '100%',
|
|
34
|
+
width: '100%',
|
|
35
|
+
overflow: 'auto',
|
|
36
|
+
'.aigne-layout': {
|
|
37
|
+
px: 2,
|
|
38
|
+
},
|
|
39
|
+
}, children: (0, jsx_runtime_1.jsx)(react_2.Suspense, { fallback: (0, jsx_runtime_1.jsx)(material_1.Stack, { flexGrow: 1, alignItems: "center", justifyContent: "center", children: (0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 24 }) }), children: (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: componentId, properties: appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentProps, props: { scrollViewProps: { disabled: true } } }) }) }) }))] }));
|
|
40
|
+
}
|
|
41
|
+
function ResponsiveChatBotContainer({ open, anchorEl, children, onClose, }) {
|
|
42
|
+
const theme = (0, material_1.useTheme)();
|
|
43
|
+
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('sm'));
|
|
44
|
+
const { agent, appearancePage } = (0, runtime_1.useRuntimeState)();
|
|
45
|
+
const title = (appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.name) || agent.name;
|
|
46
|
+
if (isMobile) {
|
|
47
|
+
return ((0, jsx_runtime_1.jsx)(ChatBotDialog, { title: title, open: open, onClose: onClose, children: children }));
|
|
48
|
+
}
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(ChatBotPopper, { anchorEl: anchorEl, title: title, open: open, onClose: onClose, children: children }));
|
|
50
|
+
}
|
|
51
|
+
function ChatBotPopper({ title, anchorEl, open, children, onClose, }) {
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Popper, { anchorEl: anchorEl, open: open, placement: "top-end", sx: {
|
|
53
|
+
zIndex: 'modal',
|
|
54
|
+
maxWidth: 500,
|
|
55
|
+
maxHeight: '80vh',
|
|
56
|
+
width: '100%',
|
|
57
|
+
height: '100%',
|
|
58
|
+
}, children: (0, jsx_runtime_1.jsx)(material_1.ClickAwayListener, { onClickAway: (e) => {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
e.stopPropagation();
|
|
61
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
62
|
+
}, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { sx: {
|
|
63
|
+
height: '100%',
|
|
64
|
+
boxShadow: 1,
|
|
65
|
+
position: 'relative',
|
|
66
|
+
background: 'white',
|
|
67
|
+
borderRadius: 1,
|
|
68
|
+
}, children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", borderBottom: 1, borderColor: "divider", p: 2, gap: 2, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", noWrap: true, children: title }), (0, jsx_runtime_1.jsx)(material_1.Button, { sx: { minWidth: 28, minHeight: 28, p: 0 }, onClick: onClose, children: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:x", fontSize: 24, color: "rgba(75, 85, 99, 1)" }) })] }), children] }) }) }));
|
|
69
|
+
}
|
|
70
|
+
function ChatBotDialog({ title, open, children, onClose, }) {
|
|
71
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Dialog, { open: open, onClose: onClose, fullScreen: true, children: [(0, jsx_runtime_1.jsx)(material_1.DialogTitle, { sx: { pl: 0 }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", gap: 2, children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "small", onClick: onClose, children: (0, jsx_runtime_1.jsx)(icons_material_1.ArrowBackIosNewRounded, { fontSize: "inherit" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", noWrap: true, children: title })] }) }), (0, jsx_runtime_1.jsx)(material_1.DialogContent, { sx: { p: 0 }, dividers: true, children: children })] }));
|
|
72
|
+
}
|
|
@@ -34,16 +34,21 @@ const CustomComponentRenderer_1 = __importDefault(require("../../../../../compon
|
|
|
34
34
|
const ux_1 = require("../../../../arcblock/ux");
|
|
35
35
|
const locale_1 = require("../../../../locale");
|
|
36
36
|
const header_1 = require("../../../../page/header");
|
|
37
|
-
const
|
|
38
|
-
const SocialShare_1 = __importDefault(require("
|
|
39
|
-
const constants_1 = require("
|
|
40
|
-
const
|
|
37
|
+
const RuntimeCommonProvider_1 = __importStar(require("../../components/RuntimeCommonProvider"));
|
|
38
|
+
const SocialShare_1 = __importDefault(require("../../components/SocialShare"));
|
|
39
|
+
const constants_1 = require("../../constants");
|
|
40
|
+
const Runtime_1 = require("../../contexts/Runtime");
|
|
41
|
+
const runtime_1 = require("../../state/runtime");
|
|
41
42
|
const logoSize = 44;
|
|
42
43
|
function AgentCreatedBy({ agent }) {
|
|
43
44
|
const { t } = (0, locale_1.useLocaleContext)();
|
|
44
45
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [t('by'), " ", (0, jsx_runtime_1.jsx)(material_1.Box, { component: ux_1.DID, did: agent.createdBy, copyable: false, responsive: true })] }));
|
|
45
46
|
}
|
|
46
47
|
function Runtime() {
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(Runtime_1.RuntimeProviderFromUrl, { children: (0, jsx_runtime_1.jsx)(RuntimeView, {}) }));
|
|
49
|
+
}
|
|
50
|
+
exports.default = Runtime;
|
|
51
|
+
function RuntimeView() {
|
|
47
52
|
var _a;
|
|
48
53
|
const { agent, appearancePage, sessionState } = (0, runtime_1.useRuntimeState)();
|
|
49
54
|
const theme = (0, material_1.useTheme)();
|
|
@@ -62,7 +67,7 @@ function Runtime() {
|
|
|
62
67
|
height: 18,
|
|
63
68
|
fontSize: 18,
|
|
64
69
|
}, children: (appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.name) || agent.name }));
|
|
65
|
-
state.description = agent.createdBy && ((0, jsx_runtime_1.jsx)(
|
|
70
|
+
state.description = agent.createdBy && ((0, jsx_runtime_1.jsx)(RuntimeCommonProvider_1.RuntimeLocaleProvider, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
66
71
|
display: 'inline-flex',
|
|
67
72
|
alignItems: 'center',
|
|
68
73
|
gap: 0.5,
|
|
@@ -90,6 +95,5 @@ function Runtime() {
|
|
|
90
95
|
sessionState.load();
|
|
91
96
|
}, []);
|
|
92
97
|
const componentId = (_a = appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentId) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_PAGE_COMPONENT_ID;
|
|
93
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
98
|
+
return ((0, jsx_runtime_1.jsxs)(RuntimeCommonProvider_1.default, { children: [appearancePage && ((0, jsx_runtime_1.jsxs)(react_helmet_1.Helmet, { children: [appearancePage.name && (0, jsx_runtime_1.jsx)("title", { children: appearancePage.name }), appearancePage.description && (0, jsx_runtime_1.jsx)("meta", { name: "description", content: appearancePage.description })] })), (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: componentId, properties: appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentProps })] }));
|
|
94
99
|
}
|
|
95
|
-
exports.default = Runtime;
|
|
@@ -20,9 +20,9 @@ const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
|
20
20
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
21
21
|
const react_1 = require("react");
|
|
22
22
|
const react_hook_form_1 = require("react-hook-form");
|
|
23
|
-
const locale_1 = require("
|
|
24
|
-
const
|
|
25
|
-
const
|
|
23
|
+
const locale_1 = require("../../../../locale");
|
|
24
|
+
const AgentInputField_1 = __importDefault(require("../../components/AgentInputField"));
|
|
25
|
+
const LoadingButton_1 = __importDefault(require("../../components/LoadingButton"));
|
|
26
26
|
const CurrentAgent_1 = require("../../contexts/CurrentAgent");
|
|
27
27
|
const runtime_1 = require("../../state/runtime");
|
|
28
28
|
exports.SUPPORTED_PARAMETER_TYPES = ['string', 'number', 'select', 'language'];
|
|
@@ -73,7 +73,7 @@ function AutoForm({ submitText, inlineLabel, autoFillLastForm = true, submitInQu
|
|
|
73
73
|
: undefined,
|
|
74
74
|
}, render: ({ field, fieldState }) => {
|
|
75
75
|
var _a;
|
|
76
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { className: "form-item", children: [parameter.label && (0, jsx_runtime_1.jsx)(material_1.FormLabel, { children: parameter.label }), (0, jsx_runtime_1.jsx)(
|
|
76
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { className: "form-item", children: [parameter.label && (0, jsx_runtime_1.jsx)(material_1.FormLabel, { children: parameter.label }), (0, jsx_runtime_1.jsx)(AgentInputField_1.default, { 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
|
|
77
77
|
? {
|
|
78
78
|
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "end", sx: { py: 3, mr: -0.75 }, children: (0, jsx_runtime_1.jsx)(LoadingButton_1.default, { type: "submit", variant: "contained", loading: sessionState.running, sx: { borderRadius: 100 }, children: submitText }) })),
|
|
79
79
|
}
|
|
@@ -10,12 +10,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
13
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
17
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
18
|
const material_1 = require("@mui/material");
|
|
16
19
|
const locale_1 = require("../../../../locale");
|
|
17
|
-
const ActionButton_1 = require("
|
|
18
|
-
const SocialShare_1 = require("
|
|
20
|
+
const ActionButton_1 = __importDefault(require("../../components/ActionButton"));
|
|
21
|
+
const SocialShare_1 = require("../../components/SocialShare");
|
|
19
22
|
function MessageActions(_a) {
|
|
20
23
|
var { content } = _a, props = __rest(_a, ["content"]);
|
|
21
24
|
const { t } = (0, locale_1.useLocaleContext)();
|
|
@@ -28,7 +31,7 @@ function MessageActions(_a) {
|
|
|
28
31
|
marginRight: '0px !important',
|
|
29
32
|
},
|
|
30
33
|
};
|
|
31
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "column", gap: 0.5 }, props, { children: [(0, jsx_runtime_1.jsx)(ActionButton_1.
|
|
34
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "column", gap: 0.5 }, props, { children: [(0, jsx_runtime_1.jsx)(ActionButton_1.default, { autoReset: true, size: "small", variant: "outlined", placement: "right",
|
|
32
35
|
// @ts-ignore
|
|
33
36
|
color: "black", tip: t('copyToClipboard'),
|
|
34
37
|
// title={t('copy')}
|
|
@@ -62,7 +65,7 @@ function MessageActions(_a) {
|
|
|
62
65
|
'.MuiIconButton-root': {
|
|
63
66
|
p: 0,
|
|
64
67
|
},
|
|
65
|
-
}, children: (0, jsx_runtime_1.jsx)(ActionButton_1.
|
|
68
|
+
}, children: (0, jsx_runtime_1.jsx)(ActionButton_1.default, { autoReset: true, size: "small", variant: "outlined", placement: "right",
|
|
66
69
|
// @ts-ignore
|
|
67
70
|
color: "black", tip: t('socialShare.title'), icon: "tabler:share", iconSucceed: "tabler:share", sx: Object.assign({}, commonActionButtonsSx) }) })] })));
|
|
68
71
|
}
|
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const material_1 = require("@mui/material");
|
|
8
|
-
const locale_1 = require("
|
|
9
|
-
const MarkdownRenderer_1 = __importDefault(require("
|
|
8
|
+
const locale_1 = require("../../../../locale");
|
|
9
|
+
const MarkdownRenderer_1 = __importDefault(require("../../components/MarkdownRenderer"));
|
|
10
10
|
function MessageErrorView({ error }) {
|
|
11
11
|
const { t } = (0, locale_1.useLocaleContext)();
|
|
12
12
|
if (!error)
|
|
@@ -45,13 +45,13 @@ const material_1 = require("@mui/material");
|
|
|
45
45
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
46
46
|
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
47
47
|
const react_1 = __importStar(require("react"));
|
|
48
|
-
const ux_1 = require("
|
|
49
|
-
const session_1 = require("
|
|
50
|
-
const
|
|
51
|
-
const MarkdownRenderer_1 = __importDefault(require("../../../MarkdownRenderer"));
|
|
52
|
-
const MessageActions_1 = __importDefault(require("../../../message/MessageActions"));
|
|
48
|
+
const ux_1 = require("../../../../arcblock/ux");
|
|
49
|
+
const session_1 = require("../../../../session");
|
|
50
|
+
const MarkdownRenderer_1 = __importDefault(require("../../components/MarkdownRenderer"));
|
|
53
51
|
const runtime_1 = require("../../state/runtime");
|
|
52
|
+
const MessageActions_1 = __importDefault(require("./MessageActions"));
|
|
54
53
|
const MessageErrorView_1 = __importDefault(require("./MessageErrorView"));
|
|
54
|
+
const MessageMetadataRenderer_1 = __importDefault(require("./MessageMetadataRenderer"));
|
|
55
55
|
const MessageItemView = (0, react_1.memo)((_a) => {
|
|
56
56
|
var _b;
|
|
57
57
|
var { message, hideAvatar } = _a, props = __rest(_a, ["message", "hideAvatar"]);
|
|
@@ -146,7 +146,7 @@ function AgentMessage({ message, hideAvatar }) {
|
|
|
146
146
|
: '', sx: childMsg.respondAs === 'systemMessage' ? { color: 'text.secondary' } : {}, children: (_e = childMsg.result) === null || _e === void 0 ? void 0 : _e.content }, childMsg.taskId)) : ((_g = (_f = childMsg.result) === null || _f === void 0 ? void 0 : _f.images) === null || _g === void 0 ? void 0 : _g.length) ? ((0, jsx_runtime_1.jsx)(image_preview_1.default, { itemWidth: 100, spacing: 1, dataSource: childMsg.result.images.map((i) => ({ src: i.url })) }, childMsg.taskId)) : null;
|
|
147
147
|
}), ((_j = message.result) === null || _j === void 0 ? void 0 : _j.content) && ((0, jsx_runtime_1.jsx)(MarkdownRenderer_1.default, { className: isMessageLoading ? 'writing' : '', children: message.result.content }))] }) })) : (isMessageLoading && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", height: 24 + 8 + 8,
|
|
148
148
|
// only response with loading
|
|
149
|
-
className: "message-response" }))), (_l = (_k = message.result) === null || _k === void 0 ? void 0 : _k.objects) === null || _l === void 0 ? void 0 : _l.map((object) => ((0, jsx_runtime_1.jsx)(
|
|
149
|
+
className: "message-response" }))), (_l = (_k = message.result) === null || _k === void 0 ? void 0 : _k.objects) === null || _l === void 0 ? void 0 : _l.map((object) => ((0, jsx_runtime_1.jsx)(MessageMetadataRenderer_1.default, { object: object.data }, object.taskId))), message.error && (0, jsx_runtime_1.jsx)(MessageErrorView_1.default, { error: message.error })] })] })] }));
|
|
150
150
|
}
|
|
151
151
|
function MessageItemWrapper(_a) {
|
|
152
152
|
var _b, _c;
|
|
@@ -8,7 +8,7 @@ const image_preview_1 = __importDefault(require("@blocklet/ai-kit/components/ima
|
|
|
8
8
|
const types_1 = require("@blocklet/ai-runtime/types");
|
|
9
9
|
const material_1 = require("@mui/material");
|
|
10
10
|
const react_1 = require("react");
|
|
11
|
-
const ReferenceLinks_1 = __importDefault(require("
|
|
11
|
+
const ReferenceLinks_1 = __importDefault(require("./ReferenceLinks"));
|
|
12
12
|
function MessageMetadataRenderer({ object }) {
|
|
13
13
|
const referenceLinks = object[types_1.RuntimeOutputVariable.referenceLinks];
|
|
14
14
|
const images = (0, react_1.useMemo)(() => {
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
|
+
const lab_1 = require("@mui/lab");
|
|
42
|
+
const material_1 = require("@mui/material");
|
|
43
|
+
const react_1 = require("react");
|
|
44
|
+
const react_wrap_balancer_1 = __importDefault(require("react-wrap-balancer"));
|
|
45
|
+
const CustomComponentRenderer_1 = __importDefault(require("../../../../../components/CustomComponentRenderer"));
|
|
46
|
+
const locale_1 = require("../../../../locale");
|
|
47
|
+
const SimpleHeader_1 = __importDefault(require("../../components/Header/SimpleHeader"));
|
|
48
|
+
const LoadingButton_1 = __importDefault(require("../../components/LoadingButton"));
|
|
49
|
+
const CurrentAgent_1 = __importStar(require("../../contexts/CurrentAgent"));
|
|
50
|
+
const CurrentMessage_1 = __importDefault(require("../../contexts/CurrentMessage"));
|
|
51
|
+
const runtime_1 = require("../../state/runtime");
|
|
52
|
+
const map_right_1 = __importDefault(require("../../utils/map-right"));
|
|
53
|
+
function PhotoGallery({ resultTitle, primaryColor }) {
|
|
54
|
+
const { childAgentId } = (0, runtime_1.useRuntimeState)();
|
|
55
|
+
const inheritedTheme = (0, material_1.useTheme)();
|
|
56
|
+
const theme = (0, react_1.useMemo)(() => {
|
|
57
|
+
let { primary } = inheritedTheme.palette;
|
|
58
|
+
try {
|
|
59
|
+
if (primaryColor) {
|
|
60
|
+
primary = inheritedTheme.palette.augmentColor({ color: { main: primaryColor } });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
console.error('augment primary color error', { error });
|
|
65
|
+
}
|
|
66
|
+
return (0, material_1.createTheme)(inheritedTheme, {
|
|
67
|
+
palette: { primary },
|
|
68
|
+
shape: {
|
|
69
|
+
borderRadius: 8,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
}, [inheritedTheme, primaryColor]);
|
|
73
|
+
return ((0, jsx_runtime_1.jsx)(material_1.ThemeProvider, { theme: theme, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { className: "aigne-layout aigne-photo-wall-layout", children: [(0, jsx_runtime_1.jsx)(SimpleHeader_1.default, { TitleProps: { fontSize: 48 }, DescriptionProps: { fontSize: 20 }, maxWidth: "md", mx: "auto", width: "100%", px: { xs: 2, sm: 3 } }), (0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: childAgentId, children: (0, jsx_runtime_1.jsx)(AgentInputRender, { className: "aigne-inputs aigne-photo-wall-inputs", maxWidth: "md", mx: "auto", width: "100%", px: { xs: 2, sm: 3 } }) }), (0, jsx_runtime_1.jsx)(OutputView, { resultTitle: resultTitle, className: "aigne-outputs aigne-photo-wall-outputs", gap: 2 })] }) }));
|
|
74
|
+
}
|
|
75
|
+
exports.default = PhotoGallery;
|
|
76
|
+
function AgentInputRender(_a) {
|
|
77
|
+
var props = __rest(_a, []);
|
|
78
|
+
const { appearanceInput } = (0, CurrentAgent_1.useCurrentAgent)();
|
|
79
|
+
if (!(appearanceInput === null || appearanceInput === void 0 ? void 0 : appearanceInput.componentId))
|
|
80
|
+
return null;
|
|
81
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({}, props, { children: (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: appearanceInput.componentId, properties: appearanceInput.componentProps }) })));
|
|
82
|
+
}
|
|
83
|
+
function NoOutputs() {
|
|
84
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Stack, { mt: 10, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { color: "text.disabled", children: "You haven't generated any pictures yet." }) }));
|
|
85
|
+
}
|
|
86
|
+
function OutputView(_a) {
|
|
87
|
+
var _b, _c, _d, _e, _f, _g;
|
|
88
|
+
var { resultTitle } = _a, props = __rest(_a, ["resultTitle"]);
|
|
89
|
+
const { t } = (0, locale_1.useLocaleContext)();
|
|
90
|
+
const { sessionState } = (0, runtime_1.useRuntimeState)();
|
|
91
|
+
const ref = (0, react_1.useRef)(null);
|
|
92
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ width: "100%", alignItems: "center", px: { xs: 2, sm: 3 }, mt: { xs: 2, sm: 3 } }, props, { children: [resultTitle && ((0, jsx_runtime_1.jsx)(material_1.Typography, { width: "100%", component: "h2", fontSize: 36, fontWeight: 700, textAlign: "center", children: (0, jsx_runtime_1.jsx)(react_wrap_balancer_1.default, { children: resultTitle }) })), sessionState.loaded && !((_b = sessionState.messages) === null || _b === void 0 ? void 0 : _b.length) && (0, jsx_runtime_1.jsx)(NoOutputs, {}), (0, jsx_runtime_1.jsxs)(lab_1.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 && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", sx: {
|
|
93
|
+
// FIXME: default using history height
|
|
94
|
+
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,
|
|
95
|
+
} })), (0, map_right_1.default)((_f = sessionState.messages) !== null && _f !== void 0 ? _f : [], (message) => ((0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: message.assistantId, children: (0, jsx_runtime_1.jsx)(CurrentMessage_1.default, { message: message, children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { children: (0, jsx_runtime_1.jsx)(OutputItemView, {}) }) }) }, message.taskId)))] }), (0, jsx_runtime_1.jsx)(material_1.Box, { my: 4, children: !!((_g = sessionState.messages) === null || _g === void 0 ? void 0 : _g.length) && !sessionState.noMoreMessage && ((0, jsx_runtime_1.jsx)(LoadingButton_1.default, { variant: "outlined", onClick: sessionState.loadMoreMessages, children: t('loadMore') })) })] })));
|
|
96
|
+
}
|
|
97
|
+
function OutputItemView() {
|
|
98
|
+
const { appearanceOutput } = (0, CurrentAgent_1.useCurrentAgent)();
|
|
99
|
+
if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId))
|
|
100
|
+
return null;
|
|
101
|
+
return ((0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProps }));
|
|
102
|
+
}
|
|
@@ -19,11 +19,11 @@ const types_1 = require("@blocklet/ai-runtime/types");
|
|
|
19
19
|
const react_1 = require("@iconify/react");
|
|
20
20
|
const material_1 = require("@mui/material");
|
|
21
21
|
const react_2 = require("react");
|
|
22
|
-
const ux_1 = require("
|
|
23
|
-
const locale_1 = require("
|
|
24
|
-
const session_1 = require("
|
|
25
|
-
const ActionButton_1 = require("
|
|
26
|
-
const UserInfo_1 = __importDefault(require("
|
|
22
|
+
const ux_1 = require("../../../../arcblock/ux");
|
|
23
|
+
const locale_1 = require("../../../../locale");
|
|
24
|
+
const session_1 = require("../../../../session");
|
|
25
|
+
const ActionButton_1 = __importDefault(require("../../components/ActionButton"));
|
|
26
|
+
const UserInfo_1 = __importDefault(require("../../components/UserInfo"));
|
|
27
27
|
const CurrentMessage_1 = require("../../contexts/CurrentMessage");
|
|
28
28
|
const getLineClamp = (line) => ({
|
|
29
29
|
display: '-webkit-box',
|
|
@@ -40,9 +40,18 @@ function PhotoGalleryItem() {
|
|
|
40
40
|
const [openDialog, setOpenDialog] = (0, react_2.useState)(false);
|
|
41
41
|
const objects = (_b = (_a = message.result) === null || _a === void 0 ? void 0 : _a.objects) !== null && _b !== void 0 ? _b : [];
|
|
42
42
|
const images = objects.flatMap((i) => { var _a; return (_a = i.data[types_1.RuntimeOutputVariable.images]) !== null && _a !== void 0 ? _a : []; });
|
|
43
|
+
if (!images.length && message.error) {
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Stack, { alignItems: "center", justifyContent: "center", sx: {
|
|
45
|
+
aspectRatio: 1,
|
|
46
|
+
bgcolor: 'grey.50',
|
|
47
|
+
borderRadius: 1,
|
|
48
|
+
overflow: 'hidden',
|
|
49
|
+
wordBreak: 'break-word',
|
|
50
|
+
}, children: (0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "error", sx: { bgcolor: 'transparent' }, children: message.error.message }) }));
|
|
51
|
+
}
|
|
43
52
|
return images.map(({ url }, index) => {
|
|
44
53
|
var _a;
|
|
45
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, {
|
|
54
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
46
55
|
position: 'relative',
|
|
47
56
|
overflow: 'hidden',
|
|
48
57
|
cursor: 'pointer',
|
|
@@ -90,7 +99,7 @@ function PromptDialog(_a) {
|
|
|
90
99
|
const { t } = (0, locale_1.useLocaleContext)();
|
|
91
100
|
const { session: authSession } = (0, session_1.useSessionContext)();
|
|
92
101
|
const borderRadius = 1;
|
|
93
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Dialog, Object.assign({ fullWidth: true, maxWidth:
|
|
102
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Dialog, Object.assign({ fullWidth: true, maxWidth: "xl", scroll: "paper", slotProps: {
|
|
94
103
|
backdrop: {
|
|
95
104
|
sx: {
|
|
96
105
|
bgcolor: 'rgba(255, 255, 255, 0.4)',
|
|
@@ -123,7 +132,7 @@ function PromptDialog(_a) {
|
|
|
123
132
|
borderColor: 'divider',
|
|
124
133
|
overflow: 'auto',
|
|
125
134
|
maxHeight: { xs: 'unset', md: '40vh' },
|
|
126
|
-
}, children: parameters === null || parameters === void 0 ? void 0 : parameters.question }), (0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(ActionButton_1.
|
|
135
|
+
}, children: parameters === null || parameters === void 0 ? void 0 : parameters.question }), (0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(ActionButton_1.default, { autoReset: true, size: "small", variant: "contained", placement: "right", tip: t('copyToClipboard'), title: t('copy'), titleSucceed: t('copied'), icon: "tabler:copy", iconSucceed: "tabler:copy-check-filled", onClick: () => {
|
|
127
136
|
window.navigator.clipboard.writeText(parameters === null || parameters === void 0 ? void 0 : parameters.question);
|
|
128
137
|
}, sx: {
|
|
129
138
|
borderRadius,
|
|
@@ -22,6 +22,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
25
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
38
|
};
|
|
@@ -30,16 +41,18 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
30
41
|
const types_1 = require("@blocklet/ai-runtime/types");
|
|
31
42
|
const material_1 = require("@mui/material");
|
|
32
43
|
const react_1 = require("react");
|
|
33
|
-
const
|
|
34
|
-
const CustomComponentRenderer_1 = __importDefault(require("
|
|
35
|
-
const session_1 = require("
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const ScrollView_1 =
|
|
44
|
+
const react_scroll_to_bottom_1 = require("react-scroll-to-bottom");
|
|
45
|
+
const CustomComponentRenderer_1 = __importDefault(require("../../../../../components/CustomComponentRenderer"));
|
|
46
|
+
const session_1 = require("../../../../session");
|
|
47
|
+
const SimpleHeader_1 = __importDefault(require("../../components/Header/SimpleHeader"));
|
|
48
|
+
const SimpleLayout_1 = __importDefault(require("../../components/Layout/SimpleLayout"));
|
|
49
|
+
const ScrollView_1 = __importDefault(require("../../components/ScrollView"));
|
|
50
|
+
const UserInfo_1 = __importDefault(require("../../components/UserInfo"));
|
|
39
51
|
const CurrentAgent_1 = __importStar(require("../../contexts/CurrentAgent"));
|
|
40
52
|
const CurrentMessage_1 = __importStar(require("../../contexts/CurrentMessage"));
|
|
41
53
|
const runtime_1 = require("../../state/runtime");
|
|
42
|
-
|
|
54
|
+
const MessageSuggestedQuestions_1 = __importDefault(require("../ChatOutput/MessageSuggestedQuestions"));
|
|
55
|
+
function SimpleChat({ primaryColor, scrollViewProps = { scroll: 'window', initialScrollBehavior: 'auto' }, }) {
|
|
43
56
|
const inheritedTheme = (0, material_1.useTheme)();
|
|
44
57
|
const theme = (0, react_1.useMemo)(() => {
|
|
45
58
|
let { primary } = inheritedTheme.palette;
|
|
@@ -58,31 +71,31 @@ function SimpleChat({ primaryColor }) {
|
|
|
58
71
|
},
|
|
59
72
|
});
|
|
60
73
|
}, [inheritedTheme, primaryColor]);
|
|
61
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
74
|
+
return ((0, jsx_runtime_1.jsx)(ScrollView_1.default, Object.assign({}, scrollViewProps, { children: (0, jsx_runtime_1.jsx)(material_1.ThemeProvider, { theme: theme, children: (0, jsx_runtime_1.jsx)(SimpleChatView, {}) }) })));
|
|
62
75
|
}
|
|
63
76
|
exports.default = SimpleChat;
|
|
64
77
|
function SimpleChatView() {
|
|
65
|
-
const {
|
|
66
|
-
const scrollToBottom = (0,
|
|
78
|
+
const { childAgentId, sessionState } = (0, runtime_1.useRuntimeState)();
|
|
79
|
+
const scrollToBottom = (0, react_scroll_to_bottom_1.useScrollToBottom)();
|
|
67
80
|
(0, react_1.useEffect)(() => {
|
|
68
81
|
if (sessionState.running)
|
|
69
|
-
scrollToBottom();
|
|
82
|
+
scrollToBottom({ behavior: 'smooth' });
|
|
70
83
|
}, [scrollToBottom, sessionState.running]);
|
|
71
|
-
|
|
72
|
-
const description = (appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.description) || agent.description;
|
|
73
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { flexGrow: 1, maxWidth: "md", width: "100%", mx: "auto", px: { xs: 2, sm: 3 }, children: [(0, jsx_runtime_1.jsx)(material_1.Stack, { gap: 2, mt: 8, mb: 4, children: (0, jsx_runtime_1.jsxs)(react_wrap_balancer_1.Provider, { children: [title && ((0, jsx_runtime_1.jsx)(material_1.Typography, { component: "h5", fontSize: 30, fontWeight: 700, textAlign: "center", children: (0, jsx_runtime_1.jsx)(react_wrap_balancer_1.default, { children: title }) })), description && ((0, jsx_runtime_1.jsx)(material_1.Typography, { textAlign: "center", children: (0, jsx_runtime_1.jsx)(react_wrap_balancer_1.default, { children: description }) }))] }) }), (0, jsx_runtime_1.jsx)(material_1.Stack, { children: (0, jsx_runtime_1.jsx)(OutputView, {}) }), (0, jsx_runtime_1.jsx)(material_1.Box, { flexGrow: 1, minHeight: 200 }), (0, jsx_runtime_1.jsx)(material_1.Stack, { sx: { position: 'sticky', bottom: 0, py: 1, bgcolor: 'background.paper', zIndex: 10 }, children: (0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: childAgentId, children: (0, jsx_runtime_1.jsx)(AgentInputRender, {}) }) })] }));
|
|
84
|
+
return ((0, jsx_runtime_1.jsxs)(SimpleLayout_1.default, { children: [(0, jsx_runtime_1.jsx)(SimpleHeader_1.default, {}), (0, jsx_runtime_1.jsx)(OutputView, { className: "aigne-outputs aigne-simple-chat-outputs", flexGrow: 1, pb: 10 }), (0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: childAgentId, children: (0, jsx_runtime_1.jsx)(AgentInputRender, { className: "aigne-inputs aigne-simple-chat-inputs", sx: { position: 'sticky', bottom: 0, pt: 1, pb: 2, bgcolor: 'background.paper', zIndex: 10 } }) })] }));
|
|
74
85
|
}
|
|
75
|
-
function AgentInputRender() {
|
|
86
|
+
function AgentInputRender(_a) {
|
|
87
|
+
var props = __rest(_a, []);
|
|
76
88
|
const { appearanceInput } = (0, CurrentAgent_1.useCurrentAgent)();
|
|
77
89
|
if (!(appearanceInput === null || appearanceInput === void 0 ? void 0 : appearanceInput.componentId))
|
|
78
90
|
return null;
|
|
79
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Stack, { children: (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: appearanceInput.componentId, properties: appearanceInput.componentProps }) }));
|
|
91
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({}, props, { children: (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: appearanceInput.componentId, properties: appearanceInput.componentProps }) })));
|
|
80
92
|
}
|
|
81
|
-
function OutputView() {
|
|
82
|
-
var
|
|
93
|
+
function OutputView(_a) {
|
|
94
|
+
var _b, _c;
|
|
95
|
+
var props = __rest(_a, []);
|
|
83
96
|
const { sessionState } = (0, runtime_1.useRuntimeState)();
|
|
84
|
-
const lastMessage = (
|
|
85
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: 2, children: [(
|
|
97
|
+
const lastMessage = (_b = sessionState.messages) === null || _b === void 0 ? void 0 : _b.slice(-1)[0];
|
|
98
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ gap: 2 }, props, { children: [(_c = sessionState.messages) === null || _c === void 0 ? void 0 : _c.map((message) => ((0, jsx_runtime_1.jsx)(material_1.Stack, { children: (0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: message.assistantId, children: (0, jsx_runtime_1.jsx)(CurrentMessage_1.default, { message: message, children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { children: (0, jsx_runtime_1.jsx)(OutputItemView, {}) }) }) }) }))), lastMessage && ((0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: lastMessage.assistantId, children: (0, jsx_runtime_1.jsx)(CurrentMessage_1.default, { message: lastMessage, children: (0, jsx_runtime_1.jsx)(SuggestedQuestionsView, {}) }) }))] })));
|
|
86
99
|
}
|
|
87
100
|
function OutputItemView() {
|
|
88
101
|
var _a, _b, _c, _d, _e;
|
|
@@ -92,7 +105,6 @@ function OutputItemView() {
|
|
|
92
105
|
const { session: authSession } = (0, session_1.useSessionContext)();
|
|
93
106
|
if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId))
|
|
94
107
|
return null;
|
|
95
|
-
// return <CustomComponentRenderer componentId={input.componentId} properties={input.componentProps} props={{hideAvatar: false}} />;
|
|
96
108
|
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: 2, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(UserInfo_1.default, { 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: (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProps, props: {
|
|
97
109
|
renderType: 'parameters',
|
|
98
110
|
} }) }) }), (0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(UserInfo_1.default, { 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: (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProps, props: {
|
|
@@ -107,7 +119,7 @@ function SuggestedQuestionsView() {
|
|
|
107
119
|
var _a, _b, _c;
|
|
108
120
|
return (_c = (_b = (_a = message === null || message === void 0 ? void 0 : message.result) === null || _a === void 0 ? void 0 : _a.objects) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.data[types_1.RuntimeOutputVariable.suggestedQuestions];
|
|
109
121
|
}, [message]);
|
|
110
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Box, { ml: 6.5, mr: 2.5, children: (suggestedQuestions === null || suggestedQuestions === void 0 ? void 0 : suggestedQuestions.length) ? ((0, jsx_runtime_1.jsx)(
|
|
122
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, { ml: 6.5, mr: 2.5, children: (suggestedQuestions === null || suggestedQuestions === void 0 ? void 0 : suggestedQuestions.length) ? ((0, jsx_runtime_1.jsx)(MessageSuggestedQuestions_1.default, { dataSource: suggestedQuestions, onClick: (item) => {
|
|
111
123
|
execute({ aid, parameters: Object.assign(Object.assign({}, message.parameters), { question: item.question }) });
|
|
112
124
|
} })) : null }));
|
|
113
125
|
}
|
|
@@ -5,13 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const material_1 = require("@mui/material");
|
|
8
|
-
const
|
|
9
|
-
const MarkdownRenderer_1 = __importDefault(require("../../../MarkdownRenderer"));
|
|
8
|
+
const MarkdownRenderer_1 = __importDefault(require("../../components/MarkdownRenderer"));
|
|
10
9
|
const CurrentMessage_1 = require("../../contexts/CurrentMessage");
|
|
10
|
+
const MessageErrorView_1 = __importDefault(require("../ChatOutput/MessageErrorView"));
|
|
11
|
+
const MessageMetadataRenderer_1 = __importDefault(require("../ChatOutput/MessageMetadataRenderer"));
|
|
11
12
|
function SimpleOutput() {
|
|
12
13
|
var _a, _b;
|
|
13
14
|
const { message } = (0, CurrentMessage_1.useCurrentMessage)();
|
|
14
15
|
const objects = (_a = message.result) === null || _a === void 0 ? void 0 : _a.objects;
|
|
15
|
-
|
|
16
|
+
const { error } = message;
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: 2, boxShadow: 1, borderRadius: 1, p: 2, children: [(0, jsx_runtime_1.jsx)(MarkdownRenderer_1.default, { children: (_b = message.result) === null || _b === void 0 ? void 0 : _b.content }), error && (0, jsx_runtime_1.jsx)(MessageErrorView_1.default, { error: error }), objects === null || objects === void 0 ? void 0 : objects.map((item) => (0, jsx_runtime_1.jsx)(MessageMetadataRenderer_1.default, { object: item.data }))] }));
|
|
16
18
|
}
|
|
17
19
|
exports.default = SimpleOutput;
|
|
@@ -22,6 +22,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
25
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
38
|
};
|
|
@@ -29,13 +40,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
40
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
30
41
|
const material_1 = require("@mui/material");
|
|
31
42
|
const react_1 = require("react");
|
|
32
|
-
const react_wrap_balancer_1 =
|
|
33
|
-
const CustomComponentRenderer_1 = __importDefault(require("
|
|
43
|
+
const react_wrap_balancer_1 = __importDefault(require("react-wrap-balancer"));
|
|
44
|
+
const CustomComponentRenderer_1 = __importDefault(require("../../../../../components/CustomComponentRenderer"));
|
|
45
|
+
const SimpleHeader_1 = __importDefault(require("../../components/Header/SimpleHeader"));
|
|
46
|
+
const SimpleLayout_1 = __importDefault(require("../../components/Layout/SimpleLayout"));
|
|
34
47
|
const CurrentAgent_1 = __importStar(require("../../contexts/CurrentAgent"));
|
|
35
48
|
const CurrentMessage_1 = __importDefault(require("../../contexts/CurrentMessage"));
|
|
36
49
|
const runtime_1 = require("../../state/runtime");
|
|
37
50
|
function SimplePage({ resultTitle, primaryColor }) {
|
|
38
|
-
const {
|
|
51
|
+
const { childAgentId } = (0, runtime_1.useRuntimeState)();
|
|
39
52
|
const inheritedTheme = (0, material_1.useTheme)();
|
|
40
53
|
const theme = (0, react_1.useMemo)(() => {
|
|
41
54
|
let { primary } = inheritedTheme.palette;
|
|
@@ -54,22 +67,22 @@ function SimplePage({ resultTitle, primaryColor }) {
|
|
|
54
67
|
},
|
|
55
68
|
});
|
|
56
69
|
}, [inheritedTheme, primaryColor]);
|
|
57
|
-
|
|
58
|
-
const description = (appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.description) || agent.description;
|
|
59
|
-
return ((0, jsx_runtime_1.jsx)(material_1.ThemeProvider, { theme: theme, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: 2, maxWidth: "md", width: "100%", mx: "auto", px: { xs: 2, sm: 3 }, children: [(0, jsx_runtime_1.jsx)(material_1.Stack, { gap: 2, mt: 8, mb: 4, children: (0, jsx_runtime_1.jsxs)(react_wrap_balancer_1.Provider, { children: [title && ((0, jsx_runtime_1.jsx)(material_1.Typography, { component: "h5", fontSize: 30, fontWeight: 700, textAlign: "center", children: (0, jsx_runtime_1.jsx)(react_wrap_balancer_1.default, { children: title }) })), description && ((0, jsx_runtime_1.jsx)(material_1.Typography, { textAlign: "center", children: (0, jsx_runtime_1.jsx)(react_wrap_balancer_1.default, { children: description }) }))] }) }), (0, jsx_runtime_1.jsx)(material_1.Stack, { children: (0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: childAgentId, children: (0, jsx_runtime_1.jsx)(AgentInputRender, {}) }) }), (0, jsx_runtime_1.jsx)(material_1.Stack, { children: (0, jsx_runtime_1.jsx)(OutputView, { resultTitle: resultTitle }) })] }) }));
|
|
70
|
+
return ((0, jsx_runtime_1.jsx)(material_1.ThemeProvider, { theme: theme, children: (0, jsx_runtime_1.jsxs)(SimpleLayout_1.default, { children: [(0, jsx_runtime_1.jsx)(SimpleHeader_1.default, {}), (0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: childAgentId, children: (0, jsx_runtime_1.jsx)(AgentInputRender, { className: "aigne-inputs aigne-simple-page-inputs" }) }), (0, jsx_runtime_1.jsx)(OutputView, { className: "aigne-outputs aigne-simple-page-outputs", resultTitle: resultTitle })] }) }));
|
|
60
71
|
}
|
|
61
72
|
exports.default = SimplePage;
|
|
62
|
-
function AgentInputRender() {
|
|
73
|
+
function AgentInputRender(_a) {
|
|
74
|
+
var props = __rest(_a, []);
|
|
63
75
|
const { appearanceInput } = (0, CurrentAgent_1.useCurrentAgent)();
|
|
64
76
|
if (!(appearanceInput === null || appearanceInput === void 0 ? void 0 : appearanceInput.componentId))
|
|
65
77
|
return null;
|
|
66
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Stack, { children: (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: appearanceInput.componentId, properties: appearanceInput.componentProps }) }));
|
|
78
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({}, props, { children: (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: appearanceInput.componentId, properties: appearanceInput.componentProps }) })));
|
|
67
79
|
}
|
|
68
|
-
function OutputView(
|
|
69
|
-
var
|
|
80
|
+
function OutputView(_a) {
|
|
81
|
+
var _b;
|
|
82
|
+
var { resultTitle } = _a, props = __rest(_a, ["resultTitle"]);
|
|
70
83
|
const { sessionState } = (0, runtime_1.useRuntimeState)();
|
|
71
|
-
const lastMessage = (
|
|
72
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Stack, { gap: 2, children: lastMessage && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [
|
|
84
|
+
const lastMessage = (_b = sessionState.messages) === null || _b === void 0 ? void 0 : _b.slice(-1)[0];
|
|
85
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ gap: 2, mt: 4 }, props, { children: lastMessage && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [resultTitle && ((0, jsx_runtime_1.jsx)(material_1.Typography, { width: "100%", component: "h5", fontSize: 36, fontWeight: 700, textAlign: "center", children: (0, jsx_runtime_1.jsx)(react_wrap_balancer_1.default, { children: resultTitle }) })), (0, jsx_runtime_1.jsx)(material_1.Stack, { children: (0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: lastMessage.assistantId, children: (0, jsx_runtime_1.jsx)(CurrentMessage_1.default, { message: lastMessage, children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { children: (0, jsx_runtime_1.jsx)(OutputItemView, {}) }) }) }) })] })) })));
|
|
73
86
|
}
|
|
74
87
|
function OutputItemView() {
|
|
75
88
|
const { appearanceOutput } = (0, CurrentAgent_1.useCurrentAgent)();
|