@blocklet/pages-kit 0.2.299 → 0.2.301
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/builtin/async/ai-runtime/api/{assistant.js → agent.js} +5 -7
- package/lib/cjs/builtin/async/ai-runtime/api/session.js +20 -18
- package/lib/cjs/builtin/async/ai-runtime/components/ActionButton.js +1 -2
- package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/index.js +2 -2
- package/lib/cjs/builtin/async/ai-runtime/components/{GlobalLoading.js → GlobalLoading/index.js} +5 -2
- package/lib/cjs/builtin/async/ai-runtime/components/{runtime-form/RuntimeFormHeader.js → Header/SimpleHeader.js} +9 -16
- package/lib/cjs/builtin/async/ai-runtime/components/{runtime-form/RuntimeFormSubmit.js → Layout/SimpleLayout.js} +6 -8
- package/lib/cjs/builtin/async/ai-runtime/components/MarkdownRenderer.js +2 -2
- package/lib/cjs/builtin/async/ai-runtime/components/{RuntimeProvider.js → RuntimeCommonProvider.js} +2 -2
- package/lib/cjs/builtin/async/ai-runtime/components/ScrollView.js +40 -57
- package/lib/cjs/builtin/async/ai-runtime/components/SocialShare.js +8 -3
- package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +0 -21
- package/lib/cjs/builtin/async/ai-runtime/components/{common/UserInfo.js → UserInfo.js} +1 -1
- package/lib/cjs/builtin/async/ai-runtime/constants.js +4 -1
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentAgent.js +4 -4
- package/lib/cjs/builtin/async/ai-runtime/contexts/Runtime.js +32 -0
- package/lib/cjs/builtin/async/ai-runtime/index.js +16 -63
- package/lib/cjs/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +72 -0
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime → runtime/Runtime}/index.js +11 -7
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/AutoForm/index.js +4 -4
- package/lib/cjs/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/MessageActions.js +7 -4
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageErrorView.js +2 -2
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageItemView.js +6 -6
- package/lib/cjs/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageMetadataRenderer.js +1 -1
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +102 -0
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/PhotoGalleryItem/index.js +17 -8
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleChat/index.js +34 -22
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleOutput/index.js +5 -3
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimplePage/index.js +25 -12
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/state/assistant.js → state/agent.js} +12 -12
- package/lib/cjs/builtin/async/ai-runtime/{components/runtime/state → state}/runtime.js +5 -10
- package/lib/cjs/builtin/async/ai-runtime/state/session.js +91 -92
- package/lib/esm/builtin/async/ai-runtime/api/{assistant.js → agent.js} +3 -5
- package/lib/esm/builtin/async/ai-runtime/api/session.js +19 -17
- package/lib/esm/builtin/async/ai-runtime/components/ActionButton.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/index.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/components/{GlobalLoading.js → GlobalLoading/index.js} +2 -1
- package/lib/esm/builtin/async/ai-runtime/components/Header/SimpleHeader.js +23 -0
- package/lib/esm/builtin/async/ai-runtime/components/{runtime-form/RuntimeFormSubmit.js → Layout/SimpleLayout.js} +5 -4
- package/lib/esm/builtin/async/ai-runtime/components/MarkdownRenderer.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/components/{RuntimeProvider.js → RuntimeCommonProvider.js} +1 -1
- package/lib/esm/builtin/async/ai-runtime/components/ScrollView.js +19 -57
- package/lib/esm/builtin/async/ai-runtime/components/SocialShare.js +8 -3
- package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +0 -21
- package/lib/esm/builtin/async/ai-runtime/components/{common/UserInfo.js → UserInfo.js} +1 -1
- package/lib/esm/builtin/async/ai-runtime/constants.js +3 -0
- package/lib/esm/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentAgent.js +3 -3
- package/lib/esm/builtin/async/ai-runtime/contexts/Runtime.js +26 -0
- package/lib/esm/builtin/async/ai-runtime/index.js +13 -58
- package/lib/esm/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +66 -0
- package/lib/esm/builtin/async/ai-runtime/{components/runtime → runtime/Runtime}/index.js +9 -5
- package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/AutoForm/index.js +4 -4
- package/lib/esm/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/MessageActions.js +2 -2
- package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageErrorView.js +2 -2
- package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageItemView.js +5 -5
- package/lib/esm/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageMetadataRenderer.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +73 -0
- package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/PhotoGalleryItem/index.js +17 -8
- package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleChat/index.js +34 -22
- package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleOutput/index.js +5 -3
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +63 -0
- package/lib/esm/builtin/async/ai-runtime/{components/runtime/state/assistant.js → state/agent.js} +9 -9
- package/lib/esm/builtin/async/ai-runtime/{components/runtime/state → state}/runtime.js +5 -10
- package/lib/esm/builtin/async/ai-runtime/state/session.js +91 -88
- package/lib/types/builtin/async/ai-runtime/api/{assistant.d.ts → agent.d.ts} +4 -4
- package/lib/types/builtin/async/ai-runtime/api/session.d.ts +7 -13
- package/lib/types/builtin/async/ai-runtime/components/ActionButton.d.ts +1 -1
- package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/index.d.ts +1 -1
- package/lib/types/builtin/async/ai-runtime/components/{GlobalLoading.d.ts → GlobalLoading/index.d.ts} +1 -0
- package/lib/types/builtin/async/ai-runtime/components/Header/SimpleHeader.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/Layout/SimpleLayout.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/components/LoadingButton.d.ts +2 -1
- package/lib/types/builtin/async/ai-runtime/components/{RuntimeProvider.d.ts → RuntimeCommonProvider.d.ts} +1 -1
- package/lib/types/builtin/async/ai-runtime/components/ScrollView.d.ts +8 -59
- package/lib/types/builtin/async/ai-runtime/constants.d.ts +3 -0
- package/lib/types/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentAgent.d.ts +1 -1
- package/lib/types/builtin/async/ai-runtime/contexts/Runtime.d.ts +14 -0
- package/lib/types/builtin/async/ai-runtime/index.d.ts +13 -24
- package/lib/types/builtin/async/ai-runtime/runtime/ChatBotButton/index.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.d.ts +1 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/index.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/state/agent.d.ts +17 -0
- package/lib/types/builtin/async/ai-runtime/{components/runtime/state → state}/runtime.d.ts +2 -2
- package/lib/types/builtin/async/ai-runtime/state/session.d.ts +10 -18
- package/lib/types/builtin/async/react-scroll-to-bottom.d.ts +2 -2
- package/package.json +7 -7
- package/lib/cjs/builtin/async/ai-runtime/components/LoadingListItemButton.js +0 -49
- package/lib/cjs/builtin/async/ai-runtime/components/PoweredBy.js +0 -22
- package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +0 -92
- package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionListView.js +0 -197
- package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionView.js +0 -122
- package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentListView.js +0 -152
- package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentView.js +0 -135
- package/lib/cjs/builtin/async/ai-runtime/components/common/ChatBot.js +0 -104
- package/lib/cjs/builtin/async/ai-runtime/components/common/index.js +0 -12
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterForm.js +0 -89
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +0 -66
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormFields.js +0 -61
- package/lib/cjs/builtin/async/ai-runtime/components/form/QuestionField.js +0 -44
- package/lib/cjs/builtin/async/ai-runtime/components/form/SettingButton.js +0 -88
- package/lib/cjs/builtin/async/ai-runtime/components/lottie/index.js +0 -34
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageErrorView.js +0 -35
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageItemView.js +0 -177
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageListView.js +0 -48
- package/lib/cjs/builtin/async/ai-runtime/components/runtime/components/PhotoGallery/index.js +0 -121
- package/lib/cjs/builtin/async/ai-runtime/components/runtime/constants.js +0 -6
- package/lib/cjs/builtin/async/ai-runtime/components/runtime/state/session.js +0 -213
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +0 -133
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +0 -60
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +0 -59
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/index.js +0 -28
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +0 -138
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +0 -31
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/index.js +0 -54
- package/lib/cjs/builtin/async/ai-runtime/components/session/CheckSession.js +0 -74
- package/lib/cjs/builtin/async/ai-runtime/components/session/SessionListView.js +0 -88
- package/lib/cjs/builtin/async/ai-runtime/hooks/auth.js +0 -31
- package/lib/cjs/builtin/async/ai-runtime/hooks/header.js +0 -69
- package/lib/cjs/builtin/async/ai-runtime/hooks/navigate.js +0 -38
- package/lib/cjs/builtin/async/ai-runtime/hooks/subscribe.js +0 -37
- package/lib/cjs/builtin/async/ai-runtime/hooks/useAsync.js +0 -32
- package/lib/cjs/builtin/async/ai-runtime/state/assistant.js +0 -59
- package/lib/cjs/builtin/async/ai-runtime/state/index.js +0 -423
- package/lib/cjs/builtin/async/ai-runtime/state/subscription.js +0 -52
- package/lib/cjs/builtin/async/ai-runtime/utils.js +0 -49
- package/lib/esm/builtin/async/ai-runtime/components/LoadingListItemButton.js +0 -46
- package/lib/esm/builtin/async/ai-runtime/components/PoweredBy.js +0 -19
- package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +0 -92
- package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionListView.js +0 -197
- package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionView.js +0 -122
- package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentListView.js +0 -152
- package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentView.js +0 -135
- package/lib/esm/builtin/async/ai-runtime/components/common/ChatBot.js +0 -98
- package/lib/esm/builtin/async/ai-runtime/components/common/index.js +0 -3
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterForm.js +0 -60
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +0 -59
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormFields.js +0 -54
- package/lib/esm/builtin/async/ai-runtime/components/form/QuestionField.js +0 -38
- package/lib/esm/builtin/async/ai-runtime/components/form/SettingButton.js +0 -82
- package/lib/esm/builtin/async/ai-runtime/components/lottie/index.js +0 -8
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageErrorView.js +0 -29
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageItemView.js +0 -146
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageListView.js +0 -42
- package/lib/esm/builtin/async/ai-runtime/components/runtime/components/PhotoGallery/index.js +0 -92
- package/lib/esm/builtin/async/ai-runtime/components/runtime/components/SimplePage/index.js +0 -50
- package/lib/esm/builtin/async/ai-runtime/components/runtime/constants.js +0 -3
- package/lib/esm/builtin/async/ai-runtime/components/runtime/state/session.js +0 -209
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +0 -102
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +0 -34
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +0 -53
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/index.js +0 -22
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +0 -132
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.js +0 -30
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +0 -25
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/index.js +0 -48
- package/lib/esm/builtin/async/ai-runtime/components/session/CheckSession.js +0 -68
- package/lib/esm/builtin/async/ai-runtime/components/session/SessionListView.js +0 -88
- package/lib/esm/builtin/async/ai-runtime/hooks/auth.js +0 -27
- package/lib/esm/builtin/async/ai-runtime/hooks/header.js +0 -62
- package/lib/esm/builtin/async/ai-runtime/hooks/navigate.js +0 -32
- package/lib/esm/builtin/async/ai-runtime/hooks/subscribe.js +0 -33
- package/lib/esm/builtin/async/ai-runtime/hooks/useAsync.js +0 -29
- package/lib/esm/builtin/async/ai-runtime/state/assistant.js +0 -54
- package/lib/esm/builtin/async/ai-runtime/state/index.js +0 -423
- package/lib/esm/builtin/async/ai-runtime/state/subscription.js +0 -47
- package/lib/esm/builtin/async/ai-runtime/utils.js +0 -42
- package/lib/types/builtin/async/ai-runtime/components/LoadingListItemButton.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/PoweredBy.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/components/collection/CollectionEditDialog.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/CollectionListView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/CollectionView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/DocumentListView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/DocumentView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/common/ChatBot.d.ts +0 -13
- package/lib/types/builtin/async/ai-runtime/components/common/index.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/components/form/ParameterForm.d.ts +0 -13
- package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormDialog.d.ts +0 -28
- package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormFields.d.ts +0 -11
- package/lib/types/builtin/async/ai-runtime/components/form/QuestionField.d.ts +0 -14
- package/lib/types/builtin/async/ai-runtime/components/form/SettingButton.d.ts +0 -9
- package/lib/types/builtin/async/ai-runtime/components/lottie/index.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/components/message/MessageErrorView.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/message/MessageItemView.d.ts +0 -15
- package/lib/types/builtin/async/ai-runtime/components/message/MessageListView.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/components/runtime/components/PhotoGallery/index.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/runtime/components/PhotoGalleryItem/index.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/components/runtime/components/SimpleChat/index.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/components/runtime/constants.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/components/runtime/state/assistant.d.ts +0 -17
- package/lib/types/builtin/async/ai-runtime/components/runtime/state/session.d.ts +0 -29
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/InitialForm.d.ts +0 -10
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.d.ts +0 -6
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/index.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/index.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/components/session/CheckSession.d.ts +0 -8
- package/lib/types/builtin/async/ai-runtime/components/session/SessionListView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/hooks/auth.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/hooks/header.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/hooks/navigate.d.ts +0 -25
- package/lib/types/builtin/async/ai-runtime/hooks/subscribe.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/hooks/useAsync.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/state/assistant.d.ts +0 -15
- package/lib/types/builtin/async/ai-runtime/state/index.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/state/subscription.d.ts +0 -15
- package/lib/types/builtin/async/ai-runtime/utils.d.ts +0 -20
- /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/LanguageField.js +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/NumberField.js +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/RadioField.js +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/SelectField.js +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/StringField.js +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/{state/loading.js → components/GlobalLoading/state.js} +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentMessage.js +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageSuggestedQuestions.js +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/ReferenceLinks.js +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/index.js +0 -0
- /package/lib/cjs/builtin/async/ai-runtime/{components/runtime/utils → utils}/map-right.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/LanguageField.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/NumberField.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/RadioField.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/SelectField.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/StringField.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/{state/loading.js → components/GlobalLoading/state.js} +0 -0
- /package/lib/esm/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentMessage.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageSuggestedQuestions.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/ReferenceLinks.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/index.js +0 -0
- /package/lib/esm/builtin/async/ai-runtime/{components/runtime/utils → utils}/map-right.js +0 -0
- /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/LanguageField.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/NumberField.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/RadioField.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/SelectField.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/StringField.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{state/loading.d.ts → components/GlobalLoading/state.d.ts} +0 -0
- /package/lib/types/builtin/async/ai-runtime/components/{common/UserInfo.d.ts → UserInfo.d.ts} +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentMessage.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/runtime → runtime/Runtime}/index.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/AutoForm/index.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/MessageActions.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageErrorView.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageItemView.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageMetadataRenderer.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageSuggestedQuestions.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/ReferenceLinks.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/index.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleOutput/index.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimplePage/index.d.ts +0 -0
- /package/lib/types/builtin/async/ai-runtime/{components/runtime/utils → utils}/map-right.d.ts +0 -0
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import { Icon } from '@iconify/react';
|
|
3
|
-
// import { Button, Stack, Typography } from '@mui/material';
|
|
4
|
-
// import { useEffect, useState } from 'react';
|
|
5
|
-
// import { Result, Toast } from '../../../../arcblock/ux';
|
|
6
|
-
// import { useLocaleContext } from '../../../../locale';
|
|
7
|
-
// import { getSessions } from '../../api/session';
|
|
8
|
-
// import { useCurrentPage, useNavigateTo, useNavigateWithQuery } from '../../hooks/navigate';
|
|
9
|
-
// import { createDatasetDetailState, createState } from '../../state';
|
|
10
|
-
// import { parseIdentity } from '../../utils';
|
|
11
|
-
// import { globalLoadingState } from '../GlobalLoading';
|
|
12
|
-
// import Layout from '../layout';
|
|
13
|
-
// import LoadingButton from '../LoadingButton';
|
|
14
|
-
// export default function CollectionView({ releaseId }: { releaseId: string }) {
|
|
15
|
-
// const { t } = useLocaleContext();
|
|
16
|
-
// const state = createState({ releaseId })();
|
|
17
|
-
// const { datasetId } = useCurrentPage();
|
|
18
|
-
// if (!datasetId) throw new Error('Invalid datasetId');
|
|
19
|
-
// const datasetState = createDatasetDetailState({ datasetId })();
|
|
20
|
-
// const to = useNavigateTo();
|
|
21
|
-
// const navigate = useNavigateWithQuery();
|
|
22
|
-
// useEffect(() => {
|
|
23
|
-
// datasetState.reload();
|
|
24
|
-
// }, []);
|
|
25
|
-
// const startChat = async () => {
|
|
26
|
-
// try {
|
|
27
|
-
// const identity = parseIdentity(releaseId);
|
|
28
|
-
// await globalLoadingState.getState().run(async () => {
|
|
29
|
-
// const { sessions } = await getSessions(identity);
|
|
30
|
-
// const session =
|
|
31
|
-
// sessions?.find((i) => i.parameters.datasetId === datasetId) ??
|
|
32
|
-
// (await state.createSession({ name: datasetState.dataset?.name, parameters: { datasetId } }));
|
|
33
|
-
// navigate({ page: 'session', sessionId: session.id });
|
|
34
|
-
// });
|
|
35
|
-
// } catch (error) {
|
|
36
|
-
// Toast.error(error.message);
|
|
37
|
-
// console.error('create session error', error);
|
|
38
|
-
// }
|
|
39
|
-
// };
|
|
40
|
-
// const [uploading, setUploading] = useState(false);
|
|
41
|
-
// const handleUploadFile = () => {
|
|
42
|
-
// const input = document.createElement('input');
|
|
43
|
-
// input.type = 'file';
|
|
44
|
-
// input.accept = '*.pdf,*.txt,*.doc,*.docx';
|
|
45
|
-
// input.onchange = async (e) => {
|
|
46
|
-
// const files = [...e.target.files];
|
|
47
|
-
// if (!files.length) return;
|
|
48
|
-
// try {
|
|
49
|
-
// setUploading(true);
|
|
50
|
-
// await Promise.all(files.map((file) => datasetState.createDocument('file', file)));
|
|
51
|
-
// } catch (error) {
|
|
52
|
-
// Toast.error(error.message);
|
|
53
|
-
// throw error;
|
|
54
|
-
// } finally {
|
|
55
|
-
// setUploading(false);
|
|
56
|
-
// }
|
|
57
|
-
// };
|
|
58
|
-
// input.click();
|
|
59
|
-
// };
|
|
60
|
-
// if (datasetState.error) {
|
|
61
|
-
// return <Result status="error" title={datasetState.error.message} sx={{ bgcolor: 'transparent', my: 10 }} />;
|
|
62
|
-
// }
|
|
63
|
-
// return (
|
|
64
|
-
// <Layout>
|
|
65
|
-
// <Stack mt={5} mb={2.5} alignItems="flex-start">
|
|
66
|
-
// <Button
|
|
67
|
-
// sx={{ ml: -0.5 }}
|
|
68
|
-
// startIcon={<Icon icon="tabler:chevron-left" />}
|
|
69
|
-
// component={RouterLink}
|
|
70
|
-
// to={to({ page: 'collections', datasetId: undefined })}>
|
|
71
|
-
// {t('back')}
|
|
72
|
-
// </Button>
|
|
73
|
-
// <Stack
|
|
74
|
-
// width="100%"
|
|
75
|
-
// direction="row"
|
|
76
|
-
// flexWrap="wrap"
|
|
77
|
-
// py={2.5}
|
|
78
|
-
// gap={1}
|
|
79
|
-
// justifyContent="space-between"
|
|
80
|
-
// alignItems="center"
|
|
81
|
-
// borderBottom={1}
|
|
82
|
-
// borderColor="divider">
|
|
83
|
-
// <Stack>
|
|
84
|
-
// <Typography component="h1" sx={{ fontSize: 32, lineHeight: '44px', fontWeight: 700 }}>
|
|
85
|
-
// {datasetState.dataset ? datasetState.dataset.name || t('unnamed') : null}
|
|
86
|
-
// </Typography>
|
|
87
|
-
// <Typography>{datasetState.dataset?.description}</Typography>
|
|
88
|
-
// </Stack>
|
|
89
|
-
// <Stack direction="row" alignItems="center" gap={1}>
|
|
90
|
-
// <LoadingButton
|
|
91
|
-
// startIcon={<Icon icon="tabler:upload" />}
|
|
92
|
-
// variant="outlined"
|
|
93
|
-
// color="black"
|
|
94
|
-
// loading={uploading}
|
|
95
|
-
// loadingPosition="start"
|
|
96
|
-
// onClick={() => handleUploadFile()}>
|
|
97
|
-
// {t('uploadFile')}
|
|
98
|
-
// </LoadingButton>
|
|
99
|
-
// <Button
|
|
100
|
-
// startIcon={<Icon icon="tabler:plus" />}
|
|
101
|
-
// variant="outlined"
|
|
102
|
-
// color="black"
|
|
103
|
-
// onClick={() => navigate({ page: 'document', documentId: '' })}>
|
|
104
|
-
// {t('newObject', { object: t('document') })}
|
|
105
|
-
// </Button>
|
|
106
|
-
// <LoadingButton
|
|
107
|
-
// color="black"
|
|
108
|
-
// startIcon={<Icon icon="tabler:message-circle-2" />}
|
|
109
|
-
// variant="contained"
|
|
110
|
-
// onClick={startChat}>
|
|
111
|
-
// {t('chat')}
|
|
112
|
-
// </LoadingButton>
|
|
113
|
-
// </Stack>
|
|
114
|
-
// </Stack>
|
|
115
|
-
// </Stack>
|
|
116
|
-
// <DocumentListView
|
|
117
|
-
// datasetId={datasetId}
|
|
118
|
-
// onEdit={(document) => navigate({ page: 'document', documentId: document?.id || '' })}
|
|
119
|
-
// />
|
|
120
|
-
// </Layout>
|
|
121
|
-
// );
|
|
122
|
-
// }
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import { Icon } from '@iconify/react';
|
|
3
|
-
// import {
|
|
4
|
-
// Box,
|
|
5
|
-
// Button,
|
|
6
|
-
// CircularProgress,
|
|
7
|
-
// ClickAwayListener,
|
|
8
|
-
// Divider,
|
|
9
|
-
// Grid,
|
|
10
|
-
// List,
|
|
11
|
-
// ListItemButton,
|
|
12
|
-
// Paper,
|
|
13
|
-
// Popper,
|
|
14
|
-
// Stack,
|
|
15
|
-
// Typography,
|
|
16
|
-
// } from '@mui/material';
|
|
17
|
-
// import { useState } from 'react';
|
|
18
|
-
// import { useLocaleContext } from '../../../../locale';
|
|
19
|
-
// import { createDatasetDetailState } from '../../state';
|
|
20
|
-
// import LoadingListItemButton from '../LoadingListItemButton';
|
|
21
|
-
// export default function DocumentListView({
|
|
22
|
-
// datasetId,
|
|
23
|
-
// onEdit,
|
|
24
|
-
// }: {
|
|
25
|
-
// datasetId: string;
|
|
26
|
-
// onEdit: (doc?: Document) => void;
|
|
27
|
-
// }) {
|
|
28
|
-
// const { t } = useLocaleContext();
|
|
29
|
-
// const state = createDatasetDetailState({ datasetId })();
|
|
30
|
-
// const [menuState, setMenuState] = useState<{
|
|
31
|
-
// anchorEl: HTMLElement;
|
|
32
|
-
// item: Document;
|
|
33
|
-
// }>();
|
|
34
|
-
// return (
|
|
35
|
-
// <Stack>
|
|
36
|
-
// {!state.list?.length && (
|
|
37
|
-
// <Stack textAlign="center" alignItems="center" gap={0.5} mt="10vh" mx={3}>
|
|
38
|
-
// {state.loading ? (
|
|
39
|
-
// <CircularProgress size={24} />
|
|
40
|
-
// ) : (
|
|
41
|
-
// <>
|
|
42
|
-
// <Typography fontSize={18}>{'📄'}</Typography>
|
|
43
|
-
// <Typography fontSize={12} sx={{ color: 'text.secondary' }}>
|
|
44
|
-
// {t('noData', { data: t('document') })}
|
|
45
|
-
// </Typography>
|
|
46
|
-
// <Button onClick={() => onEdit()}>{t('createObject', { object: t('document') })}</Button>
|
|
47
|
-
// </>
|
|
48
|
-
// )}
|
|
49
|
-
// </Stack>
|
|
50
|
-
// )}
|
|
51
|
-
// <Grid container spacing={2} pt="1px">
|
|
52
|
-
// {state.list?.map((item) => (
|
|
53
|
-
// <Grid key={item.id} item xs={6} sm={4} md={3} onClick={() => onEdit(item)}>
|
|
54
|
-
// <Box
|
|
55
|
-
// sx={{
|
|
56
|
-
// width: '100%',
|
|
57
|
-
// position: 'relative',
|
|
58
|
-
// ':before': { content: '""', display: 'block', paddingBottom: '141.4%' },
|
|
59
|
-
// }}>
|
|
60
|
-
// <Paper
|
|
61
|
-
// className={menuState?.item.id === item.id ? 'menu-active' : ''}
|
|
62
|
-
// sx={{
|
|
63
|
-
// position: 'absolute',
|
|
64
|
-
// left: 0,
|
|
65
|
-
// top: 0,
|
|
66
|
-
// width: '100%',
|
|
67
|
-
// height: '100%',
|
|
68
|
-
// overflow: 'hidden',
|
|
69
|
-
// boxShadow: 1,
|
|
70
|
-
// display: 'flex',
|
|
71
|
-
// flexDirection: 'column',
|
|
72
|
-
// pb: 1,
|
|
73
|
-
// cursor: 'pointer',
|
|
74
|
-
// '.hover-visible': { display: 'none' },
|
|
75
|
-
// ':hover, &.menu-active': {
|
|
76
|
-
// boxShadow: 2,
|
|
77
|
-
// '.hover-visible': {
|
|
78
|
-
// display: 'flex',
|
|
79
|
-
// },
|
|
80
|
-
// },
|
|
81
|
-
// }}>
|
|
82
|
-
// <Stack direction="row" sx={{ px: 2, pt: 1.5 }}>
|
|
83
|
-
// <Typography variant="subtitle2" noWrap sx={{ flex: 1, lineHeight: '24px', minHeight: 24 }}>
|
|
84
|
-
// {item.name}
|
|
85
|
-
// </Typography>
|
|
86
|
-
// <Box className="hover-visible">
|
|
87
|
-
// <Button
|
|
88
|
-
// sx={{ minWidth: 24, minHeight: 24, p: 0 }}
|
|
89
|
-
// onClick={(e) => {
|
|
90
|
-
// e.stopPropagation();
|
|
91
|
-
// e.preventDefault();
|
|
92
|
-
// setMenuState({
|
|
93
|
-
// anchorEl: e.currentTarget,
|
|
94
|
-
// item,
|
|
95
|
-
// });
|
|
96
|
-
// }}>
|
|
97
|
-
// <Icon icon="mdi:more-horiz" fontSize={18} />
|
|
98
|
-
// </Button>
|
|
99
|
-
// </Box>
|
|
100
|
-
// </Stack>
|
|
101
|
-
// <Divider sx={{ mx: 2, my: 1 }} />
|
|
102
|
-
// <Typography
|
|
103
|
-
// sx={{
|
|
104
|
-
// flex: 1,
|
|
105
|
-
// px: 2,
|
|
106
|
-
// overflow: 'hidden',
|
|
107
|
-
// wordBreak: 'break-word',
|
|
108
|
-
// fontSize: 10,
|
|
109
|
-
// lineHeight: '16px',
|
|
110
|
-
// }}>
|
|
111
|
-
// {item.content}
|
|
112
|
-
// </Typography>
|
|
113
|
-
// </Paper>
|
|
114
|
-
// </Box>
|
|
115
|
-
// </Grid>
|
|
116
|
-
// ))}
|
|
117
|
-
// </Grid>
|
|
118
|
-
// <Popper
|
|
119
|
-
// open={Boolean(menuState)}
|
|
120
|
-
// anchorEl={menuState?.anchorEl}
|
|
121
|
-
// placement="bottom-start"
|
|
122
|
-
// sx={{ zIndex: (theme) => theme.zIndex.modal + 1 }}>
|
|
123
|
-
// <ClickAwayListener onClickAway={() => setMenuState(undefined)}>
|
|
124
|
-
// <Paper
|
|
125
|
-
// sx={{
|
|
126
|
-
// boxShadow: `0px 8px 16px 0px rgba(2, 7, 19, 0.08), 0px 0px 0px 1px rgba(2, 7, 19, 0.08)`,
|
|
127
|
-
// }}>
|
|
128
|
-
// <List dense sx={{ p: 0.5, '.MuiButtonBase-root': { borderRadius: 1 } }}>
|
|
129
|
-
// <ListItemButton
|
|
130
|
-
// onClick={async () => {
|
|
131
|
-
// if (!menuState?.item) return;
|
|
132
|
-
// onEdit(menuState.item);
|
|
133
|
-
// setMenuState(undefined);
|
|
134
|
-
// }}>
|
|
135
|
-
// {t('edit')}
|
|
136
|
-
// </ListItemButton>
|
|
137
|
-
// <LoadingListItemButton
|
|
138
|
-
// sx={{ color: 'error.main' }}
|
|
139
|
-
// onClick={async () => {
|
|
140
|
-
// if (!menuState?.item) return;
|
|
141
|
-
// await state.deleteDocument(menuState.item.id);
|
|
142
|
-
// setMenuState(undefined);
|
|
143
|
-
// }}>
|
|
144
|
-
// {t('delete')}
|
|
145
|
-
// </LoadingListItemButton>
|
|
146
|
-
// </List>
|
|
147
|
-
// </Paper>
|
|
148
|
-
// </ClickAwayListener>
|
|
149
|
-
// </Popper>
|
|
150
|
-
// </Stack>
|
|
151
|
-
// );
|
|
152
|
-
// }
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import { Icon } from '@iconify/react';
|
|
3
|
-
// import { Alert, Button, CircularProgress, Divider, Stack, TextField } from '@mui/material';
|
|
4
|
-
// import { useEffect, useRef, useState } from 'react';
|
|
5
|
-
// import { useForm } from 'react-hook-form';
|
|
6
|
-
// import { Result, Toast } from '../../../../arcblock/ux';
|
|
7
|
-
// import { useLocaleContext } from '../../../../locale';
|
|
8
|
-
// import { getDocument } from '../../api/dataset';
|
|
9
|
-
// import { useCurrentPage, useNavigateTo, useNavigateWithQuery } from '../../hooks/navigate';
|
|
10
|
-
// import { createDatasetDetailState } from '../../state';
|
|
11
|
-
// import Layout from '../layout';
|
|
12
|
-
// import LoadingButton from '../LoadingButton';
|
|
13
|
-
// export default function DocumentView() {
|
|
14
|
-
// const { t } = useLocaleContext();
|
|
15
|
-
// const to = useNavigateTo();
|
|
16
|
-
// const navigate = useNavigateWithQuery();
|
|
17
|
-
// const [loading, setLoading] = useState(false);
|
|
18
|
-
// const [error, setError] = useState();
|
|
19
|
-
// const { datasetId, documentId } = useCurrentPage();
|
|
20
|
-
// const datasetDetailState = createDatasetDetailState({ datasetId })();
|
|
21
|
-
// const form = useForm({});
|
|
22
|
-
// const hiddenSubmit = useRef();
|
|
23
|
-
// useEffect(() => {
|
|
24
|
-
// if (!documentId) {
|
|
25
|
-
// form.reset();
|
|
26
|
-
// return;
|
|
27
|
-
// }
|
|
28
|
-
// (async () => {
|
|
29
|
-
// setLoading(true);
|
|
30
|
-
// try {
|
|
31
|
-
// const { document } = await getDocument(datasetId, documentId);
|
|
32
|
-
// form.reset({
|
|
33
|
-
// name: document.name,
|
|
34
|
-
// content: document.content,
|
|
35
|
-
// });
|
|
36
|
-
// } catch (error) {
|
|
37
|
-
// setError(error);
|
|
38
|
-
// } finally {
|
|
39
|
-
// setLoading(false);
|
|
40
|
-
// }
|
|
41
|
-
// })();
|
|
42
|
-
// }, [documentId]);
|
|
43
|
-
// const onSubmit = async (input) => {
|
|
44
|
-
// try {
|
|
45
|
-
// if (documentId) {
|
|
46
|
-
// await datasetDetailState.updateDocument(documentId, 'text', input);
|
|
47
|
-
// } else {
|
|
48
|
-
// await datasetDetailState.createDocument('text', input);
|
|
49
|
-
// }
|
|
50
|
-
// navigate({ page: 'collection', datasetId });
|
|
51
|
-
// } catch (error) {
|
|
52
|
-
// Toast.error(error.message);
|
|
53
|
-
// console.error(error);
|
|
54
|
-
// }
|
|
55
|
-
// };
|
|
56
|
-
// if (error) {
|
|
57
|
-
// return <Result status="error" title={error.message} sx={{ bgcolor: 'transparent', my: 10 }} />;
|
|
58
|
-
// }
|
|
59
|
-
// return (
|
|
60
|
-
// <>
|
|
61
|
-
// <Stack
|
|
62
|
-
// direction="row"
|
|
63
|
-
// height={64}
|
|
64
|
-
// alignItems="center"
|
|
65
|
-
// justifyContent="space-between"
|
|
66
|
-
// sx={{
|
|
67
|
-
// position: 'sticky',
|
|
68
|
-
// top: 64,
|
|
69
|
-
// bgcolor: 'background.default',
|
|
70
|
-
// zIndex: 10,
|
|
71
|
-
// borderBottom: 1,
|
|
72
|
-
// borderColor: 'divider',
|
|
73
|
-
// px: 2.5,
|
|
74
|
-
// }}>
|
|
75
|
-
// <Button
|
|
76
|
-
// sx={{ minWidth: 32, minHeight: 32, px: 1, ml: -1 }}
|
|
77
|
-
// component={RouterLink}
|
|
78
|
-
// startIcon={<Icon icon="tabler:chevron-left" />}
|
|
79
|
-
// to={to({ page: 'collection', datasetId })}>
|
|
80
|
-
// {t('back')}
|
|
81
|
-
// </Button>
|
|
82
|
-
// <LoadingButton
|
|
83
|
-
// disabled={loading}
|
|
84
|
-
// size="small"
|
|
85
|
-
// variant="contained"
|
|
86
|
-
// color="secondary"
|
|
87
|
-
// startIcon={<Icon icon="tabler:book-2" />}
|
|
88
|
-
// loading={form.formState.isSubmitting}
|
|
89
|
-
// loadingPosition="start"
|
|
90
|
-
// onClick={() => hiddenSubmit.current.click()}>
|
|
91
|
-
// {t('save')}
|
|
92
|
-
// </LoadingButton>
|
|
93
|
-
// </Stack>
|
|
94
|
-
// <Layout>
|
|
95
|
-
// {loading || error ? (
|
|
96
|
-
// <Stack alignItems="center" gap={0.5} mt="10vh" mx={3}>
|
|
97
|
-
// {loading ? <CircularProgress size={24} /> : error ? <Alert severity="error">{error.message}</Alert> : null}
|
|
98
|
-
// </Stack>
|
|
99
|
-
// ) : (
|
|
100
|
-
// <Stack
|
|
101
|
-
// component="form"
|
|
102
|
-
// onSubmit={form.handleSubmit(onSubmit)}
|
|
103
|
-
// sx={{ bgcolor: 'background.paper', mt: 2.5, borderRadius: 1.5, border: 1, borderColor: 'divider' }}>
|
|
104
|
-
// <TextField
|
|
105
|
-
// multiline
|
|
106
|
-
// variant="standard"
|
|
107
|
-
// InputProps={{
|
|
108
|
-
// disableUnderline: true,
|
|
109
|
-
// sx: { fontSize: 32, fontWeight: 700, lineHeight: '44px', px: 2.5, pt: 2.5 },
|
|
110
|
-
// }}
|
|
111
|
-
// hiddenLabel
|
|
112
|
-
// placeholder={t('titlePlaceholder')}
|
|
113
|
-
// {...form.register('name')}
|
|
114
|
-
// />
|
|
115
|
-
// <Divider sx={{ my: 1.5, mx: 2.5 }} />
|
|
116
|
-
// <TextField
|
|
117
|
-
// variant="standard"
|
|
118
|
-
// InputProps={{
|
|
119
|
-
// disableUnderline: true,
|
|
120
|
-
// sx: { px: 2.5, pb: 2.5 },
|
|
121
|
-
// }}
|
|
122
|
-
// multiline
|
|
123
|
-
// minRows={20}
|
|
124
|
-
// hiddenLabel
|
|
125
|
-
// size="small"
|
|
126
|
-
// placeholder={t('contentPlaceholder')}
|
|
127
|
-
// {...form.register('content')}
|
|
128
|
-
// />
|
|
129
|
-
// <Button ref={hiddenSubmit} sx={{ display: 'none' }} type="submit" />
|
|
130
|
-
// </Stack>
|
|
131
|
-
// )}
|
|
132
|
-
// </Layout>
|
|
133
|
-
// </>
|
|
134
|
-
// );
|
|
135
|
-
// }
|
|
@@ -1,104 +0,0 @@
|
|
|
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 Dialog_1 = __importDefault(require("@arcblock/ux/lib/Dialog"));
|
|
8
|
-
const react_1 = require("@iconify/react");
|
|
9
|
-
const ArrowBackIosNew_1 = __importDefault(require("@mui/icons-material/ArrowBackIosNew"));
|
|
10
|
-
const material_1 = require("@mui/material");
|
|
11
|
-
const react_2 = require("react");
|
|
12
|
-
const ux_1 = require("../../../../arcblock/ux");
|
|
13
|
-
const assistant_1 = require("../../state/assistant");
|
|
14
|
-
const ScrollView_1 = __importDefault(require("../ScrollView"));
|
|
15
|
-
function ChatBot({ assistantId, size, bottom, right, children, popperWidth, popperHeight, }) {
|
|
16
|
-
var _a, _b, _c;
|
|
17
|
-
const anchorEl = (0, react_2.useRef)(null);
|
|
18
|
-
const [assistant] = (0, assistant_1.useAssistantState)({ assistantId });
|
|
19
|
-
const [openPopper, setOpenPopper] = (0, react_2.useState)(false);
|
|
20
|
-
const theme = (0, material_1.useTheme)();
|
|
21
|
-
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('sm'));
|
|
22
|
-
const chatViewSizeSx = isMobile
|
|
23
|
-
? { width: '100vw', height: 'calc(100vh - 72px)' }
|
|
24
|
-
: { width: '40vw', height: '80vh' };
|
|
25
|
-
if (popperWidth) {
|
|
26
|
-
chatViewSizeSx.width = popperWidth;
|
|
27
|
-
}
|
|
28
|
-
if (popperHeight) {
|
|
29
|
-
chatViewSizeSx.height = popperHeight;
|
|
30
|
-
}
|
|
31
|
-
const title = ((_a = assistant.release) === null || _a === void 0 ? void 0 : _a.title) || (assistant === null || assistant === void 0 ? void 0 : assistant.name);
|
|
32
|
-
const WrapperComponent = (0, react_2.useCallback)(({ children }) => {
|
|
33
|
-
if (isMobile) {
|
|
34
|
-
return ((0, jsx_runtime_1.jsx)(Dialog_1.default, { showCloseButton: false, sx: {
|
|
35
|
-
'.ux-dialog_header': {
|
|
36
|
-
borderBottom: '1px solid rgba(229, 231, 235, 1)',
|
|
37
|
-
},
|
|
38
|
-
'.MuiDialogContent-root': {
|
|
39
|
-
p: 0,
|
|
40
|
-
display: 'flex',
|
|
41
|
-
},
|
|
42
|
-
}, open: openPopper, title: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
43
|
-
display: 'flex',
|
|
44
|
-
alignItems: 'center',
|
|
45
|
-
gap: 1,
|
|
46
|
-
ml: -1,
|
|
47
|
-
}, children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "small", onClick: () => setOpenPopper(false), children: (0, jsx_runtime_1.jsx)(ArrowBackIosNew_1.default, { fontSize: "inherit" }) }), (0, jsx_runtime_1.jsx)(material_1.Box, { children: title })] }), onClose: () => {
|
|
48
|
-
setOpenPopper(false);
|
|
49
|
-
}, children: children }));
|
|
50
|
-
}
|
|
51
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Popper, { anchorEl: anchorEl.current, open: openPopper, placement: "top-end", sx: Object.assign({ zIndex: 1200, minWidth: { sm: 500 }, maxWidth: 600 }, chatViewSizeSx), children: (0, jsx_runtime_1.jsx)(material_1.ClickAwayListener, { onClickAway: (e) => {
|
|
52
|
-
e.preventDefault();
|
|
53
|
-
e.stopPropagation();
|
|
54
|
-
setOpenPopper(false);
|
|
55
|
-
}, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
56
|
-
boxShadow: '0px 8px 16px 0px rgba(2, 7, 19, 0.08), 0px 0px 0px 1px rgba(2, 7, 19, 0.08)',
|
|
57
|
-
position: 'relative',
|
|
58
|
-
background: 'white',
|
|
59
|
-
borderRadius: 1,
|
|
60
|
-
}, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
61
|
-
zIndex: 1200,
|
|
62
|
-
display: 'flex',
|
|
63
|
-
alignItems: 'center',
|
|
64
|
-
justifyContent: 'space-between',
|
|
65
|
-
borderBottom: '1px solid rgba(229, 231, 235, 1)',
|
|
66
|
-
px: 2,
|
|
67
|
-
py: 2,
|
|
68
|
-
height: 70,
|
|
69
|
-
}, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { component: "p", sx: {
|
|
70
|
-
fontSize: 18,
|
|
71
|
-
fontWeight: 600,
|
|
72
|
-
lineHeight: '28px',
|
|
73
|
-
}, children: title }), (0, jsx_runtime_1.jsx)(material_1.Button, { sx: { minWidth: 28, minHeight: 28 }, onClick: () => setOpenPopper(false), children: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "ic:round-close", fontSize: 24, color: "rgba(75, 85, 99, 1)" }) })] }), children] }) }) }));
|
|
74
|
-
}, [isMobile, openPopper]);
|
|
75
|
-
if (!assistant)
|
|
76
|
-
return null;
|
|
77
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { position: 'fixed', bottom: bottom || 24, right: right || 24 }, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
78
|
-
display: 'inline-flex',
|
|
79
|
-
flexDirection: 'column',
|
|
80
|
-
justifyContent: 'center',
|
|
81
|
-
alignItems: 'center',
|
|
82
|
-
boxShadow: '0px 2px 4px 0px rgba(3, 7, 18, 0.04)',
|
|
83
|
-
cursor: 'pointer',
|
|
84
|
-
zIndex: 1000,
|
|
85
|
-
transition: 'transform 0.3s',
|
|
86
|
-
':hover': {
|
|
87
|
-
transform: 'scale(1.05)',
|
|
88
|
-
},
|
|
89
|
-
}, onClick: () => setOpenPopper(!openPopper), children: [(0, jsx_runtime_1.jsx)(ux_1.Avatar, { className: "logo", size: size || 48, did: (_b = globalThis.blocklet) === null || _b === void 0 ? void 0 : _b.appId, variant: "circle", shape: "circle", src: (_c = assistant.release) === null || _c === void 0 ? void 0 : _c.logo }), (0, jsx_runtime_1.jsx)(material_1.Box, { width: "100%", ref: anchorEl })] }), anchorEl.current && ((0, jsx_runtime_1.jsx)(WrapperComponent, { children: (0, jsx_runtime_1.jsx)(ScrollView_1.default, { className: "ai-bot-scroll-container", initialScrollBehavior: "auto", component: material_1.Box, sx: {
|
|
90
|
-
overscrollBehavior: 'contain',
|
|
91
|
-
height: isMobile ? '100%' : `calc(${chatViewSizeSx.height} - 70px)`,
|
|
92
|
-
width: '100%',
|
|
93
|
-
overflowY: 'auto',
|
|
94
|
-
display: 'flex',
|
|
95
|
-
'.ai-chat-header': {
|
|
96
|
-
pt: 4,
|
|
97
|
-
},
|
|
98
|
-
'.ai-runtime-form-container': {
|
|
99
|
-
borderBottomLeftRadius: 8,
|
|
100
|
-
borderBottomRightRadius: 8,
|
|
101
|
-
},
|
|
102
|
-
}, 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: children }) }) }))] }));
|
|
103
|
-
}
|
|
104
|
-
exports.default = ChatBot;
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
exports.ChatBot = exports.MessageSuggestedQuestions = exports.MessageMetadataRenderer = void 0;
|
|
7
|
-
var MessageMetadataRenderer_1 = require("./MessageMetadataRenderer");
|
|
8
|
-
Object.defineProperty(exports, "MessageMetadataRenderer", { enumerable: true, get: function () { return __importDefault(MessageMetadataRenderer_1).default; } });
|
|
9
|
-
var MessageSuggestedQuestions_1 = require("./MessageSuggestedQuestions");
|
|
10
|
-
Object.defineProperty(exports, "MessageSuggestedQuestions", { enumerable: true, get: function () { return __importDefault(MessageSuggestedQuestions_1).default; } });
|
|
11
|
-
var ChatBot_1 = require("./ChatBot");
|
|
12
|
-
Object.defineProperty(exports, "ChatBot", { enumerable: true, get: function () { return __importDefault(ChatBot_1).default; } });
|
|
@@ -1,89 +0,0 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
-
const react_1 = require("@iconify/react");
|
|
40
|
-
const material_1 = require("@mui/material");
|
|
41
|
-
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
42
|
-
const omit_1 = __importDefault(require("lodash/omit"));
|
|
43
|
-
const react_2 = require("react");
|
|
44
|
-
const react_hook_form_1 = require("react-hook-form");
|
|
45
|
-
const locale_1 = require("../../../../locale");
|
|
46
|
-
const LoadingButton_1 = __importDefault(require("../LoadingButton"));
|
|
47
|
-
const ParameterFormFields_1 = __importStar(require("./ParameterFormFields"));
|
|
48
|
-
const QuestionField_1 = __importDefault(require("./QuestionField"));
|
|
49
|
-
const SettingButton_1 = __importDefault(require("./SettingButton"));
|
|
50
|
-
function ParameterForm(_a) {
|
|
51
|
-
var _b, _c, _d;
|
|
52
|
-
var { page, disabled, readOnly, onSubmit, defaultValues, hideSubmit, isSubmitting, assistant, submitButtonTitle = (_c = (_b = assistant.release) === null || _b === void 0 ? void 0 : _b.submitButton) === null || _c === void 0 ? void 0 : _c.title, } = _a;
|
|
53
|
-
const { t } = (0, locale_1.useLocaleContext)();
|
|
54
|
-
const { sessionId } = page;
|
|
55
|
-
const parameters = (0, react_2.useMemo)(() => {
|
|
56
|
-
var _a;
|
|
57
|
-
return (_a = assistant.parameters) === null || _a === void 0 ? void 0 : _a.filter((i) => i.key && !['question', 'datasetId'].includes(i.key) && ParameterFormFields_1.SUPPORTED_PARAMETER_TYPES.includes(i.type || 'string'));
|
|
58
|
-
}, [assistant.parameters]);
|
|
59
|
-
const isChat = (_d = assistant.parameters) === null || _d === void 0 ? void 0 : _d.some((i) => i.key === 'question');
|
|
60
|
-
const defaultForm = (0, react_2.useMemo)(() => {
|
|
61
|
-
var _a;
|
|
62
|
-
const values = (0, omit_1.default)(defaultValues, 'question');
|
|
63
|
-
if (!(0, isEmpty_1.default)(values))
|
|
64
|
-
return values;
|
|
65
|
-
return Object.fromEntries((_a = parameters === null || parameters === void 0 ? void 0 : parameters.map((parameter) => [parameter.key, parameter.defaultValue])) !== null && _a !== void 0 ? _a : []);
|
|
66
|
-
}, [defaultValues]);
|
|
67
|
-
const form = (0, react_hook_form_1.useForm)({ defaultValues: defaultForm, shouldFocusError: true });
|
|
68
|
-
(0, react_2.useEffect)(() => {
|
|
69
|
-
form.reset(defaultForm);
|
|
70
|
-
}, [defaultForm]);
|
|
71
|
-
const handleSubmit = (parameters) => __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
if (onSubmit) {
|
|
73
|
-
yield onSubmit(parameters);
|
|
74
|
-
form.reset(Object.assign(Object.assign({}, parameters), { question: '' }));
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
const [expand, setExpand] = (0, react_2.useState)(false);
|
|
78
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { className: "ai-chat-form", component: "form", onSubmit: form.handleSubmit(handleSubmit, (e) => {
|
|
79
|
-
if (Object.keys(e).some((i) => i !== 'question')) {
|
|
80
|
-
setExpand(true);
|
|
81
|
-
}
|
|
82
|
-
}), children: [!!(parameters === null || parameters === void 0 ? void 0 : parameters.length) && ((0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(material_1.Stack, { direction: "row", justifyContent: "center", children: (0, jsx_runtime_1.jsx)(material_1.Button, { sx: { minWidth: 0, px: 4, py: 0, opacity: 0.7, color: 'text.secondary' }, onClick: () => setExpand(!expand), children: (0, jsx_runtime_1.jsx)(material_1.Box, { component: react_1.Icon, icon: "tabler:chevron-compact-up", sx: {
|
|
83
|
-
fontSize: 24,
|
|
84
|
-
transform: `rotateX(${expand ? '180deg' : '0deg'})`,
|
|
85
|
-
transition: 'transform .3s ease-in-out',
|
|
86
|
-
} }) }) }), (0, jsx_runtime_1.jsx)(material_1.Collapse, { in: expand, orientation: "vertical", sx: { maxHeight: '40vh', overflowY: 'auto' }, children: (0, jsx_runtime_1.jsx)(ParameterFormFields_1.default, { autoFocus: !sessionId, disabled: disabled, readOnly: readOnly, parameters: parameters, form: form, sx: { pb: 2, px: 2 } }) })] })), (0, jsx_runtime_1.jsx)(material_1.Box, { px: 2, children: !hideSubmit &&
|
|
87
|
-
(isChat ? ((0, jsx_runtime_1.jsx)(QuestionField_1.default, { page: page, showSettingButton: !!sessionId, assistant: assistant, disabled: disabled, submitButtonTitle: submitButtonTitle || t('send'), readOnly: readOnly, isSubmitting: isSubmitting, form: form, autoFocus: !!sessionId })) : ((0, jsx_runtime_1.jsxs)(material_1.Stack, { className: "ai-chat-generation-bar", direction: "row", alignItems: "center", justifyContent: "flex-end", gap: 2, children: [page.page === 'session' && (0, jsx_runtime_1.jsx)(SettingButton_1.default, { form: form, page: page }), (0, jsx_runtime_1.jsx)(material_1.Box, { flex: 1 }), (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: submitButtonTitle, disableInteractive: true, placement: "top", children: (0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsx)(LoadingButton_1.default, { disabled: disabled, type: "submit", variant: "contained", color: "secondary", loading: form.formState.isSubmitting || isSubmitting, children: submitButtonTitle || t('send') }) }) })] }))) })] }));
|
|
88
|
-
}
|
|
89
|
-
exports.default = ParameterForm;
|