@blocklet/pages-kit 0.2.316 → 0.2.318
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/components/MarkdownRenderer.js +26 -2
- package/lib/cjs/builtin/async/ai-runtime/components/OutputFieldContainer/index.js +22 -0
- package/lib/cjs/builtin/async/ai-runtime/components/ShareActions/index.js +1 -1
- package/lib/cjs/builtin/async/ai-runtime/constants.js +34 -4
- package/lib/cjs/builtin/async/ai-runtime/contexts/ActiveAgent.js +28 -0
- package/lib/cjs/builtin/async/ai-runtime/contexts/ComponentPreferences.js +27 -0
- package/lib/cjs/builtin/async/ai-runtime/contexts/CurrentMessage.js +2 -2
- package/lib/cjs/builtin/async/ai-runtime/hooks/use-appearances.js +10 -5
- package/lib/cjs/builtin/async/ai-runtime/hooks/use-header-menu.js +39 -0
- package/lib/cjs/builtin/async/ai-runtime/index.js +17 -3
- package/lib/cjs/builtin/async/ai-runtime/locales/index.js +26 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +3 -2
- package/lib/cjs/builtin/async/ai-runtime/runtime/Runtime/index.js +4 -6
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.js +2 -2
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.js +60 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.js +50 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ImagesView/index.js +30 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/MarkdownView/index.js +13 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.js +46 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/OutputFieldView/type.js +2 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +5 -5
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.js +26 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ShareView/index.js +16 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.js +25 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.js +73 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +58 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.js +33 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.js +23 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningQuestionsView.js +20 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.js +26 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +28 -134
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +35 -9
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +5 -5
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.js +54 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Input.js +66 -36
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Output.js +190 -57
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Page.js +238 -85
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +101 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.js +60 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/Loading.js +152 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.js +80 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +32 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.js +54 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/utils.js +13 -0
- package/lib/cjs/builtin/async/ai-runtime/state/runtime.js +1 -6
- package/lib/cjs/builtin/async/ai-runtime/state/session.js +52 -23
- package/lib/cjs/builtin/mui/material.js +4 -2
- package/lib/cjs/components/CustomComponentRenderer/state.js +23 -4
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/utils/inject-global-components-dump-json.js +1 -1
- package/lib/cjs/utils/inject-global-components.js +2 -0
- package/lib/esm/builtin/async/ai-runtime/components/MarkdownRenderer.js +3 -2
- package/lib/esm/builtin/async/ai-runtime/components/OutputFieldContainer/index.js +19 -0
- package/lib/esm/builtin/async/ai-runtime/components/ShareActions/index.js +2 -2
- package/lib/esm/builtin/async/ai-runtime/constants.js +32 -3
- package/lib/esm/builtin/async/ai-runtime/contexts/ActiveAgent.js +23 -0
- package/lib/esm/builtin/async/ai-runtime/contexts/ComponentPreferences.js +22 -0
- package/lib/esm/builtin/async/ai-runtime/contexts/CurrentMessage.js +2 -2
- package/lib/esm/builtin/async/ai-runtime/hooks/use-appearances.js +10 -5
- package/lib/esm/builtin/async/ai-runtime/hooks/use-header-menu.js +32 -0
- package/lib/esm/builtin/async/ai-runtime/index.js +8 -1
- package/lib/esm/builtin/async/ai-runtime/locales/index.js +26 -0
- package/lib/esm/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +3 -2
- package/lib/esm/builtin/async/ai-runtime/runtime/Runtime/index.js +4 -6
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.js +2 -2
- package/lib/esm/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.js +54 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.js +44 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ImagesView/index.js +24 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/MarkdownView/index.js +7 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.js +40 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/OutputFieldView/type.js +1 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +5 -5
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.js +20 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ShareView/index.js +10 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.js +22 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.js +44 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +30 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.js +27 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.js +18 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningQuestionsView.js +14 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.js +20 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +25 -108
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +36 -10
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +5 -5
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.js +48 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Input.js +60 -30
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Output.js +191 -58
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Page.js +238 -85
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +92 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.js +55 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/Loading.js +144 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.js +75 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +26 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.js +49 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/utils.js +9 -0
- package/lib/esm/builtin/async/ai-runtime/state/runtime.js +1 -6
- package/lib/esm/builtin/async/ai-runtime/state/session.js +52 -23
- package/lib/esm/builtin/mui/material.js +1 -1
- package/lib/esm/components/CustomComponentRenderer/state.js +22 -4
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/utils/inject-global-components-dump-json.js +1 -1
- package/lib/esm/utils/inject-global-components.js +2 -0
- package/lib/types/builtin/async/ai-runtime/api/session.d.ts +1 -0
- package/lib/types/builtin/async/ai-runtime/components/OutputFieldContainer/index.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/constants.d.ts +14 -0
- package/lib/types/builtin/async/ai-runtime/contexts/ActiveAgent.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/contexts/ComponentPreferences.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/contexts/CurrentMessage.d.ts +6 -1
- package/lib/types/builtin/async/ai-runtime/hooks/use-appearances.d.ts +4 -1
- package/lib/types/builtin/async/ai-runtime/hooks/use-header-menu.d.ts +1 -0
- package/lib/types/builtin/async/ai-runtime/index.d.ts +8 -1
- package/lib/types/builtin/async/ai-runtime/locales/index.d.ts +26 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.d.ts +2 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/ImagesView/index.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/MarkdownView/index.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/OutputFieldView/type.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/ShareView/index.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.d.ts +1 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.d.ts +3 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningQuestionsView.d.ts +1 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.d.ts +1 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/index.d.ts +13 -3
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.d.ts +1 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/Input.d.ts +1 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.d.ts +20 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/Loading.d.ts +3 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.d.ts +3 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.d.ts +16 -0
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/utils.d.ts +7 -0
- package/lib/types/builtin/async/ai-runtime/state/runtime.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/state/session.d.ts +11 -3
- package/lib/types/builtin/mui/material.d.ts +1 -1
- package/lib/types/components/CustomComponentRenderer/state.d.ts +1 -0
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/lib/types/types/core.d.ts +2 -1
- package/package.json +9 -8
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/MultiAgentsChat/index.js +0 -193
- package/lib/esm/builtin/async/ai-runtime/runtime-components/MultiAgentsChat/index.js +0 -164
- package/lib/types/builtin/async/ai-runtime/runtime-components/MultiAgentsChat/index.d.ts +0 -11
|
@@ -1,4 +1,27 @@
|
|
|
1
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
|
+
};
|
|
2
25
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
26
|
var t = {};
|
|
4
27
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -17,7 +40,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
40
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
41
|
const react_1 = require("@iconify/react");
|
|
19
42
|
const material_1 = require("@mui/material");
|
|
20
|
-
const react_2 =
|
|
43
|
+
const react_2 = __importStar(require("react"));
|
|
21
44
|
const react_markdown_1 = __importDefault(require("react-markdown"));
|
|
22
45
|
const remark_gfm_1 = __importDefault(require("remark-gfm"));
|
|
23
46
|
const locale_1 = require("../../../locale");
|
|
@@ -31,7 +54,7 @@ const MarkdownRenderer = (0, material_1.styled)((props) => ((0, jsx_runtime_1.js
|
|
|
31
54
|
if (!children)
|
|
32
55
|
return null;
|
|
33
56
|
const match = /language-(\w+)/.exec(className || '');
|
|
34
|
-
return !inline ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: ReactSyntaxHighlighter, language: match === null || match === void 0 ? void 0 : match[1] }, props, { sx: { borderRadius: 1 }, children: String(children).replace(/\n$/, '') }))) : ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: "code", className: className }, props, { children: children })));
|
|
57
|
+
return !inline ? ((0, jsx_runtime_1.jsx)(react_2.Suspense, { children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: ReactSyntaxHighlighter, language: match === null || match === void 0 ? void 0 : match[1] }, props, { sx: { borderRadius: 1 }, children: String(children).replace(/\n$/, '') })) })) : ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: "code", className: className }, props, { children: children })));
|
|
35
58
|
},
|
|
36
59
|
table: ({ className, children }) => {
|
|
37
60
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: { overflow: 'auto', my: 1 }, children: (0, jsx_runtime_1.jsx)("table", { className: className, children: children }) }));
|
|
@@ -85,6 +108,7 @@ const MarkdownRenderer = (0, material_1.styled)((props) => ((0, jsx_runtime_1.js
|
|
|
85
108
|
}
|
|
86
109
|
}
|
|
87
110
|
|
|
111
|
+
&.writing:empty,
|
|
88
112
|
&.writing > *:last-child {
|
|
89
113
|
&:after {
|
|
90
114
|
content: '';
|
|
@@ -0,0 +1,22 @@
|
|
|
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 react_1 = require("@iconify/react");
|
|
16
|
+
const material_1 = require("@mui/material");
|
|
17
|
+
function OutputFieldContainer(_a) {
|
|
18
|
+
var _b;
|
|
19
|
+
var { output } = _a, props = __rest(_a, ["output"]);
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ gap: 1 }, props, { children: [((_b = output.appearance) === null || _b === void 0 ? void 0 : _b.title) && ((0, jsx_runtime_1.jsxs)(material_1.Typography, { component: "h6", noWrap: true, sx: { display: 'flex', alignItems: 'center', gap: 1, fontSize: 18, fontWeight: 500 }, children: [output.appearance.icon && (0, jsx_runtime_1.jsx)(material_1.Box, { component: react_1.Icon, icon: output.appearance.icon }), (0, jsx_runtime_1.jsx)(material_1.Box, { component: "span", sx: { flex: 1, textOverflow: 'hidden' }, children: output.appearance.title })] })), props.children] })));
|
|
21
|
+
}
|
|
22
|
+
exports.default = OutputFieldContainer;
|
|
@@ -72,7 +72,7 @@ function ShareActions(_a) {
|
|
|
72
72
|
const C = ShareActionsMap[item.to];
|
|
73
73
|
if (!C)
|
|
74
74
|
return null;
|
|
75
|
-
return (0, jsx_runtime_1.jsx)(C, {});
|
|
75
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(C, {}) }));
|
|
76
76
|
}).filter((i) => !!i);
|
|
77
77
|
if (!(items === null || items === void 0 ? void 0 : items.length))
|
|
78
78
|
return null;
|
|
@@ -1,8 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_OUTPUT_COMPONENT_ID = exports.DEFAULT_INPUT_COMPONENT_ID = exports.DEFAULT_PAGE_COMPONENT_ID = exports.PAYMENT_KIT_DID = exports.AI_STUDIO_DID = void 0;
|
|
3
|
+
exports.getDefaultOutputComponent = exports.DEFAULT_OUTPUT_COMPONENTS = exports.IMAGES_VIEW_ID = exports.SHARE_VIEW_ID = exports.REFERENCED_LINKS_VIEW_ID = exports.SUGGESTED_QUESTIONS_VIEW_ID = exports.MARKDOWN_VIEW_ID = exports.DEFAULT_OUTPUT_COMPONENT_ID = exports.DEFAULT_INPUT_COMPONENT_ID = exports.DEFAULT_PAGE_COMPONENT_ID = exports.PAYMENT_KIT_DID = exports.AI_STUDIO_DID = void 0;
|
|
4
|
+
const types_1 = require("@blocklet/ai-runtime/types");
|
|
4
5
|
exports.AI_STUDIO_DID = 'z8iZpog7mcgcgBZzTiXJCWESvmnRrQmnd3XBB';
|
|
5
6
|
exports.PAYMENT_KIT_DID = 'z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk';
|
|
6
|
-
exports.DEFAULT_PAGE_COMPONENT_ID = 'ctnxha29uu8cx4xv';
|
|
7
|
-
exports.DEFAULT_INPUT_COMPONENT_ID = '1wwtemqcdio6nqf0';
|
|
8
|
-
exports.DEFAULT_OUTPUT_COMPONENT_ID = 'q0ckknkxph4hfwas';
|
|
7
|
+
exports.DEFAULT_PAGE_COMPONENT_ID = 'ctnxha29uu8cx4xv'; // Simple Layout
|
|
8
|
+
exports.DEFAULT_INPUT_COMPONENT_ID = '1wwtemqcdio6nqf0'; // Auto Form
|
|
9
|
+
exports.DEFAULT_OUTPUT_COMPONENT_ID = 'q0ckknkxph4hfwas'; // Simple Output
|
|
10
|
+
exports.MARKDOWN_VIEW_ID = 'a4oldpoxv7bikvpj';
|
|
11
|
+
exports.SUGGESTED_QUESTIONS_VIEW_ID = '6u8m11ss7fvu8t7i';
|
|
12
|
+
exports.REFERENCED_LINKS_VIEW_ID = 'baqmaoccdntqwayc';
|
|
13
|
+
exports.SHARE_VIEW_ID = 'jfq3df9z8lkk9not';
|
|
14
|
+
exports.IMAGES_VIEW_ID = 'txirtdgx8h2bmo7s';
|
|
15
|
+
exports.DEFAULT_OUTPUT_COMPONENTS = {
|
|
16
|
+
[types_1.RuntimeOutputVariable.text]: {
|
|
17
|
+
componentId: exports.MARKDOWN_VIEW_ID,
|
|
18
|
+
},
|
|
19
|
+
[types_1.RuntimeOutputVariable.images]: {
|
|
20
|
+
componentId: exports.IMAGES_VIEW_ID,
|
|
21
|
+
},
|
|
22
|
+
[types_1.RuntimeOutputVariable.openingMessage]: {
|
|
23
|
+
componentId: exports.MARKDOWN_VIEW_ID,
|
|
24
|
+
},
|
|
25
|
+
[types_1.RuntimeOutputVariable.suggestedQuestions]: {
|
|
26
|
+
componentId: exports.SUGGESTED_QUESTIONS_VIEW_ID,
|
|
27
|
+
},
|
|
28
|
+
[types_1.RuntimeOutputVariable.referenceLinks]: {
|
|
29
|
+
componentId: exports.REFERENCED_LINKS_VIEW_ID,
|
|
30
|
+
},
|
|
31
|
+
[types_1.RuntimeOutputVariable.share]: {
|
|
32
|
+
componentId: exports.SHARE_VIEW_ID,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
function getDefaultOutputComponent(output) {
|
|
36
|
+
return exports.DEFAULT_OUTPUT_COMPONENTS[output.name];
|
|
37
|
+
}
|
|
38
|
+
exports.getDefaultOutputComponent = getDefaultOutputComponent;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useActiveAgent = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const types_1 = require("@blocklet/ai-runtime/types");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const runtime_1 = require("../state/runtime");
|
|
8
|
+
const runtime_output_schema_1 = require("../utils/runtime-output-schema");
|
|
9
|
+
const activeAgentContext = (0, react_1.createContext)(undefined);
|
|
10
|
+
function useActiveAgent() {
|
|
11
|
+
const context = (0, react_1.useContext)(activeAgentContext);
|
|
12
|
+
if (!context) {
|
|
13
|
+
throw new Error('No such activeAgentContext. You should use `useActiveAgent` within the `ActiveAgentProvider`');
|
|
14
|
+
}
|
|
15
|
+
return context;
|
|
16
|
+
}
|
|
17
|
+
exports.useActiveAgent = useActiveAgent;
|
|
18
|
+
function ActiveAgentProvider({ children }) {
|
|
19
|
+
const { agent } = (0, runtime_1.useRuntimeState)();
|
|
20
|
+
const childAgentId = (0, react_1.useMemo)(() => {
|
|
21
|
+
var _a, _b, _c, _d;
|
|
22
|
+
return (_d = (_c = (_b = (_a = (0, runtime_output_schema_1.getOutputVariableInitialValue)(agent, types_1.RuntimeOutputVariable.children)) === null || _a === void 0 ? void 0 : _a.agents) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : agent.id;
|
|
23
|
+
}, [agent]);
|
|
24
|
+
const [activeAgentId, setActiveAgentId] = (0, react_1.useState)(childAgentId);
|
|
25
|
+
const activeAgent = (0, react_1.useMemo)(() => ({ activeAgentId, setActiveAgentId }), [activeAgentId, setActiveAgentId]);
|
|
26
|
+
return (0, jsx_runtime_1.jsx)(activeAgentContext.Provider, { value: activeAgent, children: children });
|
|
27
|
+
}
|
|
28
|
+
exports.default = ActiveAgentProvider;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
exports.useComponentPreferences = exports.ComponentPreferencesProvider = void 0;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const react_1 = require("react");
|
|
17
|
+
const componentPreferencesContext = (0, react_1.createContext)(undefined);
|
|
18
|
+
function ComponentPreferencesProvider(_a) {
|
|
19
|
+
var { children } = _a, preferences = __rest(_a, ["children"]);
|
|
20
|
+
const value = (0, react_1.useMemo)(() => (Object.assign({}, preferences)), Object.values(preferences));
|
|
21
|
+
return (0, jsx_runtime_1.jsx)(componentPreferencesContext.Provider, { value: value, children: children });
|
|
22
|
+
}
|
|
23
|
+
exports.ComponentPreferencesProvider = ComponentPreferencesProvider;
|
|
24
|
+
function useComponentPreferences() {
|
|
25
|
+
return (0, react_1.useContext)(componentPreferencesContext);
|
|
26
|
+
}
|
|
27
|
+
exports.useComponentPreferences = useComponentPreferences;
|
|
@@ -9,9 +9,9 @@ function CurrentMessageProvider({ message, children }) {
|
|
|
9
9
|
return (0, jsx_runtime_1.jsx)(context.Provider, { value: state, children: children });
|
|
10
10
|
}
|
|
11
11
|
exports.default = CurrentMessageProvider;
|
|
12
|
-
function useCurrentMessage() {
|
|
12
|
+
function useCurrentMessage({ optional } = {}) {
|
|
13
13
|
const current = (0, react_1.useContext)(context);
|
|
14
|
-
if (!current) {
|
|
14
|
+
if (!optional && !current) {
|
|
15
15
|
throw new Error('No such message state. You should use `useCurrentMessage` within the `CurrentMessageProvider`');
|
|
16
16
|
}
|
|
17
17
|
return current;
|
|
@@ -13,14 +13,16 @@ function useAppearances(args) {
|
|
|
13
13
|
const { agent: runtimeAgent } = (0, runtime_1.useRuntimeState)();
|
|
14
14
|
const { agent } = (0, CurrentAgent_1.useCurrentAgent)(args);
|
|
15
15
|
const appearancePage = (0, react_1.useMemo)(() => {
|
|
16
|
-
|
|
16
|
+
var _a, _b;
|
|
17
|
+
const appearance = (_b = (_a = agent.outputVariables) === null || _a === void 0 ? void 0 : _a.find((i) => i.name === types_1.RuntimeOutputVariable.appearancePage)) === null || _b === void 0 ? void 0 : _b.appearance;
|
|
17
18
|
return Object.assign(Object.assign({}, appearance), { componentId: (appearance === null || appearance === void 0 ? void 0 : appearance.componentId) || constants_1.DEFAULT_PAGE_COMPONENT_ID });
|
|
18
19
|
}, [agent]);
|
|
19
20
|
const appearanceInput = (0, react_1.useMemo)(() => {
|
|
20
|
-
|
|
21
|
+
var _a, _b, _c, _d;
|
|
22
|
+
const appearance = (_b = (_a = agent.outputVariables) === null || _a === void 0 ? void 0 : _a.find((i) => i.name === types_1.RuntimeOutputVariable.appearanceInput)) === null || _b === void 0 ? void 0 : _b.appearance;
|
|
21
23
|
if (appearance)
|
|
22
24
|
return appearance;
|
|
23
|
-
const runtimeAppearance = (0
|
|
25
|
+
const runtimeAppearance = (_d = (_c = runtimeAgent.outputVariables) === null || _c === void 0 ? void 0 : _c.find((i) => i.name === types_1.RuntimeOutputVariable.appearanceInput)) === null || _d === void 0 ? void 0 : _d.appearance;
|
|
24
26
|
if (runtimeAppearance)
|
|
25
27
|
return runtimeAppearance;
|
|
26
28
|
return {
|
|
@@ -28,10 +30,11 @@ function useAppearances(args) {
|
|
|
28
30
|
};
|
|
29
31
|
}, [agent, runtimeAgent]);
|
|
30
32
|
const appearanceOutput = (0, react_1.useMemo)(() => {
|
|
31
|
-
|
|
33
|
+
var _a, _b, _c, _d;
|
|
34
|
+
const appearance = (_b = (_a = agent.outputVariables) === null || _a === void 0 ? void 0 : _a.find((i) => i.name === types_1.RuntimeOutputVariable.appearanceOutput)) === null || _b === void 0 ? void 0 : _b.appearance;
|
|
32
35
|
if (appearance === null || appearance === void 0 ? void 0 : appearance.componentId)
|
|
33
36
|
return appearance;
|
|
34
|
-
const runtimeAppearance = (0
|
|
37
|
+
const runtimeAppearance = (_d = (_c = runtimeAgent.outputVariables) === null || _c === void 0 ? void 0 : _c.find((i) => i.name === types_1.RuntimeOutputVariable.appearanceOutput)) === null || _d === void 0 ? void 0 : _d.appearance;
|
|
35
38
|
if (runtimeAppearance)
|
|
36
39
|
return runtimeAppearance;
|
|
37
40
|
return {
|
|
@@ -66,6 +69,7 @@ function useOpeningMessage(args) {
|
|
|
66
69
|
const agentOpening = (0, runtime_output_schema_1.getOutputVariableInitialValue)(agent, types_1.RuntimeOutputVariable.openingMessage);
|
|
67
70
|
if (agentOpening === null || agentOpening === void 0 ? void 0 : agentOpening.message) {
|
|
68
71
|
return {
|
|
72
|
+
agent,
|
|
69
73
|
message: agentOpening.message,
|
|
70
74
|
profile,
|
|
71
75
|
};
|
|
@@ -73,6 +77,7 @@ function useOpeningMessage(args) {
|
|
|
73
77
|
const runtimeOpening = (0, runtime_output_schema_1.getOutputVariableInitialValue)(runtimeAgent, types_1.RuntimeOutputVariable.openingMessage);
|
|
74
78
|
if (runtimeOpening === null || runtimeOpening === void 0 ? void 0 : runtimeOpening.message) {
|
|
75
79
|
return {
|
|
80
|
+
agent: runtimeAgent,
|
|
76
81
|
message: runtimeOpening.message,
|
|
77
82
|
profile: runtimeProfile,
|
|
78
83
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
exports.useHeaderMenu = void 0;
|
|
16
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
17
|
+
const react_1 = require("@iconify/react");
|
|
18
|
+
const material_1 = require("@mui/material");
|
|
19
|
+
const locale_1 = require("../../../locale");
|
|
20
|
+
const header_1 = require("../../../page/header");
|
|
21
|
+
const PopperMenuButton_1 = __importDefault(require("../components/PopperMenuButton"));
|
|
22
|
+
const LoadingMenuItem_1 = __importDefault(require("../components/PopperMenuButton/LoadingMenuItem"));
|
|
23
|
+
const ComponentPreferences_1 = require("../contexts/ComponentPreferences");
|
|
24
|
+
const session_1 = require("../state/session");
|
|
25
|
+
function useHeaderMenu() {
|
|
26
|
+
var _a;
|
|
27
|
+
const { t, locale } = (0, locale_1.useLocaleContext)();
|
|
28
|
+
const { hideHeaderMenuButton } = (_a = (0, ComponentPreferences_1.useComponentPreferences)()) !== null && _a !== void 0 ? _a : {};
|
|
29
|
+
const clearSession = (0, session_1.useSessionState)((s) => s.clearSession);
|
|
30
|
+
(0, header_1.useHeader)(() => hideHeaderMenuButton
|
|
31
|
+
? {}
|
|
32
|
+
: {
|
|
33
|
+
addons: (...exists) => [
|
|
34
|
+
(0, jsx_runtime_1.jsx)(PopperMenuButton_1.default, { component: material_1.IconButton, PopperProps: { placement: 'bottom-end', sx: { zIndex: 'appBar' } }, menus: (0, jsx_runtime_1.jsxs)(LoadingMenuItem_1.default, { onClick: () => __awaiter(this, void 0, void 0, function* () { return clearSession(); }), children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "mingcute:broom-line" }) }), t('clearSession')] }), children: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:dots" }) }),
|
|
35
|
+
...exists,
|
|
36
|
+
],
|
|
37
|
+
}, [locale, hideHeaderMenuButton]);
|
|
38
|
+
}
|
|
39
|
+
exports.useHeaderMenu = useHeaderMenu;
|
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.PhotoGalleryItem = exports.ChatOutput = exports.SimpleOutput = exports.AutoForm = exports.PhotoGallery = exports.
|
|
20
|
+
exports.MarkdownView = exports.GoogleSearchSourcesView = exports.GoogleSearchRelatedQuestionsView = exports.ImagesView = exports.OpeningQuestionsView = exports.ShareView = exports.ReferencedLinksView = exports.SuggestedQuestionsView = exports.PhotoGalleryItem = exports.ChatOutput = exports.SimpleOutput = exports.AutoForm = exports.PhotoGallery = exports.SimpleChat = exports.SimplePage = exports.ChatBotButton = exports.Runtime = exports.CurrentMessageProvider = exports.CurrentAgentProvider = void 0;
|
|
21
21
|
__exportStar(require("./contexts/CurrentAgent"), exports);
|
|
22
22
|
var CurrentAgent_1 = require("./contexts/CurrentAgent");
|
|
23
23
|
Object.defineProperty(exports, "CurrentAgentProvider", { enumerable: true, get: function () { return __importDefault(CurrentAgent_1).default; } });
|
|
@@ -34,8 +34,6 @@ var SimplePage_1 = require("./runtime-components/SimplePage");
|
|
|
34
34
|
Object.defineProperty(exports, "SimplePage", { enumerable: true, get: function () { return __importDefault(SimplePage_1).default; } });
|
|
35
35
|
var SimpleChat_1 = require("./runtime-components/SimpleChat");
|
|
36
36
|
Object.defineProperty(exports, "SimpleChat", { enumerable: true, get: function () { return __importDefault(SimpleChat_1).default; } });
|
|
37
|
-
var MultiAgentsChat_1 = require("./runtime-components/MultiAgentsChat");
|
|
38
|
-
Object.defineProperty(exports, "MultiAgentsChat", { enumerable: true, get: function () { return __importDefault(MultiAgentsChat_1).default; } });
|
|
39
37
|
var PhotoGallery_1 = require("./runtime-components/PhotoGallery");
|
|
40
38
|
Object.defineProperty(exports, "PhotoGallery", { enumerable: true, get: function () { return __importDefault(PhotoGallery_1).default; } });
|
|
41
39
|
var AutoForm_1 = require("./runtime-components/AutoForm");
|
|
@@ -46,5 +44,21 @@ var ChatOutput_1 = require("./runtime-components/ChatOutput");
|
|
|
46
44
|
Object.defineProperty(exports, "ChatOutput", { enumerable: true, get: function () { return __importDefault(ChatOutput_1).default; } });
|
|
47
45
|
var PhotoGalleryItem_1 = require("./runtime-components/PhotoGalleryItem");
|
|
48
46
|
Object.defineProperty(exports, "PhotoGalleryItem", { enumerable: true, get: function () { return __importDefault(PhotoGalleryItem_1).default; } });
|
|
47
|
+
var SuggestedQuestionsView_1 = require("./runtime-components/SuggestedQuestionsView");
|
|
48
|
+
Object.defineProperty(exports, "SuggestedQuestionsView", { enumerable: true, get: function () { return __importDefault(SuggestedQuestionsView_1).default; } });
|
|
49
|
+
var ReferencedLinksView_1 = require("./runtime-components/ReferencedLinksView");
|
|
50
|
+
Object.defineProperty(exports, "ReferencedLinksView", { enumerable: true, get: function () { return __importDefault(ReferencedLinksView_1).default; } });
|
|
51
|
+
var ShareView_1 = require("./runtime-components/ShareView");
|
|
52
|
+
Object.defineProperty(exports, "ShareView", { enumerable: true, get: function () { return __importDefault(ShareView_1).default; } });
|
|
53
|
+
var OpeningQuestionsView_1 = require("./runtime-components/OpeningQuestionsView");
|
|
54
|
+
Object.defineProperty(exports, "OpeningQuestionsView", { enumerable: true, get: function () { return __importDefault(OpeningQuestionsView_1).default; } });
|
|
55
|
+
var ImagesView_1 = require("./runtime-components/ImagesView");
|
|
56
|
+
Object.defineProperty(exports, "ImagesView", { enumerable: true, get: function () { return __importDefault(ImagesView_1).default; } });
|
|
57
|
+
var GoogleSearchRelatedQuestionsView_1 = require("./runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView");
|
|
58
|
+
Object.defineProperty(exports, "GoogleSearchRelatedQuestionsView", { enumerable: true, get: function () { return __importDefault(GoogleSearchRelatedQuestionsView_1).default; } });
|
|
59
|
+
var GoogleSearchSourcesView_1 = require("./runtime-components/GoogleSearch/GoogleSearchSourcesView");
|
|
60
|
+
Object.defineProperty(exports, "GoogleSearchSourcesView", { enumerable: true, get: function () { return __importDefault(GoogleSearchSourcesView_1).default; } });
|
|
61
|
+
var MarkdownView_1 = require("./runtime-components/MarkdownView");
|
|
62
|
+
Object.defineProperty(exports, "MarkdownView", { enumerable: true, get: function () { return __importDefault(MarkdownView_1).default; } });
|
|
49
63
|
// only use to debug, should be removed when PR
|
|
50
64
|
__exportStar(require("./runtime-components/V0"), exports);
|
|
@@ -37,6 +37,7 @@ exports.translations = {
|
|
|
37
37
|
rename: 'Rename',
|
|
38
38
|
delete: 'Delete',
|
|
39
39
|
confirmDelete: 'Confirm Delete?',
|
|
40
|
+
confirm: 'Confirm',
|
|
40
41
|
noData: 'No {data} yet',
|
|
41
42
|
createObject: 'Create {object}',
|
|
42
43
|
title: 'Title',
|
|
@@ -95,6 +96,18 @@ exports.translations = {
|
|
|
95
96
|
send: 'Send',
|
|
96
97
|
session: 'Session',
|
|
97
98
|
loadMore: 'Load More',
|
|
99
|
+
v0: {
|
|
100
|
+
title: 'AIGNE v0',
|
|
101
|
+
description: 'AIGNE v0 is an AI-based code tool that can help you generate code quickly.',
|
|
102
|
+
noData: 'No conversation information yet, click the button below to start generating!',
|
|
103
|
+
deleteSessionTitle: 'Delete Conversation Information',
|
|
104
|
+
deleteSessionTip: 'Are you sure you want to delete this Conversation Information?',
|
|
105
|
+
propertiesSetting: 'Properties Setting',
|
|
106
|
+
propertiesSettingTip: 'This function is used for debugging components and does not affect the final code',
|
|
107
|
+
cannotSetPropertiesTip: 'Failed to parse PROPERTIES_SCHEMA, this code cannot be set properties',
|
|
108
|
+
codePreview: 'Code Preview',
|
|
109
|
+
codePreviewTip: 'Here is the code preview, you can view the generated code, and editing is not supported yet.',
|
|
110
|
+
},
|
|
98
111
|
},
|
|
99
112
|
zh: {
|
|
100
113
|
by: '作者',
|
|
@@ -131,6 +144,7 @@ exports.translations = {
|
|
|
131
144
|
rename: '重命名',
|
|
132
145
|
delete: '删除',
|
|
133
146
|
confirmDelete: '确定删除?',
|
|
147
|
+
confirm: '确定',
|
|
134
148
|
noData: '暂无{data}',
|
|
135
149
|
createObject: '创建{object}',
|
|
136
150
|
title: '标题',
|
|
@@ -189,5 +203,17 @@ exports.translations = {
|
|
|
189
203
|
send: '发送',
|
|
190
204
|
session: '会话',
|
|
191
205
|
loadMore: '加载更多',
|
|
206
|
+
v0: {
|
|
207
|
+
title: 'AIGNE v0',
|
|
208
|
+
description: 'AIGNE v0 是一个基于人工智能的代码工具,可以帮助您快速生成代码。',
|
|
209
|
+
noData: '暂无生成记录,点击下方按钮开始生成吧!',
|
|
210
|
+
deleteSessionTitle: '删除生成记录',
|
|
211
|
+
deleteSessionTip: '确定要删除此生成记录吗?',
|
|
212
|
+
propertiesSetting: '属性设置',
|
|
213
|
+
propertiesSettingTip: '此功能用于调试组件,不影响最终代码',
|
|
214
|
+
cannotSetPropertiesTip: '解析 PROPERTIES_SCHEMA 失败,此代码无法进行属性设置',
|
|
215
|
+
codePreview: '代码预览',
|
|
216
|
+
codePreviewTip: '以下是代码预览,您可以查看生成的代码,目前还不支持编辑。',
|
|
217
|
+
},
|
|
192
218
|
},
|
|
193
219
|
};
|
|
@@ -48,12 +48,13 @@ const LoadingMenuItem_1 = __importDefault(require("../../components/PopperMenuBu
|
|
|
48
48
|
const RuntimeCommonProvider_1 = __importDefault(require("../../components/RuntimeCommonProvider"));
|
|
49
49
|
const ScrollView_1 = __importDefault(require("../../components/ScrollView"));
|
|
50
50
|
const constants_1 = require("../../constants");
|
|
51
|
+
const ActiveAgent_1 = __importDefault(require("../../contexts/ActiveAgent"));
|
|
51
52
|
const Runtime_1 = __importDefault(require("../../contexts/Runtime"));
|
|
52
53
|
const use_appearances_1 = __importStar(require("../../hooks/use-appearances"));
|
|
53
54
|
const runtime_1 = require("../../state/runtime");
|
|
54
55
|
const session_1 = require("../../state/session");
|
|
55
56
|
function ChatBotButton({ aid, working }) {
|
|
56
|
-
return ((0, jsx_runtime_1.jsx)(Runtime_1.default, { aid: aid, working: working, children: (0, jsx_runtime_1.jsx)(
|
|
57
|
+
return ((0, jsx_runtime_1.jsx)(RuntimeCommonProvider_1.default, { children: (0, jsx_runtime_1.jsx)(Runtime_1.default, { aid: aid, working: working, children: (0, jsx_runtime_1.jsx)(ActiveAgent_1.default, { children: (0, jsx_runtime_1.jsx)(ChatBotContent, {}) }) }) }));
|
|
57
58
|
}
|
|
58
59
|
exports.default = ChatBotButton;
|
|
59
60
|
function ChatBotContent() {
|
|
@@ -73,7 +74,7 @@ function ChatBotContent() {
|
|
|
73
74
|
'.aigne-layout': {
|
|
74
75
|
px: 2,
|
|
75
76
|
},
|
|
76
|
-
}, children: (0, jsx_runtime_1.jsx)(react_2.Suspense, { fallback: (0, jsx_runtime_1.jsx)(material_1.Stack, { flexGrow: 1, alignItems: "center", justifyContent: "center", children: (0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 24 }) }), children: (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: componentId, properties: appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.
|
|
77
|
+
}, children: (0, jsx_runtime_1.jsx)(react_2.Suspense, { fallback: (0, jsx_runtime_1.jsx)(material_1.Stack, { flexGrow: 1, alignItems: "center", justifyContent: "center", children: (0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 24 }) }), children: (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: componentId, properties: appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentProperties, props: { scrollViewProps: { disabled: true }, hideHeaderMenuButton: true } }) }) }) }))] }));
|
|
77
78
|
}
|
|
78
79
|
function ResponsiveChatBotContainer({ open, anchorEl, children, onClose, }) {
|
|
79
80
|
const theme = (0, material_1.useTheme)();
|
|
@@ -38,6 +38,7 @@ const utils_1 = require("../../../../utils");
|
|
|
38
38
|
const RuntimeCommonProvider_1 = __importStar(require("../../components/RuntimeCommonProvider"));
|
|
39
39
|
const SocialShare_1 = __importDefault(require("../../components/SocialShare"));
|
|
40
40
|
const constants_1 = require("../../constants");
|
|
41
|
+
const ActiveAgent_1 = __importDefault(require("../../contexts/ActiveAgent"));
|
|
41
42
|
const Runtime_1 = __importStar(require("../../contexts/Runtime"));
|
|
42
43
|
const use_appearances_1 = __importDefault(require("../../hooks/use-appearances"));
|
|
43
44
|
const runtime_1 = require("../../state/runtime");
|
|
@@ -47,11 +48,8 @@ function AgentCreatedBy({ did }) {
|
|
|
47
48
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [t('by'), " ", (0, jsx_runtime_1.jsx)(material_1.Box, { component: ux_1.DID, did: did, copyable: false, responsive: true })] }));
|
|
48
49
|
}
|
|
49
50
|
function Runtime({ aid, working }) {
|
|
50
|
-
const children = ((0, jsx_runtime_1.jsx)(
|
|
51
|
-
|
|
52
|
-
return ((0, jsx_runtime_1.jsx)(Runtime_1.default, { aid: aid, working: working, children: children }));
|
|
53
|
-
}
|
|
54
|
-
return (0, jsx_runtime_1.jsx)(Runtime_1.RuntimeProviderFromUrl, { children: children });
|
|
51
|
+
const children = ((0, jsx_runtime_1.jsx)(ActiveAgent_1.default, { children: (0, jsx_runtime_1.jsx)(RuntimeView, {}) }));
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(RuntimeCommonProvider_1.default, { children: aid ? ((0, jsx_runtime_1.jsx)(Runtime_1.default, { aid: aid, working: working, children: children })) : ((0, jsx_runtime_1.jsx)(Runtime_1.RuntimeProviderFromUrl, { children: children })) }));
|
|
55
53
|
}
|
|
56
54
|
exports.default = Runtime;
|
|
57
55
|
function RuntimeView() {
|
|
@@ -88,5 +86,5 @@ ${agent === null || agent === void 0 ? void 0 : agent.description}
|
|
|
88
86
|
};
|
|
89
87
|
}, [locale, isMobile, agent]);
|
|
90
88
|
const componentId = (_a = appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentId) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_PAGE_COMPONENT_ID;
|
|
91
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_helmet_1.Helmet, { children: [agent.project.name && (0, jsx_runtime_1.jsx)("title", { children: agent.project.name }), agent.project.description && (0, jsx_runtime_1.jsx)("meta", { name: "description", content: agent.project.description })] }), (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: componentId, properties: appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.
|
|
89
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_helmet_1.Helmet, { children: [agent.project.name && (0, jsx_runtime_1.jsx)("title", { children: agent.project.name }), agent.project.description && (0, jsx_runtime_1.jsx)("meta", { name: "description", content: agent.project.description })] }), (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: componentId, properties: appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentProperties })] }));
|
|
92
90
|
}
|
|
@@ -7,13 +7,13 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
const material_1 = require("@mui/material");
|
|
8
8
|
const locale_1 = require("../../../../locale");
|
|
9
9
|
const MarkdownRenderer_1 = __importDefault(require("../../components/MarkdownRenderer"));
|
|
10
|
-
function MessageErrorView({ error }) {
|
|
10
|
+
function MessageErrorView({ error, sx }) {
|
|
11
11
|
const { t } = (0, locale_1.useLocaleContext)();
|
|
12
12
|
if (!error)
|
|
13
13
|
return null;
|
|
14
14
|
if (error.status === 401) {
|
|
15
15
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, { className: "ai-chat-message-error", children: (0, jsx_runtime_1.jsx)(material_1.Box, { className: "message-response", children: (0, jsx_runtime_1.jsx)(MarkdownRenderer_1.default, { children: t('requireLogin') }) }) }));
|
|
16
16
|
}
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Alert, { className: "ai-chat-message-error", severity: "error", sx: { mr: 5 }, children: error.message }));
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Alert, { className: "ai-chat-message-error", severity: "error", sx: Object.assign({ mr: 5 }, sx), children: error.message }));
|
|
18
18
|
}
|
|
19
19
|
exports.default = MessageErrorView;
|
|
@@ -0,0 +1,60 @@
|
|
|
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 joi_1 = __importDefault(require("joi"));
|
|
18
|
+
const react_1 = require("react");
|
|
19
|
+
const OutputFieldContainer_1 = __importDefault(require("../../components/OutputFieldContainer"));
|
|
20
|
+
const CurrentAgent_1 = require("../../contexts/CurrentAgent");
|
|
21
|
+
const CurrentMessage_1 = require("../../contexts/CurrentMessage");
|
|
22
|
+
const runtime_1 = require("../../state/runtime");
|
|
23
|
+
const session_1 = require("../../state/session");
|
|
24
|
+
const searchResultSchema = joi_1.default.object({
|
|
25
|
+
related_questions: joi_1.default.array().items(joi_1.default.object({
|
|
26
|
+
question: joi_1.default.string().required(),
|
|
27
|
+
link: joi_1.default.string().required(),
|
|
28
|
+
snippet: joi_1.default.string().empty([null, '']),
|
|
29
|
+
title: joi_1.default.string().required(),
|
|
30
|
+
})),
|
|
31
|
+
});
|
|
32
|
+
function GoogleSearchRelatedView({ output, outputValue, onlyLastMessage, }) {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
const { aid } = (0, CurrentAgent_1.useCurrentAgent)();
|
|
35
|
+
const { message } = (_a = (0, CurrentMessage_1.useCurrentMessage)({ optional: true })) !== null && _a !== void 0 ? _a : {};
|
|
36
|
+
const lastMessage = (0, session_1.useCurrentSessionState)((s) => { var _a; return (_a = s === null || s === void 0 ? void 0 : s.messages) === null || _a === void 0 ? void 0 : _a.at(-1); });
|
|
37
|
+
const isLastMessage = !!message && (message === null || message === void 0 ? void 0 : message.taskId) === (lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.taskId);
|
|
38
|
+
const [submitting, setSubmitting] = (0, react_1.useState)(false);
|
|
39
|
+
const { execute } = (0, runtime_1.useRuntimeState)();
|
|
40
|
+
const result = (0, react_1.useMemo)(() => {
|
|
41
|
+
const result = searchResultSchema.validate(outputValue, { allowUnknown: true });
|
|
42
|
+
if (result.error)
|
|
43
|
+
return undefined;
|
|
44
|
+
return result.value;
|
|
45
|
+
}, [outputValue]);
|
|
46
|
+
if ((!isLastMessage && onlyLastMessage) || !((_b = result === null || result === void 0 ? void 0 : result.related_questions) === null || _b === void 0 ? void 0 : _b.length))
|
|
47
|
+
return null;
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(OutputFieldContainer_1.default, { output: output, children: (0, jsx_runtime_1.jsx)(material_1.List, { dense: true, disablePadding: true, children: result.related_questions.map((item) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemButton, { onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
if (submitting)
|
|
50
|
+
return;
|
|
51
|
+
setSubmitting(true);
|
|
52
|
+
try {
|
|
53
|
+
yield execute({ aid, parameters: { question: item.question } });
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
setSubmitting(false);
|
|
57
|
+
}
|
|
58
|
+
}), children: item.question }, item.title), (0, jsx_runtime_1.jsx)(material_1.Divider, {})] }))) }) }));
|
|
59
|
+
}
|
|
60
|
+
exports.default = GoogleSearchRelatedView;
|
package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
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 joi_1 = __importDefault(require("joi"));
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const OutputFieldContainer_1 = __importDefault(require("../../components/OutputFieldContainer"));
|
|
11
|
+
const CurrentMessage_1 = require("../../contexts/CurrentMessage");
|
|
12
|
+
const searchResultSchema = joi_1.default.object({
|
|
13
|
+
organic_results: joi_1.default.array().items(joi_1.default.object({
|
|
14
|
+
title: joi_1.default.string().required(),
|
|
15
|
+
link: joi_1.default.string().required(),
|
|
16
|
+
snippet: joi_1.default.string().required(),
|
|
17
|
+
favicon: joi_1.default.string().empty([null, '']),
|
|
18
|
+
source: joi_1.default.string().empty([null, '']),
|
|
19
|
+
})),
|
|
20
|
+
});
|
|
21
|
+
function GoogleSearchSourcesView({ output, outputValue }) {
|
|
22
|
+
var _a;
|
|
23
|
+
const { message } = (_a = (0, CurrentMessage_1.useCurrentMessage)({ optional: true })) !== null && _a !== void 0 ? _a : {};
|
|
24
|
+
const searchResult = (0, react_1.useMemo)(() => {
|
|
25
|
+
const result = searchResultSchema.validate(outputValue, { allowUnknown: true });
|
|
26
|
+
if (result.error)
|
|
27
|
+
return undefined;
|
|
28
|
+
return result.value;
|
|
29
|
+
}, [outputValue]);
|
|
30
|
+
if (!message || (!(searchResult === null || searchResult === void 0 ? void 0 : searchResult.organic_results.length) && !message.loading))
|
|
31
|
+
return null;
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(OutputFieldContainer_1.default, { output: output, children: (0, jsx_runtime_1.jsxs)(material_1.Grid, { container: true, spacing: 1.5, children: [message.loading && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, sm: 3, md: 2, children: (0, jsx_runtime_1.jsx)(ItemSkeleton, {}) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, sm: 3, md: 2, children: (0, jsx_runtime_1.jsx)(ItemSkeleton, {}) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, sm: 3, md: 2, children: (0, jsx_runtime_1.jsx)(ItemSkeleton, {}) })] })), searchResult === null || searchResult === void 0 ? void 0 : searchResult.organic_results.map((item) => ((0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, sm: 3, md: 2, children: (0, jsx_runtime_1.jsx)(ItemView, { item: item }) }, item.link)))] }) }));
|
|
33
|
+
}
|
|
34
|
+
exports.default = GoogleSearchSourcesView;
|
|
35
|
+
function ItemView({ item }) {
|
|
36
|
+
var _a;
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(ItemContainer, { title: `${item.title} - ${item.source}`, favicon: (0, jsx_runtime_1.jsx)(material_1.Avatar, { src: item.favicon, sx: { width: 18, height: 18 }, children: (_a = item.source) === null || _a === void 0 ? void 0 : _a.slice(0, 1) }), link: item.link }));
|
|
38
|
+
}
|
|
39
|
+
function ItemSkeleton() {
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(ItemContainer, { title: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: "100%" }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: "40%" })] }), favicon: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 18, height: 18, variant: "circular" }), link: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: "70%" }) }));
|
|
41
|
+
}
|
|
42
|
+
function ItemContainer({ title, favicon, link }) {
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Card, { sx: { height: '100%' }, children: (0, jsx_runtime_1.jsx)(material_1.CardActionArea, { component: "a", href: typeof link === 'string' ? link : undefined, target: "_blank", sx: { height: '100%' }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { sx: { p: 1, gap: 1, height: '100%' }, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { flexGrow: 1, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", sx: {
|
|
44
|
+
display: '-webkit-box',
|
|
45
|
+
WebkitBoxOrient: 'vertical',
|
|
46
|
+
WebkitLineClamp: 2,
|
|
47
|
+
overflow: 'hidden',
|
|
48
|
+
fontWeight: 500,
|
|
49
|
+
}, children: title }) }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { flexDirection: "row", alignItems: "center", gap: 1, overflow: "hidden", children: [(0, jsx_runtime_1.jsx)(material_1.Box, { width: 18, height: 18, children: favicon }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "caption", noWrap: true, sx: { flex: 1, width: 1 }, children: link })] })] }) }) }));
|
|
50
|
+
}
|
|
@@ -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 image_preview_1 = __importDefault(require("@blocklet/ai-kit/components/image-preview"));
|
|
8
|
+
const material_1 = require("@mui/material");
|
|
9
|
+
const joi_1 = __importDefault(require("joi"));
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const OutputFieldContainer_1 = __importDefault(require("../../components/OutputFieldContainer"));
|
|
12
|
+
const CurrentMessage_1 = require("../../contexts/CurrentMessage");
|
|
13
|
+
const imagesSchema = joi_1.default.array().items(joi_1.default.object({
|
|
14
|
+
url: joi_1.default.string().required(),
|
|
15
|
+
}));
|
|
16
|
+
function ImagesView({ output, outputValue }) {
|
|
17
|
+
var _a;
|
|
18
|
+
const { message } = (_a = (0, CurrentMessage_1.useCurrentMessage)({ optional: true })) !== null && _a !== void 0 ? _a : {};
|
|
19
|
+
const images = (0, react_1.useMemo)(() => {
|
|
20
|
+
var _a;
|
|
21
|
+
const result = imagesSchema.validate(outputValue, { allowUnknown: true });
|
|
22
|
+
if (result.error)
|
|
23
|
+
return undefined;
|
|
24
|
+
return (_a = result.value) === null || _a === void 0 ? void 0 : _a.map((i) => ({ src: i.url }));
|
|
25
|
+
}, [outputValue]);
|
|
26
|
+
if (!(images === null || images === void 0 ? void 0 : images.length) && !(message === null || message === void 0 ? void 0 : message.loading))
|
|
27
|
+
return null;
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(OutputFieldContainer_1.default, { output: output, sx: { '.lazy-image-wrapper': { borderRadius: 1, img: { borderRadius: 1 } } }, children: (images === null || images === void 0 ? void 0 : images.length) ? ((0, jsx_runtime_1.jsx)(image_preview_1.default, { dataSource: images, itemWidth: 200, spacing: 1 })) : (message === null || message === void 0 ? void 0 : message.loading) ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 200, height: 200, variant: "rounded" })) : null }));
|
|
29
|
+
}
|
|
30
|
+
exports.default = ImagesView;
|
|
@@ -0,0 +1,13 @@
|
|
|
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 css_1 = require("@emotion/css");
|
|
8
|
+
const MarkdownRenderer_1 = __importDefault(require("../../components/MarkdownRenderer"));
|
|
9
|
+
const OutputFieldContainer_1 = __importDefault(require("../../components/OutputFieldContainer"));
|
|
10
|
+
function MarkdownView({ output, outputValue, fontSize, writing, }) {
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(OutputFieldContainer_1.default, { output: output, children: (0, jsx_runtime_1.jsx)(MarkdownRenderer_1.default, { className: (0, css_1.cx)(writing && 'writing'), sx: { fontSize: typeof fontSize === 'string' && /^\d+$/.test(fontSize) ? Number(fontSize) : fontSize }, children: outputValue }) }));
|
|
12
|
+
}
|
|
13
|
+
exports.default = MarkdownView;
|