@blocklet/pages-kit 0.2.285 → 0.2.287
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/builtin/async/ai-runtime/api/assistant.js +26 -0
- package/lib/cjs/builtin/async/ai-runtime/api/dataset.js +127 -0
- package/lib/cjs/builtin/async/ai-runtime/api/message.js +33 -0
- package/lib/cjs/builtin/async/ai-runtime/api/request.js +47 -0
- package/lib/cjs/builtin/async/ai-runtime/api/session.js +121 -0
- package/lib/cjs/builtin/async/ai-runtime/api/subscription.js +32 -0
- package/lib/cjs/builtin/async/ai-runtime/components/ActionButton.js +63 -0
- package/lib/cjs/builtin/async/ai-runtime/components/GlobalLoading.js +60 -0
- package/lib/cjs/builtin/async/ai-runtime/components/LoadingButton.js +40 -0
- package/lib/cjs/builtin/async/ai-runtime/components/LoadingListItemButton.js +51 -0
- package/lib/cjs/builtin/async/ai-runtime/components/MarkdownRenderer.js +156 -0
- package/lib/cjs/builtin/async/ai-runtime/components/MenuButton.js +43 -0
- package/lib/cjs/builtin/async/ai-runtime/components/PoweredBy.js +30 -0
- package/lib/cjs/builtin/async/ai-runtime/components/RuntimeProvider.js +16 -0
- package/lib/cjs/builtin/async/ai-runtime/components/ScrollView.js +109 -0
- package/lib/cjs/builtin/async/ai-runtime/components/SocialShare.js +102 -0
- package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +193 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +92 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionListView.js +197 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionView.js +122 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentListView.js +152 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentView.js +135 -0
- package/lib/cjs/builtin/async/ai-runtime/components/common/ChatBot.js +105 -0
- package/lib/cjs/builtin/async/ai-runtime/components/common/MessageMetadataRenderer.js +21 -0
- package/lib/cjs/builtin/async/ai-runtime/components/common/MessageSuggestedQuestions.js +35 -0
- package/lib/cjs/builtin/async/ai-runtime/components/common/index.js +12 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterForm.js +48 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +66 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormFields.js +43 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/QuestionField.js +44 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/SettingButton.js +76 -0
- package/lib/cjs/builtin/async/ai-runtime/components/layout/index.js +15 -0
- package/lib/cjs/builtin/async/ai-runtime/components/lottie/index.js +34 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageActions.js +38 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageErrorView.js +30 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageItemView.js +134 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageListView.js +48 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/ReferenceLinks.js +11 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/LanguageField.js +55 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/NumberField.js +21 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/SelectField.js +24 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/StringField.js +21 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/index.js +37 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +94 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +48 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHome.js +21 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +67 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/index.js +15 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +103 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.js +22 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +72 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.js +31 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/index.js +22 -0
- package/lib/cjs/builtin/async/ai-runtime/components/session/CheckSession.js +62 -0
- package/lib/cjs/builtin/async/ai-runtime/components/session/SessionListView.js +88 -0
- package/lib/cjs/builtin/async/ai-runtime/constants.js +5 -0
- package/lib/cjs/builtin/async/ai-runtime/hooks/header.js +32 -0
- package/lib/cjs/builtin/async/ai-runtime/hooks/navigate.js +37 -0
- package/lib/cjs/builtin/async/ai-runtime/hooks/subscribe.js +35 -0
- package/lib/cjs/builtin/async/ai-runtime/index.js +75 -0
- package/lib/cjs/builtin/async/ai-runtime/locales/index.js +147 -0
- package/lib/cjs/builtin/async/ai-runtime/state/assistant.js +59 -0
- package/lib/cjs/builtin/async/ai-runtime/state/index.js +423 -0
- package/lib/cjs/builtin/async/ai-runtime/state/session.js +217 -0
- package/lib/cjs/builtin/async/ai-runtime/state/subscription.js +52 -0
- package/lib/cjs/builtin/async/ai-runtime/utils.js +49 -0
- package/lib/cjs/builtin/async/react-scroll-to-bottom.js +1 -1
- package/lib/cjs/utils/builtin.js +1 -0
- package/lib/cjs/utils/inject-global-components.js +2 -0
- package/lib/esm/builtin/async/ai-runtime/api/assistant.js +22 -0
- package/lib/esm/builtin/async/ai-runtime/api/dataset.js +113 -0
- package/lib/esm/builtin/async/ai-runtime/api/message.js +28 -0
- package/lib/esm/builtin/async/ai-runtime/api/request.js +43 -0
- package/lib/esm/builtin/async/ai-runtime/api/session.js +112 -0
- package/lib/esm/builtin/async/ai-runtime/api/subscription.js +27 -0
- package/lib/esm/builtin/async/ai-runtime/components/ActionButton.js +56 -0
- package/lib/esm/builtin/async/ai-runtime/components/GlobalLoading.js +56 -0
- package/lib/esm/builtin/async/ai-runtime/components/LoadingButton.js +38 -0
- package/lib/esm/builtin/async/ai-runtime/components/LoadingListItemButton.js +48 -0
- package/lib/esm/builtin/async/ai-runtime/components/MarkdownRenderer.js +129 -0
- package/lib/esm/builtin/async/ai-runtime/components/MenuButton.js +40 -0
- package/lib/esm/builtin/async/ai-runtime/components/PoweredBy.js +27 -0
- package/lib/esm/builtin/async/ai-runtime/components/RuntimeProvider.js +10 -0
- package/lib/esm/builtin/async/ai-runtime/components/ScrollView.js +101 -0
- package/lib/esm/builtin/async/ai-runtime/components/SocialShare.js +93 -0
- package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +190 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +92 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionListView.js +197 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionView.js +122 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentListView.js +152 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentView.js +135 -0
- package/lib/esm/builtin/async/ai-runtime/components/common/ChatBot.js +99 -0
- package/lib/esm/builtin/async/ai-runtime/components/common/MessageMetadataRenderer.js +15 -0
- package/lib/esm/builtin/async/ai-runtime/components/common/MessageSuggestedQuestions.js +30 -0
- package/lib/esm/builtin/async/ai-runtime/components/common/index.js +3 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterForm.js +42 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +59 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormFields.js +37 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/QuestionField.js +38 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/SettingButton.js +73 -0
- package/lib/esm/builtin/async/ai-runtime/components/layout/index.js +12 -0
- package/lib/esm/builtin/async/ai-runtime/components/lottie/index.js +8 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageActions.js +35 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageErrorView.js +24 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageItemView.js +105 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageListView.js +42 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/ReferenceLinks.js +8 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/LanguageField.js +53 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/NumberField.js +19 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/SelectField.js +22 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/StringField.js +19 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/index.js +31 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +88 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +22 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHome.js +15 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +61 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/index.js +9 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +97 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.js +19 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +66 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.js +25 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/index.js +16 -0
- package/lib/esm/builtin/async/ai-runtime/components/session/CheckSession.js +59 -0
- package/lib/esm/builtin/async/ai-runtime/components/session/SessionListView.js +88 -0
- package/lib/esm/builtin/async/ai-runtime/constants.js +2 -0
- package/lib/esm/builtin/async/ai-runtime/hooks/header.js +25 -0
- package/lib/esm/builtin/async/ai-runtime/hooks/navigate.js +31 -0
- package/lib/esm/builtin/async/ai-runtime/hooks/subscribe.js +31 -0
- package/lib/esm/builtin/async/ai-runtime/index.js +66 -0
- package/lib/esm/builtin/async/ai-runtime/locales/index.js +144 -0
- package/lib/esm/builtin/async/ai-runtime/state/assistant.js +54 -0
- package/lib/esm/builtin/async/ai-runtime/state/index.js +423 -0
- package/lib/esm/builtin/async/ai-runtime/state/session.js +209 -0
- package/lib/esm/builtin/async/ai-runtime/state/subscription.js +47 -0
- package/lib/esm/builtin/async/ai-runtime/utils.js +42 -0
- package/lib/esm/builtin/async/react-scroll-to-bottom.js +1 -1
- package/lib/esm/utils/builtin.js +1 -0
- package/lib/esm/utils/inject-global-components.js +2 -0
- package/lib/types/builtin/async/ai-runtime/api/assistant.d.ts +18 -0
- package/lib/types/builtin/async/ai-runtime/api/dataset.d.ts +39 -0
- package/lib/types/builtin/async/ai-runtime/api/message.d.ts +39 -0
- package/lib/types/builtin/async/ai-runtime/api/request.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/api/session.d.ts +54 -0
- package/lib/types/builtin/async/ai-runtime/api/subscription.d.ts +15 -0
- package/lib/types/builtin/async/ai-runtime/components/ActionButton.d.ts +11 -0
- package/lib/types/builtin/async/ai-runtime/components/GlobalLoading.d.ts +33 -0
- package/lib/types/builtin/async/ai-runtime/components/LoadingButton.d.ts +3 -0
- package/lib/types/builtin/async/ai-runtime/components/LoadingListItemButton.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/components/MarkdownRenderer.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/components/MenuButton.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/PoweredBy.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/RuntimeProvider.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/ScrollView.d.ts +61 -0
- package/lib/types/builtin/async/ai-runtime/components/SocialShare.d.ts +17 -0
- package/lib/types/builtin/async/ai-runtime/components/ThemeProvider.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/CollectionEditDialog.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/CollectionListView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/CollectionView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/DocumentListView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/DocumentView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/common/ChatBot.d.ts +13 -0
- package/lib/types/builtin/async/ai-runtime/components/common/MessageMetadataRenderer.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/common/MessageSuggestedQuestions.d.ts +7 -0
- package/lib/types/builtin/async/ai-runtime/components/common/index.d.ts +3 -0
- package/lib/types/builtin/async/ai-runtime/components/form/ParameterForm.d.ts +12 -0
- package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormDialog.d.ts +28 -0
- package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormFields.d.ts +8 -0
- package/lib/types/builtin/async/ai-runtime/components/form/QuestionField.d.ts +13 -0
- package/lib/types/builtin/async/ai-runtime/components/form/SettingButton.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/layout/index.d.ts +7 -0
- package/lib/types/builtin/async/ai-runtime/components/lottie/index.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/message/MessageActions.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/message/MessageErrorView.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/components/message/MessageItemView.d.ts +10 -0
- package/lib/types/builtin/async/ai-runtime/components/message/MessageListView.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/message/ReferenceLinks.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/LanguageField.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/NumberField.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/SelectField.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/StringField.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/index.d.ts +7 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/InitialForm.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHome.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/index.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/index.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/session/CheckSession.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/session/SessionListView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/constants.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/hooks/header.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/hooks/navigate.d.ts +25 -0
- package/lib/types/builtin/async/ai-runtime/hooks/subscribe.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/index.d.ts +17 -0
- package/lib/types/builtin/async/ai-runtime/locales/index.d.ts +126 -0
- package/lib/types/builtin/async/ai-runtime/state/assistant.d.ts +17 -0
- package/lib/types/builtin/async/ai-runtime/state/index.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/state/session.d.ts +40 -0
- package/lib/types/builtin/async/ai-runtime/state/subscription.d.ts +15 -0
- package/lib/types/builtin/async/ai-runtime/utils.d.ts +20 -0
- package/lib/types/builtin/async/react-scroll-to-bottom.d.ts +3 -2
- package/lib/types/builtin/session.d.ts +11 -1
- package/lib/types/utils/builtin.d.ts +1 -0
- package/package.json +13 -8
- package/tsconfig.json +5 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
27
|
+
const react_1 = require("react");
|
|
28
|
+
function Lottie({ src }) {
|
|
29
|
+
(0, react_1.useEffect)(() => {
|
|
30
|
+
Promise.resolve().then(() => __importStar(require('@lottiefiles/lottie-player')));
|
|
31
|
+
}, []);
|
|
32
|
+
return (0, jsx_runtime_1.jsx)("lottie-player", { autoplay: true, loop: true, mode: "normal", src: src }, src);
|
|
33
|
+
}
|
|
34
|
+
exports.default = Lottie;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
+
const material_1 = require("@mui/material");
|
|
16
|
+
const locale_1 = require("../../../../locale");
|
|
17
|
+
const ActionButton_1 = require("../ActionButton");
|
|
18
|
+
function MessageActions(_a) {
|
|
19
|
+
var { content } = _a, props = __rest(_a, ["content"]);
|
|
20
|
+
const { t } = (0, locale_1.useLocaleContext)();
|
|
21
|
+
const commonActionButtonsSx = {
|
|
22
|
+
border: '0px !important',
|
|
23
|
+
minWidth: '32px',
|
|
24
|
+
color: 'rgba(75, 85, 99, 1)',
|
|
25
|
+
'.MuiButton-startIcon': {
|
|
26
|
+
marginRight: '0px !important',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ direction: "row", gap: 1 }, props, { children: (0, jsx_runtime_1.jsx)(ActionButton_1.ActionButton, { autoReset: true, size: "small", variant: "outlined",
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
color: "black", tip: t('copyToClipboard'),
|
|
32
|
+
// title={t('copy')}
|
|
33
|
+
// titleSucceed={t('copied')}
|
|
34
|
+
icon: "tabler:copy", iconSucceed: "tabler:copy-check-filled", sx: Object.assign({}, commonActionButtonsSx), onClick: () => {
|
|
35
|
+
window.navigator.clipboard.writeText(content);
|
|
36
|
+
} }) })));
|
|
37
|
+
}
|
|
38
|
+
exports.default = MessageActions;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
|
+
const locale_1 = require("../../../../locale");
|
|
9
|
+
const subscribe_1 = require("../../hooks/subscribe");
|
|
10
|
+
const MarkdownRenderer_1 = __importDefault(require("../MarkdownRenderer"));
|
|
11
|
+
function MessageErrorView({ assistantId, assistant, error, }) {
|
|
12
|
+
var _a, _b, _c;
|
|
13
|
+
const { t } = (0, locale_1.useLocaleContext)();
|
|
14
|
+
const { subscribeLink } = (0, subscribe_1.useSubscribeLink)({ assistantId });
|
|
15
|
+
if (error.type === 'InvalidSubscriptionError') {
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { className: "ai-chat-message-error", children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
17
|
+
bgcolor: 'grey.100',
|
|
18
|
+
p: 1.5,
|
|
19
|
+
borderRadius: 1,
|
|
20
|
+
}, children: (0, jsx_runtime_1.jsx)(MarkdownRenderer_1.default, { children: t('requireNewSubscription', {
|
|
21
|
+
price: (_b = (_a = assistant.release) === null || _a === void 0 ? void 0 : _a.payment) === null || _b === void 0 ? void 0 : _b.price,
|
|
22
|
+
}) }) }), (0, jsx_runtime_1.jsx)(material_1.Box, { mt: 1, children: subscribeLink ? ((0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", href: subscribeLink, children: t('subscribeNow') })) : ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
23
|
+
bgcolor: 'grey.100',
|
|
24
|
+
p: 1.5,
|
|
25
|
+
borderRadius: 1,
|
|
26
|
+
}, children: t('thanksForSubscription') })) })] }));
|
|
27
|
+
}
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Alert, { className: "ai-chat-message-error", severity: "error", children: (error.type === 'ReachMaxRoundLimitError' && ((_c = assistant === null || assistant === void 0 ? void 0 : assistant.release) === null || _c === void 0 ? void 0 : _c.reachMaxRoundLimitTip)) || error.message }));
|
|
29
|
+
}
|
|
30
|
+
exports.default = MessageErrorView;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
30
|
+
const image_preview_1 = __importDefault(require("@blocklet/ai-kit/components/image-preview"));
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
|
+
const material_1 = require("@mui/material");
|
|
33
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
34
|
+
const react_1 = __importStar(require("react"));
|
|
35
|
+
const ux_1 = require("../../../../arcblock/ux");
|
|
36
|
+
const locale_1 = require("../../../../locale");
|
|
37
|
+
const session_1 = require("../../../../session");
|
|
38
|
+
const common_1 = require("../common");
|
|
39
|
+
const MarkdownRenderer_1 = __importDefault(require("../MarkdownRenderer"));
|
|
40
|
+
const MessageActions_1 = __importDefault(require("./MessageActions"));
|
|
41
|
+
const MessageErrorView_1 = __importDefault(require("./MessageErrorView"));
|
|
42
|
+
// if today, show time only, else show date and time
|
|
43
|
+
const formatTodayTime = (time) => {
|
|
44
|
+
const today = (0, dayjs_1.default)().format('YYYY-MM-DD');
|
|
45
|
+
const date = (0, dayjs_1.default)(time).format('YYYY-MM-DD');
|
|
46
|
+
return today === date ? (0, dayjs_1.default)(time).format('HH:mm') : (0, dayjs_1.default)(time).format('YYYY-MM-DD HH:mm');
|
|
47
|
+
};
|
|
48
|
+
function MessageItemView({ assistantId, assistant, message, previousMessageTime, messageTimeType = 'user', hideAvatar, }) {
|
|
49
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
50
|
+
const { session: authSession } = (0, session_1.useSessionContext)();
|
|
51
|
+
const { locale } = (0, locale_1.useLocaleContext)();
|
|
52
|
+
const hasResult = !!(((_a = message.result) === null || _a === void 0 ? void 0 : _a.content) ||
|
|
53
|
+
((_c = (_b = message.result) === null || _b === void 0 ? void 0 : _b.images) === null || _c === void 0 ? void 0 : _c.length) ||
|
|
54
|
+
((_e = (_d = message.result) === null || _d === void 0 ? void 0 : _d.messages) === null || _e === void 0 ? void 0 : _e.length) ||
|
|
55
|
+
((_g = (_f = message.result) === null || _f === void 0 ? void 0 : _f.objects) === null || _g === void 0 ? void 0 : _g.length));
|
|
56
|
+
const showPreviousTime = (0, react_1.useMemo)(() => {
|
|
57
|
+
if (messageTimeType !== 'previous')
|
|
58
|
+
return false;
|
|
59
|
+
if (!previousMessageTime)
|
|
60
|
+
return true;
|
|
61
|
+
const p = (0, dayjs_1.default)(previousMessageTime);
|
|
62
|
+
const c = (0, dayjs_1.default)(message.createdAt);
|
|
63
|
+
return c.valueOf() - p.valueOf() >= 300e3; // 和上一条消息时间间隔不超过 5 分钟,则不显示时间
|
|
64
|
+
}, [previousMessageTime, messageTimeType]);
|
|
65
|
+
const extraUserInfo = [
|
|
66
|
+
messageTimeType === 'user' && (message === null || message === void 0 ? void 0 : message.createdAt) && ((0, jsx_runtime_1.jsx)(material_1.Typography, { sx: {
|
|
67
|
+
fontSize: 12,
|
|
68
|
+
lineHeight: '24px',
|
|
69
|
+
color: 'text.secondary',
|
|
70
|
+
}, children: formatTodayTime(message.createdAt) }, "user-time")),
|
|
71
|
+
].filter(Boolean);
|
|
72
|
+
const commonMessageSx = {
|
|
73
|
+
position: 'relative',
|
|
74
|
+
borderRadius: 1,
|
|
75
|
+
py: 1,
|
|
76
|
+
px: 2,
|
|
77
|
+
mt: 0.5,
|
|
78
|
+
// without logo width
|
|
79
|
+
maxWidth: 'calc(100% - 40px)',
|
|
80
|
+
'.message-actions': {
|
|
81
|
+
position: 'absolute',
|
|
82
|
+
top: 0,
|
|
83
|
+
right: -40,
|
|
84
|
+
background: 'white',
|
|
85
|
+
border: 1,
|
|
86
|
+
borderRadius: 1,
|
|
87
|
+
borderColor: 'grey.300',
|
|
88
|
+
opacity: 0,
|
|
89
|
+
transition: 'opacity 0.2s',
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
const isMessageLoading = (message.loading || !message.result) && !message.error;
|
|
93
|
+
const showUserMessage = ((_h = assistant.release) === null || _h === void 0 ? void 0 : _h.template) !== 'form' && !!((_j = message.parameters) === null || _j === void 0 ? void 0 : _j.question);
|
|
94
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { className: "ai-chat-message-item", gap: 2.5, overflow: "hidden", sx: {
|
|
95
|
+
'.message-question': Object.assign(Object.assign({}, commonMessageSx), { borderTopRightRadius: '2px', backgroundColor: 'rgba(239, 246, 255, 1)' }),
|
|
96
|
+
'.message-response': Object.assign(Object.assign({}, commonMessageSx), { borderTopLeftRadius: '2px', backgroundColor: 'rgba(229, 231, 235, 1)' }),
|
|
97
|
+
'.ai-chat-message-ai:hover': {
|
|
98
|
+
'.message-actions': {
|
|
99
|
+
opacity: 1,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
}, children: [showPreviousTime && message.createdAt && ((0, jsx_runtime_1.jsx)(material_1.Box, { className: "ai-chat-message-time", sx: { textAlign: 'center', fontSize: 13, color: 'text.secondary', mb: -1.5 }, children: (0, jsx_runtime_1.jsx)(ux_1.RelativeTime, { locale: locale, value: message.createdAt, relativeRange: 600e3 }) })), showUserMessage && ((0, jsx_runtime_1.jsxs)(material_1.Stack, { className: "ai-chat-message-user", direction: "row", gap: 1.5, sx: {
|
|
103
|
+
display: 'flex',
|
|
104
|
+
flexDirection: 'row-reverse',
|
|
105
|
+
textAlign: 'right',
|
|
106
|
+
justifyContent: 'flex-end',
|
|
107
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(ux_1.Avatar, { size: 40, src: (_k = authSession.user) === null || _k === void 0 ? void 0 : _k.avatar, did: (_l = authSession.user) === null || _l === void 0 ? void 0 : _l.did, variant: "circle", shape: "circle" }) }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { flex: 1, overflow: "hidden", sx: {
|
|
108
|
+
display: 'flex',
|
|
109
|
+
flexDirection: 'column',
|
|
110
|
+
alignItems: 'flex-end',
|
|
111
|
+
}, children: [(0, jsx_runtime_1.jsxs)(MessageUserName, { children: [(_m = authSession.user) === null || _m === void 0 ? void 0 : _m.fullName, extraUserInfo] }), (0, jsx_runtime_1.jsx)(material_1.Box, { className: "message-question", sx: { whiteSpace: 'pre-wrap', wordBreak: 'break-word', textAlign: 'left' }, children: (_o = message.parameters) === null || _o === void 0 ? void 0 : _o.question })] })] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, { className: "ai-chat-message-ai", direction: "row", gap: 1.5, children: [!hideAvatar && ((0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(ux_1.Avatar, { size: 40, did: (_p = globalThis.blocklet) === null || _p === void 0 ? void 0 : _p.appId, variant: "circle", shape: "circle", src: (_q = assistant.release) === null || _q === void 0 ? void 0 : _q.logo }) })), (0, jsx_runtime_1.jsxs)(material_1.Box, { flex: 1, overflow: "hidden", children: [!hideAvatar && ((0, jsx_runtime_1.jsxs)(MessageUserName, { children: [((_r = assistant.release) === null || _r === void 0 ? void 0 : _r.title) || assistant.name, extraUserInfo] })), (0, jsx_runtime_1.jsxs)(react_1.default.Suspense, { children: [hasResult ? ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: 1, className: "message-response", children: [(_t = (_s = message.result) === null || _s === void 0 ? void 0 : _s.messages) === null || _t === void 0 ? void 0 : _t.map((childMsg, index) => {
|
|
112
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
113
|
+
return ((_a = childMsg.result) === null || _a === void 0 ? void 0 : _a.content) ? ((0, jsx_runtime_1.jsx)(MarkdownRenderer_1.default, { className: isMessageLoading &&
|
|
114
|
+
!((_b = message.result) === null || _b === void 0 ? void 0 : _b.content) &&
|
|
115
|
+
!((_d = (_c = message.result) === null || _c === void 0 ? void 0 : _c.images) === null || _d === void 0 ? void 0 : _d.length) &&
|
|
116
|
+
message.result.messages.length - 1 === index
|
|
117
|
+
? 'writing'
|
|
118
|
+
: '', sx: childMsg.respondAs === 'systemMessage' ? { color: 'text.secondary' } : {}, children: (_e = childMsg.result) === null || _e === void 0 ? void 0 : _e.content }, childMsg.taskId)) : ((_g = (_f = childMsg.result) === null || _f === void 0 ? void 0 : _f.images) === null || _g === void 0 ? void 0 : _g.length) ? ((0, jsx_runtime_1.jsx)(image_preview_1.default, { itemWidth: 100, spacing: 1, dataSource: childMsg.result.images.map((i) => ({ src: i.url })) }, childMsg.taskId)) : null;
|
|
119
|
+
}), ((_u = message.result) === null || _u === void 0 ? void 0 : _u.content) && ((0, jsx_runtime_1.jsx)(MarkdownRenderer_1.default, { className: isMessageLoading ? 'writing' : '', children: message.result.content })), !!((_w = (_v = message.result) === null || _v === void 0 ? void 0 : _v.images) === null || _w === void 0 ? void 0 : _w.length) && ((0, jsx_runtime_1.jsx)(image_preview_1.default, { itemWidth: 100, spacing: 1, dataSource: message.result.images.map((i) => ({ src: i.url })) })), !isMessageLoading && ((_x = message.result) === null || _x === void 0 ? void 0 : _x.content) && ((0, jsx_runtime_1.jsx)(MessageActions_1.default, { className: "message-actions", content: message.result.content }))] })) : (isMessageLoading && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", height: 24 + 8 + 8,
|
|
120
|
+
// only response with loading
|
|
121
|
+
className: "message-response" }))), !!((_z = (_y = message.result) === null || _y === void 0 ? void 0 : _y.objects) === null || _z === void 0 ? void 0 : _z.length) &&
|
|
122
|
+
((_1 = (_0 = message.result) === null || _0 === void 0 ? void 0 : _0.objects) === null || _1 === void 0 ? void 0 : _1.map((object) => ((0, jsx_runtime_1.jsx)(common_1.MessageMetadataRenderer, { object: object.data }, object.taskId)))), message.error && ((0, jsx_runtime_1.jsx)(MessageErrorView_1.default, { assistantId: assistantId, assistant: assistant, error: message.error }))] })] })] })] }));
|
|
123
|
+
}
|
|
124
|
+
exports.default = MessageItemView;
|
|
125
|
+
function MessageUserName({ children }) {
|
|
126
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Typography, { component: "div", noWrap: true, sx: {
|
|
127
|
+
fontSize: 14,
|
|
128
|
+
lineHeight: '24px',
|
|
129
|
+
fontWeight: 500,
|
|
130
|
+
display: 'flex',
|
|
131
|
+
alignItems: 'center',
|
|
132
|
+
gap: 1,
|
|
133
|
+
}, children: children }));
|
|
134
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
+
const material_1 = require("@mui/material");
|
|
19
|
+
const react_1 = require("react");
|
|
20
|
+
const assistant_1 = require("../../state/assistant");
|
|
21
|
+
const session_1 = require("../../state/session");
|
|
22
|
+
const MessageItemView_1 = __importDefault(require("./MessageItemView"));
|
|
23
|
+
function MessageListView(_a) {
|
|
24
|
+
var { assistantId, sessionId } = _a, props = __rest(_a, ["assistantId", "sessionId"]);
|
|
25
|
+
const [assistant] = (0, assistant_1.useAssistantState)({ assistantId });
|
|
26
|
+
const [session, { messages = [] }] = (0, session_1.useSessionState)({ sessionId, required: true });
|
|
27
|
+
const opener = (0, react_1.useMemo)(() => {
|
|
28
|
+
var _a;
|
|
29
|
+
const { openerMessage } = (_a = assistant.release) !== null && _a !== void 0 ? _a : {};
|
|
30
|
+
if (openerMessage) {
|
|
31
|
+
return {
|
|
32
|
+
taskId: '',
|
|
33
|
+
sessionId: session.id,
|
|
34
|
+
createdAt: session.createdAt,
|
|
35
|
+
updatedAt: session.createdAt,
|
|
36
|
+
result: { content: openerMessage },
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
}, [assistant.release]);
|
|
41
|
+
if (!session)
|
|
42
|
+
return null;
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ gap: 2.5 }, props, { children: [opener && (0, jsx_runtime_1.jsx)(MessageItemView_1.default, { assistantId: assistantId, assistant: assistant, message: opener }), messages.map((message, index) => {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(MessageItemView_1.default, { assistantId: assistantId, assistant: assistant, message: message, previousMessageTime: (_b = (_a = messages[index - 1]) === null || _a === void 0 ? void 0 : _a.createdAt) !== null && _b !== void 0 ? _b : session.createdAt }, message.taskId));
|
|
46
|
+
})] })));
|
|
47
|
+
}
|
|
48
|
+
exports.default = MessageListView;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
|
+
function ReferenceLinks({ links }) {
|
|
6
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { sx: { wordBreak: 'break-word' }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "subtitle2", children: "References:" }), links === null || links === void 0 ? void 0 : links.map((item, index) => (0, jsx_runtime_1.jsx)(ReferenceLinkItemView, { link: item }, index))] }));
|
|
7
|
+
}
|
|
8
|
+
exports.default = ReferenceLinks;
|
|
9
|
+
function ReferenceLinkItemView({ link, }) {
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Stack, { children: (0, jsx_runtime_1.jsx)(material_1.Link, { href: link.url, children: link.title || link.url }) }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
+
const material_1 = require("@mui/material");
|
|
16
|
+
const react_1 = require("react");
|
|
17
|
+
const locale_1 = require("../../../../locale");
|
|
18
|
+
const LanguageField = (0, react_1.forwardRef)((_a, ref) => {
|
|
19
|
+
var { readOnly, parameter, onChange } = _a, props = __rest(_a, ["readOnly", "parameter", "onChange"]);
|
|
20
|
+
const { locale } = (0, locale_1.useLocaleContext)();
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({ ref: ref, select: true, onChange: (e) => onChange(e.target.value) }, props, { InputProps: Object.assign(Object.assign({}, props.InputProps), { readOnly }), children: languages.map((option) => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: option.en, children: locale === 'zh' ? option.cn : option.en }, option.en))) })));
|
|
22
|
+
});
|
|
23
|
+
exports.default = LanguageField;
|
|
24
|
+
const languages = [
|
|
25
|
+
{ en: 'English', cn: '英语' },
|
|
26
|
+
{ en: 'Simplified Chinese', cn: '中文-简体' },
|
|
27
|
+
{ en: 'Traditional Chinese', cn: '中文-繁体' },
|
|
28
|
+
{ en: 'Spanish', cn: '西班牙语' },
|
|
29
|
+
{ en: 'French', cn: '法语' },
|
|
30
|
+
{ en: 'German', cn: '德语' },
|
|
31
|
+
{ en: 'Italian', cn: '意大利语' },
|
|
32
|
+
{ en: 'Portuguese', cn: '葡萄牙语' },
|
|
33
|
+
{ en: 'Japanese', cn: '日语' },
|
|
34
|
+
{ en: 'Korean', cn: '韩语' },
|
|
35
|
+
{ en: 'Russian', cn: '俄语' },
|
|
36
|
+
{ en: 'Polish', cn: '波兰语' },
|
|
37
|
+
{ en: 'Arabic', cn: '阿拉伯语' },
|
|
38
|
+
{ en: 'Dutch', cn: '荷兰语' },
|
|
39
|
+
{ en: 'Swedish', cn: '瑞典语' },
|
|
40
|
+
{ en: 'Finnish', cn: '芬兰语' },
|
|
41
|
+
{ en: 'Czech', cn: '捷克语' },
|
|
42
|
+
{ en: 'Danish', cn: '丹麦语' },
|
|
43
|
+
{ en: 'Greek', cn: '希腊语' },
|
|
44
|
+
{ en: 'Romanian', cn: '罗马尼亚语' },
|
|
45
|
+
{ en: 'Hungarian', cn: '匈牙利语' },
|
|
46
|
+
{ en: 'Bulgarian', cn: '保加利亚语' },
|
|
47
|
+
{ en: 'Slovak', cn: '斯洛伐克语' },
|
|
48
|
+
{ en: 'Norwegian', cn: '挪威语' },
|
|
49
|
+
{ en: 'Hebrew', cn: '希伯来语' },
|
|
50
|
+
{ en: 'Turkish', cn: '土耳其语' },
|
|
51
|
+
{ en: 'Thai', cn: '泰语' },
|
|
52
|
+
{ en: 'Indonesian', cn: '印尼语' },
|
|
53
|
+
{ en: 'Vietnamese', cn: '越南语' },
|
|
54
|
+
{ en: 'Hindi', cn: '印地语' },
|
|
55
|
+
];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
+
const material_1 = require("@mui/material");
|
|
16
|
+
const react_1 = require("react");
|
|
17
|
+
const NumberField = (0, react_1.forwardRef)((_a, ref) => {
|
|
18
|
+
var { readOnly, parameter } = _a, props = __rest(_a, ["readOnly", "parameter"]);
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(material_1.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)); } })));
|
|
20
|
+
});
|
|
21
|
+
exports.default = NumberField;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
+
const material_1 = require("@mui/material");
|
|
16
|
+
const react_1 = require("react");
|
|
17
|
+
const SelectField = (0, react_1.forwardRef)((_a, ref) => {
|
|
18
|
+
var _b, _c, _d, _e;
|
|
19
|
+
var { readOnly, parameter, onChange } = _a, props = __rest(_a, ["readOnly", "parameter", "onChange"]);
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(material_1.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({}, (_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': {
|
|
21
|
+
whiteSpace: 'pre-wrap',
|
|
22
|
+
} }) }) }), children: (_e = parameter === null || parameter === void 0 ? void 0 : parameter.options) === null || _e === void 0 ? void 0 : _e.map((option) => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: option.value, children: option.label }, option.id))) })));
|
|
23
|
+
});
|
|
24
|
+
exports.default = SelectField;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
+
const material_1 = require("@mui/material");
|
|
16
|
+
const react_1 = require("react");
|
|
17
|
+
const StringField = (0, react_1.forwardRef)((_a, ref) => {
|
|
18
|
+
var { readOnly, parameter, onChange } = _a, props = __rest(_a, ["readOnly", "parameter", "onChange"]);
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({ ref: ref, multiline: parameter === null || parameter === void 0 ? void 0 : parameter.multiline, minRows: (parameter === null || parameter === void 0 ? void 0 : parameter.multiline) ? 2 : undefined, onChange: (e) => onChange(e.target.value) }, props, { InputProps: Object.assign(Object.assign({}, props.InputProps), { inputProps: Object.assign(Object.assign({}, props.inputProps), { maxLength: parameter === null || parameter === void 0 ? void 0 : parameter.maxLength }), readOnly }) })));
|
|
20
|
+
});
|
|
21
|
+
exports.default = StringField;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
+
const LanguageField_1 = __importDefault(require("./LanguageField"));
|
|
19
|
+
const NumberField_1 = __importDefault(require("./NumberField"));
|
|
20
|
+
const SelectField_1 = __importDefault(require("./SelectField"));
|
|
21
|
+
const StringField_1 = __importDefault(require("./StringField"));
|
|
22
|
+
function ParameterField(_a) {
|
|
23
|
+
var { parameter } = _a, props = __rest(_a, ["parameter"]);
|
|
24
|
+
if (parameter.type === 'source')
|
|
25
|
+
return null;
|
|
26
|
+
if (parameter.key === 'datasetId') {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const Field = {
|
|
30
|
+
number: NumberField_1.default,
|
|
31
|
+
string: StringField_1.default,
|
|
32
|
+
select: SelectField_1.default,
|
|
33
|
+
language: LanguageField_1.default,
|
|
34
|
+
}[parameter.type || 'string'] || StringField_1.default;
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(Field, Object.assign({ required: parameter === null || parameter === void 0 ? void 0 : parameter.required, label: parameter === null || parameter === void 0 ? void 0 : parameter.label, helperText: parameter === null || parameter === void 0 ? void 0 : parameter.helper, placeholder: parameter === null || parameter === void 0 ? void 0 : parameter.placeholder }, { parameter }, { size: "small" }, props)));
|
|
36
|
+
}
|
|
37
|
+
exports.default = ParameterField;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const material_1 = require("@mui/material");
|
|
17
|
+
const omit_1 = __importDefault(require("lodash/omit"));
|
|
18
|
+
const react_1 = require("react");
|
|
19
|
+
const session_1 = require("../../../../session");
|
|
20
|
+
const session_2 = require("../../api/session");
|
|
21
|
+
const navigate_1 = require("../../hooks/navigate");
|
|
22
|
+
const assistant_1 = require("../../state/assistant");
|
|
23
|
+
const session_3 = require("../../state/session");
|
|
24
|
+
const MessageSuggestedQuestions_1 = require("../common/MessageSuggestedQuestions");
|
|
25
|
+
const ParameterForm_1 = __importDefault(require("../form/ParameterForm"));
|
|
26
|
+
const GlobalLoading_1 = require("../GlobalLoading");
|
|
27
|
+
const MessageItemView_1 = __importDefault(require("../message/MessageItemView"));
|
|
28
|
+
const PoweredBy_1 = __importDefault(require("../PoweredBy"));
|
|
29
|
+
function InitialForm({ page }) {
|
|
30
|
+
var _a;
|
|
31
|
+
const { session: authSession } = (0, session_1.useSessionContext)();
|
|
32
|
+
const [assistant] = (0, assistant_1.useAssistantState)({ assistantId: page.assistantId });
|
|
33
|
+
const { parameters } = assistant;
|
|
34
|
+
const [error, setError] = (0, react_1.useState)();
|
|
35
|
+
const isChat = parameters === null || parameters === void 0 ? void 0 : parameters.some((i) => i.key === 'question');
|
|
36
|
+
const opener = (0, react_1.useMemo)(() => {
|
|
37
|
+
var _a;
|
|
38
|
+
const { openerMessage } = (_a = assistant.release) !== null && _a !== void 0 ? _a : {};
|
|
39
|
+
if (openerMessage) {
|
|
40
|
+
return {
|
|
41
|
+
taskId: '',
|
|
42
|
+
sessionId: '',
|
|
43
|
+
createdAt: new Date().toISOString(),
|
|
44
|
+
updatedAt: new Date().toISOString(),
|
|
45
|
+
result: { content: openerMessage },
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return undefined;
|
|
49
|
+
}, [assistant.release]);
|
|
50
|
+
const { assistantId } = (0, navigate_1.useCurrentPage)();
|
|
51
|
+
const [creating, setCreating] = (0, react_1.useState)(false);
|
|
52
|
+
const onSubmit = (...args_1) => __awaiter(this, [...args_1], void 0, function* (parameters = {}, entry) {
|
|
53
|
+
if (!authSession.user) {
|
|
54
|
+
yield new Promise((resolve) => {
|
|
55
|
+
authSession.login(() => {
|
|
56
|
+
resolve();
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (creating)
|
|
61
|
+
return;
|
|
62
|
+
setCreating(true);
|
|
63
|
+
try {
|
|
64
|
+
yield GlobalLoading_1.globalLoadingState.getState().run(() => __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
const { created: session } = yield (0, session_2.createSession)({
|
|
66
|
+
assistantId,
|
|
67
|
+
name: parameters.question,
|
|
68
|
+
parameters: (0, omit_1.default)(parameters, isChat ? ['question'] : []),
|
|
69
|
+
entry,
|
|
70
|
+
});
|
|
71
|
+
(0, session_3.createSessionState)({ sessionId: session.id }).getState().execute({
|
|
72
|
+
assistantId,
|
|
73
|
+
parameters,
|
|
74
|
+
});
|
|
75
|
+
setError(undefined);
|
|
76
|
+
page.navigate({ page: 'session', assistantId, sessionId: session.id });
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
setError(error);
|
|
81
|
+
}
|
|
82
|
+
finally {
|
|
83
|
+
setCreating(false);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
if (authSession.loading)
|
|
87
|
+
return null;
|
|
88
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [opener && ((0, jsx_runtime_1.jsx)(material_1.Box, { my: 2, children: (0, jsx_runtime_1.jsx)(MessageItemView_1.default, { assistantId: assistantId, hideAvatar: true, assistant: assistant, message: opener }) })), ((_a = assistant.entries) === null || _a === void 0 ? void 0 : _a.length) && ((0, jsx_runtime_1.jsx)(EntryListView, { assistant: assistant, onEntryClick: (entry) => onSubmit(entry.parameters, { id: entry.id, title: entry.title }) })), (0, jsx_runtime_1.jsx)(material_1.Box, { flex: 1 }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { position: 'sticky', bottom: 0 }, children: [(0, jsx_runtime_1.jsx)(ParameterForm_1.default, { assistant: assistant, onSubmit: onSubmit }), error && (0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "error", children: error.message }), (0, jsx_runtime_1.jsx)(PoweredBy_1.default, { assistantId: page.assistantId, sx: { my: 1 } })] })] }));
|
|
89
|
+
}
|
|
90
|
+
exports.default = InitialForm;
|
|
91
|
+
function EntryListView({ assistant, onEntryClick, }) {
|
|
92
|
+
var _a;
|
|
93
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Stack, { gap: 1, alignItems: "flex-start", children: (_a = assistant.entries) === null || _a === void 0 ? void 0 : _a.map((entry) => entry.title && ((0, jsx_runtime_1.jsx)(MessageSuggestedQuestions_1.MessageSuggestedQuestion, { onClick: () => onEntryClick === null || onEntryClick === void 0 ? void 0 : onEntryClick(entry), children: entry.title }, entry.title))) }));
|
|
94
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
27
|
+
const material_1 = require("@mui/material");
|
|
28
|
+
const react_wrap_balancer_1 = __importStar(require("react-wrap-balancer"));
|
|
29
|
+
const ux_1 = require("../../../../arcblock/ux");
|
|
30
|
+
function RuntimeChatHeader({ assistant }) {
|
|
31
|
+
var _a, _b, _c, _d, _e;
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, { className: "ai-chat-header", sx: { pt: 10 }, children: (0, jsx_runtime_1.jsxs)(react_wrap_balancer_1.Provider, { children: [((_a = assistant.release) === null || _a === void 0 ? void 0 : _a.logo) && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, children: (0, jsx_runtime_1.jsx)(material_1.Box, { component: ux_1.Avatar, className: "logo", size: 100, did: (_b = globalThis.blocklet) === null || _b === void 0 ? void 0 : _b.appId, src: (_c = assistant.release) === null || _c === void 0 ? void 0 : _c.logo, sx: { borderRadius: 1 } }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, { component: "h1", sx: {
|
|
33
|
+
fontWeight: 'bold',
|
|
34
|
+
fontSize: 18,
|
|
35
|
+
mt: 1,
|
|
36
|
+
lineHeight: '28px',
|
|
37
|
+
textAlign: 'center',
|
|
38
|
+
color: '#010714',
|
|
39
|
+
}, children: (0, jsx_runtime_1.jsxs)(react_wrap_balancer_1.default, { children: ["\u200C\u200C\u200C\u200C\u200C\u200C", ((_d = assistant.release) === null || _d === void 0 ? void 0 : _d.title) || (assistant === null || assistant === void 0 ? void 0 : assistant.name)] }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { component: "p", sx: {
|
|
40
|
+
mt: 2.5,
|
|
41
|
+
fontSize: 16,
|
|
42
|
+
lineHeight: '28px',
|
|
43
|
+
textAlign: 'center',
|
|
44
|
+
whiteSpace: 'pre-wrap',
|
|
45
|
+
color: '#465566',
|
|
46
|
+
}, children: (0, jsx_runtime_1.jsxs)(react_wrap_balancer_1.default, { children: ["\u200C\u200C\u200C\u200C\u200C\u200C\u200C", ((_e = assistant.release) === null || _e === void 0 ? void 0 : _e.description) || (assistant === null || assistant === void 0 ? void 0 : assistant.description)] }) })] }) }));
|
|
47
|
+
}
|
|
48
|
+
exports.default = RuntimeChatHeader;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const assistant_1 = require("../../state/assistant");
|
|
8
|
+
const layout_1 = __importDefault(require("../layout"));
|
|
9
|
+
const InitialForm_1 = __importDefault(require("./InitialForm"));
|
|
10
|
+
const RuntimeChatHeader_1 = __importDefault(require("./RuntimeChatHeader"));
|
|
11
|
+
function RuntimeChatHome({ page }) {
|
|
12
|
+
const [assistant] = (0, assistant_1.useAssistantState)({ assistantId: page.assistantId });
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)(layout_1.default, { disableBottomPadding: true, containerProps: {
|
|
14
|
+
sx: {
|
|
15
|
+
display: 'flex',
|
|
16
|
+
flexDirection: 'column',
|
|
17
|
+
height: '100%',
|
|
18
|
+
},
|
|
19
|
+
}, children: [(0, jsx_runtime_1.jsx)(RuntimeChatHeader_1.default, { assistant: assistant }), (0, jsx_runtime_1.jsx)(InitialForm_1.default, { page: page })] }));
|
|
20
|
+
}
|
|
21
|
+
exports.default = RuntimeChatHome;
|