@blocklet/pages-kit 0.2.433 → 0.2.435
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,226 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
-
var t = {};
|
|
12
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
-
t[p] = s[p];
|
|
14
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
-
t[p[i]] = s[p[i]];
|
|
18
|
-
}
|
|
19
|
-
return t;
|
|
20
|
-
};
|
|
21
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
-
import { RuntimeOutputVariable } from '@blocklet/ai-runtime/types';
|
|
23
|
-
import { Icon } from '@iconify/react';
|
|
24
|
-
import { Box, Stack, styled } from '@mui/material';
|
|
25
|
-
import { saveAs } from 'file-saver';
|
|
26
|
-
import DOMPurify from 'isomorphic-dompurify';
|
|
27
|
-
import { useMemo } from 'react';
|
|
28
|
-
import { getQuery, joinURL, withQuery } from 'ufo';
|
|
29
|
-
import { useLocaleContext } from '../../../../locale';
|
|
30
|
-
import { useSessionContext } from '../../../../session';
|
|
31
|
-
import { AI_RUNTIME_DID } from '../../constants';
|
|
32
|
-
import { useCurrentAgent } from '../../contexts/CurrentAgent';
|
|
33
|
-
import { useCurrentMessage } from '../../contexts/CurrentMessage';
|
|
34
|
-
import { useProfile } from '../../hooks/use-appearances';
|
|
35
|
-
import { useRuntimeState } from '../../state/runtime';
|
|
36
|
-
import { isValidInput } from '../../utils/agent-inputs';
|
|
37
|
-
import { convertImageToBlob, downloadImage } from '../../utils/download-image';
|
|
38
|
-
import ActionButton from '../ActionButton';
|
|
39
|
-
import CommunityIcon from './Community';
|
|
40
|
-
export default function ShareActions(_a) {
|
|
41
|
-
var _b;
|
|
42
|
-
var props = __rest(_a, []);
|
|
43
|
-
const { agent } = useCurrentAgent();
|
|
44
|
-
const { message } = useCurrentMessage();
|
|
45
|
-
const sharing = useMemo(() => {
|
|
46
|
-
var _a, _b;
|
|
47
|
-
return (_b = (_a = agent.outputVariables) === null || _a === void 0 ? void 0 : _a.find((i) => i.name === RuntimeOutputVariable.share)) === null || _b === void 0 ? void 0 : _b.initialValue;
|
|
48
|
-
}, [agent]);
|
|
49
|
-
const inputs = useMemo(() => {
|
|
50
|
-
var _a;
|
|
51
|
-
return ((_a = agent.parameters) === null || _a === void 0 ? void 0 : _a.filter(isValidInput).map((i) => { var _a, _b; return [((_a = i.label) === null || _a === void 0 ? void 0 : _a.trim()) || i.key, (_b = message.inputs) === null || _b === void 0 ? void 0 : _b[i.key]]; }).filter((i) => i[1]).map(([k, v]) => `${k}: ${v}`).join('\n')) || '';
|
|
52
|
-
}, [agent.parameters, message.inputs]);
|
|
53
|
-
const items = (_b = sharing === null || sharing === void 0 ? void 0 : sharing.items) === null || _b === void 0 ? void 0 : _b.map((item) => {
|
|
54
|
-
var _a, _b;
|
|
55
|
-
const C = ShareActionsMap[item.to];
|
|
56
|
-
if (!C)
|
|
57
|
-
return null;
|
|
58
|
-
return (_jsx(Box, { children: _jsx(C, { inputs: inputs, shareAttach: {
|
|
59
|
-
shareAttachInputs: (_a = sharing === null || sharing === void 0 ? void 0 : sharing.shareAttachInputs) !== null && _a !== void 0 ? _a : false,
|
|
60
|
-
shareAttachUrl: (_b = sharing === null || sharing === void 0 ? void 0 : sharing.shareAttachUrl) !== null && _b !== void 0 ? _b : false,
|
|
61
|
-
} }) }, item.to));
|
|
62
|
-
}).filter((i) => !!i);
|
|
63
|
-
if (!(items === null || items === void 0 ? void 0 : items.length))
|
|
64
|
-
return null;
|
|
65
|
-
return _jsx(Stack, Object.assign({}, props, { children: items }));
|
|
66
|
-
}
|
|
67
|
-
const ShareActionsMap = {
|
|
68
|
-
twitter: ShareTwitter,
|
|
69
|
-
copy: ShareCopy,
|
|
70
|
-
saveAs: ShareSave,
|
|
71
|
-
community: ShareCommunity,
|
|
72
|
-
link: ShareLink,
|
|
73
|
-
};
|
|
74
|
-
function ShareTwitter({ inputs, shareAttach, }) {
|
|
75
|
-
const { t } = useLocaleContext();
|
|
76
|
-
const { message } = useCurrentMessage();
|
|
77
|
-
const { link } = useCurrentLink();
|
|
78
|
-
const query = useMemo(() => {
|
|
79
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
80
|
-
const content = ((_c = (_b = (_a = message.outputs) === null || _a === void 0 ? void 0 : _a.objects) === null || _b === void 0 ? void 0 : _b.find((i) => i === null || i === void 0 ? void 0 : i[RuntimeOutputVariable.text])) === null || _c === void 0 ? void 0 : _c[RuntimeOutputVariable.text]) ||
|
|
81
|
-
((_h = (_g = (_f = (_e = (_d = message.outputs) === null || _d === void 0 ? void 0 : _d.objects) === null || _e === void 0 ? void 0 : _e.find((i) => { var _a; return (_a = i === null || i === void 0 ? void 0 : i[RuntimeOutputVariable.images]) === null || _a === void 0 ? void 0 : _a.length; })) === null || _f === void 0 ? void 0 : _f[RuntimeOutputVariable.images]) === null || _g === void 0 ? void 0 : _g.at(0)) === null || _h === void 0 ? void 0 : _h.url);
|
|
82
|
-
if (!content)
|
|
83
|
-
return null;
|
|
84
|
-
const texts = [];
|
|
85
|
-
if (shareAttach.shareAttachInputs) {
|
|
86
|
-
texts.push(inputs);
|
|
87
|
-
}
|
|
88
|
-
texts.push(content);
|
|
89
|
-
let text = texts.join('\n\n');
|
|
90
|
-
// 如果 content 长度超过 100,截断
|
|
91
|
-
if (text.length > 250) {
|
|
92
|
-
text = `${text.slice(0, 250)}...`;
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
text,
|
|
96
|
-
url: link,
|
|
97
|
-
};
|
|
98
|
-
}, [message.outputs]);
|
|
99
|
-
if (!query)
|
|
100
|
-
return null;
|
|
101
|
-
return (_jsx(StyledActionButton, { tip: t('socialShare.shareToX'), title: _jsx(Icon, { icon: "tabler:brand-x" }), target: "_blank", href: withQuery('https://twitter.com/intent/tweet', query) }));
|
|
102
|
-
}
|
|
103
|
-
function ShareLink() {
|
|
104
|
-
const { t } = useLocaleContext();
|
|
105
|
-
const { link } = useCurrentLink();
|
|
106
|
-
return (_jsx(StyledActionButton, { autoReset: true, tip: t('socialShare.copyLink'), tipSucceed: t('copied'), title: _jsx(Icon, { icon: "tabler:link" }), titleSucceed: _jsx(Icon, { icon: "tabler:link-plus" }), onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
107
|
-
if (link) {
|
|
108
|
-
window.navigator.clipboard.writeText(link);
|
|
109
|
-
}
|
|
110
|
-
}) }));
|
|
111
|
-
}
|
|
112
|
-
function ShareCopy({ inputs, shareAttach, }) {
|
|
113
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
114
|
-
const { t } = useLocaleContext();
|
|
115
|
-
const { message } = useCurrentMessage();
|
|
116
|
-
const { link } = useCurrentLink();
|
|
117
|
-
const content = (_c = (_b = (_a = message.outputs) === null || _a === void 0 ? void 0 : _a.objects) === null || _b === void 0 ? void 0 : _b.find((i) => i === null || i === void 0 ? void 0 : i[RuntimeOutputVariable.text])) === null || _c === void 0 ? void 0 : _c[RuntimeOutputVariable.text];
|
|
118
|
-
const image = (_h = (_g = (_f = (_e = (_d = message.outputs) === null || _d === void 0 ? void 0 : _d.objects) === null || _e === void 0 ? void 0 : _e.find((i) => { var _a; return (_a = i === null || i === void 0 ? void 0 : i[RuntimeOutputVariable.images]) === null || _a === void 0 ? void 0 : _a.length; })) === null || _f === void 0 ? void 0 : _f[RuntimeOutputVariable.images]) === null || _g === void 0 ? void 0 : _g.at(0)) === null || _h === void 0 ? void 0 : _h.url;
|
|
119
|
-
if (!content && !image)
|
|
120
|
-
return null;
|
|
121
|
-
return (_jsx(StyledActionButton, { autoReset: true, tip: t('copy'), tipSucceed: t('copied'), title: _jsx(Icon, { icon: "tabler:copy" }), titleSucceed: _jsx(Icon, { icon: "tabler:copy-check" }), onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
122
|
-
if (content) {
|
|
123
|
-
const texts = [];
|
|
124
|
-
if (shareAttach.shareAttachUrl) {
|
|
125
|
-
texts.push(link);
|
|
126
|
-
}
|
|
127
|
-
if (shareAttach.shareAttachInputs) {
|
|
128
|
-
texts.push(inputs);
|
|
129
|
-
}
|
|
130
|
-
texts.push(content);
|
|
131
|
-
window.navigator.clipboard.writeText(texts.filter(Boolean).join('\n\n'));
|
|
132
|
-
}
|
|
133
|
-
else if (image) {
|
|
134
|
-
const imageBlob = yield convertImageToBlob(yield downloadImage({ url: image }));
|
|
135
|
-
window.navigator.clipboard.write([new ClipboardItem({ 'image/png': imageBlob })]);
|
|
136
|
-
}
|
|
137
|
-
}) }));
|
|
138
|
-
}
|
|
139
|
-
function ShareSave({ inputs, shareAttach, }) {
|
|
140
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
141
|
-
const { t } = useLocaleContext();
|
|
142
|
-
const { message } = useCurrentMessage();
|
|
143
|
-
const { aid, agent } = useRuntimeState();
|
|
144
|
-
const profile = useProfile({ aid });
|
|
145
|
-
const { link } = useCurrentLink();
|
|
146
|
-
const content = (_c = (_b = (_a = message.outputs) === null || _a === void 0 ? void 0 : _a.objects) === null || _b === void 0 ? void 0 : _b.find((i) => i === null || i === void 0 ? void 0 : i[RuntimeOutputVariable.text])) === null || _c === void 0 ? void 0 : _c[RuntimeOutputVariable.text];
|
|
147
|
-
const image = (_h = (_g = (_f = (_e = (_d = message.outputs) === null || _d === void 0 ? void 0 : _d.objects) === null || _e === void 0 ? void 0 : _e.find((i) => { var _a; return (_a = i === null || i === void 0 ? void 0 : i[RuntimeOutputVariable.images]) === null || _a === void 0 ? void 0 : _a.length; })) === null || _f === void 0 ? void 0 : _f[RuntimeOutputVariable.images]) === null || _g === void 0 ? void 0 : _g.at(0)) === null || _h === void 0 ? void 0 : _h.url;
|
|
148
|
-
if (!content && !image)
|
|
149
|
-
return null;
|
|
150
|
-
return (_jsx(StyledActionButton, { tip: t('save'), tipSucceed: t('saved'), title: _jsx(Icon, { icon: "tabler:file-download" }), titleSucceed: _jsx(Icon, { icon: "tabler:file-check" }), onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
151
|
-
// @ts-ignore
|
|
152
|
-
const { default: html2pdf } = yield import('html2pdf.js');
|
|
153
|
-
if (content) {
|
|
154
|
-
const element = document.createElement('div');
|
|
155
|
-
if (shareAttach.shareAttachUrl) {
|
|
156
|
-
element.innerHTML += `<p><a href="{${link}}">${link}</a></p>`;
|
|
157
|
-
}
|
|
158
|
-
if (shareAttach.shareAttachInputs) {
|
|
159
|
-
element.innerHTML += `<p><blockquote>${DOMPurify.sanitize(inputs)}</blockquote></p>`;
|
|
160
|
-
}
|
|
161
|
-
element.innerHTML += `<p>${DOMPurify.sanitize(content)}</p>`;
|
|
162
|
-
yield html2pdf()
|
|
163
|
-
.set({
|
|
164
|
-
margin: 1,
|
|
165
|
-
filename: `${profile.name || agent.id} - ${message.id}.pdf`,
|
|
166
|
-
image: { type: 'jpeg', quality: 0.98 },
|
|
167
|
-
html2canvas: { scale: 2 },
|
|
168
|
-
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' },
|
|
169
|
-
})
|
|
170
|
-
.from(element)
|
|
171
|
-
.save();
|
|
172
|
-
}
|
|
173
|
-
else if (image) {
|
|
174
|
-
saveAs(image, `${profile.name || agent.id}.png`);
|
|
175
|
-
}
|
|
176
|
-
}) }));
|
|
177
|
-
}
|
|
178
|
-
function ShareCommunity({ inputs, shareAttach, }) {
|
|
179
|
-
const { t } = useLocaleContext();
|
|
180
|
-
const { message } = useCurrentMessage();
|
|
181
|
-
const { link } = useCurrentLink();
|
|
182
|
-
const query = useMemo(() => {
|
|
183
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
184
|
-
const text = (_d = (_c = (_b = (_a = message.outputs) === null || _a === void 0 ? void 0 : _a.objects) === null || _b === void 0 ? void 0 : _b.find((i) => i === null || i === void 0 ? void 0 : i[RuntimeOutputVariable.text])) === null || _c === void 0 ? void 0 : _c[RuntimeOutputVariable.text]) !== null && _d !== void 0 ? _d : '';
|
|
185
|
-
const images = (_j = (_h = (_g = (_f = (_e = message.outputs) === null || _e === void 0 ? void 0 : _e.objects) === null || _f === void 0 ? void 0 : _f.find) === null || _g === void 0 ? void 0 : _g.call(_f, (i) => { var _a; return (_a = i === null || i === void 0 ? void 0 : i[RuntimeOutputVariable.images]) === null || _a === void 0 ? void 0 : _a.length; })) === null || _h === void 0 ? void 0 : _h[RuntimeOutputVariable.images]) === null || _j === void 0 ? void 0 : _j.map((i) => i.url);
|
|
186
|
-
let content = '';
|
|
187
|
-
if (shareAttach.shareAttachUrl) {
|
|
188
|
-
content += `[[]](${link})\n\n`;
|
|
189
|
-
}
|
|
190
|
-
if (shareAttach.shareAttachInputs) {
|
|
191
|
-
content += `> ${inputs}\n\n`;
|
|
192
|
-
}
|
|
193
|
-
if (images) {
|
|
194
|
-
content += images.map((image) => ``).join('\n');
|
|
195
|
-
}
|
|
196
|
-
content += text;
|
|
197
|
-
return {
|
|
198
|
-
boardId: 'aigne',
|
|
199
|
-
format: 'markdown',
|
|
200
|
-
title: `${((_k = message.inputs) === null || _k === void 0 ? void 0 : _k.question) || inputs}`,
|
|
201
|
-
content,
|
|
202
|
-
labels: 'demo',
|
|
203
|
-
};
|
|
204
|
-
}, [inputs, message.outputs, shareAttach]);
|
|
205
|
-
return (_jsx(StyledActionButton, { tip: t('socialShare.shareToCommunity'), title: _jsx(CommunityIcon, {}), target: "_blank", href: withQuery('https://community.arcblock.io/discussions/add?', query) }));
|
|
206
|
-
}
|
|
207
|
-
const StyledActionButton = styled(ActionButton)(({ theme }) => theme.unstable_sx({
|
|
208
|
-
fontSize: 'inherit',
|
|
209
|
-
p: 0.5,
|
|
210
|
-
minWidth: '0 !important',
|
|
211
|
-
minHeight: '0 !important',
|
|
212
|
-
}));
|
|
213
|
-
const useCurrentLink = () => {
|
|
214
|
-
var _a, _b, _c;
|
|
215
|
-
const { session } = useSessionContext();
|
|
216
|
-
const { message } = useCurrentMessage();
|
|
217
|
-
const prefix = (_b = (_a = window.blocklet) === null || _a === void 0 ? void 0 : _a.componentMountPoints.find((i) => i.did === AI_RUNTIME_DID)) === null || _b === void 0 ? void 0 : _b.mountPoint;
|
|
218
|
-
if (!prefix)
|
|
219
|
-
throw new Error('No aigne runtime prefix found');
|
|
220
|
-
const link = withQuery(joinURL(window.origin, prefix, '/messages', message.id), {
|
|
221
|
-
agentUrl: withQuery(getQuery(window.location.href).agentUrl || window.location.href, {
|
|
222
|
-
inviter: (_c = session.user) === null || _c === void 0 ? void 0 : _c.did,
|
|
223
|
-
}),
|
|
224
|
-
});
|
|
225
|
-
return { link };
|
|
226
|
-
};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { Icon } from '@iconify/react';
|
|
14
|
-
import { Box, MenuItem, useTheme } from '@mui/material';
|
|
15
|
-
import { useCallback } from 'react';
|
|
16
|
-
import { FacebookIcon, FacebookShareButton, LinkedinIcon, LinkedinShareButton, RedditIcon, RedditShareButton, TelegramIcon, TelegramShareButton, WeiboIcon, WeiboShareButton, XIcon, TwitterShareButton as XShareButton, } from 'react-share';
|
|
17
|
-
import { LocaleProvider, useLocaleContext } from '../../../locale';
|
|
18
|
-
import { translations } from '../locales';
|
|
19
|
-
import MenuButton from './MenuButton';
|
|
20
|
-
const getFormattedUrl = (url) => {
|
|
21
|
-
// remove page & sessionId query params
|
|
22
|
-
const urlObj = new URL(url);
|
|
23
|
-
urlObj.searchParams.delete('page');
|
|
24
|
-
urlObj.searchParams.delete('sessionId');
|
|
25
|
-
return urlObj.toString();
|
|
26
|
-
};
|
|
27
|
-
export default function SocialShare(props) {
|
|
28
|
-
const { type = 'menu' } = props, restProps = __rest(props, ["type"]);
|
|
29
|
-
const { locale } = useLocaleContext();
|
|
30
|
-
const renderContent = useCallback(() => {
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
if (type === 'buttons') {
|
|
33
|
-
return _jsx(SocialShareButtons, Object.assign({}, restProps));
|
|
34
|
-
}
|
|
35
|
-
// @ts-ignore
|
|
36
|
-
return _jsx(SocialShareMenu, Object.assign({}, restProps));
|
|
37
|
-
}, [type, restProps]);
|
|
38
|
-
return (
|
|
39
|
-
// @ts-ignore
|
|
40
|
-
_jsx(LocaleProvider, { translations: translations, locale: locale, fallbackLocale: "en", children: renderContent() }));
|
|
41
|
-
}
|
|
42
|
-
export function SocialShareMenu(_a) {
|
|
43
|
-
var { url = getFormattedUrl(window.location.href), content, children = _jsx(Icon, { icon: "tabler:share" }), MenuProps, disableCopyLink = false } = _a, restProps = __rest(_a, ["url", "content", "children", "MenuProps", "disableCopyLink"]);
|
|
44
|
-
const theme = useTheme();
|
|
45
|
-
const { t } = useLocaleContext();
|
|
46
|
-
const itemIconSx = {
|
|
47
|
-
width: 22,
|
|
48
|
-
height: 22,
|
|
49
|
-
border: 1,
|
|
50
|
-
borderColor: theme.palette.text.secondary,
|
|
51
|
-
borderRadius: 0.75,
|
|
52
|
-
display: 'flex',
|
|
53
|
-
alignItems: 'center',
|
|
54
|
-
justifyContent: 'center',
|
|
55
|
-
};
|
|
56
|
-
const buttonSx = {
|
|
57
|
-
display: 'flex',
|
|
58
|
-
alignItems: 'center',
|
|
59
|
-
gap: 1.5,
|
|
60
|
-
minWidth: 120,
|
|
61
|
-
lineHeight: '1!important',
|
|
62
|
-
width: '100%',
|
|
63
|
-
border: 'none',
|
|
64
|
-
bgcolor: 'transparent',
|
|
65
|
-
};
|
|
66
|
-
const iconProps = {
|
|
67
|
-
bgStyle: { fill: '#fff' },
|
|
68
|
-
iconFillColor: theme.palette.text.secondary,
|
|
69
|
-
style: {
|
|
70
|
-
borderRadius: '6px',
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
return (_jsx(MenuButton, Object.assign({ MenuProps: Object.assign(Object.assign({}, MenuProps), { sx: { li: { p: 0, button: { px: '8px !important', py: '4px !important' } } } }), menus: [
|
|
74
|
-
_jsx(MenuItem, { children: _jsxs(Box, { component: XShareButton, url: url, title: content, sx: buttonSx, children: [_jsx(Box, Object.assign({ component: XIcon, sx: itemIconSx, round: true }, iconProps)), _jsx("span", { children: t('socialShare.shareToX') })] }) }, "shareOnX"),
|
|
75
|
-
_jsx(MenuItem, { children: _jsxs(Box, { component: TelegramShareButton, url: url, title: content, sx: buttonSx, children: [_jsx(Box, Object.assign({ component: TelegramIcon, sx: itemIconSx, round: true }, iconProps)), _jsx("span", { children: t('socialShare.shareToTelegram') })] }) }, "shareOnTelegram"),
|
|
76
|
-
_jsx(MenuItem, { children: _jsxs(Box, { component: RedditShareButton, url: url, title: content, sx: buttonSx, children: [_jsx(Box, Object.assign({ component: RedditIcon, sx: itemIconSx, round: true }, iconProps)), _jsx("span", { children: t('socialShare.shareToReddit') })] }) }, "shareOnReddit"),
|
|
77
|
-
_jsx(MenuItem, { children: _jsxs(Box, { component: WeiboShareButton, url: url, title: content, sx: buttonSx, children: [_jsx(Box, Object.assign({ component: WeiboIcon, sx: itemIconSx, round: true }, iconProps)), _jsx("span", { children: t('socialShare.shareToWeibo') })] }) }, "shareOnWeibo"),
|
|
78
|
-
_jsx(MenuItem, { children: _jsxs(Box, { component: FacebookShareButton, url: url, sx: buttonSx, children: [_jsx(Box, Object.assign({ component: FacebookIcon, sx: itemIconSx, round: true }, iconProps)), _jsx("span", { children: t('socialShare.shareToFacebook') })] }) }, "shareOnFacebook"),
|
|
79
|
-
_jsx(MenuItem, { children: _jsxs(Box, { component: LinkedinShareButton, url: url, summary: content, sx: buttonSx, children: [_jsx(Box, Object.assign({ component: LinkedinIcon, sx: itemIconSx, round: true }, iconProps)), _jsx("span", { children: t('socialShare.shareToLinkedin') })] }) }, "shareOnLinkedin"),
|
|
80
|
-
!disableCopyLink && (_jsx(MenuItem, { children: _jsxs(Box, { component: "button", sx: buttonSx, onClick: () => {
|
|
81
|
-
window.navigator.clipboard.writeText(url);
|
|
82
|
-
}, children: [_jsx(Box, Object.assign({ sx: itemIconSx, round: true }, iconProps, { children: _jsx(Icon, { icon: "tabler:link" }) })), _jsx("span", { children: t('socialShare.copyLink') })] }) }, "copyToClipboard")),
|
|
83
|
-
].filter(Boolean) }, restProps, { children: children })));
|
|
84
|
-
}
|
|
85
|
-
export function SocialShareButtons(_a) {
|
|
86
|
-
var { url = getFormattedUrl(window.location.href), content, sx, itemSx, onClick, bgFill, iconFill } = _a, rest = __rest(_a, ["url", "content", "sx", "itemSx", "onClick", "bgFill", "iconFill"]);
|
|
87
|
-
const mergedSx = [
|
|
88
|
-
{ display: 'flex', alignItems: 'center', gap: 0.5, lineHeight: 1 },
|
|
89
|
-
...(Array.isArray(sx) ? sx : [sx]),
|
|
90
|
-
];
|
|
91
|
-
const mergedItemSx = [
|
|
92
|
-
{ width: { xs: 24, sm: 28 }, height: { xs: 24, sm: 28 }, borderRadius: 1 },
|
|
93
|
-
...(Array.isArray(itemSx) ? itemSx : [itemSx]),
|
|
94
|
-
];
|
|
95
|
-
const iconProps = {
|
|
96
|
-
bgStyle: { fill: bgFill || '#bbb' },
|
|
97
|
-
iconFillColor: iconFill || '#fff',
|
|
98
|
-
};
|
|
99
|
-
return (_jsxs(Box, Object.assign({ sx: mergedSx }, rest, { children: [_jsx(XShareButton, { url: url, title: content, children: _jsx(Box, Object.assign({ component: XIcon, sx: mergedItemSx }, iconProps)) }), _jsx(TelegramShareButton, { url: url, title: content, children: _jsx(Box, Object.assign({ component: TelegramIcon, sx: mergedItemSx }, iconProps)) }), _jsx(RedditShareButton, { url: url, title: content, children: _jsx(Box, Object.assign({ component: RedditIcon, sx: mergedItemSx }, iconProps)) }), _jsx(WeiboShareButton, { url: url, title: content, children: _jsx(Box, Object.assign({ component: WeiboIcon, sx: mergedItemSx }, iconProps)) }), _jsx(FacebookShareButton, { url: url, children: _jsx(Box, Object.assign({ component: FacebookIcon, sx: mergedItemSx }, iconProps)) }), _jsx(LinkedinShareButton, { url: url, summary: content, children: _jsx(Box, Object.assign({ component: LinkedinIcon, sx: mergedItemSx }, iconProps)) })] })));
|
|
100
|
-
}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { ArrowDropDownRounded } from '@mui/icons-material';
|
|
14
|
-
import { CircularProgress, CssBaseline, GlobalStyles, ThemeProvider as MuiThemeProvider, Stack, alpha, createTheme, inputBaseClasses, useTheme, } from '@mui/material';
|
|
15
|
-
import { Suspense, useMemo } from 'react';
|
|
16
|
-
import { Helmet } from 'react-helmet';
|
|
17
|
-
import { useRuntimeState } from '../state/runtime';
|
|
18
|
-
import { chineseFonts } from '../utils/fonts';
|
|
19
|
-
import GlobalLoading from './GlobalLoading';
|
|
20
|
-
export default function ThemeProvider({ children }) {
|
|
21
|
-
var _a, _b, _c;
|
|
22
|
-
const { appearance } = useRuntimeState().agent.project;
|
|
23
|
-
const theme = useTheme();
|
|
24
|
-
const bodyFontFamily = (_a = appearance === null || appearance === void 0 ? void 0 : appearance.typography) === null || _a === void 0 ? void 0 : _a.fontFamily;
|
|
25
|
-
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;
|
|
26
|
-
const newTheme = useMemo(() => {
|
|
27
|
-
var _a, _b, _c, _d, _e, _f;
|
|
28
|
-
let { primary, secondary } = theme.palette;
|
|
29
|
-
try {
|
|
30
|
-
if (appearance === null || appearance === void 0 ? void 0 : appearance.primaryColor) {
|
|
31
|
-
primary = theme.palette.augmentColor({ color: { main: appearance === null || appearance === void 0 ? void 0 : appearance.primaryColor } });
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
console.error('augment primary color error', { error });
|
|
36
|
-
}
|
|
37
|
-
try {
|
|
38
|
-
if (appearance === null || appearance === void 0 ? void 0 : appearance.secondaryColor) {
|
|
39
|
-
secondary = theme.palette.augmentColor({ color: { main: appearance === null || appearance === void 0 ? void 0 : appearance.secondaryColor } });
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
console.error('augment secondary color error', { error });
|
|
44
|
-
}
|
|
45
|
-
const { fontFamily } = theme.typography;
|
|
46
|
-
const headingFontFamily = [
|
|
47
|
-
((_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),
|
|
48
|
-
fontFamily,
|
|
49
|
-
]
|
|
50
|
-
.filter(Boolean)
|
|
51
|
-
.join(',');
|
|
52
|
-
const bodyFontFamily = [
|
|
53
|
-
((_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),
|
|
54
|
-
fontFamily,
|
|
55
|
-
]
|
|
56
|
-
.filter(Boolean)
|
|
57
|
-
.join(',');
|
|
58
|
-
const themeOptions = {
|
|
59
|
-
components: {
|
|
60
|
-
MuiSelect: {
|
|
61
|
-
defaultProps: { IconComponent: ArrowDropDownRounded },
|
|
62
|
-
},
|
|
63
|
-
MuiTextField: {
|
|
64
|
-
variants: [
|
|
65
|
-
{
|
|
66
|
-
props: {},
|
|
67
|
-
style: ({ theme }) => theme.unstable_sx({
|
|
68
|
-
'.MuiInputBase-root': {
|
|
69
|
-
fieldset: { borderColor: 'grey.400' },
|
|
70
|
-
[`&.Mui-focused, :not(.${inputBaseClasses.disabled}):hover`]: {
|
|
71
|
-
fieldset: {
|
|
72
|
-
border: 'none',
|
|
73
|
-
boxShadow: `0px 0px 0px 4px ${alpha(theme.palette.primary.main, 0.2)}, 0px 0px 0px 1px ${theme.palette.primary.main}`,
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
'.MuiInputLabel-root': {
|
|
78
|
-
[`&.Mui-focused, :not(.${inputBaseClasses.disabled}):hover, &.MuiFormLabel-filled`]: {
|
|
79
|
-
backgroundColor: `${theme.palette.primary.main}`,
|
|
80
|
-
color: 'white',
|
|
81
|
-
px: 1,
|
|
82
|
-
ml: -0.8,
|
|
83
|
-
py: 0.2,
|
|
84
|
-
mt: -0.1,
|
|
85
|
-
borderRadius: 4,
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
}),
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
props: { select: true },
|
|
92
|
-
style: (_a) => {
|
|
93
|
-
var { theme } = _a, p = __rest(_a, ["theme"]);
|
|
94
|
-
const { placeholder } = p;
|
|
95
|
-
return theme.unstable_sx({
|
|
96
|
-
'& .MuiSelect-select .notranslate::after': placeholder
|
|
97
|
-
? {
|
|
98
|
-
content: `"${placeholder}"`,
|
|
99
|
-
opacity: 0.42,
|
|
100
|
-
}
|
|
101
|
-
: {},
|
|
102
|
-
'& .MuiFormLabel-root:not(.MuiInputLabel-shrink) + .MuiInputBase-root > .MuiSelect-select .notranslate::after': {
|
|
103
|
-
opacity: 0,
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
},
|
|
110
|
-
MuiListItemButton: {
|
|
111
|
-
variants: [
|
|
112
|
-
{
|
|
113
|
-
props: {},
|
|
114
|
-
style: ({ theme }) => theme.unstable_sx({
|
|
115
|
-
fontSize: 13,
|
|
116
|
-
color: '#010714',
|
|
117
|
-
}),
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
const tempTheme = createTheme({
|
|
124
|
-
typography: Object.assign(Object.assign({ fontFamily: bodyFontFamily }, Object.fromEntries(new Array(5).fill(0).map((_, index) => [
|
|
125
|
-
`h${index + 1}`,
|
|
126
|
-
{
|
|
127
|
-
fontFamily: headingFontFamily,
|
|
128
|
-
},
|
|
129
|
-
]))), { button: {
|
|
130
|
-
textTransform: 'none',
|
|
131
|
-
} }),
|
|
132
|
-
palette: {
|
|
133
|
-
primary,
|
|
134
|
-
secondary,
|
|
135
|
-
},
|
|
136
|
-
});
|
|
137
|
-
return createTheme(theme, themeOptions, {
|
|
138
|
-
typography: tempTheme.typography,
|
|
139
|
-
palette: {
|
|
140
|
-
primary: tempTheme.palette.primary,
|
|
141
|
-
secondary: tempTheme.palette.secondary,
|
|
142
|
-
text: tempTheme.palette.text,
|
|
143
|
-
background: {
|
|
144
|
-
default: '#ffffff',
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
shape: {
|
|
148
|
-
borderRadius: 8,
|
|
149
|
-
},
|
|
150
|
-
shadows: [
|
|
151
|
-
'none',
|
|
152
|
-
'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)',
|
|
153
|
-
'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)',
|
|
154
|
-
...tempTheme.shadows.slice(3),
|
|
155
|
-
],
|
|
156
|
-
});
|
|
157
|
-
}, [theme]);
|
|
158
|
-
const fontUrls = useMemo(() => {
|
|
159
|
-
const urls = [bodyFontFamily, headingFontFamily]
|
|
160
|
-
.filter((i) => !!i)
|
|
161
|
-
.map((font) => {
|
|
162
|
-
var _a;
|
|
163
|
-
return ((_a = chineseFonts.find((i) => i.value === font)) === null || _a === void 0 ? void 0 : _a.link) ||
|
|
164
|
-
`https://fonts.googleapis.com/css?family=${font.replace(/ /g, '+')}`;
|
|
165
|
-
});
|
|
166
|
-
return [...new Set(urls)];
|
|
167
|
-
}, [bodyFontFamily, headingFontFamily]);
|
|
168
|
-
return (_jsxs(MuiThemeProvider, { theme: newTheme, children: [_jsx(Helmet, { children: fontUrls.map((url) => (_jsx("link", { rel: "stylesheet", href: url }, url))) }), _jsxs(CssBaseline, { children: [_jsx(GlobalStyles, { styles: (theme) => theme.unstable_sx({
|
|
169
|
-
'h1,h2,h3,h4,h5': {
|
|
170
|
-
fontFamily: `${theme.typography.h1.fontFamily} !important`,
|
|
171
|
-
},
|
|
172
|
-
body: {
|
|
173
|
-
fontFamily: `${theme.typography.fontFamily} !important`,
|
|
174
|
-
},
|
|
175
|
-
'.page-header': {
|
|
176
|
-
borderBottom: '1px solid rgba(229, 231, 235, 1)',
|
|
177
|
-
},
|
|
178
|
-
'.white-tooltip .MuiTooltip-tooltip': {
|
|
179
|
-
background: 'white !important',
|
|
180
|
-
boxShadow: '0px 4px 8px 0px rgba(3, 7, 18, 0.08)',
|
|
181
|
-
border: '1px solid rgba(229, 231, 235, 1)',
|
|
182
|
-
padding: 4,
|
|
183
|
-
},
|
|
184
|
-
}) }), _jsx(GlobalLoading, { sx: { position: 'fixed', left: 0, top: 0, width: '100%', zIndex: 'snackbar' } }), _jsx(Suspense, { fallback: _jsx(Stack, { flexGrow: 1, alignItems: "center", justifyContent: "center", children: _jsx(CircularProgress, { size: 24 }) }), children: children })] })] }));
|
|
185
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import DID from '@arcblock/ux/lib/DID';
|
|
14
|
-
import { Box, Stack, Typography } from '@mui/material';
|
|
15
|
-
import dayjs from 'dayjs';
|
|
16
|
-
import { useMemo } from 'react';
|
|
17
|
-
import { Avatar } from '../../../arcblock/ux';
|
|
18
|
-
export default function UserInfo(_a) {
|
|
19
|
-
var { avatar, showDID, did, name, time, children, reverse, UserNameProps } = _a, restProps = __rest(_a, ["avatar", "showDID", "did", "name", "time", "children", "reverse", "UserNameProps"]);
|
|
20
|
-
return (_jsxs(Stack, Object.assign({ className: "user-info", alignItems: "center", direction: reverse ? 'row-reverse' : 'row', gap: 1.5 }, restProps, { children: [(avatar || did) && (_jsx(Box, { sx: {
|
|
21
|
-
display: 'flex',
|
|
22
|
-
alignItems: 'center',
|
|
23
|
-
maxHeight: 44,
|
|
24
|
-
}, children: _jsx(Avatar, { size: 40, did: did, variant: "circle", shape: "circle",
|
|
25
|
-
// @ts-ignore
|
|
26
|
-
src: avatar }) })), _jsxs(Box, { flex: 1, width: 0, children: [_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 && (_jsx(UserTime, { time: time, sx: {
|
|
27
|
-
fontSize: 12,
|
|
28
|
-
lineHeight: '24px',
|
|
29
|
-
opacity: 0.8,
|
|
30
|
-
} }))] })), showDID && did && _jsx(Box, { component: DID, did: did, copyable: false, size: 14, responsive: true, sx: { mt: -0.25 } }), _jsx(Box, { flex: 1, children: children })] })] })));
|
|
31
|
-
}
|
|
32
|
-
export function UserName(_a) {
|
|
33
|
-
var { children, sx } = _a, restProps = __rest(_a, ["children", "sx"]);
|
|
34
|
-
return (_jsx(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 })));
|
|
35
|
-
}
|
|
36
|
-
export function UserTime(_a) {
|
|
37
|
-
var { time } = _a, restProps = __rest(_a, ["time"]);
|
|
38
|
-
const formattedTime = useMemo(() => {
|
|
39
|
-
const date = dayjs(time);
|
|
40
|
-
if (!date.isValid())
|
|
41
|
-
return undefined;
|
|
42
|
-
return date.isSame(dayjs(), 'date') ? date.format('HH:mm') : date.format('YYYY-MM-DD HH:mm');
|
|
43
|
-
}, [time]);
|
|
44
|
-
if (!formattedTime)
|
|
45
|
-
return null;
|
|
46
|
-
return (_jsx(Typography, Object.assign({}, restProps, { children: formattedTime }), "user-time"));
|
|
47
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { RuntimeOutputVariable } from '@blocklet/ai-runtime/types';
|
|
2
|
-
export const AI_STUDIO_DID = 'z8iZpog7mcgcgBZzTiXJCWESvmnRrQmnd3XBB';
|
|
3
|
-
export const AI_RUNTIME_DID = 'z2qaBP9SahqU2L2YA3ip7NecwKACMByTFuiJ2';
|
|
4
|
-
export const PAYMENT_KIT_DID = 'z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk';
|
|
5
|
-
export const DEFAULT_PAGE_COMPONENT_ID = 'ctnxha29uu8cx4xv'; // Simple Layout
|
|
6
|
-
export const DEFAULT_INPUT_COMPONENT_ID = '1wwtemqcdio6nqf0'; // Auto Form
|
|
7
|
-
export const DEFAULT_OUTPUT_COMPONENT_ID = 'q0ckknkxph4hfwas'; // Simple Output
|
|
8
|
-
export const MARKDOWN_VIEW_ID = 'a4oldpoxv7bikvpj';
|
|
9
|
-
export const SUGGESTED_QUESTIONS_VIEW_ID = '6u8m11ss7fvu8t7i';
|
|
10
|
-
export const REFERENCED_LINKS_VIEW_ID = 'baqmaoccdntqwayc';
|
|
11
|
-
export const SHARE_VIEW_ID = 'jfq3df9z8lkk9not';
|
|
12
|
-
export const IMAGES_VIEW_ID = 'txirtdgx8h2bmo7s';
|
|
13
|
-
export const OPENING_QUESTIONS_VIEW_ID = 'vgsgsvnhud0cq37v';
|
|
14
|
-
export const DEFAULT_OUTPUT_COMPONENTS = {
|
|
15
|
-
[RuntimeOutputVariable.text]: {
|
|
16
|
-
componentId: MARKDOWN_VIEW_ID,
|
|
17
|
-
},
|
|
18
|
-
[RuntimeOutputVariable.images]: {
|
|
19
|
-
componentId: IMAGES_VIEW_ID,
|
|
20
|
-
},
|
|
21
|
-
[RuntimeOutputVariable.openingMessage]: {
|
|
22
|
-
componentId: MARKDOWN_VIEW_ID,
|
|
23
|
-
},
|
|
24
|
-
[RuntimeOutputVariable.suggestedQuestions]: {
|
|
25
|
-
componentId: SUGGESTED_QUESTIONS_VIEW_ID,
|
|
26
|
-
},
|
|
27
|
-
[RuntimeOutputVariable.referenceLinks]: {
|
|
28
|
-
componentId: REFERENCED_LINKS_VIEW_ID,
|
|
29
|
-
},
|
|
30
|
-
[RuntimeOutputVariable.share]: {
|
|
31
|
-
componentId: SHARE_VIEW_ID,
|
|
32
|
-
},
|
|
33
|
-
[RuntimeOutputVariable.openingQuestions]: {
|
|
34
|
-
componentId: OPENING_QUESTIONS_VIEW_ID,
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
export function getDefaultOutputComponent(output) {
|
|
38
|
-
return DEFAULT_OUTPUT_COMPONENTS[output.name];
|
|
39
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { RuntimeOutputVariable } from '@blocklet/ai-runtime/types';
|
|
3
|
-
import { createContext, useContext, useMemo, useState } from 'react';
|
|
4
|
-
import { useRuntimeState } from '../state/runtime';
|
|
5
|
-
import { getOutputVariableInitialValue } from '../utils/runtime-output-schema';
|
|
6
|
-
const activeAgentContext = createContext(undefined);
|
|
7
|
-
export function useActiveAgent() {
|
|
8
|
-
const context = useContext(activeAgentContext);
|
|
9
|
-
if (!context) {
|
|
10
|
-
throw new Error('No such activeAgentContext. You should use `useActiveAgent` within the `ActiveAgentProvider`');
|
|
11
|
-
}
|
|
12
|
-
return context;
|
|
13
|
-
}
|
|
14
|
-
export default function ActiveAgentProvider({ children }) {
|
|
15
|
-
const { agent } = useRuntimeState();
|
|
16
|
-
const childAgentId = useMemo(() => {
|
|
17
|
-
var _a, _b, _c, _d;
|
|
18
|
-
return (_d = (_c = (_b = (_a = getOutputVariableInitialValue(agent, 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;
|
|
19
|
-
}, [agent]);
|
|
20
|
-
const [activeAgentId, setActiveAgentId] = useState(childAgentId);
|
|
21
|
-
const activeAgent = useMemo(() => ({ activeAgentId, setActiveAgentId }), [activeAgentId, setActiveAgentId]);
|
|
22
|
-
return _jsx(activeAgentContext.Provider, { value: activeAgent, children: children });
|
|
23
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import omitBy from 'lodash/omitBy';
|
|
14
|
-
import { createContext, useContext, useMemo } from 'react';
|
|
15
|
-
const componentPreferencesContext = createContext(undefined);
|
|
16
|
-
export default function ComponentPreferencesProvider(_a) {
|
|
17
|
-
var { children } = _a, preferences = __rest(_a, ["children"]);
|
|
18
|
-
const inherited = useComponentPreferences();
|
|
19
|
-
const value = useMemo(() => (Object.assign(Object.assign({}, inherited), omitBy(preferences, (i) => i === undefined || i === null))), [inherited, Object.values(preferences)]);
|
|
20
|
-
return _jsx(componentPreferencesContext.Provider, { value: value, children: children });
|
|
21
|
-
}
|
|
22
|
-
export function useComponentPreferences() {
|
|
23
|
-
return useContext(componentPreferencesContext);
|
|
24
|
-
}
|