@blocklet/pages-kit 0.2.432 → 0.2.434
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.js +17 -0
- package/lib/cjs/builtin/{async/ai-runtime/components/AgentInputField/LanguageField.js → components/LanguageField/index.js} +3 -3
- package/lib/cjs/builtin/{components.js → components/index.js} +1 -1
- package/lib/cjs/components/CustomComponentRenderer/context.js +13 -0
- package/lib/cjs/components/CustomComponentRenderer/index.js +5 -1
- package/lib/cjs/components/CustomComponentRenderer/state.js +20 -6
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/builtin/async/ai-runtime.js +1 -0
- package/lib/esm/builtin/{async/ai-runtime/components/AgentInputField/LanguageField.js → components/LanguageField/index.js} +2 -2
- package/lib/esm/builtin/components/index.js +1 -0
- package/lib/esm/components/CustomComponentRenderer/context.js +9 -0
- package/lib/esm/components/CustomComponentRenderer/index.js +5 -1
- package/lib/esm/components/CustomComponentRenderer/state.js +21 -7
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/builtin/async/ai-runtime.d.ts +1 -0
- package/lib/types/builtin/components/index.d.ts +1 -0
- package/lib/types/components/CustomComponentRenderer/context.d.ts +14 -0
- package/lib/types/components/CustomComponentRenderer/index.d.ts +1 -0
- package/lib/types/components/CustomComponentRenderer/state.d.ts +5 -1
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -5
- package/tsconfig.json +1 -1
- package/lib/cjs/builtin/async/ai-runtime/api/agent.js +0 -24
- package/lib/cjs/builtin/async/ai-runtime/api/asset.js +0 -25
- package/lib/cjs/builtin/async/ai-runtime/api/dataset.js +0 -134
- package/lib/cjs/builtin/async/ai-runtime/api/message.js +0 -46
- package/lib/cjs/builtin/async/ai-runtime/api/request.js +0 -74
- package/lib/cjs/builtin/async/ai-runtime/api/secret.js +0 -24
- package/lib/cjs/builtin/async/ai-runtime/api/session.js +0 -137
- package/lib/cjs/builtin/async/ai-runtime/components/ActionButton.js +0 -62
- package/lib/cjs/builtin/async/ai-runtime/components/AgentErrorBoundary.js +0 -34
- package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/BooleanField.js +0 -21
- package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/NumberField.js +0 -21
- package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/RadioField.js +0 -39
- package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/SelectField.js +0 -24
- package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/StringField.js +0 -35
- package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/index.js +0 -44
- package/lib/cjs/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.js +0 -80
- package/lib/cjs/builtin/async/ai-runtime/components/GlobalLoading/index.js +0 -27
- package/lib/cjs/builtin/async/ai-runtime/components/GlobalLoading/state.js +0 -39
- package/lib/cjs/builtin/async/ai-runtime/components/Header/SimpleHeader.js +0 -49
- package/lib/cjs/builtin/async/ai-runtime/components/Layout/SimpleLayout.js +0 -21
- package/lib/cjs/builtin/async/ai-runtime/components/LoadingButton.js +0 -40
- package/lib/cjs/builtin/async/ai-runtime/components/MarkdownRenderer/index.js +0 -146
- package/lib/cjs/builtin/async/ai-runtime/components/MenuButton.js +0 -55
- package/lib/cjs/builtin/async/ai-runtime/components/OutputFieldContainer/index.js +0 -22
- package/lib/cjs/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.js +0 -49
- package/lib/cjs/builtin/async/ai-runtime/components/PopperMenuButton/index.js +0 -68
- package/lib/cjs/builtin/async/ai-runtime/components/RuntimeCommonProvider.js +0 -25
- package/lib/cjs/builtin/async/ai-runtime/components/ScrollView.js +0 -92
- package/lib/cjs/builtin/async/ai-runtime/components/ShareActions/Community.js +0 -6
- package/lib/cjs/builtin/async/ai-runtime/components/ShareActions/index.js +0 -255
- package/lib/cjs/builtin/async/ai-runtime/components/SocialShare.js +0 -108
- package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +0 -191
- package/lib/cjs/builtin/async/ai-runtime/components/UserInfo.js +0 -55
- package/lib/cjs/builtin/async/ai-runtime/constants.js +0 -43
- package/lib/cjs/builtin/async/ai-runtime/contexts/ActiveAgent.js +0 -27
- package/lib/cjs/builtin/async/ai-runtime/contexts/ComponentPreferences.js +0 -31
- package/lib/cjs/builtin/async/ai-runtime/contexts/CurrentAgent.js +0 -34
- package/lib/cjs/builtin/async/ai-runtime/contexts/CurrentMessage.js +0 -18
- package/lib/cjs/builtin/async/ai-runtime/contexts/Identity.js +0 -36
- package/lib/cjs/builtin/async/ai-runtime/contexts/Runtime.js +0 -52
- package/lib/cjs/builtin/async/ai-runtime/error.js +0 -10
- package/lib/cjs/builtin/async/ai-runtime/hooks/use-agent-admin.js +0 -13
- package/lib/cjs/builtin/async/ai-runtime/hooks/use-appearances.js +0 -109
- package/lib/cjs/builtin/async/ai-runtime/hooks/use-header-menu.js +0 -50
- package/lib/cjs/builtin/async/ai-runtime/index.js +0 -83
- package/lib/cjs/builtin/async/ai-runtime/locales/index.js +0 -237
- package/lib/cjs/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +0 -116
- package/lib/cjs/builtin/async/ai-runtime/runtime/Runtime/index.js +0 -48
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +0 -138
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.js +0 -19
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageItemView.js +0 -186
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageMetadataRenderer.js +0 -24
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageSuggestedQuestions.js +0 -34
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/ReferenceLinks.js +0 -11
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/index.js +0 -24
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.js +0 -85
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.js +0 -64
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ImagesView/index.js +0 -30
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/MarkdownView/index.js +0 -13
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.js +0 -46
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/OutputFieldView/type.js +0 -2
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +0 -65
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.js +0 -150
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.js +0 -26
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ShareView/index.js +0 -16
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.js +0 -38
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/DrawerOpenCloseIcon.js +0 -42
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.js +0 -94
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +0 -79
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.js +0 -34
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.js +0 -45
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.js +0 -28
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +0 -82
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +0 -69
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +0 -55
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.js +0 -54
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Input.js +0 -189
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Output.js +0 -252
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Page.js +0 -300
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +0 -158
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.js +0 -60
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/Loading.js +0 -153
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.js +0 -80
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/TransparentTooltip.js +0 -25
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +0 -68
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.js +0 -56
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/index.js +0 -12
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/utils.js +0 -13
- package/lib/cjs/builtin/async/ai-runtime/state/agent.js +0 -58
- package/lib/cjs/builtin/async/ai-runtime/state/runtime.js +0 -48
- package/lib/cjs/builtin/async/ai-runtime/state/session.js +0 -415
- package/lib/cjs/builtin/async/ai-runtime/utils/agent-inputs.js +0 -14
- package/lib/cjs/builtin/async/ai-runtime/utils/download-image.js +0 -40
- package/lib/cjs/builtin/async/ai-runtime/utils/fonts.js +0 -35
- package/lib/cjs/builtin/async/ai-runtime/utils/map-right.js +0 -10
- package/lib/cjs/builtin/async/ai-runtime/utils/runtime-output-schema.js +0 -7
- package/lib/cjs/builtin/async/ai-runtime/utils/zustand.js +0 -9
- package/lib/esm/builtin/async/ai-runtime/api/agent.js +0 -21
- package/lib/esm/builtin/async/ai-runtime/api/asset.js +0 -22
- package/lib/esm/builtin/async/ai-runtime/api/dataset.js +0 -121
- package/lib/esm/builtin/async/ai-runtime/api/message.js +0 -42
- package/lib/esm/builtin/async/ai-runtime/api/request.js +0 -68
- package/lib/esm/builtin/async/ai-runtime/api/secret.js +0 -21
- package/lib/esm/builtin/async/ai-runtime/api/session.js +0 -128
- package/lib/esm/builtin/async/ai-runtime/components/ActionButton.js +0 -56
- package/lib/esm/builtin/async/ai-runtime/components/AgentErrorBoundary.js +0 -30
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/BooleanField.js +0 -19
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/NumberField.js +0 -19
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/RadioField.js +0 -37
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/SelectField.js +0 -22
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/StringField.js +0 -33
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/index.js +0 -38
- package/lib/esm/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.js +0 -76
- package/lib/esm/builtin/async/ai-runtime/components/GlobalLoading/index.js +0 -22
- package/lib/esm/builtin/async/ai-runtime/components/GlobalLoading/state.js +0 -36
- package/lib/esm/builtin/async/ai-runtime/components/Header/SimpleHeader.js +0 -23
- package/lib/esm/builtin/async/ai-runtime/components/Layout/SimpleLayout.js +0 -18
- package/lib/esm/builtin/async/ai-runtime/components/LoadingButton.js +0 -38
- package/lib/esm/builtin/async/ai-runtime/components/MarkdownRenderer/index.js +0 -118
- package/lib/esm/builtin/async/ai-runtime/components/MenuButton.js +0 -52
- package/lib/esm/builtin/async/ai-runtime/components/OutputFieldContainer/index.js +0 -19
- package/lib/esm/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.js +0 -46
- package/lib/esm/builtin/async/ai-runtime/components/PopperMenuButton/index.js +0 -42
- package/lib/esm/builtin/async/ai-runtime/components/RuntimeCommonProvider.js +0 -18
- package/lib/esm/builtin/async/ai-runtime/components/ScrollView.js +0 -63
- package/lib/esm/builtin/async/ai-runtime/components/ShareActions/Community.js +0 -4
- package/lib/esm/builtin/async/ai-runtime/components/ShareActions/index.js +0 -226
- package/lib/esm/builtin/async/ai-runtime/components/SocialShare.js +0 -100
- package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +0 -185
- package/lib/esm/builtin/async/ai-runtime/components/UserInfo.js +0 -47
- package/lib/esm/builtin/async/ai-runtime/constants.js +0 -39
- package/lib/esm/builtin/async/ai-runtime/contexts/ActiveAgent.js +0 -23
- package/lib/esm/builtin/async/ai-runtime/contexts/ComponentPreferences.js +0 -24
- package/lib/esm/builtin/async/ai-runtime/contexts/CurrentAgent.js +0 -30
- package/lib/esm/builtin/async/ai-runtime/contexts/CurrentMessage.js +0 -14
- package/lib/esm/builtin/async/ai-runtime/contexts/Identity.js +0 -28
- package/lib/esm/builtin/async/ai-runtime/contexts/Runtime.js +0 -22
- package/lib/esm/builtin/async/ai-runtime/error.js +0 -6
- package/lib/esm/builtin/async/ai-runtime/hooks/use-agent-admin.js +0 -10
- package/lib/esm/builtin/async/ai-runtime/hooks/use-appearances.js +0 -103
- package/lib/esm/builtin/async/ai-runtime/hooks/use-header-menu.js +0 -44
- package/lib/esm/builtin/async/ai-runtime/index.js +0 -37
- package/lib/esm/builtin/async/ai-runtime/locales/index.js +0 -234
- package/lib/esm/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +0 -87
- package/lib/esm/builtin/async/ai-runtime/runtime/Runtime/index.js +0 -19
- package/lib/esm/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +0 -132
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.js +0 -13
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageItemView.js +0 -157
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageMetadataRenderer.js +0 -18
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageSuggestedQuestions.js +0 -30
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/ReferenceLinks.js +0 -8
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/index.js +0 -18
- package/lib/esm/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.js +0 -56
- package/lib/esm/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.js +0 -58
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ImagesView/index.js +0 -24
- package/lib/esm/builtin/async/ai-runtime/runtime-components/MarkdownView/index.js +0 -7
- package/lib/esm/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.js +0 -40
- package/lib/esm/builtin/async/ai-runtime/runtime-components/OutputFieldView/type.js +0 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +0 -59
- package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.js +0 -144
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.js +0 -20
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ShareView/index.js +0 -10
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.js +0 -35
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/DrawerOpenCloseIcon.js +0 -39
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.js +0 -65
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +0 -50
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.js +0 -28
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.js +0 -40
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.js +0 -22
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +0 -53
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +0 -40
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +0 -49
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.js +0 -48
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Input.js +0 -183
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Output.js +0 -246
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Page.js +0 -294
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +0 -149
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.js +0 -55
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/Loading.js +0 -146
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.js +0 -75
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/TransparentTooltip.js +0 -23
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +0 -42
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.js +0 -52
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/index.js +0 -3
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/utils.js +0 -9
- package/lib/esm/builtin/async/ai-runtime/state/agent.js +0 -55
- package/lib/esm/builtin/async/ai-runtime/state/runtime.js +0 -45
- package/lib/esm/builtin/async/ai-runtime/state/session.js +0 -408
- package/lib/esm/builtin/async/ai-runtime/utils/agent-inputs.js +0 -10
- package/lib/esm/builtin/async/ai-runtime/utils/download-image.js +0 -36
- package/lib/esm/builtin/async/ai-runtime/utils/fonts.js +0 -32
- package/lib/esm/builtin/async/ai-runtime/utils/map-right.js +0 -7
- package/lib/esm/builtin/async/ai-runtime/utils/runtime-output-schema.js +0 -4
- package/lib/esm/builtin/async/ai-runtime/utils/zustand.js +0 -6
- package/lib/esm/builtin/components.js +0 -1
- package/lib/types/builtin/async/ai-runtime/api/agent.d.ts +0 -51
- package/lib/types/builtin/async/ai-runtime/api/asset.d.ts +0 -16
- package/lib/types/builtin/async/ai-runtime/api/dataset.d.ts +0 -39
- package/lib/types/builtin/async/ai-runtime/api/message.d.ts +0 -35
- package/lib/types/builtin/async/ai-runtime/api/request.d.ts +0 -12
- package/lib/types/builtin/async/ai-runtime/api/secret.d.ts +0 -12
- package/lib/types/builtin/async/ai-runtime/api/session.d.ts +0 -61
- package/lib/types/builtin/async/ai-runtime/components/ActionButton.d.ts +0 -14
- package/lib/types/builtin/async/ai-runtime/components/AgentErrorBoundary.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/components/AgentInputField/BooleanField.d.ts +0 -8
- package/lib/types/builtin/async/ai-runtime/components/AgentInputField/NumberField.d.ts +0 -8
- package/lib/types/builtin/async/ai-runtime/components/AgentInputField/RadioField.d.ts +0 -8
- package/lib/types/builtin/async/ai-runtime/components/AgentInputField/SelectField.d.ts +0 -8
- package/lib/types/builtin/async/ai-runtime/components/AgentInputField/StringField.d.ts +0 -8
- package/lib/types/builtin/async/ai-runtime/components/AgentInputField/index.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.d.ts +0 -10
- package/lib/types/builtin/async/ai-runtime/components/GlobalLoading/index.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/components/GlobalLoading/state.d.ts +0 -10
- package/lib/types/builtin/async/ai-runtime/components/Header/SimpleHeader.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/Layout/SimpleLayout.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/components/LoadingButton.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/components/MarkdownRenderer/index.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/components/MenuButton.d.ts +0 -10
- package/lib/types/builtin/async/ai-runtime/components/OutputFieldContainer/index.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/PopperMenuButton/index.d.ts +0 -6
- package/lib/types/builtin/async/ai-runtime/components/RuntimeCommonProvider.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/components/ScrollView.d.ts +0 -10
- package/lib/types/builtin/async/ai-runtime/components/ShareActions/Community.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/components/ShareActions/index.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/components/SocialShare.d.ts +0 -20
- package/lib/types/builtin/async/ai-runtime/components/ThemeProvider.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/components/UserInfo.d.ts +0 -18
- package/lib/types/builtin/async/ai-runtime/constants.d.ts +0 -21
- package/lib/types/builtin/async/ai-runtime/contexts/ActiveAgent.d.ts +0 -9
- package/lib/types/builtin/async/ai-runtime/contexts/ComponentPreferences.d.ts +0 -11
- package/lib/types/builtin/async/ai-runtime/contexts/CurrentAgent.d.ts +0 -16
- package/lib/types/builtin/async/ai-runtime/contexts/CurrentMessage.d.ts +0 -15
- package/lib/types/builtin/async/ai-runtime/contexts/Identity.d.ts +0 -16
- package/lib/types/builtin/async/ai-runtime/contexts/Runtime.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/error.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/hooks/use-agent-admin.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/hooks/use-appearances.d.ts +0 -78
- package/lib/types/builtin/async/ai-runtime/hooks/use-header-menu.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/index.d.ts +0 -36
- package/lib/types/builtin/async/ai-runtime/locales/index.d.ts +0 -210
- package/lib/types/builtin/async/ai-runtime/runtime/ChatBotButton/index.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/runtime/Runtime/index.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/runtime-components/AutoForm/index.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageItemView.d.ts +0 -12
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageMetadataRenderer.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageSuggestedQuestions.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/ReferenceLinks.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/index.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/ImagesView/index.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/MarkdownView/index.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/OutputFieldView/type.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/ShareView/index.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/DrawerOpenCloseIcon.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.d.ts +0 -9
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/index.d.ts +0 -16
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimplePage/index.d.ts +0 -6
- package/lib/types/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/Input.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/Output.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/Page.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.d.ts +0 -20
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/Loading.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/TransparentTooltip.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.d.ts +0 -17
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/index.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/utils.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/state/agent.d.ts +0 -12
- package/lib/types/builtin/async/ai-runtime/state/runtime.d.ts +0 -14
- package/lib/types/builtin/async/ai-runtime/state/session.d.ts +0 -60
- package/lib/types/builtin/async/ai-runtime/utils/agent-inputs.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/utils/download-image.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/utils/fonts.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/utils/map-right.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/utils/runtime-output-schema.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/utils/zustand.d.ts +0 -2
- package/lib/types/builtin/components.d.ts +0 -1
- /package/lib/cjs/builtin/{async/ai-runtime/utils → components/LanguageField}/languages.js +0 -0
- /package/lib/esm/builtin/{async/ai-runtime/utils → components/LanguageField}/languages.js +0 -0
- /package/lib/types/builtin/{async/ai-runtime/components/AgentInputField/LanguageField.d.ts → components/LanguageField/index.d.ts} +0 -0
- /package/lib/types/builtin/{async/ai-runtime/utils → components/LanguageField}/languages.d.ts +0 -0
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.default = ThemeProvider;
|
|
18
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
-
const icons_material_1 = require("@mui/icons-material");
|
|
20
|
-
const material_1 = require("@mui/material");
|
|
21
|
-
const react_1 = require("react");
|
|
22
|
-
const react_helmet_1 = require("react-helmet");
|
|
23
|
-
const runtime_1 = require("../state/runtime");
|
|
24
|
-
const fonts_1 = require("../utils/fonts");
|
|
25
|
-
const GlobalLoading_1 = __importDefault(require("./GlobalLoading"));
|
|
26
|
-
function ThemeProvider({ children }) {
|
|
27
|
-
var _a, _b, _c;
|
|
28
|
-
const { appearance } = (0, runtime_1.useRuntimeState)().agent.project;
|
|
29
|
-
const theme = (0, material_1.useTheme)();
|
|
30
|
-
const bodyFontFamily = (_a = appearance === null || appearance === void 0 ? void 0 : appearance.typography) === null || _a === void 0 ? void 0 : _a.fontFamily;
|
|
31
|
-
const headingFontFamily = (_c = (_b = appearance === null || appearance === void 0 ? void 0 : appearance.typography) === null || _b === void 0 ? void 0 : _b.heading) === null || _c === void 0 ? void 0 : _c.fontFamily;
|
|
32
|
-
const newTheme = (0, react_1.useMemo)(() => {
|
|
33
|
-
var _a, _b, _c, _d, _e, _f;
|
|
34
|
-
let { primary, secondary } = theme.palette;
|
|
35
|
-
try {
|
|
36
|
-
if (appearance === null || appearance === void 0 ? void 0 : appearance.primaryColor) {
|
|
37
|
-
primary = theme.palette.augmentColor({ color: { main: appearance === null || appearance === void 0 ? void 0 : appearance.primaryColor } });
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
console.error('augment primary color error', { error });
|
|
42
|
-
}
|
|
43
|
-
try {
|
|
44
|
-
if (appearance === null || appearance === void 0 ? void 0 : appearance.secondaryColor) {
|
|
45
|
-
secondary = theme.palette.augmentColor({ color: { main: appearance === null || appearance === void 0 ? void 0 : appearance.secondaryColor } });
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
console.error('augment secondary color error', { error });
|
|
50
|
-
}
|
|
51
|
-
const { fontFamily } = theme.typography;
|
|
52
|
-
const headingFontFamily = [
|
|
53
|
-
((_b = (_a = appearance === null || appearance === void 0 ? void 0 : appearance.typography) === null || _a === void 0 ? void 0 : _a.heading) === null || _b === void 0 ? void 0 : _b.fontFamily) && JSON.stringify((_d = (_c = appearance === null || appearance === void 0 ? void 0 : appearance.typography) === null || _c === void 0 ? void 0 : _c.heading) === null || _d === void 0 ? void 0 : _d.fontFamily),
|
|
54
|
-
fontFamily,
|
|
55
|
-
]
|
|
56
|
-
.filter(Boolean)
|
|
57
|
-
.join(',');
|
|
58
|
-
const bodyFontFamily = [
|
|
59
|
-
((_e = appearance === null || appearance === void 0 ? void 0 : appearance.typography) === null || _e === void 0 ? void 0 : _e.fontFamily) && JSON.stringify((_f = appearance === null || appearance === void 0 ? void 0 : appearance.typography) === null || _f === void 0 ? void 0 : _f.fontFamily),
|
|
60
|
-
fontFamily,
|
|
61
|
-
]
|
|
62
|
-
.filter(Boolean)
|
|
63
|
-
.join(',');
|
|
64
|
-
const themeOptions = {
|
|
65
|
-
components: {
|
|
66
|
-
MuiSelect: {
|
|
67
|
-
defaultProps: { IconComponent: icons_material_1.ArrowDropDownRounded },
|
|
68
|
-
},
|
|
69
|
-
MuiTextField: {
|
|
70
|
-
variants: [
|
|
71
|
-
{
|
|
72
|
-
props: {},
|
|
73
|
-
style: ({ theme }) => theme.unstable_sx({
|
|
74
|
-
'.MuiInputBase-root': {
|
|
75
|
-
fieldset: { borderColor: 'grey.400' },
|
|
76
|
-
[`&.Mui-focused, :not(.${material_1.inputBaseClasses.disabled}):hover`]: {
|
|
77
|
-
fieldset: {
|
|
78
|
-
border: 'none',
|
|
79
|
-
boxShadow: `0px 0px 0px 4px ${(0, material_1.alpha)(theme.palette.primary.main, 0.2)}, 0px 0px 0px 1px ${theme.palette.primary.main}`,
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
'.MuiInputLabel-root': {
|
|
84
|
-
[`&.Mui-focused, :not(.${material_1.inputBaseClasses.disabled}):hover, &.MuiFormLabel-filled`]: {
|
|
85
|
-
backgroundColor: `${theme.palette.primary.main}`,
|
|
86
|
-
color: 'white',
|
|
87
|
-
px: 1,
|
|
88
|
-
ml: -0.8,
|
|
89
|
-
py: 0.2,
|
|
90
|
-
mt: -0.1,
|
|
91
|
-
borderRadius: 4,
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
}),
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
props: { select: true },
|
|
98
|
-
style: (_a) => {
|
|
99
|
-
var { theme } = _a, p = __rest(_a, ["theme"]);
|
|
100
|
-
const { placeholder } = p;
|
|
101
|
-
return theme.unstable_sx({
|
|
102
|
-
'& .MuiSelect-select .notranslate::after': placeholder
|
|
103
|
-
? {
|
|
104
|
-
content: `"${placeholder}"`,
|
|
105
|
-
opacity: 0.42,
|
|
106
|
-
}
|
|
107
|
-
: {},
|
|
108
|
-
'& .MuiFormLabel-root:not(.MuiInputLabel-shrink) + .MuiInputBase-root > .MuiSelect-select .notranslate::after': {
|
|
109
|
-
opacity: 0,
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
},
|
|
116
|
-
MuiListItemButton: {
|
|
117
|
-
variants: [
|
|
118
|
-
{
|
|
119
|
-
props: {},
|
|
120
|
-
style: ({ theme }) => theme.unstable_sx({
|
|
121
|
-
fontSize: 13,
|
|
122
|
-
color: '#010714',
|
|
123
|
-
}),
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
};
|
|
129
|
-
const tempTheme = (0, material_1.createTheme)({
|
|
130
|
-
typography: Object.assign(Object.assign({ fontFamily: bodyFontFamily }, Object.fromEntries(new Array(5).fill(0).map((_, index) => [
|
|
131
|
-
`h${index + 1}`,
|
|
132
|
-
{
|
|
133
|
-
fontFamily: headingFontFamily,
|
|
134
|
-
},
|
|
135
|
-
]))), { button: {
|
|
136
|
-
textTransform: 'none',
|
|
137
|
-
} }),
|
|
138
|
-
palette: {
|
|
139
|
-
primary,
|
|
140
|
-
secondary,
|
|
141
|
-
},
|
|
142
|
-
});
|
|
143
|
-
return (0, material_1.createTheme)(theme, themeOptions, {
|
|
144
|
-
typography: tempTheme.typography,
|
|
145
|
-
palette: {
|
|
146
|
-
primary: tempTheme.palette.primary,
|
|
147
|
-
secondary: tempTheme.palette.secondary,
|
|
148
|
-
text: tempTheme.palette.text,
|
|
149
|
-
background: {
|
|
150
|
-
default: '#ffffff',
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
shape: {
|
|
154
|
-
borderRadius: 8,
|
|
155
|
-
},
|
|
156
|
-
shadows: [
|
|
157
|
-
'none',
|
|
158
|
-
'0px 0px 0px 1px rgba(2, 7, 19, 0.08), 0px 1px 2px -1px rgba(2, 7, 19, 0.08), 0px 2px 4px 0px rgba(2, 7, 19, 0.04)',
|
|
159
|
-
'0px 0px 0px 1px rgba(2, 7, 19, 0.08), 0px 1px 2px -1px rgba(2, 7, 19, 0.08), 0px 2px 8px 0px rgba(2, 7, 19, 0.10)',
|
|
160
|
-
...tempTheme.shadows.slice(3),
|
|
161
|
-
],
|
|
162
|
-
});
|
|
163
|
-
}, [theme]);
|
|
164
|
-
const fontUrls = (0, react_1.useMemo)(() => {
|
|
165
|
-
const urls = [bodyFontFamily, headingFontFamily]
|
|
166
|
-
.filter((i) => !!i)
|
|
167
|
-
.map((font) => {
|
|
168
|
-
var _a;
|
|
169
|
-
return ((_a = fonts_1.chineseFonts.find((i) => i.value === font)) === null || _a === void 0 ? void 0 : _a.link) ||
|
|
170
|
-
`https://fonts.googleapis.com/css?family=${font.replace(/ /g, '+')}`;
|
|
171
|
-
});
|
|
172
|
-
return [...new Set(urls)];
|
|
173
|
-
}, [bodyFontFamily, headingFontFamily]);
|
|
174
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.ThemeProvider, { theme: newTheme, children: [(0, jsx_runtime_1.jsx)(react_helmet_1.Helmet, { children: fontUrls.map((url) => ((0, jsx_runtime_1.jsx)("link", { rel: "stylesheet", href: url }, url))) }), (0, jsx_runtime_1.jsxs)(material_1.CssBaseline, { children: [(0, jsx_runtime_1.jsx)(material_1.GlobalStyles, { styles: (theme) => theme.unstable_sx({
|
|
175
|
-
'h1,h2,h3,h4,h5': {
|
|
176
|
-
fontFamily: `${theme.typography.h1.fontFamily} !important`,
|
|
177
|
-
},
|
|
178
|
-
body: {
|
|
179
|
-
fontFamily: `${theme.typography.fontFamily} !important`,
|
|
180
|
-
},
|
|
181
|
-
'.page-header': {
|
|
182
|
-
borderBottom: '1px solid rgba(229, 231, 235, 1)',
|
|
183
|
-
},
|
|
184
|
-
'.white-tooltip .MuiTooltip-tooltip': {
|
|
185
|
-
background: 'white !important',
|
|
186
|
-
boxShadow: '0px 4px 8px 0px rgba(3, 7, 18, 0.08)',
|
|
187
|
-
border: '1px solid rgba(229, 231, 235, 1)',
|
|
188
|
-
padding: 4,
|
|
189
|
-
},
|
|
190
|
-
}) }), (0, jsx_runtime_1.jsx)(GlobalLoading_1.default, { sx: { position: 'fixed', left: 0, top: 0, width: '100%', zIndex: 'snackbar' } }), (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(material_1.Stack, { flexGrow: 1, alignItems: "center", justifyContent: "center", children: (0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 24 }) }), children: children })] })] }));
|
|
191
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.default = UserInfo;
|
|
18
|
-
exports.UserName = UserName;
|
|
19
|
-
exports.UserTime = UserTime;
|
|
20
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
21
|
-
const DID_1 = __importDefault(require("@arcblock/ux/lib/DID"));
|
|
22
|
-
const material_1 = require("@mui/material");
|
|
23
|
-
const dayjs_1 = __importDefault(require("dayjs"));
|
|
24
|
-
const react_1 = require("react");
|
|
25
|
-
const ux_1 = require("../../../arcblock/ux");
|
|
26
|
-
function UserInfo(_a) {
|
|
27
|
-
var { avatar, showDID, did, name, time, children, reverse, UserNameProps } = _a, restProps = __rest(_a, ["avatar", "showDID", "did", "name", "time", "children", "reverse", "UserNameProps"]);
|
|
28
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: "user-info", alignItems: "center", direction: reverse ? 'row-reverse' : 'row', gap: 1.5 }, restProps, { children: [(avatar || did) && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
29
|
-
display: 'flex',
|
|
30
|
-
alignItems: 'center',
|
|
31
|
-
maxHeight: 44,
|
|
32
|
-
}, children: (0, jsx_runtime_1.jsx)(ux_1.Avatar, { size: 40, did: did, variant: "circle", shape: "circle",
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
src: avatar }) })), (0, jsx_runtime_1.jsxs)(material_1.Box, { flex: 1, width: 0, children: [(0, jsx_runtime_1.jsxs)(UserName, Object.assign({}, UserNameProps, { sx: Object.assign({ justifyContent: reverse ? 'flex-end' : 'flex-start' }, UserNameProps === null || UserNameProps === void 0 ? void 0 : UserNameProps.sx), children: [name || '', time && ((0, jsx_runtime_1.jsx)(UserTime, { time: time, sx: {
|
|
35
|
-
fontSize: 12,
|
|
36
|
-
lineHeight: '24px',
|
|
37
|
-
opacity: 0.8,
|
|
38
|
-
} }))] })), showDID && did && (0, jsx_runtime_1.jsx)(material_1.Box, { component: DID_1.default, did: did, copyable: false, size: 14, responsive: true, sx: { mt: -0.25 } }), (0, jsx_runtime_1.jsx)(material_1.Box, { flex: 1, children: children })] })] })));
|
|
39
|
-
}
|
|
40
|
-
function UserName(_a) {
|
|
41
|
-
var { children, sx } = _a, restProps = __rest(_a, ["children", "sx"]);
|
|
42
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "div", noWrap: true, sx: Object.assign({ fontSize: 14, lineHeight: '24px', fontWeight: 500, display: 'flex', alignItems: 'center', gap: 1 }, sx) }, restProps, { children: children })));
|
|
43
|
-
}
|
|
44
|
-
function UserTime(_a) {
|
|
45
|
-
var { time } = _a, restProps = __rest(_a, ["time"]);
|
|
46
|
-
const formattedTime = (0, react_1.useMemo)(() => {
|
|
47
|
-
const date = (0, dayjs_1.default)(time);
|
|
48
|
-
if (!date.isValid())
|
|
49
|
-
return undefined;
|
|
50
|
-
return date.isSame((0, dayjs_1.default)(), 'date') ? date.format('HH:mm') : date.format('YYYY-MM-DD HH:mm');
|
|
51
|
-
}, [time]);
|
|
52
|
-
if (!formattedTime)
|
|
53
|
-
return null;
|
|
54
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({}, restProps, { children: formattedTime }), "user-time"));
|
|
55
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_OUTPUT_COMPONENTS = exports.OPENING_QUESTIONS_VIEW_ID = exports.IMAGES_VIEW_ID = exports.SHARE_VIEW_ID = exports.REFERENCED_LINKS_VIEW_ID = exports.SUGGESTED_QUESTIONS_VIEW_ID = exports.MARKDOWN_VIEW_ID = exports.DEFAULT_OUTPUT_COMPONENT_ID = exports.DEFAULT_INPUT_COMPONENT_ID = exports.DEFAULT_PAGE_COMPONENT_ID = exports.PAYMENT_KIT_DID = exports.AI_RUNTIME_DID = exports.AI_STUDIO_DID = void 0;
|
|
4
|
-
exports.getDefaultOutputComponent = getDefaultOutputComponent;
|
|
5
|
-
const types_1 = require("@blocklet/ai-runtime/types");
|
|
6
|
-
exports.AI_STUDIO_DID = 'z8iZpog7mcgcgBZzTiXJCWESvmnRrQmnd3XBB';
|
|
7
|
-
exports.AI_RUNTIME_DID = 'z2qaBP9SahqU2L2YA3ip7NecwKACMByTFuiJ2';
|
|
8
|
-
exports.PAYMENT_KIT_DID = 'z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk';
|
|
9
|
-
exports.DEFAULT_PAGE_COMPONENT_ID = 'ctnxha29uu8cx4xv'; // Simple Layout
|
|
10
|
-
exports.DEFAULT_INPUT_COMPONENT_ID = '1wwtemqcdio6nqf0'; // Auto Form
|
|
11
|
-
exports.DEFAULT_OUTPUT_COMPONENT_ID = 'q0ckknkxph4hfwas'; // Simple Output
|
|
12
|
-
exports.MARKDOWN_VIEW_ID = 'a4oldpoxv7bikvpj';
|
|
13
|
-
exports.SUGGESTED_QUESTIONS_VIEW_ID = '6u8m11ss7fvu8t7i';
|
|
14
|
-
exports.REFERENCED_LINKS_VIEW_ID = 'baqmaoccdntqwayc';
|
|
15
|
-
exports.SHARE_VIEW_ID = 'jfq3df9z8lkk9not';
|
|
16
|
-
exports.IMAGES_VIEW_ID = 'txirtdgx8h2bmo7s';
|
|
17
|
-
exports.OPENING_QUESTIONS_VIEW_ID = 'vgsgsvnhud0cq37v';
|
|
18
|
-
exports.DEFAULT_OUTPUT_COMPONENTS = {
|
|
19
|
-
[types_1.RuntimeOutputVariable.text]: {
|
|
20
|
-
componentId: exports.MARKDOWN_VIEW_ID,
|
|
21
|
-
},
|
|
22
|
-
[types_1.RuntimeOutputVariable.images]: {
|
|
23
|
-
componentId: exports.IMAGES_VIEW_ID,
|
|
24
|
-
},
|
|
25
|
-
[types_1.RuntimeOutputVariable.openingMessage]: {
|
|
26
|
-
componentId: exports.MARKDOWN_VIEW_ID,
|
|
27
|
-
},
|
|
28
|
-
[types_1.RuntimeOutputVariable.suggestedQuestions]: {
|
|
29
|
-
componentId: exports.SUGGESTED_QUESTIONS_VIEW_ID,
|
|
30
|
-
},
|
|
31
|
-
[types_1.RuntimeOutputVariable.referenceLinks]: {
|
|
32
|
-
componentId: exports.REFERENCED_LINKS_VIEW_ID,
|
|
33
|
-
},
|
|
34
|
-
[types_1.RuntimeOutputVariable.share]: {
|
|
35
|
-
componentId: exports.SHARE_VIEW_ID,
|
|
36
|
-
},
|
|
37
|
-
[types_1.RuntimeOutputVariable.openingQuestions]: {
|
|
38
|
-
componentId: exports.OPENING_QUESTIONS_VIEW_ID,
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
function getDefaultOutputComponent(output) {
|
|
42
|
-
return exports.DEFAULT_OUTPUT_COMPONENTS[output.name];
|
|
43
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useActiveAgent = useActiveAgent;
|
|
4
|
-
exports.default = ActiveAgentProvider;
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const types_1 = require("@blocklet/ai-runtime/types");
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
const runtime_1 = require("../state/runtime");
|
|
9
|
-
const runtime_output_schema_1 = require("../utils/runtime-output-schema");
|
|
10
|
-
const activeAgentContext = (0, react_1.createContext)(undefined);
|
|
11
|
-
function useActiveAgent() {
|
|
12
|
-
const context = (0, react_1.useContext)(activeAgentContext);
|
|
13
|
-
if (!context) {
|
|
14
|
-
throw new Error('No such activeAgentContext. You should use `useActiveAgent` within the `ActiveAgentProvider`');
|
|
15
|
-
}
|
|
16
|
-
return context;
|
|
17
|
-
}
|
|
18
|
-
function ActiveAgentProvider({ children }) {
|
|
19
|
-
const { agent } = (0, runtime_1.useRuntimeState)();
|
|
20
|
-
const childAgentId = (0, react_1.useMemo)(() => {
|
|
21
|
-
var _a, _b, _c, _d;
|
|
22
|
-
return (_d = (_c = (_b = (_a = (0, runtime_output_schema_1.getOutputVariableInitialValue)(agent, types_1.RuntimeOutputVariable.children)) === null || _a === void 0 ? void 0 : _a.agents) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : agent.id;
|
|
23
|
-
}, [agent]);
|
|
24
|
-
const [activeAgentId, setActiveAgentId] = (0, react_1.useState)(childAgentId);
|
|
25
|
-
const activeAgent = (0, react_1.useMemo)(() => ({ activeAgentId, setActiveAgentId }), [activeAgentId, setActiveAgentId]);
|
|
26
|
-
return (0, jsx_runtime_1.jsx)(activeAgentContext.Provider, { value: activeAgent, children: children });
|
|
27
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.default = ComponentPreferencesProvider;
|
|
18
|
-
exports.useComponentPreferences = useComponentPreferences;
|
|
19
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
20
|
-
const omitBy_1 = __importDefault(require("lodash/omitBy"));
|
|
21
|
-
const react_1 = require("react");
|
|
22
|
-
const componentPreferencesContext = (0, react_1.createContext)(undefined);
|
|
23
|
-
function ComponentPreferencesProvider(_a) {
|
|
24
|
-
var { children } = _a, preferences = __rest(_a, ["children"]);
|
|
25
|
-
const inherited = useComponentPreferences();
|
|
26
|
-
const value = (0, react_1.useMemo)(() => (Object.assign(Object.assign({}, inherited), (0, omitBy_1.default)(preferences, (i) => i === undefined || i === null))), [inherited, Object.values(preferences)]);
|
|
27
|
-
return (0, jsx_runtime_1.jsx)(componentPreferencesContext.Provider, { value: value, children: children });
|
|
28
|
-
}
|
|
29
|
-
function useComponentPreferences() {
|
|
30
|
-
return (0, react_1.useContext)(componentPreferencesContext);
|
|
31
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = CurrentAgentProvider;
|
|
4
|
-
exports.useCurrentAgent = useCurrentAgent;
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const aid_1 = require("@blocklet/ai-runtime/common/aid");
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
const agent_1 = require("../state/agent");
|
|
9
|
-
const runtime_1 = require("../state/runtime");
|
|
10
|
-
function useCurrentAid({ agentId }) {
|
|
11
|
-
const { aid } = (0, runtime_1.useRuntimeState)();
|
|
12
|
-
return (0, react_1.useMemo)(() => ({
|
|
13
|
-
aid: (0, aid_1.stringifyIdentity)(Object.assign(Object.assign({}, (0, aid_1.parseIdentity)(aid, { rejectWhenError: true })), { agentId })),
|
|
14
|
-
}), [aid, agentId]);
|
|
15
|
-
}
|
|
16
|
-
const context = (0, react_1.createContext)(undefined);
|
|
17
|
-
function CurrentAgentProvider({ agentId, children }) {
|
|
18
|
-
const state = useCurrentAid({ agentId });
|
|
19
|
-
return (0, jsx_runtime_1.jsx)(context.Provider, { value: state, children: children });
|
|
20
|
-
}
|
|
21
|
-
function useCurrentAgent(args = {}) {
|
|
22
|
-
const { blockletDid, aid: runtimeAid, working } = (0, runtime_1.useRuntimeState)();
|
|
23
|
-
const aidFromParam = (0, react_1.useMemo)(() => args.aid ||
|
|
24
|
-
(args.agentId
|
|
25
|
-
? (0, aid_1.stringifyIdentity)(Object.assign(Object.assign({}, (0, aid_1.parseIdentity)(runtimeAid, { rejectWhenError: true })), { agentId: args.agentId }))
|
|
26
|
-
: undefined), [args.agentId, args.aid, runtimeAid]);
|
|
27
|
-
const current = (0, react_1.useContext)(context);
|
|
28
|
-
const aid = aidFromParam !== null && aidFromParam !== void 0 ? aidFromParam : current === null || current === void 0 ? void 0 : current.aid;
|
|
29
|
-
if (!aid) {
|
|
30
|
-
throw new Error('No such current agent state. You should use `useCurrentAgent` within the `CurrentAgentProvider`');
|
|
31
|
-
}
|
|
32
|
-
const [agent] = (0, agent_1.useAgentState)({ blockletDid, aid, working });
|
|
33
|
-
return { aid, agent };
|
|
34
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = CurrentMessageProvider;
|
|
4
|
-
exports.useCurrentMessage = useCurrentMessage;
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const context = (0, react_1.createContext)(undefined);
|
|
8
|
-
function CurrentMessageProvider({ message, children }) {
|
|
9
|
-
const state = (0, react_1.useMemo)(() => ({ message }), [message]);
|
|
10
|
-
return (0, jsx_runtime_1.jsx)(context.Provider, { value: state, children: children });
|
|
11
|
-
}
|
|
12
|
-
function useCurrentMessage({ optional } = {}) {
|
|
13
|
-
const current = (0, react_1.useContext)(context);
|
|
14
|
-
if (!optional && !current) {
|
|
15
|
-
throw new Error('No such message state. You should use `useCurrentMessage` within the `CurrentMessageProvider`');
|
|
16
|
-
}
|
|
17
|
-
return current;
|
|
18
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useIdentityContext = useIdentityContext;
|
|
7
|
-
exports.default = IdentityProvider;
|
|
8
|
-
exports.IdentityProviderFromUrl = IdentityProviderFromUrl;
|
|
9
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
10
|
-
const react_1 = require("react");
|
|
11
|
-
const react_router_dom_1 = require("react-router-dom");
|
|
12
|
-
const RuntimeCommonProvider_1 = __importDefault(require("../components/RuntimeCommonProvider"));
|
|
13
|
-
const error_1 = require("../error");
|
|
14
|
-
const identityContext = (0, react_1.createContext)(undefined);
|
|
15
|
-
function useIdentityContext() {
|
|
16
|
-
const context = (0, react_1.useContext)(identityContext);
|
|
17
|
-
if (!context) {
|
|
18
|
-
throw new Error('No such runtime context. You should use `useRuntimeContext` within the `RuntimeProvider`');
|
|
19
|
-
}
|
|
20
|
-
return context;
|
|
21
|
-
}
|
|
22
|
-
function IdentityProvider({ blockletDid, aid, working, children, }) {
|
|
23
|
-
if (!aid)
|
|
24
|
-
throw new Error('Missing required props `aid`');
|
|
25
|
-
const value = (0, react_1.useMemo)(() => ({ blockletDid, aid, working }), [blockletDid, aid, working]);
|
|
26
|
-
return ((0, jsx_runtime_1.jsx)(RuntimeCommonProvider_1.default, { children: (0, jsx_runtime_1.jsx)(identityContext.Provider, { value: value, children: children }) }));
|
|
27
|
-
}
|
|
28
|
-
function IdentityProviderFromUrl({ children }) {
|
|
29
|
-
const [query] = (0, react_router_dom_1.useSearchParams)();
|
|
30
|
-
const aid = query.get('aid');
|
|
31
|
-
const blockletDid = query.get('blockletDid') || undefined;
|
|
32
|
-
const working = query.get('working') === 'true';
|
|
33
|
-
if (!aid)
|
|
34
|
-
throw new error_1.CustomError(404, 'Missing required query parameters `aid`');
|
|
35
|
-
return ((0, jsx_runtime_1.jsx)(IdentityProvider, { blockletDid: blockletDid, aid: aid, working: working, children: children }));
|
|
36
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.default = RuntimeProvider;
|
|
41
|
-
exports.RuntimeProviderFromUrl = RuntimeProviderFromUrl;
|
|
42
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
43
|
-
const ThemeProvider_1 = __importDefault(require("../components/ThemeProvider"));
|
|
44
|
-
const Identity_1 = __importStar(require("./Identity"));
|
|
45
|
-
function RuntimeProvider(_a) {
|
|
46
|
-
var props = __rest(_a, []);
|
|
47
|
-
return ((0, jsx_runtime_1.jsx)(Identity_1.default, Object.assign({}, props, { children: (0, jsx_runtime_1.jsx)(ThemeProvider_1.default, { children: props.children }) })));
|
|
48
|
-
}
|
|
49
|
-
function RuntimeProviderFromUrl(_a) {
|
|
50
|
-
var props = __rest(_a, []);
|
|
51
|
-
return ((0, jsx_runtime_1.jsx)(Identity_1.IdentityProviderFromUrl, Object.assign({}, props, { children: (0, jsx_runtime_1.jsx)(ThemeProvider_1.default, { children: props.children }) })));
|
|
52
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CustomError = void 0;
|
|
4
|
-
class CustomError extends Error {
|
|
5
|
-
constructor(status, message) {
|
|
6
|
-
super(message);
|
|
7
|
-
this.status = status;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.CustomError = CustomError;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useIsAgentAdmin = useIsAgentAdmin;
|
|
4
|
-
const session_1 = require("../../../session");
|
|
5
|
-
const ADMIN_ROLES = ['admin', 'owner'];
|
|
6
|
-
function useIsAgentAdmin(agent) {
|
|
7
|
-
const { session } = (0, session_1.useSessionContext)();
|
|
8
|
-
if (!session.user)
|
|
9
|
-
return false;
|
|
10
|
-
if (ADMIN_ROLES.includes(session.user.role))
|
|
11
|
-
return true;
|
|
12
|
-
return session.user.did === agent.createdBy || session.user.did === agent.project.createdBy;
|
|
13
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = useAppearances;
|
|
4
|
-
exports.useProfile = useProfile;
|
|
5
|
-
exports.useOpeningMessage = useOpeningMessage;
|
|
6
|
-
exports.useOpeningQuestions = useOpeningQuestions;
|
|
7
|
-
const types_1 = require("@blocklet/ai-runtime/types");
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
const ufo_1 = require("ufo");
|
|
10
|
-
const utils_1 = require("../../../utils");
|
|
11
|
-
const constants_1 = require("../constants");
|
|
12
|
-
const CurrentAgent_1 = require("../contexts/CurrentAgent");
|
|
13
|
-
const runtime_1 = require("../state/runtime");
|
|
14
|
-
const runtime_output_schema_1 = require("../utils/runtime-output-schema");
|
|
15
|
-
function useAppearances(args) {
|
|
16
|
-
const { agent: runtimeAgent } = (0, runtime_1.useRuntimeState)();
|
|
17
|
-
const { agent } = (0, CurrentAgent_1.useCurrentAgent)(args);
|
|
18
|
-
const appearancePage = (0, react_1.useMemo)(() => {
|
|
19
|
-
var _a, _b, _c, _d;
|
|
20
|
-
const appearance = (_b = (_a = agent.outputVariables) === null || _a === void 0 ? void 0 : _a.find((i) => i.name === types_1.RuntimeOutputVariable.appearancePage)) === null || _b === void 0 ? void 0 : _b.appearance;
|
|
21
|
-
if (appearance === null || appearance === void 0 ? void 0 : appearance.componentId)
|
|
22
|
-
return Object.assign(Object.assign({}, appearance), { componentId: appearance.componentId });
|
|
23
|
-
const runtimeAppearance = (_d = (_c = runtimeAgent.outputVariables) === null || _c === void 0 ? void 0 : _c.find((i) => i.name === types_1.RuntimeOutputVariable.appearancePage)) === null || _d === void 0 ? void 0 : _d.appearance;
|
|
24
|
-
if (runtimeAppearance === null || runtimeAppearance === void 0 ? void 0 : runtimeAppearance.componentId)
|
|
25
|
-
return Object.assign(Object.assign({}, runtimeAppearance), { componentId: runtimeAppearance.componentId });
|
|
26
|
-
return {
|
|
27
|
-
componentId: constants_1.DEFAULT_PAGE_COMPONENT_ID,
|
|
28
|
-
};
|
|
29
|
-
}, [agent]);
|
|
30
|
-
const appearanceInput = (0, react_1.useMemo)(() => {
|
|
31
|
-
var _a, _b, _c, _d;
|
|
32
|
-
const appearance = (_b = (_a = agent.outputVariables) === null || _a === void 0 ? void 0 : _a.find((i) => i.name === types_1.RuntimeOutputVariable.appearanceInput)) === null || _b === void 0 ? void 0 : _b.appearance;
|
|
33
|
-
if (appearance === null || appearance === void 0 ? void 0 : appearance.componentId)
|
|
34
|
-
return Object.assign(Object.assign({}, appearance), { componentId: appearance.componentId });
|
|
35
|
-
const runtimeAppearance = (_d = (_c = runtimeAgent.outputVariables) === null || _c === void 0 ? void 0 : _c.find((i) => i.name === types_1.RuntimeOutputVariable.appearanceInput)) === null || _d === void 0 ? void 0 : _d.appearance;
|
|
36
|
-
if (runtimeAppearance === null || runtimeAppearance === void 0 ? void 0 : runtimeAppearance.componentId)
|
|
37
|
-
return Object.assign(Object.assign({}, runtimeAppearance), { componentId: runtimeAppearance.componentId });
|
|
38
|
-
return {
|
|
39
|
-
componentId: constants_1.DEFAULT_INPUT_COMPONENT_ID,
|
|
40
|
-
};
|
|
41
|
-
}, [agent, runtimeAgent]);
|
|
42
|
-
const appearanceOutput = (0, react_1.useMemo)(() => {
|
|
43
|
-
var _a, _b, _c, _d;
|
|
44
|
-
const appearance = (_b = (_a = agent.outputVariables) === null || _a === void 0 ? void 0 : _a.find((i) => i.name === types_1.RuntimeOutputVariable.appearanceOutput)) === null || _b === void 0 ? void 0 : _b.appearance;
|
|
45
|
-
if (appearance === null || appearance === void 0 ? void 0 : appearance.componentId)
|
|
46
|
-
return Object.assign(Object.assign({}, appearance), { componentId: appearance.componentId });
|
|
47
|
-
const runtimeAppearance = (_d = (_c = runtimeAgent.outputVariables) === null || _c === void 0 ? void 0 : _c.find((i) => i.name === types_1.RuntimeOutputVariable.appearanceOutput)) === null || _d === void 0 ? void 0 : _d.appearance;
|
|
48
|
-
if (runtimeAppearance === null || runtimeAppearance === void 0 ? void 0 : runtimeAppearance.componentId)
|
|
49
|
-
return Object.assign(Object.assign({}, runtimeAppearance), { componentId: runtimeAppearance.componentId });
|
|
50
|
-
return {
|
|
51
|
-
componentId: constants_1.DEFAULT_OUTPUT_COMPONENT_ID,
|
|
52
|
-
};
|
|
53
|
-
}, [agent, runtimeAgent]);
|
|
54
|
-
return { appearancePage, appearanceInput, appearanceOutput };
|
|
55
|
-
}
|
|
56
|
-
function getProjectIconUrl({ blockletDid, aid }) {
|
|
57
|
-
return (0, ufo_1.withQuery)((0, ufo_1.joinURL)(window.location.origin, (0, utils_1.getComponentMountPoint)(constants_1.AI_RUNTIME_DID), '/api/agents', aid, '/logo'), { blockletDid });
|
|
58
|
-
}
|
|
59
|
-
function useProfile(args) {
|
|
60
|
-
const { blockletDid, aid, agent: runtimeAgent } = (0, runtime_1.useRuntimeState)();
|
|
61
|
-
const { agent } = (0, CurrentAgent_1.useCurrentAgent)(args);
|
|
62
|
-
return (0, react_1.useMemo)(() => {
|
|
63
|
-
const profile = (0, runtime_output_schema_1.getOutputVariableInitialValue)(agent, types_1.RuntimeOutputVariable.profile);
|
|
64
|
-
const runtimeProfile = (0, runtime_output_schema_1.getOutputVariableInitialValue)(runtimeAgent, types_1.RuntimeOutputVariable.profile);
|
|
65
|
-
return {
|
|
66
|
-
avatar: (profile === null || profile === void 0 ? void 0 : profile.avatar) || (runtimeProfile === null || runtimeProfile === void 0 ? void 0 : runtimeProfile.avatar) || getProjectIconUrl({ blockletDid, aid }),
|
|
67
|
-
name: (profile === null || profile === void 0 ? void 0 : profile.name) || (runtimeProfile === null || runtimeProfile === void 0 ? void 0 : runtimeProfile.name) || runtimeAgent.name || runtimeAgent.project.name,
|
|
68
|
-
description: (profile === null || profile === void 0 ? void 0 : profile.description) ||
|
|
69
|
-
(runtimeProfile === null || runtimeProfile === void 0 ? void 0 : runtimeProfile.description) ||
|
|
70
|
-
runtimeAgent.description ||
|
|
71
|
-
runtimeAgent.project.description,
|
|
72
|
-
};
|
|
73
|
-
}, [agent, runtimeAgent]);
|
|
74
|
-
}
|
|
75
|
-
function useOpeningMessage(args) {
|
|
76
|
-
const { aid: runtimeAid, agent: runtimeAgent } = (0, runtime_1.useRuntimeState)();
|
|
77
|
-
const runtimeProfile = useProfile({ aid: runtimeAid });
|
|
78
|
-
const { agent } = (0, CurrentAgent_1.useCurrentAgent)(args);
|
|
79
|
-
const profile = useProfile(args);
|
|
80
|
-
return (0, react_1.useMemo)(() => {
|
|
81
|
-
const agentOpening = (0, runtime_output_schema_1.getOutputVariableInitialValue)(agent, types_1.RuntimeOutputVariable.openingMessage);
|
|
82
|
-
if (agentOpening === null || agentOpening === void 0 ? void 0 : agentOpening.message) {
|
|
83
|
-
return {
|
|
84
|
-
agent,
|
|
85
|
-
message: agentOpening.message,
|
|
86
|
-
profile,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
const runtimeOpening = (0, runtime_output_schema_1.getOutputVariableInitialValue)(runtimeAgent, types_1.RuntimeOutputVariable.openingMessage);
|
|
90
|
-
if (runtimeOpening === null || runtimeOpening === void 0 ? void 0 : runtimeOpening.message) {
|
|
91
|
-
return {
|
|
92
|
-
agent: runtimeAgent,
|
|
93
|
-
message: runtimeOpening.message,
|
|
94
|
-
profile: runtimeProfile,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
return undefined;
|
|
98
|
-
}, [agent, profile, runtimeAgent, runtimeProfile]);
|
|
99
|
-
}
|
|
100
|
-
function useOpeningQuestions(args) {
|
|
101
|
-
const { agent } = (0, CurrentAgent_1.useCurrentAgent)(args);
|
|
102
|
-
return (0, react_1.useMemo)(() => {
|
|
103
|
-
var _a, _b;
|
|
104
|
-
const questions = (_b = (_a = (0, runtime_output_schema_1.getOutputVariableInitialValue)(agent, types_1.RuntimeOutputVariable.openingQuestions)) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.filter((i) => !!i.title);
|
|
105
|
-
if (!(questions === null || questions === void 0 ? void 0 : questions.length))
|
|
106
|
-
return undefined;
|
|
107
|
-
return { questions };
|
|
108
|
-
}, [agent]);
|
|
109
|
-
}
|