@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,49 +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, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
-
import { Stack, Typography } from '@mui/material';
|
|
14
|
-
import { Suspense, memo } from 'react';
|
|
15
|
-
import Balancer from 'react-wrap-balancer';
|
|
16
|
-
import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
|
|
17
|
-
import { AgentErrorView } from '../../components/AgentErrorBoundary';
|
|
18
|
-
import SimpleHeader from '../../components/Header/SimpleHeader';
|
|
19
|
-
import SimpleLayout from '../../components/Layout/SimpleLayout';
|
|
20
|
-
import { useActiveAgent } from '../../contexts/ActiveAgent';
|
|
21
|
-
import ComponentPreferencesProvider from '../../contexts/ComponentPreferences';
|
|
22
|
-
import CurrentAgentProvider from '../../contexts/CurrentAgent';
|
|
23
|
-
import CurrentMessageProvider from '../../contexts/CurrentMessage';
|
|
24
|
-
import useAppearances from '../../hooks/use-appearances';
|
|
25
|
-
import { useAutoLoadSessionState, useCurrentSessionState } from '../../state/session';
|
|
26
|
-
export default function SimplePage(_a) {
|
|
27
|
-
var { resultTitle } = _a, preferences = __rest(_a, ["resultTitle"]);
|
|
28
|
-
const { activeAgentId } = useActiveAgent();
|
|
29
|
-
useAutoLoadSessionState();
|
|
30
|
-
return (_jsx(ComponentPreferencesProvider, Object.assign({}, preferences, { children: _jsxs(SimpleLayout, { pb: 4, children: [_jsx(SimpleHeader, {}), _jsx(CurrentAgentProvider, { agentId: activeAgentId, children: _jsx(AgentInputRender, { className: "aigne-inputs aigne-simple-page-inputs" }) }), _jsx(OutputView, { className: "aigne-outputs aigne-simple-page-outputs", resultTitle: resultTitle })] }) })));
|
|
31
|
-
}
|
|
32
|
-
function AgentInputRender(_a) {
|
|
33
|
-
var props = __rest(_a, []);
|
|
34
|
-
const { appearanceInput } = useAppearances();
|
|
35
|
-
if (!(appearanceInput === null || appearanceInput === void 0 ? void 0 : appearanceInput.componentId))
|
|
36
|
-
return null;
|
|
37
|
-
return (_jsx(Stack, Object.assign({}, props, { children: _jsx(CustomComponentRenderer, { componentId: appearanceInput.componentId, properties: appearanceInput.componentProperties }) })));
|
|
38
|
-
}
|
|
39
|
-
function OutputView(_a) {
|
|
40
|
-
var { resultTitle } = _a, props = __rest(_a, ["resultTitle"]);
|
|
41
|
-
const lastMessage = useCurrentSessionState((s) => { var _a; return (_a = s === null || s === void 0 ? void 0 : s.messages) === null || _a === void 0 ? void 0 : _a.at(0); });
|
|
42
|
-
return (_jsx(Stack, Object.assign({ gap: 2, mt: 4 }, props, { children: lastMessage && (_jsxs(_Fragment, { children: [resultTitle && (_jsx(Typography, { width: "100%", component: "h5", fontSize: 36, fontWeight: 700, textAlign: "center", children: _jsx(Balancer, { children: resultTitle }) })), _jsx(Stack, { children: _jsx(OutputItemView, { message: lastMessage }) })] })) })));
|
|
43
|
-
}
|
|
44
|
-
const OutputItemView = memo(({ message }) => {
|
|
45
|
-
const { appearanceOutput } = useAppearances({ agentId: message.agentId });
|
|
46
|
-
if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId))
|
|
47
|
-
return null;
|
|
48
|
-
return (_jsx(CurrentAgentProvider, { agentId: message.agentId, children: _jsx(CurrentMessageProvider, { message: message, children: _jsx(Suspense, { children: _jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties, fallbackRender: AgentErrorView }, message.id) }) }) }));
|
|
49
|
-
});
|
|
@@ -1,48 +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 { Stack, Typography } from '@mui/material';
|
|
14
|
-
import Joi from 'joi';
|
|
15
|
-
import { useMemo } from 'react';
|
|
16
|
-
import OutputFieldContainer from '../../components/OutputFieldContainer';
|
|
17
|
-
import { useCurrentAgent } from '../../contexts/CurrentAgent';
|
|
18
|
-
import { useCurrentMessage } from '../../contexts/CurrentMessage';
|
|
19
|
-
import { useRuntimeState } from '../../state/runtime';
|
|
20
|
-
import { useCurrentSessionState } from '../../state/session';
|
|
21
|
-
const suggestedQuestionsSchema = Joi.array().items(Joi.object({
|
|
22
|
-
question: Joi.string().required(),
|
|
23
|
-
}));
|
|
24
|
-
export default function SuggestedQuestionsView({ output, outputValue, onlyLastMessage, }) {
|
|
25
|
-
var _a;
|
|
26
|
-
const { message } = (_a = useCurrentMessage({ optional: true })) !== null && _a !== void 0 ? _a : {};
|
|
27
|
-
const lastMessage = useCurrentSessionState((s) => { var _a; return (_a = s === null || s === void 0 ? void 0 : s.messages) === null || _a === void 0 ? void 0 : _a.at(0); });
|
|
28
|
-
const isLastMessage = !!message && message.id === (lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.id);
|
|
29
|
-
const questions = useMemo(() => {
|
|
30
|
-
const result = suggestedQuestionsSchema.validate(outputValue, { allowUnknown: true });
|
|
31
|
-
if (result.error)
|
|
32
|
-
return undefined;
|
|
33
|
-
return result.value;
|
|
34
|
-
}, [outputValue]);
|
|
35
|
-
const { aid } = useCurrentAgent();
|
|
36
|
-
const { execute } = useRuntimeState();
|
|
37
|
-
if (!message || (!isLastMessage && onlyLastMessage) || !(questions === null || questions === void 0 ? void 0 : questions.length))
|
|
38
|
-
return null;
|
|
39
|
-
return (_jsx(OutputFieldContainer, { output: output, children: _jsx(Stack, { gap: 1, children: questions.map((item) => (_jsx(MessageSuggestedQuestion, { onClick: () => {
|
|
40
|
-
execute({ aid, parameters: Object.assign(Object.assign({}, message.inputs), { question: item.question }) });
|
|
41
|
-
}, children: item.question }, item.question))) }) }));
|
|
42
|
-
}
|
|
43
|
-
function MessageSuggestedQuestion(_a) {
|
|
44
|
-
var props = __rest(_a, []);
|
|
45
|
-
return (_jsx(Typography, Object.assign({ variant: "subtitle2" }, props, { sx: Object.assign({ display: 'inline-block', border: 1, borderColor: 'rgba(229, 231, 235, 1)', borderRadius: 1, py: 1, px: 2, cursor: 'pointer', '&:hover': {
|
|
46
|
-
backgroundColor: 'rgba(239, 246, 255, 1)',
|
|
47
|
-
} }, props.sx) })));
|
|
48
|
-
}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
import { cx } from '@emotion/css';
|
|
12
|
-
import { Icon } from '@iconify/react';
|
|
13
|
-
import { Box, Button, FormLabel, InputAdornment, Stack, ThemeProvider, createTheme, formLabelClasses, outlinedInputClasses, styled, useTheme, } from '@mui/material';
|
|
14
|
-
import isEmpty from 'lodash/isEmpty';
|
|
15
|
-
import omit from 'lodash/omit';
|
|
16
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
17
|
-
import { Controller, useForm } from 'react-hook-form';
|
|
18
|
-
import { useLocaleContext } from '../../../../locale';
|
|
19
|
-
import AgentInputField from '../../components/AgentInputField';
|
|
20
|
-
import LoadingButton from '../../components/LoadingButton';
|
|
21
|
-
import { useCurrentAgent } from '../../contexts/CurrentAgent';
|
|
22
|
-
import { useOpeningQuestions } from '../../hooks/use-appearances';
|
|
23
|
-
import { useRuntimeState } from '../../state/runtime';
|
|
24
|
-
import { useCurrentSessionState, useSessionState } from '../../state/session';
|
|
25
|
-
import { isValidInput } from '../../utils/agent-inputs';
|
|
26
|
-
import { useV0RuntimeContext } from './contexts/V0Runtime';
|
|
27
|
-
export default function V0Input({ submitText, inlineLabel, autoFillLastForm = false, submitInQuestionField = true, chatMode = true, }) {
|
|
28
|
-
var _a, _b;
|
|
29
|
-
const { t } = useLocaleContext();
|
|
30
|
-
const { aid, agent } = useCurrentAgent();
|
|
31
|
-
const [executeLoading, setExecuteLoading] = useState(false);
|
|
32
|
-
const opening = useOpeningQuestions();
|
|
33
|
-
const { execute } = useRuntimeState();
|
|
34
|
-
const { running } = useCurrentSessionState((s) => s) || {};
|
|
35
|
-
const { currentSessionId } = useSessionState((s) => s) || {};
|
|
36
|
-
const { setCurrentMessageTaskId } = useV0RuntimeContext();
|
|
37
|
-
const parameters = useMemo(() => {
|
|
38
|
-
var _a;
|
|
39
|
-
return (_a = agent.parameters) === null || _a === void 0 ? void 0 : _a.filter(isValidInput).map((i) => {
|
|
40
|
-
var _a;
|
|
41
|
-
return (Object.assign(Object.assign({}, i), { label: ((_a = i.label) === null || _a === void 0 ? void 0 : _a.trim()) || undefined }));
|
|
42
|
-
});
|
|
43
|
-
}, [agent.parameters]);
|
|
44
|
-
const defaultForm = useInitialFormValues();
|
|
45
|
-
const theme = useFormTheme();
|
|
46
|
-
const form = useForm({ defaultValues: defaultForm });
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
if (autoFillLastForm && !form.formState.isSubmitted && !form.formState.isSubmitting) {
|
|
49
|
-
form.reset(chatMode ? omit(defaultForm, 'question') : defaultForm);
|
|
50
|
-
}
|
|
51
|
-
}, [defaultForm, autoFillLastForm, form, chatMode]);
|
|
52
|
-
const onSubmit = (parameters) => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
try {
|
|
54
|
-
if (!(parameters === null || parameters === void 0 ? void 0 : parameters.question))
|
|
55
|
-
return;
|
|
56
|
-
setExecuteLoading(true);
|
|
57
|
-
// in session page, send message
|
|
58
|
-
yield execute({
|
|
59
|
-
aid,
|
|
60
|
-
parameters,
|
|
61
|
-
onResponseStart: () => {
|
|
62
|
-
setCurrentMessageTaskId(undefined);
|
|
63
|
-
if (chatMode)
|
|
64
|
-
form.resetField('question', { defaultValue: '' });
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
console.error(error);
|
|
70
|
-
}
|
|
71
|
-
finally {
|
|
72
|
-
setExecuteLoading(false);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
return (_jsxs(ThemeProvider, { theme: theme, children: [!currentSessionId && ((_a = opening === null || opening === void 0 ? void 0 : opening.questions) === null || _a === void 0 ? void 0 : _a.length) && (_jsx(Stack, { sx: {
|
|
76
|
-
flexDirection: 'row',
|
|
77
|
-
gap: 1,
|
|
78
|
-
mb: 1,
|
|
79
|
-
flexWrap: 'wrap',
|
|
80
|
-
}, children: (_b = opening === null || opening === void 0 ? void 0 : opening.questions) === null || _b === void 0 ? void 0 : _b.map((item) => {
|
|
81
|
-
const { title, parameters, id } = item;
|
|
82
|
-
const question = (parameters === null || parameters === void 0 ? void 0 : parameters.questions) || title;
|
|
83
|
-
return (_jsx(Button, { variant: "outlined", size: "small", endIcon: _jsx(Icon, { icon: "tabler:arrow-down-right", style: {
|
|
84
|
-
marginLeft: -4,
|
|
85
|
-
} }), onClick: () => {
|
|
86
|
-
form.reset(Object.assign({}, parameters));
|
|
87
|
-
// auto execute message
|
|
88
|
-
// onSubmit({ ...parameters });
|
|
89
|
-
}, children: question }, id));
|
|
90
|
-
}) })), _jsxs(Form, { id: "v0-input", component: "form", className: cx('form', `label-position-${inlineLabel ? 'start' : 'top'}`), onSubmit: form.handleSubmit(onSubmit), children: [parameters === null || parameters === void 0 ? void 0 : parameters.map((parameter, index) => {
|
|
91
|
-
const { key, required } = parameter !== null && parameter !== void 0 ? parameter : {};
|
|
92
|
-
return (_jsx(Box, { children: _jsx(Controller, { control: form.control, name: key, rules: {
|
|
93
|
-
required,
|
|
94
|
-
min: parameter.type === 'number' && typeof parameter.min === 'number'
|
|
95
|
-
? { value: parameter.min, message: '' }
|
|
96
|
-
: undefined,
|
|
97
|
-
max: parameter.type === 'number' && typeof parameter.max === 'number'
|
|
98
|
-
? { value: parameter.max, message: '' }
|
|
99
|
-
: undefined,
|
|
100
|
-
minLength: parameter.type === 'string' && typeof parameter.minLength === 'number'
|
|
101
|
-
? { value: parameter.minLength, message: '' }
|
|
102
|
-
: undefined,
|
|
103
|
-
maxLength: parameter.type === 'string' && typeof parameter.maxLength === 'number'
|
|
104
|
-
? { value: parameter.maxLength, message: '' }
|
|
105
|
-
: undefined,
|
|
106
|
-
}, render: ({ field, fieldState }) => {
|
|
107
|
-
var _a;
|
|
108
|
-
return (_jsxs(Stack, { className: "form-item", children: [parameter.label && _jsx(FormLabel, { children: parameter.label }), _jsx(AgentInputField, { inputRef: field.ref, autoFocus: index === 0, size: "small", hiddenLabel: true, fullWidth: true, label: undefined, parameter: parameter, maxRows: !(parameter === null || parameter === void 0 ? void 0 : parameter.type) || (parameter === null || parameter === void 0 ? void 0 : parameter.type) === 'string' ? 5 : undefined, value: field.value || '', onChange: (value) => field.onChange({ target: { value } }), error: Boolean(fieldState.error), helperText: ((_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message) || (parameter === null || parameter === void 0 ? void 0 : parameter.helper), InputProps: parameter.key === 'question' && submitInQuestionField
|
|
109
|
-
? {
|
|
110
|
-
endAdornment: (_jsx(InputAdornment, { position: "end", sx: { py: 3, mr: -0.75, alignSelf: 'flex-end' }, children: _jsx(LoadingButton, { type: "submit", variant: "contained", loading: running, sx: { borderRadius: 100 }, children: submitText || t('generate') }) })),
|
|
111
|
-
}
|
|
112
|
-
: undefined })] }));
|
|
113
|
-
} }) }, parameter.id));
|
|
114
|
-
}), !(submitInQuestionField && (parameters === null || parameters === void 0 ? void 0 : parameters.some((i) => i.key === 'question'))) && (_jsx(LoadingButton, { type: "submit", variant: "contained", loading: executeLoading || running, sx: { height: 40 }, children: submitText || t('generate') }))] })] }));
|
|
115
|
-
}
|
|
116
|
-
const autoSetLastParameters = false;
|
|
117
|
-
function useInitialFormValues() {
|
|
118
|
-
const { agent } = useCurrentAgent();
|
|
119
|
-
const lastMessage = useCurrentSessionState((s) => { var _a; return (_a = s === null || s === void 0 ? void 0 : s.messages) === null || _a === void 0 ? void 0 : _a.at(0); });
|
|
120
|
-
const [lastInputs, setLastInputs] = useState();
|
|
121
|
-
useEffect(() => {
|
|
122
|
-
if (autoSetLastParameters && !lastInputs) {
|
|
123
|
-
const lastParameters = lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.inputs;
|
|
124
|
-
if (!isEmpty(lastParameters))
|
|
125
|
-
setLastInputs(lastParameters);
|
|
126
|
-
}
|
|
127
|
-
}, [lastMessage]);
|
|
128
|
-
return useMemo(() => {
|
|
129
|
-
var _a, _b;
|
|
130
|
-
if (lastInputs) {
|
|
131
|
-
return lastInputs;
|
|
132
|
-
}
|
|
133
|
-
return Object.fromEntries((_b = (_a = agent.parameters) === null || _a === void 0 ? void 0 : _a.map((parameter) => [parameter.key, parameter.defaultValue])) !== null && _b !== void 0 ? _b : []);
|
|
134
|
-
}, [lastInputs, agent]);
|
|
135
|
-
}
|
|
136
|
-
function useFormTheme() {
|
|
137
|
-
const theme = useTheme();
|
|
138
|
-
return useMemo(() => {
|
|
139
|
-
const themeOptions = {
|
|
140
|
-
shape: {
|
|
141
|
-
borderRadius: 8,
|
|
142
|
-
},
|
|
143
|
-
components: {
|
|
144
|
-
MuiTextField: {
|
|
145
|
-
styleOverrides: {
|
|
146
|
-
root: ({ theme }) => theme.unstable_sx({
|
|
147
|
-
[`.${outlinedInputClasses.root}`]: {
|
|
148
|
-
[`.${outlinedInputClasses.notchedOutline}`]: {
|
|
149
|
-
borderWidth: 2,
|
|
150
|
-
borderColor: 'primary.light',
|
|
151
|
-
},
|
|
152
|
-
':hover': {
|
|
153
|
-
[`.${outlinedInputClasses.notchedOutline}`]: {
|
|
154
|
-
borderColor: 'primary.main',
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
}),
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
};
|
|
163
|
-
return createTheme(theme, themeOptions);
|
|
164
|
-
}, [theme]);
|
|
165
|
-
}
|
|
166
|
-
const Form = styled(Stack)(({ theme }) => theme.unstable_sx({
|
|
167
|
-
gap: 2,
|
|
168
|
-
'.form-item': {
|
|
169
|
-
gap: 0.5,
|
|
170
|
-
[`.${formLabelClasses.root}`]: {
|
|
171
|
-
fontWeight: 500,
|
|
172
|
-
color: 'text.primary',
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
'&.label-position-start': {
|
|
176
|
-
'.form-item': {
|
|
177
|
-
display: 'flex',
|
|
178
|
-
flexDirection: 'row',
|
|
179
|
-
alignItems: 'center',
|
|
180
|
-
gap: 1,
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
}));
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
import Toast from '@arcblock/ux/lib/Toast';
|
|
12
|
-
import { Icon } from '@iconify/react';
|
|
13
|
-
import { Alert, Box, Button, ButtonGroup, Drawer, Stack, Typography } from '@mui/material';
|
|
14
|
-
import groupBy from 'lodash/groupBy';
|
|
15
|
-
import { Suspense, useRef, useState } from 'react';
|
|
16
|
-
import { transpileAndLoadScript } from '../../../../../components/CustomComponentRenderer';
|
|
17
|
-
import { useLocaleContext } from '../../../../locale';
|
|
18
|
-
import MarkdownRenderer from '../../components/MarkdownRenderer';
|
|
19
|
-
import ShareActions from '../../components/ShareActions';
|
|
20
|
-
import { useCurrentMessage } from '../../contexts/CurrentMessage';
|
|
21
|
-
import MessageMetadataRenderer from '../ChatOutput/MessageMetadataRenderer';
|
|
22
|
-
import { CodeRenderByMessageMemo as CodeRenderByMessage, getCurrentCodeByTaskId } from './components/CodePreview';
|
|
23
|
-
import Loading from './components/Loading';
|
|
24
|
-
import PropertiesSetting from './components/PropertiesSetting';
|
|
25
|
-
import UserQuestion from './components/UserQuestion';
|
|
26
|
-
import { useV0RuntimeContext } from './contexts/V0Runtime';
|
|
27
|
-
const DEFAULT_DESKTOP_SX = {
|
|
28
|
-
width: '100%',
|
|
29
|
-
height: '100%',
|
|
30
|
-
};
|
|
31
|
-
export default function V0Output() {
|
|
32
|
-
var _a, _b;
|
|
33
|
-
const { message } = useCurrentMessage();
|
|
34
|
-
const propertiesSettingRef = useRef(null);
|
|
35
|
-
const { propertiesValueMap, setPropertiesValueMap, isMobile } = useV0RuntimeContext();
|
|
36
|
-
const [code, setCode] = useState('');
|
|
37
|
-
const { t, locale } = useLocaleContext();
|
|
38
|
-
const [codePreviewExtraProps, setCodePreviewExtraProps] = useState({
|
|
39
|
-
sx: DEFAULT_DESKTOP_SX,
|
|
40
|
-
key: 'Desktop',
|
|
41
|
-
});
|
|
42
|
-
const objects = (_a = message.outputs) === null || _a === void 0 ? void 0 : _a.objects;
|
|
43
|
-
const { id: taskId, inputs } = message;
|
|
44
|
-
const isMessageLoading = (message.loading || !message.outputs) && !message.error;
|
|
45
|
-
const disabled = isMessageLoading || !(objects === null || objects === void 0 ? void 0 : objects.length) || message.error;
|
|
46
|
-
const responsiveSx = {
|
|
47
|
-
backgroundColor: 'white',
|
|
48
|
-
borderColor: 'rgba(0, 0, 0, 0.1) !important',
|
|
49
|
-
// rewrite disabled style
|
|
50
|
-
'&.frame-button.Mui-disabled': {
|
|
51
|
-
backgroundColor: 'primary.main',
|
|
52
|
-
color: 'white',
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
const tooltipOptions = [
|
|
56
|
-
!isMobile && {
|
|
57
|
-
key: 'Desktop',
|
|
58
|
-
icon: 'tabler:device-desktop',
|
|
59
|
-
props: {
|
|
60
|
-
className: 'frame-button',
|
|
61
|
-
disabled: (codePreviewExtraProps === null || codePreviewExtraProps === void 0 ? void 0 : codePreviewExtraProps.key) === 'Desktop',
|
|
62
|
-
sx: Object.assign({}, responsiveSx),
|
|
63
|
-
onClick: () => setCodePreviewExtraProps({
|
|
64
|
-
sx: DEFAULT_DESKTOP_SX,
|
|
65
|
-
key: 'Desktop',
|
|
66
|
-
}),
|
|
67
|
-
},
|
|
68
|
-
group: 'responsive',
|
|
69
|
-
},
|
|
70
|
-
!isMobile && {
|
|
71
|
-
key: 'Tablet',
|
|
72
|
-
icon: 'tabler:device-tablet',
|
|
73
|
-
props: {
|
|
74
|
-
className: 'frame-button',
|
|
75
|
-
disabled: (codePreviewExtraProps === null || codePreviewExtraProps === void 0 ? void 0 : codePreviewExtraProps.key) === 'Tablet',
|
|
76
|
-
sx: Object.assign({}, responsiveSx),
|
|
77
|
-
onClick: () => setCodePreviewExtraProps({
|
|
78
|
-
sx: {
|
|
79
|
-
width: '768px',
|
|
80
|
-
height: '1024px',
|
|
81
|
-
},
|
|
82
|
-
key: 'Tablet',
|
|
83
|
-
}),
|
|
84
|
-
},
|
|
85
|
-
group: 'responsive',
|
|
86
|
-
},
|
|
87
|
-
!isMobile && {
|
|
88
|
-
key: 'Mobile',
|
|
89
|
-
icon: 'tabler:device-mobile',
|
|
90
|
-
props: {
|
|
91
|
-
className: 'frame-button',
|
|
92
|
-
disabled: (codePreviewExtraProps === null || codePreviewExtraProps === void 0 ? void 0 : codePreviewExtraProps.key) === 'Mobile',
|
|
93
|
-
sx: Object.assign({}, responsiveSx),
|
|
94
|
-
onClick: () => setCodePreviewExtraProps({
|
|
95
|
-
sx: {
|
|
96
|
-
width: '375px',
|
|
97
|
-
height: '667px',
|
|
98
|
-
},
|
|
99
|
-
key: 'Mobile',
|
|
100
|
-
}),
|
|
101
|
-
},
|
|
102
|
-
group: 'responsive',
|
|
103
|
-
},
|
|
104
|
-
// setting
|
|
105
|
-
{
|
|
106
|
-
key: 'Setting',
|
|
107
|
-
icon: 'tabler:settings-2',
|
|
108
|
-
props: {
|
|
109
|
-
disabled,
|
|
110
|
-
sx: Object.assign({}, responsiveSx),
|
|
111
|
-
onClick: (e) => __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
var _a;
|
|
113
|
-
const { taskid: taskId } = ((_a = e === null || e === void 0 ? void 0 : e.currentTarget) === null || _a === void 0 ? void 0 : _a.dataset) || {};
|
|
114
|
-
const currentCode = getCurrentCodeByTaskId(message);
|
|
115
|
-
try {
|
|
116
|
-
yield transpileAndLoadScript(currentCode).then((m) => {
|
|
117
|
-
var _a, _b, _c;
|
|
118
|
-
if (typeof (m === null || m === void 0 ? void 0 : m.PROPERTIES_SCHEMA) === 'object' && (m === null || m === void 0 ? void 0 : m.PROPERTIES_SCHEMA.length)) {
|
|
119
|
-
const schemaDefaultValues = Object.fromEntries(m.PROPERTIES_SCHEMA.map((item) => {
|
|
120
|
-
const { key, locales } = item;
|
|
121
|
-
const currentLocale = (locales === null || locales === void 0 ? void 0 : locales[locale]) || (locales === null || locales === void 0 ? void 0 : locales.en);
|
|
122
|
-
return [key, currentLocale === null || currentLocale === void 0 ? void 0 : currentLocale.defaultValue];
|
|
123
|
-
}));
|
|
124
|
-
const defaultValues = Object.assign(Object.assign({}, schemaDefaultValues), (((_a = propertiesValueMap[taskId]) === null || _a === void 0 ? void 0 : _a[locale]) || ((_b = propertiesValueMap[taskId]) === null || _b === void 0 ? void 0 : _b.en) || {}));
|
|
125
|
-
// format default values
|
|
126
|
-
m.PROPERTIES_SCHEMA.forEach((item) => {
|
|
127
|
-
const { key, type } = item;
|
|
128
|
-
if (type === 'json' && typeof defaultValues[key] === 'object') {
|
|
129
|
-
try {
|
|
130
|
-
defaultValues[key] = JSON.stringify(defaultValues[key], null, 2);
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
// ignore error
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
// @ts-ignore
|
|
138
|
-
(_c = propertiesSettingRef.current) === null || _c === void 0 ? void 0 : _c.open({
|
|
139
|
-
schema: m.PROPERTIES_SCHEMA,
|
|
140
|
-
onSubmit: (values) => {
|
|
141
|
-
const realValues = {};
|
|
142
|
-
m.PROPERTIES_SCHEMA.forEach((item) => {
|
|
143
|
-
const { key, type } = item;
|
|
144
|
-
if (type === 'json' && typeof values[key] === 'string') {
|
|
145
|
-
try {
|
|
146
|
-
realValues[key] = JSON.parse(values[key]);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
catch (error) {
|
|
150
|
-
// ignore error
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
realValues[key] = values[key];
|
|
154
|
-
});
|
|
155
|
-
setPropertiesValueMap(Object.assign(Object.assign({}, propertiesValueMap), { [taskId]: Object.assign(Object.assign({}, propertiesValueMap[taskId]), { [locale]: realValues }) }));
|
|
156
|
-
},
|
|
157
|
-
defaultValues,
|
|
158
|
-
});
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
throw new Error('No properties schema found');
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
catch (error) {
|
|
165
|
-
// ignore error
|
|
166
|
-
// send cannot set properties message
|
|
167
|
-
Toast.info(t('v0.cannotSetPropertiesTip'));
|
|
168
|
-
}
|
|
169
|
-
}),
|
|
170
|
-
},
|
|
171
|
-
group: 'setting',
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
key: 'CodePreview',
|
|
175
|
-
icon: code ? 'tabler:layout-board' : 'tabler:code',
|
|
176
|
-
buttonText: !isMobile && (code ? 'Canvas' : 'Code'),
|
|
177
|
-
props: {
|
|
178
|
-
disabled,
|
|
179
|
-
variant: 'contained',
|
|
180
|
-
color: 'primary',
|
|
181
|
-
onClick: () => {
|
|
182
|
-
setCode(getCurrentCodeByTaskId(message));
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
group: 'codePreview',
|
|
186
|
-
},
|
|
187
|
-
].filter(Boolean);
|
|
188
|
-
const onCloseCode = () => setCode('');
|
|
189
|
-
return (_jsxs(Stack, { sx: {
|
|
190
|
-
p: 2,
|
|
191
|
-
gap: 2,
|
|
192
|
-
height: '100%',
|
|
193
|
-
display: 'flex',
|
|
194
|
-
justifyContent: 'flex-start',
|
|
195
|
-
alignItems: 'center',
|
|
196
|
-
flexDirection: 'column',
|
|
197
|
-
}, children: [_jsxs(Stack, { sx: {
|
|
198
|
-
display: 'flex',
|
|
199
|
-
justifyContent: 'space-between',
|
|
200
|
-
alignItems: 'center',
|
|
201
|
-
width: '100%',
|
|
202
|
-
gap: 1.5,
|
|
203
|
-
flexDirection: 'row',
|
|
204
|
-
'.question': {
|
|
205
|
-
backgroundColor: 'white',
|
|
206
|
-
border: 1,
|
|
207
|
-
borderColor: 'rgba(0, 0, 0, 0.1) !important',
|
|
208
|
-
},
|
|
209
|
-
}, children: [_jsx(UserQuestion, { question: inputs === null || inputs === void 0 ? void 0 : inputs.question }), _jsx(Box, { sx: {
|
|
210
|
-
display: 'flex',
|
|
211
|
-
alignItems: 'center',
|
|
212
|
-
gap: 1,
|
|
213
|
-
}, children: Object.entries(groupBy(tooltipOptions, 'group')).map(([group, options]) => {
|
|
214
|
-
return (_jsx(ButtonGroup, { variant: "text", color: "inherit", size: "small", sx: {
|
|
215
|
-
borderColor: 'rgba(0, 0, 0, 0.1) !important',
|
|
216
|
-
border: 1,
|
|
217
|
-
}, children: options.map((option) => {
|
|
218
|
-
const { icon, key, props, buttonText } = option;
|
|
219
|
-
return (_jsxs(Button, Object.assign({ "data-taskId": taskId }, props, { children: [_jsx(Icon, { icon: icon, fontSize: 22 }), buttonText && _jsx(Box, { sx: { ml: 1 }, children: buttonText })] }), key));
|
|
220
|
-
}) }, group));
|
|
221
|
-
}) })] }), _jsx(Box, { sx: Object.assign({ display: 'flex', justifyContent: 'center', overflow: 'hidden', backgroundColor: 'white', borderRadius: 1 }, codePreviewExtraProps === null || codePreviewExtraProps === void 0 ? void 0 : codePreviewExtraProps.sx), children: _jsx(CodeRenderByMessage, { message: message, zoom: 1, sx: {
|
|
222
|
-
overflowX: 'auto',
|
|
223
|
-
overflowY: 'auto',
|
|
224
|
-
scrollbarWidth: 'thin',
|
|
225
|
-
scrollbarColor: 'grey transparent',
|
|
226
|
-
}, propertiesValueMap: propertiesValueMap }) }), objects === null || objects === void 0 ? void 0 : objects.map((item, index) => _jsx(MessageMetadataRenderer, { object: item }, index)), !isMessageLoading && ((_b = message.outputs) === null || _b === void 0 ? void 0 : _b.content) && (_jsx(ShareActions, { direction: "row", justifyContent: "flex-end", sx: { mt: 2 } })), _jsxs(Suspense, { fallback: _jsx(Loading, {}), children: [_jsx(Drawer, { anchor: isMobile ? 'bottom' : 'right', open: !!code, onClose: onCloseCode, children: _jsxs(Box, { sx: Object.assign({ p: 2, pt: 0 }, (isMobile ? { maxHeight: '70vh' } : { maxWidth: '70vw' })), children: [_jsxs(Box, { sx: {
|
|
227
|
-
py: 2,
|
|
228
|
-
position: 'sticky',
|
|
229
|
-
top: 0,
|
|
230
|
-
left: 0,
|
|
231
|
-
backgroundColor: 'white',
|
|
232
|
-
zIndex: 9999,
|
|
233
|
-
display: 'flex',
|
|
234
|
-
justifyContent: 'space-between',
|
|
235
|
-
alignItems: 'center',
|
|
236
|
-
}, children: [_jsx(Typography, { variant: "h6", sx: {
|
|
237
|
-
lineHeight: 1,
|
|
238
|
-
}, children: t('v0.codePreview') }), _jsx(Button, { onClick: onCloseCode,
|
|
239
|
-
// variant="text"
|
|
240
|
-
color: "inherit", disableElevation: true, sx: {
|
|
241
|
-
minWidth: 32,
|
|
242
|
-
minHeight: 32,
|
|
243
|
-
p: 0,
|
|
244
|
-
fontSize: 22,
|
|
245
|
-
}, children: _jsx(Icon, { icon: "tabler:x" }) })] }), _jsx(Alert, { severity: "info", sx: { mb: 2 }, children: t('v0.codePreviewTip') }), _jsx(MarkdownRenderer, { children: `\`\`\`typescript\n${code}\n\`\`\`` })] }) }), _jsx(PropertiesSetting, { ref: propertiesSettingRef })] })] }));
|
|
246
|
-
}
|