@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
package/lib/cjs/builtin/async/ai-runtime/{components/runtime/state/assistant.js → state/agent.js}
RENAMED
|
@@ -9,24 +9,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.useAgentState = exports.createAgentState = void 0;
|
|
13
13
|
const zustand_1 = require("zustand");
|
|
14
14
|
const immer_1 = require("zustand/middleware/immer");
|
|
15
|
-
const
|
|
15
|
+
const agent_1 = require("../api/agent");
|
|
16
16
|
const STATES = {};
|
|
17
|
-
const
|
|
17
|
+
const createAgentState = ({ aid, working, agent }) => {
|
|
18
18
|
var _a;
|
|
19
19
|
const key = working ? `${aid}-working` : aid;
|
|
20
20
|
(_a = STATES[key]) !== null && _a !== void 0 ? _a : (STATES[key] = (0, zustand_1.create)()((0, immer_1.immer)((set) => ({
|
|
21
|
-
|
|
21
|
+
agent,
|
|
22
22
|
load: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
23
|
set((state) => {
|
|
24
24
|
state.loading = true;
|
|
25
25
|
});
|
|
26
26
|
try {
|
|
27
|
-
const
|
|
27
|
+
const agent = yield (0, agent_1.getAgent)({ aid, working });
|
|
28
28
|
set((state) => {
|
|
29
|
-
state.
|
|
29
|
+
state.agent = agent;
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
catch (error) {
|
|
@@ -44,18 +44,18 @@ const createAssistantState = ({ aid, working, assistant, }) => {
|
|
|
44
44
|
}))));
|
|
45
45
|
return STATES[key];
|
|
46
46
|
};
|
|
47
|
-
exports.
|
|
47
|
+
exports.createAgentState = createAgentState;
|
|
48
48
|
const LOADING_TASKS = {};
|
|
49
|
-
function
|
|
49
|
+
function useAgentState({ aid, working }) {
|
|
50
50
|
var _a;
|
|
51
|
-
const state = (0, exports.
|
|
52
|
-
if (!state.
|
|
51
|
+
const state = (0, exports.createAgentState)({ aid, working })();
|
|
52
|
+
if (!state.agent) {
|
|
53
53
|
if (state.error)
|
|
54
54
|
throw state.error;
|
|
55
55
|
const key = working ? `${aid}-working` : aid;
|
|
56
56
|
(_a = LOADING_TASKS[key]) !== null && _a !== void 0 ? _a : (LOADING_TASKS[key] = state.load());
|
|
57
57
|
throw LOADING_TASKS[key];
|
|
58
58
|
}
|
|
59
|
-
return [state.
|
|
59
|
+
return [state.agent, state];
|
|
60
60
|
}
|
|
61
|
-
exports.
|
|
61
|
+
exports.useAgentState = useAgentState;
|
|
@@ -12,19 +12,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.useRuntimeState = void 0;
|
|
13
13
|
const types_1 = require("@blocklet/ai-runtime/types");
|
|
14
14
|
const react_1 = require("react");
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const assistant_1 = require("./assistant");
|
|
15
|
+
const session_1 = require("../../../session");
|
|
16
|
+
const Runtime_1 = require("../contexts/Runtime");
|
|
17
|
+
const agent_1 = require("./agent");
|
|
19
18
|
const session_2 = require("./session");
|
|
20
19
|
function useRuntimeState() {
|
|
21
20
|
var _a;
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
if (!aid)
|
|
25
|
-
throw new error_1.CustomError(404, 'Missing required query parameters `aid`');
|
|
26
|
-
const working = query.get('working') === 'true';
|
|
27
|
-
const [agent] = (0, assistant_1.useAssistantState)({ aid, working });
|
|
21
|
+
const { aid, working } = (0, Runtime_1.useRuntimeContext)();
|
|
22
|
+
const [agent] = (0, agent_1.useAgentState)({ aid, working });
|
|
28
23
|
const sessionState = (0, session_2.createSessionState)({ aid })();
|
|
29
24
|
const { session: authSession } = (0, session_1.useSessionContext)();
|
|
30
25
|
// reset state after logged out
|
|
@@ -15,41 +15,48 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
|
15
15
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
16
16
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
17
17
|
};
|
|
18
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
|
-
};
|
|
21
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.
|
|
23
|
-
const
|
|
24
|
-
const pick_1 = __importDefault(require("lodash/pick"));
|
|
19
|
+
exports.createSessionState = void 0;
|
|
20
|
+
const aid_1 = require("@blocklet/ai-runtime/common/aid");
|
|
25
21
|
const zustand_1 = require("zustand");
|
|
26
22
|
const immer_1 = require("zustand/middleware/immer");
|
|
27
23
|
const message_1 = require("../api/message");
|
|
28
24
|
const session_1 = require("../api/session");
|
|
29
|
-
const utils_1 = require("../utils");
|
|
30
25
|
const STATES = {};
|
|
31
|
-
const
|
|
26
|
+
const GET_MESSAGES_LIMIT = 100;
|
|
27
|
+
const GET_MESSAGES_ORDER_DIRECTION = 'desc';
|
|
28
|
+
const createSessionState = ({ aid }) => {
|
|
32
29
|
var _a;
|
|
33
|
-
(_a = STATES[
|
|
34
|
-
|
|
35
|
-
updateSession: (_b) => __awaiter(void 0, [_b], void 0, function* ({ parameters }) {
|
|
36
|
-
const { updated } = yield (0, session_1.updateSession)({ sessionId, parameters });
|
|
30
|
+
(_a = STATES[aid]) !== null && _a !== void 0 ? _a : (STATES[aid] = (0, zustand_1.create)()((0, immer_1.immer)((set, get) => ({
|
|
31
|
+
reset: () => {
|
|
37
32
|
set((state) => {
|
|
38
|
-
state.
|
|
33
|
+
state.loading = undefined;
|
|
34
|
+
state.loaded = undefined;
|
|
35
|
+
state.running = undefined;
|
|
36
|
+
state.session = undefined;
|
|
37
|
+
state.messages = undefined;
|
|
38
|
+
state.noMoreMessage = undefined;
|
|
39
|
+
state.messageLoading = undefined;
|
|
40
|
+
state.error = undefined;
|
|
39
41
|
});
|
|
40
|
-
}
|
|
42
|
+
},
|
|
41
43
|
load: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
44
|
+
var _b;
|
|
42
45
|
set((state) => {
|
|
43
46
|
state.loading = true;
|
|
44
47
|
});
|
|
45
48
|
try {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
const { sessions } = yield (0, session_1.getSessions)({ aid });
|
|
50
|
+
const session = (_b = sessions[0]) !== null && _b !== void 0 ? _b : (yield (0, session_1.createSession)({ aid })).created;
|
|
51
|
+
const { messages } = yield (0, message_1.getMessages)({
|
|
52
|
+
sessionId: session.id,
|
|
53
|
+
orderDirection: GET_MESSAGES_ORDER_DIRECTION,
|
|
54
|
+
limit: GET_MESSAGES_LIMIT,
|
|
55
|
+
});
|
|
50
56
|
set((state) => {
|
|
51
57
|
state.session = session;
|
|
52
|
-
state.messages = messages;
|
|
58
|
+
state.messages = messages.toReversed();
|
|
59
|
+
state.noMoreMessage = messages.length < GET_MESSAGES_LIMIT;
|
|
53
60
|
});
|
|
54
61
|
}
|
|
55
62
|
catch (error) {
|
|
@@ -60,37 +67,67 @@ const createSessionState = ({ sessionId, session }) => {
|
|
|
60
67
|
}
|
|
61
68
|
finally {
|
|
62
69
|
set((state) => {
|
|
70
|
+
state.loaded = true;
|
|
63
71
|
state.loading = false;
|
|
64
72
|
});
|
|
65
73
|
}
|
|
66
74
|
}),
|
|
67
|
-
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
loadMoreMessages: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
76
|
+
var _c;
|
|
77
|
+
set((state) => {
|
|
78
|
+
state.messageLoading = true;
|
|
79
|
+
});
|
|
80
|
+
const { session, messages } = get();
|
|
81
|
+
if (!session)
|
|
82
|
+
return;
|
|
83
|
+
try {
|
|
84
|
+
const result = yield (0, message_1.getMessages)({
|
|
85
|
+
sessionId: session.id,
|
|
86
|
+
before: (_c = messages === null || messages === void 0 ? void 0 : messages.slice(-1)[0]) === null || _c === void 0 ? void 0 : _c.id,
|
|
87
|
+
orderDirection: GET_MESSAGES_ORDER_DIRECTION,
|
|
88
|
+
limit: GET_MESSAGES_LIMIT,
|
|
89
|
+
});
|
|
90
|
+
set((state) => {
|
|
91
|
+
var _a;
|
|
92
|
+
state.messages = ((_a = state.messages) !== null && _a !== void 0 ? _a : []).concat(result.messages.toReversed());
|
|
93
|
+
state.noMoreMessage = result.messages.length < GET_MESSAGES_LIMIT;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
finally {
|
|
97
|
+
set((state) => {
|
|
98
|
+
state.messageLoading = false;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}),
|
|
102
|
+
execute: (_d) => __awaiter(void 0, [_d], void 0, function* ({ aid, working, parameters, onResponseStart, }) {
|
|
103
|
+
var _e, e_1, _f, _g;
|
|
104
|
+
let { session } = get();
|
|
105
|
+
if (!session) {
|
|
106
|
+
yield get().load();
|
|
107
|
+
session = get().session;
|
|
108
|
+
}
|
|
109
|
+
if (!session)
|
|
110
|
+
throw new Error('This session is not initialized');
|
|
111
|
+
const { id: sessionId } = session;
|
|
112
|
+
const identity = (0, aid_1.parseIdentity)(aid, { rejectWhenError: true });
|
|
71
113
|
let message;
|
|
72
|
-
const childMessages = [];
|
|
73
|
-
const childMessagesMap = {};
|
|
74
114
|
set((state) => {
|
|
75
115
|
state.running = true;
|
|
76
116
|
state.error = undefined;
|
|
77
117
|
});
|
|
78
|
-
let realParameters = Object.assign(Object.assign({}, parameters), { $clientTime: new Date().toISOString() });
|
|
79
|
-
if (includeSessionParameters) {
|
|
80
|
-
realParameters = Object.assign(Object.assign({}, (_g = get().session) === null || _g === void 0 ? void 0 : _g.parameters), parameters);
|
|
81
|
-
}
|
|
82
118
|
try {
|
|
83
|
-
const stream = (0, session_1.
|
|
119
|
+
const stream = (0, session_1.runAgent)({
|
|
120
|
+
aid,
|
|
84
121
|
sessionId,
|
|
85
|
-
|
|
86
|
-
parameters:
|
|
122
|
+
working,
|
|
123
|
+
parameters: Object.assign(Object.assign({}, parameters), { $clientTime: new Date().toISOString() }),
|
|
87
124
|
});
|
|
88
125
|
let responseStarted = false;
|
|
89
126
|
try {
|
|
90
|
-
for (var
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const value =
|
|
127
|
+
for (var _h = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield stream_1.next(), _e = stream_1_1.done, !_e; _h = true) {
|
|
128
|
+
_g = stream_1_1.value;
|
|
129
|
+
_h = false;
|
|
130
|
+
const value = _g;
|
|
94
131
|
if (!responseStarted) {
|
|
95
132
|
responseStarted = true;
|
|
96
133
|
onResponseStart === null || onResponseStart === void 0 ? void 0 : onResponseStart();
|
|
@@ -99,8 +136,8 @@ const createSessionState = ({ sessionId, session }) => {
|
|
|
99
136
|
if (!message) {
|
|
100
137
|
message = {
|
|
101
138
|
taskId: value.taskId,
|
|
102
|
-
sessionId,
|
|
103
139
|
assistantId: identity.assistantId,
|
|
140
|
+
sessionId,
|
|
104
141
|
parameters,
|
|
105
142
|
createdAt: new Date().toISOString(),
|
|
106
143
|
updatedAt: new Date().toISOString(),
|
|
@@ -113,49 +150,23 @@ const createSessionState = ({ sessionId, session }) => {
|
|
|
113
150
|
});
|
|
114
151
|
}
|
|
115
152
|
if (message.taskId === value.taskId) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
(_f = (_h = msg.result).objects) !== null && _f !== void 0 ? _f : (_h.objects = []);
|
|
129
|
-
msg.result.objects.push({ taskId: value.taskId, data: value.delta.object });
|
|
153
|
+
requestAnimationFrame(() => {
|
|
154
|
+
set((state) => {
|
|
155
|
+
var _a, _b, _c, _d, _e, _f;
|
|
156
|
+
var _g;
|
|
157
|
+
const msg = (_a = state.messages) === null || _a === void 0 ? void 0 : _a.findLast((i) => i.taskId === message.taskId);
|
|
158
|
+
if (!msg)
|
|
159
|
+
return;
|
|
160
|
+
(_b = msg.result) !== null && _b !== void 0 ? _b : (msg.result = {});
|
|
161
|
+
msg.result.content = (msg.result.content || '') + (value.delta.content || '');
|
|
162
|
+
if ((_d = (_c = value.delta) === null || _c === void 0 ? void 0 : _c.images) === null || _d === void 0 ? void 0 : _d.length) {
|
|
163
|
+
msg.result.images = ((_e = msg.result.images) !== null && _e !== void 0 ? _e : []).concat(value.delta.images);
|
|
164
|
+
}
|
|
130
165
|
if (value.delta.object) {
|
|
131
|
-
(_g =
|
|
132
|
-
(
|
|
166
|
+
(_f = (_g = msg.result).objects) !== null && _f !== void 0 ? _f : (_g.objects = []);
|
|
167
|
+
msg.result.objects.push({ taskId: value.taskId, data: value.delta.object });
|
|
133
168
|
}
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
else if (value.respondAs && value.respondAs !== 'none') {
|
|
138
|
-
let childMessage = childMessagesMap[value.taskId];
|
|
139
|
-
if (!childMessage) {
|
|
140
|
-
childMessage = {
|
|
141
|
-
taskId: value.taskId,
|
|
142
|
-
respondAs: value.respondAs,
|
|
143
|
-
};
|
|
144
|
-
childMessagesMap[value.taskId] = childMessage;
|
|
145
|
-
childMessages.push(childMessage);
|
|
146
|
-
}
|
|
147
|
-
(_h = childMessage.result) !== null && _h !== void 0 ? _h : (childMessage.result = {});
|
|
148
|
-
childMessage.result.content = (childMessage.result.content || '') + (value.delta.content || '');
|
|
149
|
-
if ((_k = (_j = value.delta) === null || _j === void 0 ? void 0 : _j.images) === null || _k === void 0 ? void 0 : _k.length) {
|
|
150
|
-
childMessage.result.images = ((_l = childMessage.result.images) !== null && _l !== void 0 ? _l : []).concat(value.delta.images);
|
|
151
|
-
}
|
|
152
|
-
set((state) => {
|
|
153
|
-
var _a, _b;
|
|
154
|
-
const msg = (_a = state.messages) === null || _a === void 0 ? void 0 : _a.findLast((i) => i.taskId === message.taskId);
|
|
155
|
-
if (!msg)
|
|
156
|
-
return;
|
|
157
|
-
(_b = msg.result) !== null && _b !== void 0 ? _b : (msg.result = {});
|
|
158
|
-
msg.result.messages = JSON.parse(JSON.stringify(childMessages));
|
|
169
|
+
});
|
|
159
170
|
});
|
|
160
171
|
}
|
|
161
172
|
}
|
|
@@ -174,7 +185,7 @@ const createSessionState = ({ sessionId, session }) => {
|
|
|
174
185
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
175
186
|
finally {
|
|
176
187
|
try {
|
|
177
|
-
if (!
|
|
188
|
+
if (!_h && !_e && (_f = stream_1.return)) yield _f.call(stream_1);
|
|
178
189
|
}
|
|
179
190
|
finally { if (e_1) throw e_1.error; }
|
|
180
191
|
}
|
|
@@ -197,18 +208,6 @@ const createSessionState = ({ sessionId, session }) => {
|
|
|
197
208
|
}
|
|
198
209
|
}),
|
|
199
210
|
}))));
|
|
200
|
-
return STATES[
|
|
211
|
+
return STATES[aid];
|
|
201
212
|
};
|
|
202
213
|
exports.createSessionState = createSessionState;
|
|
203
|
-
const LOADING_TASKS = {};
|
|
204
|
-
function useSessionState({ sessionId, required }) {
|
|
205
|
-
var _a;
|
|
206
|
-
const state = (0, exports.createSessionState)({ sessionId })();
|
|
207
|
-
if (!state.session) {
|
|
208
|
-
(_a = LOADING_TASKS[sessionId]) !== null && _a !== void 0 ? _a : (LOADING_TASKS[sessionId] = state.load());
|
|
209
|
-
if (required)
|
|
210
|
-
throw LOADING_TASKS[sessionId];
|
|
211
|
-
}
|
|
212
|
-
return [state.session, state];
|
|
213
|
-
}
|
|
214
|
-
exports.useSessionState = useSessionState;
|
|
@@ -10,13 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { joinURL } from 'ufo';
|
|
11
11
|
import { getComponentMountPoint } from '../../../utils';
|
|
12
12
|
import { AI_STUDIO_DID } from '../constants';
|
|
13
|
-
import { parseIdentity } from '../utils';
|
|
14
13
|
import { request } from './request';
|
|
15
|
-
export function
|
|
16
|
-
return __awaiter(this, arguments, void 0, function* ({
|
|
17
|
-
const { projectId, projectRef, assistantId } = parseIdentity(id, { rejectWhenError: true });
|
|
14
|
+
export function getAgent(_a) {
|
|
15
|
+
return __awaiter(this, arguments, void 0, function* ({ aid, working }) {
|
|
18
16
|
return request({
|
|
19
|
-
url: joinURL(getComponentMountPoint(AI_STUDIO_DID), '/api/
|
|
17
|
+
url: joinURL(getComponentMountPoint(AI_STUDIO_DID), '/api/agents', aid),
|
|
20
18
|
query: { working },
|
|
21
19
|
});
|
|
22
20
|
});
|
|
@@ -20,20 +20,16 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar
|
|
|
20
20
|
function reject(value) { resume("throw", value); }
|
|
21
21
|
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
22
22
|
};
|
|
23
|
-
import { joinURL
|
|
23
|
+
import { joinURL } from 'ufo';
|
|
24
24
|
import { EventSourceParserStream } from '../../../stream';
|
|
25
25
|
import { getComponentMountPoint } from '../../../utils';
|
|
26
26
|
import { AI_STUDIO_DID } from '../constants';
|
|
27
|
-
import { parseIdentity } from '../utils';
|
|
28
27
|
import { fetch, request } from './request';
|
|
29
28
|
export function getSessions(_a) {
|
|
30
|
-
return __awaiter(this, arguments, void 0, function* ({
|
|
29
|
+
return __awaiter(this, arguments, void 0, function* ({ aid }) {
|
|
31
30
|
return request({
|
|
32
|
-
url:
|
|
33
|
-
|
|
34
|
-
projectRef,
|
|
35
|
-
assistantId,
|
|
36
|
-
}),
|
|
31
|
+
url: joinURL(getComponentMountPoint(AI_STUDIO_DID), '/api/sessions'),
|
|
32
|
+
query: { aid },
|
|
37
33
|
});
|
|
38
34
|
});
|
|
39
35
|
}
|
|
@@ -45,22 +41,23 @@ export function getSession(_a) {
|
|
|
45
41
|
});
|
|
46
42
|
}
|
|
47
43
|
export function createSession(_a) {
|
|
48
|
-
return __awaiter(this, arguments, void 0, function* ({
|
|
44
|
+
return __awaiter(this, arguments, void 0, function* ({ aid, name, }) {
|
|
49
45
|
return request({
|
|
50
46
|
method: 'POST',
|
|
51
47
|
url: joinURL(getComponentMountPoint(AI_STUDIO_DID), '/api/sessions'),
|
|
52
|
-
body:
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
body: {
|
|
49
|
+
aid,
|
|
50
|
+
name,
|
|
51
|
+
},
|
|
55
52
|
});
|
|
56
53
|
});
|
|
57
54
|
}
|
|
58
55
|
export function updateSession(_a) {
|
|
59
|
-
return __awaiter(this, arguments, void 0, function* ({ sessionId, name,
|
|
56
|
+
return __awaiter(this, arguments, void 0, function* ({ sessionId, name, }) {
|
|
60
57
|
return request({
|
|
61
58
|
method: 'PATCH',
|
|
62
59
|
url: joinURL(getComponentMountPoint(AI_STUDIO_DID), '/api/sessions', sessionId),
|
|
63
|
-
body: { name
|
|
60
|
+
body: { name },
|
|
64
61
|
});
|
|
65
62
|
});
|
|
66
63
|
}
|
|
@@ -72,8 +69,8 @@ export function deleteSession(_a) {
|
|
|
72
69
|
});
|
|
73
70
|
});
|
|
74
71
|
}
|
|
75
|
-
export function
|
|
76
|
-
return __asyncGenerator(this, arguments, function*
|
|
72
|
+
export function runAgent(_a) {
|
|
73
|
+
return __asyncGenerator(this, arguments, function* runAgent_1({ aid, sessionId, working, parameters, }) {
|
|
77
74
|
var _b;
|
|
78
75
|
const res = yield __await(fetch(joinURL(getComponentMountPoint(AI_STUDIO_DID), '/api/ai/call'), {
|
|
79
76
|
method: 'POST',
|
|
@@ -81,7 +78,12 @@ export function runAssistant(_a) {
|
|
|
81
78
|
'Content-Type': 'application/json',
|
|
82
79
|
Accept: 'text/event-stream',
|
|
83
80
|
},
|
|
84
|
-
body: JSON.stringify(
|
|
81
|
+
body: JSON.stringify({
|
|
82
|
+
sessionId,
|
|
83
|
+
parameters: Object.assign(Object.assign({}, parameters), { $clientTime: new Date().toISOString() }),
|
|
84
|
+
aid,
|
|
85
|
+
working,
|
|
86
|
+
}),
|
|
85
87
|
}));
|
|
86
88
|
if (!(res.status >= 200 && res.status < 300)) {
|
|
87
89
|
let json;
|
|
@@ -23,7 +23,7 @@ import { Icon } from '@iconify/react';
|
|
|
23
23
|
import { Box, Tooltip } from '@mui/material';
|
|
24
24
|
import { useRef, useState } from 'react';
|
|
25
25
|
import LoadingButton from './LoadingButton';
|
|
26
|
-
export function ActionButton(_a) {
|
|
26
|
+
export default function ActionButton(_a) {
|
|
27
27
|
var { tip, tipSucceed, title, titleSucceed, icon, iconSucceed, autoReset, placement = 'top' } = _a, props = __rest(_a, ["tip", "tipSucceed", "title", "titleSucceed", "icon", "iconSucceed", "autoReset", "placement"]);
|
|
28
28
|
const [copied, setCopied] = useState(false);
|
|
29
29
|
const [error, setError] = useState();
|
|
@@ -15,7 +15,7 @@ import NumberField from './NumberField';
|
|
|
15
15
|
import RadioField from './RadioField';
|
|
16
16
|
import SelectField from './SelectField';
|
|
17
17
|
import StringField from './StringField';
|
|
18
|
-
export default function
|
|
18
|
+
export default function AgentInputField(_a) {
|
|
19
19
|
var _b;
|
|
20
20
|
var { parameter } = _a, props = __rest(_a, ["parameter"]);
|
|
21
21
|
if (parameter.type === 'source')
|
package/lib/esm/builtin/async/ai-runtime/components/{GlobalLoading.js → GlobalLoading/index.js}
RENAMED
|
@@ -11,7 +11,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { LinearProgress } from '@mui/material';
|
|
14
|
-
import { globalLoadingState } from '
|
|
14
|
+
import { globalLoadingState } from './state';
|
|
15
|
+
export { globalLoadingState } from './state';
|
|
15
16
|
export default function GlobalLoading(_a) {
|
|
16
17
|
var props = __rest(_a, []);
|
|
17
18
|
const state = globalLoadingState();
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { cx } from '@emotion/css';
|
|
14
|
+
import { Stack, Typography } from '@mui/material';
|
|
15
|
+
import Balancer, { Provider } from 'react-wrap-balancer';
|
|
16
|
+
import { useRuntimeState } from '../../state/runtime';
|
|
17
|
+
export default function SimpleHeader(_a) {
|
|
18
|
+
var { TitleProps, DescriptionProps } = _a, props = __rest(_a, ["TitleProps", "DescriptionProps"]);
|
|
19
|
+
const { agent, appearancePage } = useRuntimeState();
|
|
20
|
+
const title = (appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.name) || agent.name;
|
|
21
|
+
const description = (appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.description) || agent.description;
|
|
22
|
+
return (_jsx(Stack, Object.assign({ gap: 2, mt: 8, mb: 4 }, props, { className: cx('aigne-header aigne-simple-header', props.className), children: _jsxs(Provider, { children: [title && (_jsx(Typography, Object.assign({ width: "100%", component: "h5", fontSize: 30, fontWeight: 700, textAlign: "center" }, TitleProps, { children: _jsx(Balancer, { children: title }) }))), description && (_jsx(Typography, Object.assign({ width: "100%", textAlign: "center" }, DescriptionProps, { children: _jsx(Balancer, { children: description }) })))] }) })));
|
|
23
|
+
}
|
|
@@ -10,8 +10,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
import { cx } from '@emotion/css';
|
|
14
|
+
import { Stack } from '@mui/material';
|
|
15
|
+
export default function SimpleLayout(_a) {
|
|
16
|
+
var props = __rest(_a, []);
|
|
17
|
+
return (_jsx(Stack, Object.assign({ flexGrow: 1, maxWidth: "md", width: "100%", mx: "auto", px: { xs: 2, sm: 3 } }, props, { className: cx('aigne-layout aigne-layout-simple', props.className) })));
|
|
17
18
|
}
|
|
@@ -16,7 +16,7 @@ import React from 'react';
|
|
|
16
16
|
import { useLocaleContext } from '../../../locale';
|
|
17
17
|
import MarkdownAsync from '../../react-markdown';
|
|
18
18
|
import ReactSyntaxHighlighterAsync from '../../react-syntax-highlighter';
|
|
19
|
-
import
|
|
19
|
+
import ActionButton from './ActionButton';
|
|
20
20
|
const ReactSyntaxHighlighter = React.lazy(() => ReactSyntaxHighlighterAsync().then((m) => ({ default: m.Prism })));
|
|
21
21
|
const Markdown = React.lazy(() => Promise.all([
|
|
22
22
|
MarkdownAsync(),
|
package/lib/esm/builtin/async/ai-runtime/components/{RuntimeProvider.js → RuntimeCommonProvider.js}
RENAMED
|
@@ -7,7 +7,7 @@ import { LocaleProvider, useLocaleContext } from '../../../locale';
|
|
|
7
7
|
import { translations } from '../locales';
|
|
8
8
|
import GlobalLoading from './GlobalLoading';
|
|
9
9
|
import ThemeProvider from './ThemeProvider';
|
|
10
|
-
export default function
|
|
10
|
+
export default function RuntimeCommonProvider({ children }) {
|
|
11
11
|
return (_jsx(RuntimeLocaleProvider, { children: _jsx(ThemeProvider, { children: _jsxs(ErrorBoundary, { FallbackComponent: ErrorRender, children: [_jsx(GlobalLoading, { sx: { position: 'fixed', left: 0, top: 0, width: '100%', zIndex: 'snackbar' } }), _jsx(React.Suspense, { fallback: _jsx(Stack, { flexGrow: 1, alignItems: "center", justifyContent: "center", children: _jsx(CircularProgress, { size: 24 }) }), children: children })] }) }) }));
|
|
12
12
|
}
|
|
13
13
|
function ErrorRender({ error }) {
|
|
@@ -1,12 +1,3 @@
|
|
|
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
1
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
2
|
var t = {};
|
|
12
3
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -20,63 +11,34 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
11
|
};
|
|
21
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
13
|
import { Box } from '@mui/material';
|
|
23
|
-
import { useEffect, useMemo
|
|
24
|
-
import
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
.then((mod) => {
|
|
30
|
-
scrollToBottomModuleLoader.mod = mod;
|
|
31
|
-
return mod;
|
|
32
|
-
})
|
|
33
|
-
.catch((error) => {
|
|
34
|
-
scrollToBottomModuleLoader.error = error;
|
|
35
|
-
throw error;
|
|
36
|
-
}));
|
|
37
|
-
return scrollToBottomModuleLoader;
|
|
38
|
-
}
|
|
39
|
-
export function useScrollToBottomModule() {
|
|
40
|
-
const loader = loadScrollToBottomModule();
|
|
41
|
-
const [mod, setMod] = useState(loader.mod);
|
|
42
|
-
const [error, setError] = useState(loader.error);
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
(() => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
try {
|
|
46
|
-
yield loader.promise;
|
|
47
|
-
if (loader.mod)
|
|
48
|
-
setMod(loader.mod);
|
|
49
|
-
else if (loader.error)
|
|
50
|
-
setError(loader.error);
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
setError(error);
|
|
54
|
-
}
|
|
55
|
-
}))();
|
|
56
|
-
}, []);
|
|
57
|
-
if (mod)
|
|
58
|
-
return mod;
|
|
59
|
-
if (error)
|
|
60
|
-
throw error;
|
|
61
|
-
throw loader.promise;
|
|
62
|
-
}
|
|
14
|
+
import { useEffect, useMemo } from 'react';
|
|
15
|
+
import * as scrollToBottom from 'react-scroll-to-bottom';
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
import useInternalContext from 'react-scroll-to-bottom/lib/esm/hooks/internal/useInternalContext';
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
const Composer = scrollToBottom.Composer;
|
|
63
20
|
export default function ScrollView(_a) {
|
|
64
|
-
var { children, initialScrollBehavior } = _a, props = __rest(_a, ["children", "initialScrollBehavior"]);
|
|
65
|
-
|
|
66
|
-
|
|
21
|
+
var { disabled, children, scroll, component, initialScrollBehavior } = _a, props = __rest(_a, ["disabled", "children", "scroll", "component", "initialScrollBehavior"]);
|
|
22
|
+
if (disabled) {
|
|
23
|
+
if (component) {
|
|
24
|
+
return (_jsx(Box, Object.assign({ component: component }, props, { children: children })));
|
|
25
|
+
}
|
|
26
|
+
return children;
|
|
27
|
+
}
|
|
28
|
+
return (_jsx(Composer, { initialScrollBehavior: initialScrollBehavior, children: _jsx(ScrollViewWithinWindow, Object.assign({ scroll: scroll, component: component }, props, { children: children })) }));
|
|
67
29
|
}
|
|
68
30
|
function ScrollViewWithinWindow(_a) {
|
|
69
|
-
var { children,
|
|
70
|
-
const { setTarget } =
|
|
31
|
+
var { children, scroll, component } = _a, props = __rest(_a, ["children", "scroll", "component"]);
|
|
32
|
+
const { setTarget } = useInternalContext();
|
|
71
33
|
const ele = useFakeScrollElementOfWindow();
|
|
72
34
|
useEffect(() => {
|
|
73
|
-
if (
|
|
35
|
+
if (scroll === 'window') {
|
|
74
36
|
setTarget(ele);
|
|
75
37
|
}
|
|
76
|
-
}, [
|
|
38
|
+
}, [scroll]);
|
|
77
39
|
if (!component)
|
|
78
40
|
return children;
|
|
79
|
-
return (_jsx(Box, Object.assign({ component: component }, props, { ref: !
|
|
41
|
+
return (_jsx(Box, Object.assign({ component: component }, props, { ref: !scroll ? setTarget : undefined, children: children })));
|
|
80
42
|
}
|
|
81
43
|
function useFakeScrollElementOfWindow() {
|
|
82
44
|
return useMemo(() => {
|