@blocklet/pages-kit 0.2.432 → 0.2.434
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/builtin/async/ai-runtime.js +17 -0
- package/lib/cjs/builtin/{async/ai-runtime/components/AgentInputField/LanguageField.js → components/LanguageField/index.js} +3 -3
- package/lib/cjs/builtin/{components.js → components/index.js} +1 -1
- package/lib/cjs/components/CustomComponentRenderer/context.js +13 -0
- package/lib/cjs/components/CustomComponentRenderer/index.js +5 -1
- package/lib/cjs/components/CustomComponentRenderer/state.js +20 -6
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/builtin/async/ai-runtime.js +1 -0
- package/lib/esm/builtin/{async/ai-runtime/components/AgentInputField/LanguageField.js → components/LanguageField/index.js} +2 -2
- package/lib/esm/builtin/components/index.js +1 -0
- package/lib/esm/components/CustomComponentRenderer/context.js +9 -0
- package/lib/esm/components/CustomComponentRenderer/index.js +5 -1
- package/lib/esm/components/CustomComponentRenderer/state.js +21 -7
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/builtin/async/ai-runtime.d.ts +1 -0
- package/lib/types/builtin/components/index.d.ts +1 -0
- package/lib/types/components/CustomComponentRenderer/context.d.ts +14 -0
- package/lib/types/components/CustomComponentRenderer/index.d.ts +1 -0
- package/lib/types/components/CustomComponentRenderer/state.d.ts +5 -1
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -5
- package/tsconfig.json +1 -1
- package/lib/cjs/builtin/async/ai-runtime/api/agent.js +0 -24
- package/lib/cjs/builtin/async/ai-runtime/api/asset.js +0 -25
- package/lib/cjs/builtin/async/ai-runtime/api/dataset.js +0 -134
- package/lib/cjs/builtin/async/ai-runtime/api/message.js +0 -46
- package/lib/cjs/builtin/async/ai-runtime/api/request.js +0 -74
- package/lib/cjs/builtin/async/ai-runtime/api/secret.js +0 -24
- package/lib/cjs/builtin/async/ai-runtime/api/session.js +0 -137
- package/lib/cjs/builtin/async/ai-runtime/components/ActionButton.js +0 -62
- package/lib/cjs/builtin/async/ai-runtime/components/AgentErrorBoundary.js +0 -34
- package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/BooleanField.js +0 -21
- package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/NumberField.js +0 -21
- package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/RadioField.js +0 -39
- package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/SelectField.js +0 -24
- package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/StringField.js +0 -35
- package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/index.js +0 -44
- package/lib/cjs/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.js +0 -80
- package/lib/cjs/builtin/async/ai-runtime/components/GlobalLoading/index.js +0 -27
- package/lib/cjs/builtin/async/ai-runtime/components/GlobalLoading/state.js +0 -39
- package/lib/cjs/builtin/async/ai-runtime/components/Header/SimpleHeader.js +0 -49
- package/lib/cjs/builtin/async/ai-runtime/components/Layout/SimpleLayout.js +0 -21
- package/lib/cjs/builtin/async/ai-runtime/components/LoadingButton.js +0 -40
- package/lib/cjs/builtin/async/ai-runtime/components/MarkdownRenderer/index.js +0 -146
- package/lib/cjs/builtin/async/ai-runtime/components/MenuButton.js +0 -55
- package/lib/cjs/builtin/async/ai-runtime/components/OutputFieldContainer/index.js +0 -22
- package/lib/cjs/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.js +0 -49
- package/lib/cjs/builtin/async/ai-runtime/components/PopperMenuButton/index.js +0 -68
- package/lib/cjs/builtin/async/ai-runtime/components/RuntimeCommonProvider.js +0 -25
- package/lib/cjs/builtin/async/ai-runtime/components/ScrollView.js +0 -92
- package/lib/cjs/builtin/async/ai-runtime/components/ShareActions/Community.js +0 -6
- package/lib/cjs/builtin/async/ai-runtime/components/ShareActions/index.js +0 -255
- package/lib/cjs/builtin/async/ai-runtime/components/SocialShare.js +0 -108
- package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +0 -191
- package/lib/cjs/builtin/async/ai-runtime/components/UserInfo.js +0 -55
- package/lib/cjs/builtin/async/ai-runtime/constants.js +0 -43
- package/lib/cjs/builtin/async/ai-runtime/contexts/ActiveAgent.js +0 -27
- package/lib/cjs/builtin/async/ai-runtime/contexts/ComponentPreferences.js +0 -31
- package/lib/cjs/builtin/async/ai-runtime/contexts/CurrentAgent.js +0 -34
- package/lib/cjs/builtin/async/ai-runtime/contexts/CurrentMessage.js +0 -18
- package/lib/cjs/builtin/async/ai-runtime/contexts/Identity.js +0 -36
- package/lib/cjs/builtin/async/ai-runtime/contexts/Runtime.js +0 -52
- package/lib/cjs/builtin/async/ai-runtime/error.js +0 -10
- package/lib/cjs/builtin/async/ai-runtime/hooks/use-agent-admin.js +0 -13
- package/lib/cjs/builtin/async/ai-runtime/hooks/use-appearances.js +0 -109
- package/lib/cjs/builtin/async/ai-runtime/hooks/use-header-menu.js +0 -50
- package/lib/cjs/builtin/async/ai-runtime/index.js +0 -83
- package/lib/cjs/builtin/async/ai-runtime/locales/index.js +0 -237
- package/lib/cjs/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +0 -116
- package/lib/cjs/builtin/async/ai-runtime/runtime/Runtime/index.js +0 -48
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +0 -138
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.js +0 -19
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageItemView.js +0 -186
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageMetadataRenderer.js +0 -24
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageSuggestedQuestions.js +0 -34
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/ReferenceLinks.js +0 -11
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/index.js +0 -24
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.js +0 -85
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.js +0 -64
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ImagesView/index.js +0 -30
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/MarkdownView/index.js +0 -13
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.js +0 -46
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/OutputFieldView/type.js +0 -2
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +0 -65
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.js +0 -150
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.js +0 -26
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ShareView/index.js +0 -16
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.js +0 -38
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/DrawerOpenCloseIcon.js +0 -42
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.js +0 -94
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +0 -79
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.js +0 -34
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.js +0 -45
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.js +0 -28
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +0 -82
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +0 -69
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +0 -55
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.js +0 -54
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Input.js +0 -189
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Output.js +0 -252
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Page.js +0 -300
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +0 -158
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.js +0 -60
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/Loading.js +0 -153
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.js +0 -80
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/TransparentTooltip.js +0 -25
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +0 -68
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.js +0 -56
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/index.js +0 -12
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/utils.js +0 -13
- package/lib/cjs/builtin/async/ai-runtime/state/agent.js +0 -58
- package/lib/cjs/builtin/async/ai-runtime/state/runtime.js +0 -48
- package/lib/cjs/builtin/async/ai-runtime/state/session.js +0 -415
- package/lib/cjs/builtin/async/ai-runtime/utils/agent-inputs.js +0 -14
- package/lib/cjs/builtin/async/ai-runtime/utils/download-image.js +0 -40
- package/lib/cjs/builtin/async/ai-runtime/utils/fonts.js +0 -35
- package/lib/cjs/builtin/async/ai-runtime/utils/map-right.js +0 -10
- package/lib/cjs/builtin/async/ai-runtime/utils/runtime-output-schema.js +0 -7
- package/lib/cjs/builtin/async/ai-runtime/utils/zustand.js +0 -9
- package/lib/esm/builtin/async/ai-runtime/api/agent.js +0 -21
- package/lib/esm/builtin/async/ai-runtime/api/asset.js +0 -22
- package/lib/esm/builtin/async/ai-runtime/api/dataset.js +0 -121
- package/lib/esm/builtin/async/ai-runtime/api/message.js +0 -42
- package/lib/esm/builtin/async/ai-runtime/api/request.js +0 -68
- package/lib/esm/builtin/async/ai-runtime/api/secret.js +0 -21
- package/lib/esm/builtin/async/ai-runtime/api/session.js +0 -128
- package/lib/esm/builtin/async/ai-runtime/components/ActionButton.js +0 -56
- package/lib/esm/builtin/async/ai-runtime/components/AgentErrorBoundary.js +0 -30
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/BooleanField.js +0 -19
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/NumberField.js +0 -19
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/RadioField.js +0 -37
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/SelectField.js +0 -22
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/StringField.js +0 -33
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/index.js +0 -38
- package/lib/esm/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.js +0 -76
- package/lib/esm/builtin/async/ai-runtime/components/GlobalLoading/index.js +0 -22
- package/lib/esm/builtin/async/ai-runtime/components/GlobalLoading/state.js +0 -36
- package/lib/esm/builtin/async/ai-runtime/components/Header/SimpleHeader.js +0 -23
- package/lib/esm/builtin/async/ai-runtime/components/Layout/SimpleLayout.js +0 -18
- package/lib/esm/builtin/async/ai-runtime/components/LoadingButton.js +0 -38
- package/lib/esm/builtin/async/ai-runtime/components/MarkdownRenderer/index.js +0 -118
- package/lib/esm/builtin/async/ai-runtime/components/MenuButton.js +0 -52
- package/lib/esm/builtin/async/ai-runtime/components/OutputFieldContainer/index.js +0 -19
- package/lib/esm/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.js +0 -46
- package/lib/esm/builtin/async/ai-runtime/components/PopperMenuButton/index.js +0 -42
- package/lib/esm/builtin/async/ai-runtime/components/RuntimeCommonProvider.js +0 -18
- package/lib/esm/builtin/async/ai-runtime/components/ScrollView.js +0 -63
- package/lib/esm/builtin/async/ai-runtime/components/ShareActions/Community.js +0 -4
- package/lib/esm/builtin/async/ai-runtime/components/ShareActions/index.js +0 -226
- package/lib/esm/builtin/async/ai-runtime/components/SocialShare.js +0 -100
- package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +0 -185
- package/lib/esm/builtin/async/ai-runtime/components/UserInfo.js +0 -47
- package/lib/esm/builtin/async/ai-runtime/constants.js +0 -39
- package/lib/esm/builtin/async/ai-runtime/contexts/ActiveAgent.js +0 -23
- package/lib/esm/builtin/async/ai-runtime/contexts/ComponentPreferences.js +0 -24
- package/lib/esm/builtin/async/ai-runtime/contexts/CurrentAgent.js +0 -30
- package/lib/esm/builtin/async/ai-runtime/contexts/CurrentMessage.js +0 -14
- package/lib/esm/builtin/async/ai-runtime/contexts/Identity.js +0 -28
- package/lib/esm/builtin/async/ai-runtime/contexts/Runtime.js +0 -22
- package/lib/esm/builtin/async/ai-runtime/error.js +0 -6
- package/lib/esm/builtin/async/ai-runtime/hooks/use-agent-admin.js +0 -10
- package/lib/esm/builtin/async/ai-runtime/hooks/use-appearances.js +0 -103
- package/lib/esm/builtin/async/ai-runtime/hooks/use-header-menu.js +0 -44
- package/lib/esm/builtin/async/ai-runtime/index.js +0 -37
- package/lib/esm/builtin/async/ai-runtime/locales/index.js +0 -234
- package/lib/esm/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +0 -87
- package/lib/esm/builtin/async/ai-runtime/runtime/Runtime/index.js +0 -19
- package/lib/esm/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +0 -132
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.js +0 -13
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageItemView.js +0 -157
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageMetadataRenderer.js +0 -18
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageSuggestedQuestions.js +0 -30
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/ReferenceLinks.js +0 -8
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/index.js +0 -18
- package/lib/esm/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.js +0 -56
- package/lib/esm/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.js +0 -58
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ImagesView/index.js +0 -24
- package/lib/esm/builtin/async/ai-runtime/runtime-components/MarkdownView/index.js +0 -7
- package/lib/esm/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.js +0 -40
- package/lib/esm/builtin/async/ai-runtime/runtime-components/OutputFieldView/type.js +0 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +0 -59
- package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.js +0 -144
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.js +0 -20
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ShareView/index.js +0 -10
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.js +0 -35
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/DrawerOpenCloseIcon.js +0 -39
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.js +0 -65
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +0 -50
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.js +0 -28
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.js +0 -40
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.js +0 -22
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +0 -53
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +0 -40
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +0 -49
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.js +0 -48
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Input.js +0 -183
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Output.js +0 -246
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Page.js +0 -294
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +0 -149
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.js +0 -55
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/Loading.js +0 -146
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.js +0 -75
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/TransparentTooltip.js +0 -23
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +0 -42
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.js +0 -52
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/index.js +0 -3
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/utils.js +0 -9
- package/lib/esm/builtin/async/ai-runtime/state/agent.js +0 -55
- package/lib/esm/builtin/async/ai-runtime/state/runtime.js +0 -45
- package/lib/esm/builtin/async/ai-runtime/state/session.js +0 -408
- package/lib/esm/builtin/async/ai-runtime/utils/agent-inputs.js +0 -10
- package/lib/esm/builtin/async/ai-runtime/utils/download-image.js +0 -36
- package/lib/esm/builtin/async/ai-runtime/utils/fonts.js +0 -32
- package/lib/esm/builtin/async/ai-runtime/utils/map-right.js +0 -7
- package/lib/esm/builtin/async/ai-runtime/utils/runtime-output-schema.js +0 -4
- package/lib/esm/builtin/async/ai-runtime/utils/zustand.js +0 -6
- package/lib/esm/builtin/components.js +0 -1
- package/lib/types/builtin/async/ai-runtime/api/agent.d.ts +0 -51
- package/lib/types/builtin/async/ai-runtime/api/asset.d.ts +0 -16
- package/lib/types/builtin/async/ai-runtime/api/dataset.d.ts +0 -39
- package/lib/types/builtin/async/ai-runtime/api/message.d.ts +0 -35
- package/lib/types/builtin/async/ai-runtime/api/request.d.ts +0 -12
- package/lib/types/builtin/async/ai-runtime/api/secret.d.ts +0 -12
- package/lib/types/builtin/async/ai-runtime/api/session.d.ts +0 -61
- package/lib/types/builtin/async/ai-runtime/components/ActionButton.d.ts +0 -14
- package/lib/types/builtin/async/ai-runtime/components/AgentErrorBoundary.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/components/AgentInputField/BooleanField.d.ts +0 -8
- package/lib/types/builtin/async/ai-runtime/components/AgentInputField/NumberField.d.ts +0 -8
- package/lib/types/builtin/async/ai-runtime/components/AgentInputField/RadioField.d.ts +0 -8
- package/lib/types/builtin/async/ai-runtime/components/AgentInputField/SelectField.d.ts +0 -8
- package/lib/types/builtin/async/ai-runtime/components/AgentInputField/StringField.d.ts +0 -8
- package/lib/types/builtin/async/ai-runtime/components/AgentInputField/index.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.d.ts +0 -10
- package/lib/types/builtin/async/ai-runtime/components/GlobalLoading/index.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/components/GlobalLoading/state.d.ts +0 -10
- package/lib/types/builtin/async/ai-runtime/components/Header/SimpleHeader.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/Layout/SimpleLayout.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/components/LoadingButton.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/components/MarkdownRenderer/index.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/components/MenuButton.d.ts +0 -10
- package/lib/types/builtin/async/ai-runtime/components/OutputFieldContainer/index.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/PopperMenuButton/index.d.ts +0 -6
- package/lib/types/builtin/async/ai-runtime/components/RuntimeCommonProvider.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/components/ScrollView.d.ts +0 -10
- package/lib/types/builtin/async/ai-runtime/components/ShareActions/Community.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/components/ShareActions/index.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/components/SocialShare.d.ts +0 -20
- package/lib/types/builtin/async/ai-runtime/components/ThemeProvider.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/components/UserInfo.d.ts +0 -18
- package/lib/types/builtin/async/ai-runtime/constants.d.ts +0 -21
- package/lib/types/builtin/async/ai-runtime/contexts/ActiveAgent.d.ts +0 -9
- package/lib/types/builtin/async/ai-runtime/contexts/ComponentPreferences.d.ts +0 -11
- package/lib/types/builtin/async/ai-runtime/contexts/CurrentAgent.d.ts +0 -16
- package/lib/types/builtin/async/ai-runtime/contexts/CurrentMessage.d.ts +0 -15
- package/lib/types/builtin/async/ai-runtime/contexts/Identity.d.ts +0 -16
- package/lib/types/builtin/async/ai-runtime/contexts/Runtime.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/error.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/hooks/use-agent-admin.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/hooks/use-appearances.d.ts +0 -78
- package/lib/types/builtin/async/ai-runtime/hooks/use-header-menu.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/index.d.ts +0 -36
- package/lib/types/builtin/async/ai-runtime/locales/index.d.ts +0 -210
- package/lib/types/builtin/async/ai-runtime/runtime/ChatBotButton/index.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/runtime/Runtime/index.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/runtime-components/AutoForm/index.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageItemView.d.ts +0 -12
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageMetadataRenderer.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageSuggestedQuestions.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/ReferenceLinks.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/index.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/ImagesView/index.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/MarkdownView/index.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/OutputFieldView/type.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/ShareView/index.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/DrawerOpenCloseIcon.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.d.ts +0 -9
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/index.d.ts +0 -16
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimplePage/index.d.ts +0 -6
- package/lib/types/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/Input.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/Output.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/Page.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.d.ts +0 -20
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/Loading.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/TransparentTooltip.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.d.ts +0 -17
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/index.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/utils.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/state/agent.d.ts +0 -12
- package/lib/types/builtin/async/ai-runtime/state/runtime.d.ts +0 -14
- package/lib/types/builtin/async/ai-runtime/state/session.d.ts +0 -60
- package/lib/types/builtin/async/ai-runtime/utils/agent-inputs.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/utils/download-image.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/utils/fonts.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/utils/map-right.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/utils/runtime-output-schema.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/utils/zustand.d.ts +0 -2
- package/lib/types/builtin/components.d.ts +0 -1
- /package/lib/cjs/builtin/{async/ai-runtime/utils → components/LanguageField}/languages.js +0 -0
- /package/lib/esm/builtin/{async/ai-runtime/utils → components/LanguageField}/languages.js +0 -0
- /package/lib/types/builtin/{async/ai-runtime/components/AgentInputField/LanguageField.d.ts → components/LanguageField/index.d.ts} +0 -0
- /package/lib/types/builtin/{async/ai-runtime/utils → components/LanguageField}/languages.d.ts +0 -0
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { joinURL, withQuery } from 'ufo';
|
|
2
|
-
import { getAIRuntimeApiPrefix } from './request';
|
|
3
|
-
const presets = {
|
|
4
|
-
avatar: { w: 80 },
|
|
5
|
-
default: { w: 1200 },
|
|
6
|
-
};
|
|
7
|
-
export function getAssetUrl({ blockletDid, aid, filename, w, preset, }) {
|
|
8
|
-
var _a, _b;
|
|
9
|
-
const url = filename && aid && !(filename === null || filename === void 0 ? void 0 : filename.startsWith('http'))
|
|
10
|
-
? withQuery(joinURL(getAIRuntimeApiPrefix(), '/api/agents', aid, 'assets', filename), {
|
|
11
|
-
blockletDid,
|
|
12
|
-
})
|
|
13
|
-
: filename;
|
|
14
|
-
if (!url)
|
|
15
|
-
return url;
|
|
16
|
-
const width = (_b = w !== null && w !== void 0 ? w : (_a = presets[preset]) === null || _a === void 0 ? void 0 : _a.w) !== null && _b !== void 0 ? _b : presets.default.w;
|
|
17
|
-
return withQuery(url, {
|
|
18
|
-
imageFilter: width ? 'resize' : undefined,
|
|
19
|
-
f: 'webp',
|
|
20
|
-
w: width,
|
|
21
|
-
});
|
|
22
|
-
}
|
|
@@ -1,121 +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 { joinURL, withQuery } from 'ufo';
|
|
11
|
-
import { AI_STUDIO_DID } from '../constants';
|
|
12
|
-
import { request } from './request';
|
|
13
|
-
export function getDataset(_a) {
|
|
14
|
-
return __awaiter(this, arguments, void 0, function* ({ datasetId }) {
|
|
15
|
-
const url = joinURL('/api/datasets/', datasetId);
|
|
16
|
-
const result = yield request({ blocklet: AI_STUDIO_DID, url });
|
|
17
|
-
if (!result)
|
|
18
|
-
throw new Error('Collection not found!');
|
|
19
|
-
return result;
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
export function getDatasets(_a) {
|
|
23
|
-
return __awaiter(this, arguments, void 0, function* ({ appId }) {
|
|
24
|
-
const url = withQuery('/api/datasets', { appId });
|
|
25
|
-
return request({ blocklet: AI_STUDIO_DID, url });
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
export function createDataset(_a) {
|
|
29
|
-
return __awaiter(this, arguments, void 0, function* ({ appId, name, description, }) {
|
|
30
|
-
return request({
|
|
31
|
-
blocklet: AI_STUDIO_DID,
|
|
32
|
-
method: 'POST',
|
|
33
|
-
url: '/api/datasets',
|
|
34
|
-
body: {
|
|
35
|
-
appId,
|
|
36
|
-
name,
|
|
37
|
-
description,
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
export function updateDataset(datasetId, input) {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
return request({
|
|
45
|
-
blocklet: AI_STUDIO_DID,
|
|
46
|
-
method: 'PUT',
|
|
47
|
-
url: joinURL('/api/datasets', datasetId),
|
|
48
|
-
body: input,
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
export function deleteDataset(datasetId) {
|
|
53
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
const url = joinURL('/api/datasets', datasetId);
|
|
55
|
-
return request({ blocklet: AI_STUDIO_DID, method: 'DELETE', url });
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
export function deleteDocument(datasetId, documentId) {
|
|
59
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
return request({
|
|
61
|
-
blocklet: AI_STUDIO_DID,
|
|
62
|
-
method: 'DELETE',
|
|
63
|
-
url: joinURL('/api/datasets', datasetId, 'documents', documentId),
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
export function getDocuments(datasetId) {
|
|
68
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
return request({
|
|
70
|
-
blocklet: AI_STUDIO_DID,
|
|
71
|
-
url: joinURL('/api/datasets', datasetId, 'documents'),
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
export function getDocument(datasetId, documentId) {
|
|
76
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
const result = yield request({
|
|
78
|
-
blocklet: AI_STUDIO_DID,
|
|
79
|
-
url: joinURL('/api/datasets', datasetId, 'documents', documentId),
|
|
80
|
-
});
|
|
81
|
-
if (!(result === null || result === void 0 ? void 0 : result.document))
|
|
82
|
-
throw new Error('Document not found!');
|
|
83
|
-
return result;
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
export function createDocument(datasetId, type, input) {
|
|
87
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
if (type === 'file')
|
|
89
|
-
return createDocumentFile(datasetId, input);
|
|
90
|
-
return request({
|
|
91
|
-
blocklet: AI_STUDIO_DID,
|
|
92
|
-
method: 'POST',
|
|
93
|
-
url: joinURL('/api/datasets', datasetId, 'documents', type),
|
|
94
|
-
body: input,
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
export function createDocumentFile(datasetId, file) {
|
|
99
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
-
const form = new FormData();
|
|
101
|
-
form.append('data', file);
|
|
102
|
-
form.append('type', 'file');
|
|
103
|
-
form.append('filename', file.name);
|
|
104
|
-
return request({
|
|
105
|
-
blocklet: AI_STUDIO_DID,
|
|
106
|
-
method: 'POST',
|
|
107
|
-
url: joinURL('/api/datasets', datasetId, 'documents/file'),
|
|
108
|
-
body: form,
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
export function updateDocument(datasetId, documentId, type, input) {
|
|
113
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
-
return request({
|
|
115
|
-
blocklet: AI_STUDIO_DID,
|
|
116
|
-
method: 'PUT',
|
|
117
|
-
url: joinURL('/api/datasets', datasetId, 'documents', documentId, type),
|
|
118
|
-
body: input,
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
}
|
|
@@ -1,42 +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 { joinURL } from 'ufo';
|
|
22
|
-
import { AI_RUNTIME_DID } from '../constants';
|
|
23
|
-
import { request } from './request';
|
|
24
|
-
export function getMessages(_a) {
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
var { sessionId } = _a, query = __rest(_a, ["sessionId"]);
|
|
27
|
-
return request({
|
|
28
|
-
blocklet: AI_RUNTIME_DID,
|
|
29
|
-
url: joinURL('/api/sessions', sessionId, 'messages'),
|
|
30
|
-
query,
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
export function deleteMessages(_a) {
|
|
35
|
-
return __awaiter(this, arguments, void 0, function* ({ sessionId }) {
|
|
36
|
-
yield request({
|
|
37
|
-
blocklet: AI_RUNTIME_DID,
|
|
38
|
-
method: 'DELETE',
|
|
39
|
-
url: joinURL('/api/sessions', sessionId, 'messages'),
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
@@ -1,68 +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 { createFetch } from '@blocklet/js-sdk';
|
|
22
|
-
import { withQuery } from 'ufo';
|
|
23
|
-
import { getComponentMountPoint } from '../../../utils';
|
|
24
|
-
import { AI_RUNTIME_DID } from '../constants';
|
|
25
|
-
import { CustomError } from '../error';
|
|
26
|
-
let isDEV = false;
|
|
27
|
-
try {
|
|
28
|
-
// @ts-ignore
|
|
29
|
-
isDEV = import.meta.env.DEV;
|
|
30
|
-
}
|
|
31
|
-
catch (_a) {
|
|
32
|
-
// ignore
|
|
33
|
-
}
|
|
34
|
-
export const getAIRuntimeApiPrefix = () => window.AI_RUNTIME_API_PREFIX || getComponentMountPoint(AI_RUNTIME_DID);
|
|
35
|
-
const fetchMap = {};
|
|
36
|
-
const getFetch = (blocklet) => {
|
|
37
|
-
if (!fetchMap[blocklet]) {
|
|
38
|
-
fetchMap[blocklet] = createFetch({}, { lazy: isDEV, lazyTime: 1000, componentDid: blocklet });
|
|
39
|
-
}
|
|
40
|
-
return fetchMap[blocklet];
|
|
41
|
-
};
|
|
42
|
-
export const fetch = (input, _a) => {
|
|
43
|
-
var { blocklet } = _a, init = __rest(_a, ["blocklet"]);
|
|
44
|
-
const f = getFetch(blocklet);
|
|
45
|
-
return f(input, init);
|
|
46
|
-
};
|
|
47
|
-
export function request(_a) {
|
|
48
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
var _b, _c, _d;
|
|
50
|
-
var { blocklet, url, query, body } = _a, init = __rest(_a, ["blocklet", "url", "query", "body"]);
|
|
51
|
-
const fetch = getFetch(blocklet);
|
|
52
|
-
const result = yield fetch(withQuery(url, query !== null && query !== void 0 ? query : {}), Object.assign(Object.assign({}, init), { headers: {
|
|
53
|
-
'Content-Type': 'application/json',
|
|
54
|
-
}, body: typeof body === 'object' ? JSON.stringify(body) : body }));
|
|
55
|
-
if (!(result.status >= 200 && result.status < 300)) {
|
|
56
|
-
let json;
|
|
57
|
-
try {
|
|
58
|
-
json = yield result.json();
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
console.error('parse response error', error);
|
|
62
|
-
}
|
|
63
|
-
const message = (_d = (_c = (_b = json === null || json === void 0 ? void 0 : json.error) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : json === null || json === void 0 ? void 0 : json.message) !== null && _d !== void 0 ? _d : json === null || json === void 0 ? void 0 : json.error;
|
|
64
|
-
throw new CustomError(result.status, typeof message === 'string' ? message : `request error ${result.status}`);
|
|
65
|
-
}
|
|
66
|
-
return result.json();
|
|
67
|
-
});
|
|
68
|
-
}
|
|
@@ -1,21 +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 { AI_RUNTIME_DID } from '../constants';
|
|
11
|
-
import { request } from './request';
|
|
12
|
-
export function createSecrets(_a) {
|
|
13
|
-
return __awaiter(this, arguments, void 0, function* ({ input }) {
|
|
14
|
-
return request({
|
|
15
|
-
blocklet: AI_RUNTIME_DID,
|
|
16
|
-
method: 'POST',
|
|
17
|
-
url: '/api/secrets',
|
|
18
|
-
body: input,
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
}
|
|
@@ -1,128 +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 { joinURL } from 'ufo';
|
|
22
|
-
import { EventSourceParserStream } from '../../../stream';
|
|
23
|
-
import { AI_RUNTIME_DID } from '../constants';
|
|
24
|
-
import { fetch, request } from './request';
|
|
25
|
-
export function getSessions(_a) {
|
|
26
|
-
return __awaiter(this, arguments, void 0, function* ({ aid }) {
|
|
27
|
-
return request({
|
|
28
|
-
blocklet: AI_RUNTIME_DID,
|
|
29
|
-
url: '/api/sessions',
|
|
30
|
-
query: { aid },
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
export function getSession(_a) {
|
|
35
|
-
return __awaiter(this, arguments, void 0, function* ({ sessionId }) {
|
|
36
|
-
return request({
|
|
37
|
-
blocklet: AI_RUNTIME_DID,
|
|
38
|
-
url: joinURL('/api/sessions', sessionId),
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
export function createSession(_a) {
|
|
43
|
-
return __awaiter(this, arguments, void 0, function* ({ aid, name, }) {
|
|
44
|
-
return request({
|
|
45
|
-
blocklet: AI_RUNTIME_DID,
|
|
46
|
-
method: 'POST',
|
|
47
|
-
url: '/api/sessions',
|
|
48
|
-
body: {
|
|
49
|
-
aid,
|
|
50
|
-
name,
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
export function clearSession(_a) {
|
|
56
|
-
return __awaiter(this, arguments, void 0, function* ({ sessionId }) {
|
|
57
|
-
return request({
|
|
58
|
-
blocklet: AI_RUNTIME_DID,
|
|
59
|
-
method: 'POST',
|
|
60
|
-
url: joinURL('/api/sessions', sessionId, '/clear'),
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
export function updateSession(_a) {
|
|
65
|
-
return __awaiter(this, arguments, void 0, function* ({ sessionId, name, }) {
|
|
66
|
-
return request({
|
|
67
|
-
blocklet: AI_RUNTIME_DID,
|
|
68
|
-
method: 'PATCH',
|
|
69
|
-
url: joinURL('/api/sessions', sessionId),
|
|
70
|
-
body: { name },
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
export function deleteSession(_a) {
|
|
75
|
-
return __awaiter(this, arguments, void 0, function* ({ sessionId, }) {
|
|
76
|
-
return request({
|
|
77
|
-
blocklet: AI_RUNTIME_DID,
|
|
78
|
-
method: 'DELETE',
|
|
79
|
-
url: joinURL('/api/sessions', sessionId),
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
export function runAgent(_a) {
|
|
84
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
var _b;
|
|
86
|
-
var { responseType } = _a, input = __rest(_a, ["responseType"]);
|
|
87
|
-
if (responseType === 'stream') {
|
|
88
|
-
const res = yield fetch('/api/ai/call', {
|
|
89
|
-
blocklet: AI_RUNTIME_DID,
|
|
90
|
-
method: 'POST',
|
|
91
|
-
headers: {
|
|
92
|
-
'Content-Type': 'application/json',
|
|
93
|
-
Accept: 'text/event-stream',
|
|
94
|
-
},
|
|
95
|
-
body: JSON.stringify({
|
|
96
|
-
blockletDid: input.blockletDid,
|
|
97
|
-
sessionId: input.sessionId,
|
|
98
|
-
inputs: Object.assign(Object.assign({}, input.inputs), { $clientTime: new Date().toISOString() }),
|
|
99
|
-
aid: input.aid,
|
|
100
|
-
working: input.working,
|
|
101
|
-
}),
|
|
102
|
-
});
|
|
103
|
-
if (!(res.status >= 200 && res.status < 300)) {
|
|
104
|
-
let json;
|
|
105
|
-
try {
|
|
106
|
-
json = yield res.json();
|
|
107
|
-
}
|
|
108
|
-
catch (error) {
|
|
109
|
-
// ignore
|
|
110
|
-
}
|
|
111
|
-
const message = (_b = json === null || json === void 0 ? void 0 : json.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
112
|
-
if (typeof message === 'string') {
|
|
113
|
-
throw new Error(message);
|
|
114
|
-
}
|
|
115
|
-
throw new Error(`Unknown Error: ${res.status}`);
|
|
116
|
-
}
|
|
117
|
-
return res
|
|
118
|
-
.body.pipeThrough(new TextDecoderStream())
|
|
119
|
-
.pipeThrough(new EventSourceParserStream());
|
|
120
|
-
}
|
|
121
|
-
return request({
|
|
122
|
-
blocklet: AI_RUNTIME_DID,
|
|
123
|
-
method: 'POST',
|
|
124
|
-
url: joinURL('/api/ai/call'),
|
|
125
|
-
body: input,
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
}
|
|
@@ -1,56 +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 { Icon } from '@iconify/react';
|
|
23
|
-
import { Box, Tooltip } from '@mui/material';
|
|
24
|
-
import { useRef, useState } from 'react';
|
|
25
|
-
import LoadingButton from './LoadingButton';
|
|
26
|
-
export default function ActionButton(_a) {
|
|
27
|
-
var { tip, tipSucceed, title, titleSucceed, icon, iconSucceed, autoReset, placement = 'top' } = _a, props = __rest(_a, ["tip", "tipSucceed", "title", "titleSucceed", "icon", "iconSucceed", "autoReset", "placement"]);
|
|
28
|
-
const [active, setActive] = useState(false);
|
|
29
|
-
const [error, setError] = useState();
|
|
30
|
-
const timer = useRef();
|
|
31
|
-
const onClose = () => {
|
|
32
|
-
setError(undefined);
|
|
33
|
-
if (autoReset) {
|
|
34
|
-
timer.current = window.setTimeout(() => {
|
|
35
|
-
setActive(false);
|
|
36
|
-
}, 3000);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const onOpen = () => {
|
|
40
|
-
clearTimeout(timer.current);
|
|
41
|
-
};
|
|
42
|
-
const realIcon = active ? iconSucceed : icon;
|
|
43
|
-
const toolTipTitleText = error ? _jsx(Box, { color: "error", children: error.message }) : (active && tipSucceed) || tip;
|
|
44
|
-
const buttonText = active ? titleSucceed : title;
|
|
45
|
-
return (_jsx(Tooltip, { title: toolTipTitleText, disableInteractive: true, placement: placement, onClose: onClose, onOpen: onOpen, children: _jsx("span", { children: _jsx(LoadingButton, Object.assign({ startIcon: realIcon && (typeof realIcon === 'string' ? _jsx(Icon, { icon: realIcon }) : realIcon), loadingPosition: realIcon ? 'start' : undefined }, props, { onClick: (e) => __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
if (!props.onClick)
|
|
47
|
-
return;
|
|
48
|
-
try {
|
|
49
|
-
yield props.onClick(e);
|
|
50
|
-
setActive(true);
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
setError(error);
|
|
54
|
-
}
|
|
55
|
-
}), children: buttonText })) }) }));
|
|
56
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { SubscriptionErrorType } from '@blocklet/ai-kit/api';
|
|
3
|
-
import { SubscribeErrorAlert } from '@blocklet/ai-kit/components';
|
|
4
|
-
import { Alert, Button, Stack, alertClasses } from '@mui/material';
|
|
5
|
-
import { ErrorBoundary } from 'react-error-boundary';
|
|
6
|
-
import { useLocaleContext } from '../../../locale';
|
|
7
|
-
import { useIsAgentAdmin } from '../hooks/use-agent-admin';
|
|
8
|
-
import { useRuntimeState } from '../state/runtime';
|
|
9
|
-
import { settingsDialogState } from './AgentSettings/AgentSettingsDialog';
|
|
10
|
-
export default function AgentErrorBoundary({ children }) {
|
|
11
|
-
return _jsx(ErrorBoundary, { FallbackComponent: AgentErrorView, children: children });
|
|
12
|
-
}
|
|
13
|
-
export function AgentErrorView({ error }) {
|
|
14
|
-
if (error.type === 'MissingSecretError') {
|
|
15
|
-
return _jsx(MissingSecretErrorView, {});
|
|
16
|
-
}
|
|
17
|
-
if (error.type === SubscriptionErrorType.UNSUBSCRIBED) {
|
|
18
|
-
return _jsx(SubscribeErrorAlert, { error: error });
|
|
19
|
-
}
|
|
20
|
-
return _jsx(Alert, { severity: "error", children: String(error === null || error === void 0 ? void 0 : error.message) });
|
|
21
|
-
}
|
|
22
|
-
function MissingSecretErrorView() {
|
|
23
|
-
const { t } = useLocaleContext();
|
|
24
|
-
const { agent } = useRuntimeState();
|
|
25
|
-
const isAdmin = useIsAgentAdmin(agent);
|
|
26
|
-
const allSecretsHasValue = agent.config.secrets.every((i) => i.hasValue);
|
|
27
|
-
return (_jsx(Alert, { severity: allSecretsHasValue ? 'info' : 'error', sx: { [`.${alertClasses.message}`]: { flex: 1 } }, children: _jsxs(Stack, { width: "100%", children: [allSecretsHasValue
|
|
28
|
-
? 'Configuration successful, you can continue to use it now!'
|
|
29
|
-
: 'The required configuration is missing. Please complete the setup before proceeding!', isAdmin && (_jsx(Stack, { alignItems: "flex-end", children: _jsx(Button, { size: "small", variant: "outlined", onClick: () => settingsDialogState.getState().open(), children: t('setup') }) }))] }) }));
|
|
30
|
-
}
|
|
@@ -1,19 +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 { FormControl, FormControlLabel, FormHelperText, Switch } from '@mui/material';
|
|
14
|
-
import { forwardRef } from 'react';
|
|
15
|
-
const BooleanField = forwardRef((_a, ref) => {
|
|
16
|
-
var { readOnly, parameter, onChange } = _a, props = __rest(_a, ["readOnly", "parameter", "onChange"]);
|
|
17
|
-
return (_jsxs(FormControl, { sx: { alignItems: 'flex-start' }, children: [_jsx(FormControlLabel, { ref: ref, required: parameter === null || parameter === void 0 ? void 0 : parameter.required, label: props.label || (parameter === null || parameter === void 0 ? void 0 : parameter.label), labelPlacement: "start", control: _jsx(Switch, { readOnly: readOnly, checked: !!props.value, onChange: (_, checked) => onChange(checked) }) }), (parameter === null || parameter === void 0 ? void 0 : parameter.helper) && _jsx(FormHelperText, { children: parameter === null || parameter === void 0 ? void 0 : parameter.helper })] }));
|
|
18
|
-
});
|
|
19
|
-
export default BooleanField;
|
|
@@ -1,19 +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 { TextField } from '@mui/material';
|
|
14
|
-
import { forwardRef } from 'react';
|
|
15
|
-
const NumberField = forwardRef((_a, ref) => {
|
|
16
|
-
var { readOnly, parameter } = _a, props = __rest(_a, ["readOnly", "parameter"]);
|
|
17
|
-
return (_jsx(TextField, Object.assign({ ref: ref }, props, { InputProps: Object.assign(Object.assign({}, props.InputProps), { readOnly, inputProps: Object.assign({ type: 'number', inputMode: 'numeric', pattern: '[0-9]*', min: parameter === null || parameter === void 0 ? void 0 : parameter.min, max: parameter === null || parameter === void 0 ? void 0 : parameter.max }, props.inputProps) }), onChange: (e) => { var _a; return (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, Number(e.target.value)); } })));
|
|
18
|
-
});
|
|
19
|
-
export default NumberField;
|
|
@@ -1,37 +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 { FormControlLabel, Radio, RadioGroup, alpha } from '@mui/material';
|
|
14
|
-
import { forwardRef } from 'react';
|
|
15
|
-
const RadioField = forwardRef((_a, ref) => {
|
|
16
|
-
var _b;
|
|
17
|
-
var { readOnly, parameter, onChange } = _a, props = __rest(_a, ["readOnly", "parameter", "onChange"]);
|
|
18
|
-
return (_jsx(RadioGroup, Object.assign({ ref: ref, row: true, onChange: (e) => onChange(e.target.value) }, props, { children: (_b = parameter === null || parameter === void 0 ? void 0 : parameter.options) === null || _b === void 0 ? void 0 : _b.map((option) => {
|
|
19
|
-
const checked = option.value === props.value;
|
|
20
|
-
return (_jsx(FormControlLabel, { label: option.label, disabled: readOnly, value: option.value, checked: checked, control: _jsx(Radio, {}), sx: {
|
|
21
|
-
transition: 'all 0.3s linear',
|
|
22
|
-
ml: 0,
|
|
23
|
-
mr: 1,
|
|
24
|
-
my: 0.5,
|
|
25
|
-
py: 0.5,
|
|
26
|
-
px: 2.5,
|
|
27
|
-
border: 2,
|
|
28
|
-
borderColor: (theme) => (checked ? theme.palette.primary.main : alpha(theme.palette.primary.main, 0.3)),
|
|
29
|
-
borderRadius: 8,
|
|
30
|
-
'.MuiRadio-root': {
|
|
31
|
-
// hidden radio button
|
|
32
|
-
display: 'none',
|
|
33
|
-
},
|
|
34
|
-
} }, option.id));
|
|
35
|
-
}) })));
|
|
36
|
-
});
|
|
37
|
-
export default RadioField;
|
|
@@ -1,22 +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 { MenuItem, TextField } from '@mui/material';
|
|
14
|
-
import { forwardRef } from 'react';
|
|
15
|
-
const SelectField = forwardRef((_a, ref) => {
|
|
16
|
-
var _b, _c, _d, _e;
|
|
17
|
-
var { readOnly, parameter, onChange } = _a, props = __rest(_a, ["readOnly", "parameter", "onChange"]);
|
|
18
|
-
return (_jsx(TextField, Object.assign({ ref: ref, select: true, onChange: (e) => onChange(e.target.value) }, props, { InputProps: Object.assign(Object.assign({}, props.InputProps), { readOnly }), SelectProps: Object.assign(Object.assign({}, props.SelectProps), { MenuProps: Object.assign(Object.assign({ disableScrollLock: true }, (_b = props.SelectProps) === null || _b === void 0 ? void 0 : _b.MenuProps), { sx: Object.assign(Object.assign({}, (_d = (_c = props.SelectProps) === null || _c === void 0 ? void 0 : _c.MenuProps) === null || _d === void 0 ? void 0 : _d.sx), { '.MuiMenuItem-root': {
|
|
19
|
-
whiteSpace: 'pre-wrap',
|
|
20
|
-
} }) }) }), children: (_e = parameter === null || parameter === void 0 ? void 0 : parameter.options) === null || _e === void 0 ? void 0 : _e.map((option) => (_jsx(MenuItem, { value: option.value, children: option.label }, option.id))) })));
|
|
21
|
-
});
|
|
22
|
-
export default SelectField;
|
|
@@ -1,33 +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 { TextField, inputBaseClasses } from '@mui/material';
|
|
14
|
-
import { forwardRef, useCallback } from 'react';
|
|
15
|
-
const StringField = forwardRef((_a, ref) => {
|
|
16
|
-
var _b;
|
|
17
|
-
var { readOnly, parameter, onChange } = _a, props = __rest(_a, ["readOnly", "parameter", "onChange"]);
|
|
18
|
-
const isQuestion = (parameter === null || parameter === void 0 ? void 0 : parameter.key) === 'question';
|
|
19
|
-
const onKeyDown = useCallback((e) => {
|
|
20
|
-
var _a;
|
|
21
|
-
if (!isQuestion)
|
|
22
|
-
return;
|
|
23
|
-
// NOTE: Pressing Enter in the IME will trigger the 229 event
|
|
24
|
-
if (e.keyCode === 229)
|
|
25
|
-
return;
|
|
26
|
-
if (e.key === 'Enter' && !e.shiftKey && !e.repeat) {
|
|
27
|
-
e.preventDefault();
|
|
28
|
-
(_a = e.target.form) === null || _a === void 0 ? void 0 : _a.requestSubmit();
|
|
29
|
-
}
|
|
30
|
-
}, [isQuestion]);
|
|
31
|
-
return (_jsx(TextField, Object.assign({ ref: ref, multiline: isQuestion || (parameter === null || parameter === void 0 ? void 0 : parameter.multiline) || isQuestion, minRows: isQuestion ? 1 : (parameter === null || parameter === void 0 ? void 0 : parameter.multiline) ? 2 : undefined, onChange: (e) => onChange(e.target.value), onKeyDown: onKeyDown }, props, { InputProps: Object.assign(Object.assign({ readOnly }, props.InputProps), { sx: Object.assign({ py: 0, [`.${inputBaseClasses.input}`]: { py: 1 } }, (_b = props.InputProps) === null || _b === void 0 ? void 0 : _b.sx), inputProps: Object.assign(Object.assign({}, props.inputProps), { maxLength: parameter === null || parameter === void 0 ? void 0 : parameter.maxLength }) }) })));
|
|
32
|
-
});
|
|
33
|
-
export default StringField;
|