@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,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,98 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
3
|
-
import { Icon } from '@iconify/react';
|
|
4
|
-
import ArrowBackIosNewIcon from '@mui/icons-material/ArrowBackIosNew';
|
|
5
|
-
import { Box, Button, CircularProgress, ClickAwayListener, IconButton, Popper, Stack, Typography, useMediaQuery, useTheme, } from '@mui/material';
|
|
6
|
-
import { Suspense, useCallback, useRef, useState } from 'react';
|
|
7
|
-
import { Avatar } from '../../../../arcblock/ux';
|
|
8
|
-
import { useAssistantState } from '../../state/assistant';
|
|
9
|
-
import ScrollView from '../ScrollView';
|
|
10
|
-
export default function ChatBot({ assistantId, size, bottom, right, children, popperWidth, popperHeight, }) {
|
|
11
|
-
var _a, _b, _c;
|
|
12
|
-
const anchorEl = useRef(null);
|
|
13
|
-
const [assistant] = useAssistantState({ assistantId });
|
|
14
|
-
const [openPopper, setOpenPopper] = useState(false);
|
|
15
|
-
const theme = useTheme();
|
|
16
|
-
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
|
|
17
|
-
const chatViewSizeSx = isMobile
|
|
18
|
-
? { width: '100vw', height: 'calc(100vh - 72px)' }
|
|
19
|
-
: { width: '40vw', height: '80vh' };
|
|
20
|
-
if (popperWidth) {
|
|
21
|
-
chatViewSizeSx.width = popperWidth;
|
|
22
|
-
}
|
|
23
|
-
if (popperHeight) {
|
|
24
|
-
chatViewSizeSx.height = popperHeight;
|
|
25
|
-
}
|
|
26
|
-
const title = ((_a = assistant.release) === null || _a === void 0 ? void 0 : _a.title) || (assistant === null || assistant === void 0 ? void 0 : assistant.name);
|
|
27
|
-
const WrapperComponent = useCallback(({ children }) => {
|
|
28
|
-
if (isMobile) {
|
|
29
|
-
return (_jsx(Dialog, { showCloseButton: false, sx: {
|
|
30
|
-
'.ux-dialog_header': {
|
|
31
|
-
borderBottom: '1px solid rgba(229, 231, 235, 1)',
|
|
32
|
-
},
|
|
33
|
-
'.MuiDialogContent-root': {
|
|
34
|
-
p: 0,
|
|
35
|
-
display: 'flex',
|
|
36
|
-
},
|
|
37
|
-
}, open: openPopper, title: _jsxs(Box, { sx: {
|
|
38
|
-
display: 'flex',
|
|
39
|
-
alignItems: 'center',
|
|
40
|
-
gap: 1,
|
|
41
|
-
ml: -1,
|
|
42
|
-
}, children: [_jsx(IconButton, { size: "small", onClick: () => setOpenPopper(false), children: _jsx(ArrowBackIosNewIcon, { fontSize: "inherit" }) }), _jsx(Box, { children: title })] }), onClose: () => {
|
|
43
|
-
setOpenPopper(false);
|
|
44
|
-
}, children: children }));
|
|
45
|
-
}
|
|
46
|
-
return (_jsx(Popper, { anchorEl: anchorEl.current, open: openPopper, placement: "top-end", sx: Object.assign({ zIndex: 1200, minWidth: { sm: 500 }, maxWidth: 600 }, chatViewSizeSx), children: _jsx(ClickAwayListener, { onClickAway: (e) => {
|
|
47
|
-
e.preventDefault();
|
|
48
|
-
e.stopPropagation();
|
|
49
|
-
setOpenPopper(false);
|
|
50
|
-
}, children: _jsxs(Box, { sx: {
|
|
51
|
-
boxShadow: '0px 8px 16px 0px rgba(2, 7, 19, 0.08), 0px 0px 0px 1px rgba(2, 7, 19, 0.08)',
|
|
52
|
-
position: 'relative',
|
|
53
|
-
background: 'white',
|
|
54
|
-
borderRadius: 1,
|
|
55
|
-
}, children: [_jsxs(Box, { sx: {
|
|
56
|
-
zIndex: 1200,
|
|
57
|
-
display: 'flex',
|
|
58
|
-
alignItems: 'center',
|
|
59
|
-
justifyContent: 'space-between',
|
|
60
|
-
borderBottom: '1px solid rgba(229, 231, 235, 1)',
|
|
61
|
-
px: 2,
|
|
62
|
-
py: 2,
|
|
63
|
-
height: 70,
|
|
64
|
-
}, children: [_jsx(Typography, { component: "p", sx: {
|
|
65
|
-
fontSize: 18,
|
|
66
|
-
fontWeight: 600,
|
|
67
|
-
lineHeight: '28px',
|
|
68
|
-
}, children: title }), _jsx(Button, { sx: { minWidth: 28, minHeight: 28 }, onClick: () => setOpenPopper(false), children: _jsx(Icon, { icon: "ic:round-close", fontSize: 24, color: "rgba(75, 85, 99, 1)" }) })] }), children] }) }) }));
|
|
69
|
-
}, [isMobile, openPopper]);
|
|
70
|
-
if (!assistant)
|
|
71
|
-
return null;
|
|
72
|
-
return (_jsxs(Box, { sx: { position: 'fixed', bottom: bottom || 24, right: right || 24 }, children: [_jsxs(Box, { sx: {
|
|
73
|
-
display: 'inline-flex',
|
|
74
|
-
flexDirection: 'column',
|
|
75
|
-
justifyContent: 'center',
|
|
76
|
-
alignItems: 'center',
|
|
77
|
-
boxShadow: '0px 2px 4px 0px rgba(3, 7, 18, 0.04)',
|
|
78
|
-
cursor: 'pointer',
|
|
79
|
-
zIndex: 1000,
|
|
80
|
-
transition: 'transform 0.3s',
|
|
81
|
-
':hover': {
|
|
82
|
-
transform: 'scale(1.05)',
|
|
83
|
-
},
|
|
84
|
-
}, onClick: () => setOpenPopper(!openPopper), children: [_jsx(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 }), _jsx(Box, { width: "100%", ref: anchorEl })] }), anchorEl.current && (_jsx(WrapperComponent, { children: _jsx(ScrollView, { className: "ai-bot-scroll-container", initialScrollBehavior: "auto", component: Box, sx: {
|
|
85
|
-
overscrollBehavior: 'contain',
|
|
86
|
-
height: isMobile ? '100%' : `calc(${chatViewSizeSx.height} - 70px)`,
|
|
87
|
-
width: '100%',
|
|
88
|
-
overflowY: 'auto',
|
|
89
|
-
display: 'flex',
|
|
90
|
-
'.ai-chat-header': {
|
|
91
|
-
pt: 4,
|
|
92
|
-
},
|
|
93
|
-
'.ai-runtime-form-container': {
|
|
94
|
-
borderBottomLeftRadius: 8,
|
|
95
|
-
borderBottomRightRadius: 8,
|
|
96
|
-
},
|
|
97
|
-
}, children: _jsx(Suspense, { fallback: _jsx(Stack, { flexGrow: 1, alignItems: "center", justifyContent: "center", children: _jsx(CircularProgress, { size: 24 }) }), children: children }) }) }))] }));
|
|
98
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
import { Icon } from '@iconify/react';
|
|
12
|
-
import { Box, Button, Collapse, Stack, Tooltip } from '@mui/material';
|
|
13
|
-
import isEmpty from 'lodash/isEmpty';
|
|
14
|
-
import omit from 'lodash/omit';
|
|
15
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
16
|
-
import { useForm } from 'react-hook-form';
|
|
17
|
-
import { useLocaleContext } from '../../../../locale';
|
|
18
|
-
import LoadingButton from '../LoadingButton';
|
|
19
|
-
import ParameterFormFields, { SUPPORTED_PARAMETER_TYPES } from './ParameterFormFields';
|
|
20
|
-
import QuestionField from './QuestionField';
|
|
21
|
-
import SettingButton from './SettingButton';
|
|
22
|
-
export default function ParameterForm(_a) {
|
|
23
|
-
var _b, _c, _d;
|
|
24
|
-
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;
|
|
25
|
-
const { t } = useLocaleContext();
|
|
26
|
-
const { sessionId } = page;
|
|
27
|
-
const parameters = useMemo(() => {
|
|
28
|
-
var _a;
|
|
29
|
-
return (_a = assistant.parameters) === null || _a === void 0 ? void 0 : _a.filter((i) => i.key && !['question', 'datasetId'].includes(i.key) && SUPPORTED_PARAMETER_TYPES.includes(i.type || 'string'));
|
|
30
|
-
}, [assistant.parameters]);
|
|
31
|
-
const isChat = (_d = assistant.parameters) === null || _d === void 0 ? void 0 : _d.some((i) => i.key === 'question');
|
|
32
|
-
const defaultForm = useMemo(() => {
|
|
33
|
-
var _a;
|
|
34
|
-
const values = omit(defaultValues, 'question');
|
|
35
|
-
if (!isEmpty(values))
|
|
36
|
-
return values;
|
|
37
|
-
return Object.fromEntries((_a = parameters === null || parameters === void 0 ? void 0 : parameters.map((parameter) => [parameter.key, parameter.defaultValue])) !== null && _a !== void 0 ? _a : []);
|
|
38
|
-
}, [defaultValues]);
|
|
39
|
-
const form = useForm({ defaultValues: defaultForm, shouldFocusError: true });
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
form.reset(defaultForm);
|
|
42
|
-
}, [defaultForm]);
|
|
43
|
-
const handleSubmit = (parameters) => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
if (onSubmit) {
|
|
45
|
-
yield onSubmit(parameters);
|
|
46
|
-
form.reset(Object.assign(Object.assign({}, parameters), { question: '' }));
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
const [expand, setExpand] = useState(false);
|
|
50
|
-
return (_jsxs(Stack, { className: "ai-chat-form", component: "form", onSubmit: form.handleSubmit(handleSubmit, (e) => {
|
|
51
|
-
if (Object.keys(e).some((i) => i !== 'question')) {
|
|
52
|
-
setExpand(true);
|
|
53
|
-
}
|
|
54
|
-
}), children: [!!(parameters === null || parameters === void 0 ? void 0 : parameters.length) && (_jsxs(Box, { children: [_jsx(Stack, { direction: "row", justifyContent: "center", children: _jsx(Button, { sx: { minWidth: 0, px: 4, py: 0, opacity: 0.7, color: 'text.secondary' }, onClick: () => setExpand(!expand), children: _jsx(Box, { component: Icon, icon: "tabler:chevron-compact-up", sx: {
|
|
55
|
-
fontSize: 24,
|
|
56
|
-
transform: `rotateX(${expand ? '180deg' : '0deg'})`,
|
|
57
|
-
transition: 'transform .3s ease-in-out',
|
|
58
|
-
} }) }) }), _jsx(Collapse, { in: expand, orientation: "vertical", sx: { maxHeight: '40vh', overflowY: 'auto' }, children: _jsx(ParameterFormFields, { autoFocus: !sessionId, disabled: disabled, readOnly: readOnly, parameters: parameters, form: form, sx: { pb: 2, px: 2 } }) })] })), _jsx(Box, { px: 2, children: !hideSubmit &&
|
|
59
|
-
(isChat ? (_jsx(QuestionField, { page: page, showSettingButton: !!sessionId, assistant: assistant, disabled: disabled, submitButtonTitle: submitButtonTitle || t('send'), readOnly: readOnly, isSubmitting: isSubmitting, form: form, autoFocus: !!sessionId })) : (_jsxs(Stack, { className: "ai-chat-generation-bar", direction: "row", alignItems: "center", justifyContent: "flex-end", gap: 2, children: [page.page === 'session' && _jsx(SettingButton, { form: form, page: page }), _jsx(Box, { flex: 1 }), _jsx(Tooltip, { title: submitButtonTitle, disableInteractive: true, placement: "top", children: _jsx("span", { children: _jsx(LoadingButton, { disabled: disabled, type: "submit", variant: "contained", color: "secondary", loading: form.formState.isSubmitting || isSubmitting, children: submitButtonTitle || t('send') }) }) })] }))) })] }));
|
|
60
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
import { Icon } from '@iconify/react';
|
|
12
|
-
import { Box, Button, Dialog, DialogActions, DialogContent, DialogTitle, useMediaQuery, useTheme } from '@mui/material';
|
|
13
|
-
import { useForm } from 'react-hook-form';
|
|
14
|
-
import { create } from 'zustand';
|
|
15
|
-
import { immer } from 'zustand/middleware/immer';
|
|
16
|
-
import { useLocaleContext } from '../../../../locale';
|
|
17
|
-
import { useAssistantState } from '../../state/assistant';
|
|
18
|
-
import { useSessionState } from '../../state/session';
|
|
19
|
-
import LoadingButton from '../LoadingButton';
|
|
20
|
-
import ParameterFormFields from './ParameterFormFields';
|
|
21
|
-
export default function ParameterFormDialog({ assistantId, sessionId, DialogProps, }) {
|
|
22
|
-
const { t } = useLocaleContext();
|
|
23
|
-
const theme = useTheme();
|
|
24
|
-
const fullScreen = useMediaQuery(theme.breakpoints.down('sm'));
|
|
25
|
-
const dialogState = parameterFormDialogState();
|
|
26
|
-
const [assistant] = useAssistantState({ assistantId });
|
|
27
|
-
const { parameters } = assistant;
|
|
28
|
-
const [session, sessionState] = useSessionState({ sessionId, required: true });
|
|
29
|
-
const form = useForm({ defaultValues: Object.assign({}, session.parameters) });
|
|
30
|
-
const onSubmit = (parameters) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
yield sessionState.updateSession({ parameters });
|
|
32
|
-
dialogState.close();
|
|
33
|
-
});
|
|
34
|
-
return (_jsxs(Dialog, Object.assign({}, DialogProps, { open: dialogState.isOpen, onClose: dialogState.close, fullScreen: fullScreen, maxWidth: "sm", fullWidth: true, component: "form", onSubmit: form.handleSubmit(onSubmit), sx: {
|
|
35
|
-
zIndex: (theme) => theme.zIndex.modal + 1,
|
|
36
|
-
}, children: [_jsxs(DialogTitle, { sx: { display: 'flex', alignItems: 'center', gap: 1 }, children: [_jsx(Box, { flex: 1, children: t('parameters') }), _jsx(Button, { sx: { minWidth: 28, minHeight: 28 }, onClick: dialogState.close, children: _jsx(Icon, { icon: "ic:round-close", fontSize: 24, color: "rgba(75, 85, 99, 1)" }) })] }), _jsx(DialogContent, { dividers: true, children: _jsx(ParameterFormFields, { parameters: parameters, form: form }) }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "outlined",
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
color: "black", size: "small", onClick: dialogState.close, children: t('cancel') }), _jsx(LoadingButton, { variant: "contained", color: "black", type: "submit", size: "small", loading: form.formState.isSubmitting, children: t('save') })] })] })));
|
|
39
|
-
}
|
|
40
|
-
export const parameterFormDialogState = create()(immer((set, get) => ({
|
|
41
|
-
isOpen: false,
|
|
42
|
-
callback: undefined,
|
|
43
|
-
open() {
|
|
44
|
-
return new Promise((resolve) => {
|
|
45
|
-
set((state) => {
|
|
46
|
-
state.isOpen = true;
|
|
47
|
-
state.callback = resolve;
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
},
|
|
51
|
-
close() {
|
|
52
|
-
var _a, _b;
|
|
53
|
-
(_b = (_a = get()).callback) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
54
|
-
set((state) => {
|
|
55
|
-
state.isOpen = false;
|
|
56
|
-
state.callback = undefined;
|
|
57
|
-
});
|
|
58
|
-
},
|
|
59
|
-
})));
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { Box, Stack, Typography } from '@mui/material';
|
|
14
|
-
import { Controller } from 'react-hook-form';
|
|
15
|
-
import ParameterField from '../parameters';
|
|
16
|
-
export const SUPPORTED_PARAMETER_TYPES = ['string', 'number', 'select', 'language'];
|
|
17
|
-
export default function ParameterFormFields(_a) {
|
|
18
|
-
var { autoFocus, disabled, readOnly, parameters, form } = _a, props = __rest(_a, ["autoFocus", "disabled", "readOnly", "parameters", "form"]);
|
|
19
|
-
let isFirstParameterRendered = false;
|
|
20
|
-
return (_jsx(Stack, Object.assign({ gap: 1 }, props, { children: parameters === null || parameters === void 0 ? void 0 : parameters.map((parameter) => {
|
|
21
|
-
const { key, required } = parameter !== null && parameter !== void 0 ? parameter : {};
|
|
22
|
-
if (!key || !SUPPORTED_PARAMETER_TYPES.includes(parameter.type || 'string'))
|
|
23
|
-
return null;
|
|
24
|
-
const isFirstParameter = !isFirstParameterRendered;
|
|
25
|
-
isFirstParameterRendered = true;
|
|
26
|
-
return (_jsx(Box, { children: _jsx(Controller, { disabled: disabled, control: form.control, name: key, rules: {
|
|
27
|
-
required,
|
|
28
|
-
min: parameter.type === 'number' && typeof parameter.min === 'number'
|
|
29
|
-
? { value: parameter.min, message: '' }
|
|
30
|
-
: undefined,
|
|
31
|
-
max: parameter.type === 'number' && typeof parameter.max === 'number'
|
|
32
|
-
? { value: parameter.max, message: '' }
|
|
33
|
-
: undefined,
|
|
34
|
-
minLength: parameter.type === 'string' && typeof parameter.minLength === 'number'
|
|
35
|
-
? { value: parameter.minLength, message: '' }
|
|
36
|
-
: undefined,
|
|
37
|
-
maxLength: parameter.type === 'string' && typeof parameter.maxLength === 'number'
|
|
38
|
-
? { value: parameter.maxLength, message: '' }
|
|
39
|
-
: undefined,
|
|
40
|
-
}, render: ({ field, fieldState }) => {
|
|
41
|
-
var _a;
|
|
42
|
-
return (_jsxs(Box, { children: [_jsx(Typography, { component: "div", sx: {
|
|
43
|
-
lineHeight: '24px',
|
|
44
|
-
mb: 0.5,
|
|
45
|
-
fontWeight: 500,
|
|
46
|
-
color: 'rgba(18, 22, 24, 1)',
|
|
47
|
-
}, children: (parameter === null || parameter === void 0 ? void 0 : parameter.label) || parameter.key }), _jsx(ParameterField, { inputRef: field.ref, autoFocus: autoFocus && isFirstParameter, readOnly: readOnly, 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), sx: {
|
|
48
|
-
'& .MuiInputBase-root': {
|
|
49
|
-
bgcolor: 'background.paper',
|
|
50
|
-
},
|
|
51
|
-
} })] }));
|
|
52
|
-
} }) }, parameter.id));
|
|
53
|
-
}) })));
|
|
54
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Icon } from '@iconify/react';
|
|
3
|
-
import { TextField, Tooltip } from '@mui/material';
|
|
4
|
-
import { useMemo, useRef } from 'react';
|
|
5
|
-
import { Controller } from 'react-hook-form';
|
|
6
|
-
import { useLocaleContext } from '../../../../locale';
|
|
7
|
-
import LoadingButton from '../LoadingButton';
|
|
8
|
-
import SettingButton from './SettingButton';
|
|
9
|
-
export default function QuestionField({ page, assistant, showSettingButton, form, isSubmitting, autoFocus, readOnly, disabled, submitButtonTitle, }) {
|
|
10
|
-
const { t } = useLocaleContext();
|
|
11
|
-
const defaultPlaceholder = t('questionPlaceholder');
|
|
12
|
-
const placeholder = useMemo(() => { var _a, _b; return ((_b = (_a = assistant.parameters) === null || _a === void 0 ? void 0 : _a.find((i) => i.key === 'question')) === null || _b === void 0 ? void 0 : _b.placeholder) || defaultPlaceholder; }, [submitButtonTitle, assistant, defaultPlaceholder]);
|
|
13
|
-
const submitRef = useRef(null);
|
|
14
|
-
return (_jsx(Controller, { control: form.control, name: "question", rules: { required: true }, render: ({ field }) => (_jsx(TextField, { disabled: disabled, inputRef: field.ref, id: "question-input", size: "small", multiline: true, fullWidth: true, variant: "outlined", autoFocus: autoFocus, placeholder: placeholder, value: field.value || '', onChange: (e) => field.onChange(e), onKeyDownCapture: (e) => {
|
|
15
|
-
var _a;
|
|
16
|
-
// NOTE: Pressing Enter in the IME will trigger the 229 event
|
|
17
|
-
if (e.keyCode === 229)
|
|
18
|
-
return;
|
|
19
|
-
if (e.key === 'Enter' && !e.shiftKey) {
|
|
20
|
-
e.preventDefault();
|
|
21
|
-
(_a = submitRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
22
|
-
}
|
|
23
|
-
}, InputProps: {
|
|
24
|
-
readOnly,
|
|
25
|
-
sx: { p: 1, bgcolor: 'white', borderRadius: 1 },
|
|
26
|
-
startAdornment: showSettingButton && page.page === 'session' && (_jsx(SettingButton, { form: form, page: page, sx: { minWidth: 32, minHeight: 32 }, tabIndex: -1 })),
|
|
27
|
-
className: 'ai-chat-question-field',
|
|
28
|
-
endAdornment: (_jsx(Tooltip, { title: submitButtonTitle, disableInteractive: true, placement: "top", children: _jsx("span", { children: _jsx(LoadingButton, { disabled: disabled, id: "question-submit", ref: submitRef, type: "submit", variant: "contained",
|
|
29
|
-
// @ts-ignore
|
|
30
|
-
color: "black", sx: {
|
|
31
|
-
alignSelf: 'flex-end',
|
|
32
|
-
ml: 1,
|
|
33
|
-
p: 0.25,
|
|
34
|
-
minWidth: 32,
|
|
35
|
-
minHeight: 32,
|
|
36
|
-
}, loading: form.formState.isSubmitting || isSubmitting, children: _jsx(Icon, { icon: "tabler:arrow-up", fontSize: 26 }) }) }) })),
|
|
37
|
-
} })) }));
|
|
38
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
-
var t = {};
|
|
12
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
-
t[p] = s[p];
|
|
14
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
-
t[p[i]] = s[p[i]];
|
|
18
|
-
}
|
|
19
|
-
return t;
|
|
20
|
-
};
|
|
21
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
-
import { Icon } from '@iconify/react';
|
|
23
|
-
import { Box, Button, ClickAwayListener, Paper, Popper } from '@mui/material';
|
|
24
|
-
import { useState } from 'react';
|
|
25
|
-
import { useLocaleContext } from '../../../../locale';
|
|
26
|
-
import { createSession } from '../../api/session';
|
|
27
|
-
import { globalLoadingState } from '../../state/loading';
|
|
28
|
-
import LoadingListItemButton from '../LoadingListItemButton';
|
|
29
|
-
export default function SettingButton(_a) {
|
|
30
|
-
var { page, form } = _a, props = __rest(_a, ["page", "form"]);
|
|
31
|
-
const { t } = useLocaleContext();
|
|
32
|
-
const [openSetting, setOpenSetting] = useState(false);
|
|
33
|
-
const settingOptions = [
|
|
34
|
-
// {
|
|
35
|
-
// key: 'parametersSetting',
|
|
36
|
-
// label: t('parametersSetting'),
|
|
37
|
-
// onClick: () => parametersDialogOpen(),
|
|
38
|
-
// icon: 'tabler:adjustments-horizontal',
|
|
39
|
-
// sx: {
|
|
40
|
-
// color: 'rgba(3, 7, 18, 1)',
|
|
41
|
-
// },
|
|
42
|
-
// },
|
|
43
|
-
{
|
|
44
|
-
key: 'newSession',
|
|
45
|
-
label: t('newObject', { object: t('session') }),
|
|
46
|
-
onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
form.setFocus('question');
|
|
48
|
-
yield globalLoadingState.getState().run(() => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
const { created: session } = yield createSession({
|
|
50
|
-
assistantId: page.assistantId,
|
|
51
|
-
});
|
|
52
|
-
page.navigate({
|
|
53
|
-
page: 'session',
|
|
54
|
-
assistantId: page.assistantId,
|
|
55
|
-
sessionId: session.id,
|
|
56
|
-
});
|
|
57
|
-
}));
|
|
58
|
-
}),
|
|
59
|
-
icon: 'tabler:plus',
|
|
60
|
-
sx: {
|
|
61
|
-
color: 'rgba(225, 29, 72, 1)',
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
];
|
|
65
|
-
return [
|
|
66
|
-
_jsx(Button, Object.assign({ id: "setting-button", onClick: () => setOpenSetting(!openSetting) }, props, { sx: Object.assign({ minWidth: 40, minHeight: 40, p: 0, mr: 1, alignSelf: 'flex-end' }, props.sx), children: _jsx(Box, { component: Icon, icon: "tabler:menu-2", sx: { fontSize: 24, color: 'black.main' } }) }), "setting-button"),
|
|
67
|
-
_jsx(Popper, { anchorEl: document.getElementById('setting-button'), open: openSetting, placement: "top-start", sx: { zIndex: (theme) => theme.zIndex.modal + 1 }, children: _jsx(ClickAwayListener, { onClickAway: (e) => {
|
|
68
|
-
e.preventDefault();
|
|
69
|
-
e.stopPropagation();
|
|
70
|
-
setOpenSetting(false);
|
|
71
|
-
}, children: _jsx(Paper, { sx: {
|
|
72
|
-
py: 0.5,
|
|
73
|
-
boxShadow: '0px 8px 16px 0px rgba(2, 7, 19, 0.08), 0px 0px 0px 1px rgba(2, 7, 19, 0.08)',
|
|
74
|
-
}, children: settingOptions.map((option) => {
|
|
75
|
-
const { key, label, onClick, icon, sx } = option;
|
|
76
|
-
return (_jsxs(LoadingListItemButton, { onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
yield onClick();
|
|
78
|
-
setOpenSetting(false);
|
|
79
|
-
}), sx: Object.assign({ fontSize: 13, lineHeight: '22px', py: 0.75, px: 1.5, fontWeight: 400 }, sx), children: [_jsx(Box, { component: Icon, icon: icon, sx: { fontSize: 16, mr: 1 } }), label] }, key));
|
|
80
|
-
}) }) }) }, "setting-popper"),
|
|
81
|
-
];
|
|
82
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect } from 'react';
|
|
3
|
-
export default function Lottie({ src }) {
|
|
4
|
-
useEffect(() => {
|
|
5
|
-
import('@lottiefiles/lottie-player');
|
|
6
|
-
}, []);
|
|
7
|
-
return _jsx("lottie-player", { autoplay: true, loop: true, mode: "normal", src: src }, src);
|
|
8
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Alert, Box, Button } from '@mui/material';
|
|
3
|
-
import { useLocaleContext } from '../../../../locale';
|
|
4
|
-
import { useLogin } from '../../hooks/auth';
|
|
5
|
-
import { useSubscribeLink } from '../../hooks/subscribe';
|
|
6
|
-
import { useAssistantState } from '../../state/assistant';
|
|
7
|
-
import MarkdownRenderer from '../MarkdownRenderer';
|
|
8
|
-
export default function MessageErrorView({ page, error }) {
|
|
9
|
-
var _a, _b, _c;
|
|
10
|
-
const { t } = useLocaleContext();
|
|
11
|
-
const [assistant] = useAssistantState(page);
|
|
12
|
-
const { subscribeLink } = useSubscribeLink(page);
|
|
13
|
-
const login = useLogin({ page });
|
|
14
|
-
if (!error)
|
|
15
|
-
return null;
|
|
16
|
-
if (error.type === 'InvalidSubscriptionError') {
|
|
17
|
-
return (_jsxs(Box, { className: "ai-chat-message-error", children: [_jsx(Box, { className: "message-response", children: _jsx(MarkdownRenderer, { children: t('requireNewSubscription', {
|
|
18
|
-
price: (_b = (_a = assistant.release) === null || _a === void 0 ? void 0 : _a.payment) === null || _b === void 0 ? void 0 : _b.price,
|
|
19
|
-
}) }) }), _jsx(Box, { mt: 1, children: subscribeLink ? (
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
_jsx(Button, { variant: "contained", color: "black", href: subscribeLink, children: t('subscribeNow') })) : (_jsx(Box, { className: "message-response", children: t('thanksForSubscription') })) })] }));
|
|
22
|
-
}
|
|
23
|
-
if (error.status === 401) {
|
|
24
|
-
return (_jsxs(Box, { className: "ai-chat-message-error", children: [_jsx(Box, { className: "message-response", children: _jsx(MarkdownRenderer, { children: t('requireLogin') }) }), _jsx(Box, { mt: 1, children: _jsx(Button, { variant: "contained",
|
|
25
|
-
// @ts-ignore
|
|
26
|
-
color: "black", onClick: login, children: t('loginNow') }) })] }));
|
|
27
|
-
}
|
|
28
|
-
return (_jsx(Alert, { className: "ai-chat-message-error", severity: "error", sx: { mr: 5 }, children: (error.type === 'ReachMaxRoundLimitError' && ((_c = assistant === null || assistant === void 0 ? void 0 : assistant.release) === null || _c === void 0 ? void 0 : _c.reachMaxRoundLimitTip)) || error.message }));
|
|
29
|
-
}
|