@blocklet/pages-kit 0.2.341 → 0.2.342
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/agent.js +3 -5
- package/lib/cjs/builtin/async/ai-runtime/api/message.js +2 -4
- package/lib/cjs/builtin/async/ai-runtime/api/request.js +5 -1
- package/lib/cjs/builtin/async/ai-runtime/api/{subscription.js → secret.js} +7 -15
- package/lib/cjs/builtin/async/ai-runtime/api/session.js +9 -10
- package/lib/cjs/builtin/async/ai-runtime/components/AgentErrorBoundary.js +27 -0
- package/lib/cjs/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.js +80 -0
- package/lib/cjs/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.js +1 -1
- package/lib/cjs/builtin/async/ai-runtime/components/ShareActions/index.js +10 -10
- package/lib/cjs/builtin/async/ai-runtime/constants.js +2 -1
- package/lib/cjs/builtin/async/ai-runtime/contexts/CurrentAgent.js +2 -2
- package/lib/cjs/builtin/async/ai-runtime/contexts/Runtime.js +4 -3
- package/lib/cjs/builtin/async/ai-runtime/hooks/use-agent-admin.js +11 -0
- package/lib/cjs/builtin/async/ai-runtime/hooks/use-header-menu.js +10 -2
- package/lib/cjs/builtin/async/ai-runtime/locales/index.js +4 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime/Runtime/index.js +5 -4
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +26 -57
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageItemView.js +10 -19
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/index.js +2 -2
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.js +1 -1
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +3 -3
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.js +5 -5
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +5 -4
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.js +1 -1
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.js +2 -2
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +5 -4
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +2 -2
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.js +2 -2
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Input.js +1 -1
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Output.js +5 -5
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Page.js +7 -7
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +8 -8
- package/lib/cjs/builtin/async/ai-runtime/state/agent.js +7 -8
- package/lib/cjs/builtin/async/ai-runtime/state/runtime.js +5 -5
- package/lib/cjs/builtin/async/ai-runtime/state/session.js +15 -17
- package/lib/cjs/builtin/page/header.js +3 -3
- package/lib/cjs/components/CustomComponentRenderer/index.js +1 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/builtin/async/ai-runtime/api/agent.js +4 -6
- package/lib/esm/builtin/async/ai-runtime/api/message.js +3 -5
- package/lib/esm/builtin/async/ai-runtime/api/request.js +3 -0
- package/lib/esm/builtin/async/ai-runtime/api/{subscription.js → secret.js} +7 -14
- package/lib/esm/builtin/async/ai-runtime/api/session.js +10 -11
- package/lib/esm/builtin/async/ai-runtime/components/AgentErrorBoundary.js +22 -0
- package/lib/esm/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.js +76 -0
- package/lib/esm/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/components/ShareActions/index.js +10 -10
- package/lib/esm/builtin/async/ai-runtime/constants.js +1 -0
- package/lib/esm/builtin/async/ai-runtime/contexts/CurrentAgent.js +2 -2
- package/lib/esm/builtin/async/ai-runtime/contexts/Runtime.js +4 -3
- package/lib/esm/builtin/async/ai-runtime/hooks/use-agent-admin.js +7 -0
- package/lib/esm/builtin/async/ai-runtime/hooks/use-header-menu.js +11 -3
- package/lib/esm/builtin/async/ai-runtime/locales/index.js +4 -0
- package/lib/esm/builtin/async/ai-runtime/runtime/Runtime/index.js +5 -4
- package/lib/esm/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +27 -58
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageItemView.js +10 -19
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/index.js +2 -2
- package/lib/esm/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +3 -3
- package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.js +5 -5
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +5 -4
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.js +2 -2
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +5 -4
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +2 -2
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.js +2 -2
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Input.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Output.js +5 -5
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Page.js +7 -7
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +8 -8
- package/lib/esm/builtin/async/ai-runtime/state/agent.js +6 -6
- package/lib/esm/builtin/async/ai-runtime/state/runtime.js +5 -5
- package/lib/esm/builtin/async/ai-runtime/state/session.js +15 -17
- package/lib/esm/builtin/page/header.js +3 -3
- package/lib/esm/components/CustomComponentRenderer/BlockletReactComponentRenderer.js +1 -1
- package/lib/esm/components/CustomComponentRenderer/index.js +1 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/builtin/async/ai-runtime/api/agent.d.ts +10 -1
- package/lib/types/builtin/async/ai-runtime/api/message.d.ts +4 -15
- package/lib/types/builtin/async/ai-runtime/api/request.d.ts +1 -0
- package/lib/types/builtin/async/ai-runtime/api/secret.d.ts +12 -0
- package/lib/types/builtin/async/ai-runtime/api/session.d.ts +5 -8
- package/lib/types/builtin/async/ai-runtime/components/AgentErrorBoundary.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.d.ts +10 -0
- package/lib/types/builtin/async/ai-runtime/constants.d.ts +1 -0
- package/lib/types/builtin/async/ai-runtime/contexts/Runtime.d.ts +3 -1
- package/lib/types/builtin/async/ai-runtime/hooks/use-agent-admin.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/locales/index.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/runtime/Runtime/index.d.ts +2 -1
- package/lib/types/builtin/async/ai-runtime/state/agent.d.ts +2 -6
- package/lib/types/builtin/async/ai-runtime/state/runtime.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/state/session.d.ts +1 -0
- package/lib/types/builtin/page/header.d.ts +2 -2
- package/lib/types/components/CustomComponentRenderer/index.d.ts +3 -0
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/lib/types/builtin/async/ai-runtime/api/subscription.d.ts +0 -15
|
@@ -11,14 +11,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getAgent = void 0;
|
|
13
13
|
const ufo_1 = require("ufo");
|
|
14
|
-
const utils_1 = require("../../../utils");
|
|
15
|
-
const constants_1 = require("../constants");
|
|
16
14
|
const request_1 = require("./request");
|
|
17
15
|
function getAgent(_a) {
|
|
18
|
-
return __awaiter(this, arguments, void 0, function* ({ aid, working }) {
|
|
16
|
+
return __awaiter(this, arguments, void 0, function* ({ aid, blockletDid, working, }) {
|
|
19
17
|
return (0, request_1.request)({
|
|
20
|
-
url: (0, ufo_1.joinURL)((0,
|
|
21
|
-
query: { working },
|
|
18
|
+
url: (0, ufo_1.joinURL)((0, request_1.getAIRuntimeApiPrefix)(), '/api/agents', aid),
|
|
19
|
+
query: { working, blockletDid },
|
|
22
20
|
});
|
|
23
21
|
});
|
|
24
22
|
}
|
|
@@ -22,14 +22,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.deleteMessages = exports.getMessages = void 0;
|
|
24
24
|
const ufo_1 = require("ufo");
|
|
25
|
-
const utils_1 = require("../../../utils");
|
|
26
|
-
const constants_1 = require("../constants");
|
|
27
25
|
const request_1 = require("./request");
|
|
28
26
|
function getMessages(_a) {
|
|
29
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
28
|
var { sessionId } = _a, query = __rest(_a, ["sessionId"]);
|
|
31
29
|
return (0, request_1.request)({
|
|
32
|
-
url: (0, ufo_1.joinURL)((0,
|
|
30
|
+
url: (0, ufo_1.joinURL)((0, request_1.getAIRuntimeApiPrefix)(), '/api/sessions', sessionId, 'messages'),
|
|
33
31
|
query,
|
|
34
32
|
});
|
|
35
33
|
});
|
|
@@ -39,7 +37,7 @@ function deleteMessages(_a) {
|
|
|
39
37
|
return __awaiter(this, arguments, void 0, function* ({ sessionId }) {
|
|
40
38
|
yield (0, request_1.request)({
|
|
41
39
|
method: 'DELETE',
|
|
42
|
-
url: (0, ufo_1.joinURL)((0,
|
|
40
|
+
url: (0, ufo_1.joinURL)((0, request_1.getAIRuntimeApiPrefix)(), '/api/sessions', sessionId, 'messages'),
|
|
43
41
|
});
|
|
44
42
|
});
|
|
45
43
|
}
|
|
@@ -20,9 +20,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.request = exports.fetch = void 0;
|
|
23
|
+
exports.request = exports.fetch = exports.getAIRuntimeApiPrefix = void 0;
|
|
24
24
|
const js_sdk_1 = require("@blocklet/js-sdk");
|
|
25
25
|
const ufo_1 = require("ufo");
|
|
26
|
+
const utils_1 = require("../../../utils");
|
|
27
|
+
const constants_1 = require("../constants");
|
|
26
28
|
const error_1 = require("../error");
|
|
27
29
|
let isDEV = false;
|
|
28
30
|
try {
|
|
@@ -32,6 +34,8 @@ try {
|
|
|
32
34
|
catch (_a) {
|
|
33
35
|
// ignore
|
|
34
36
|
}
|
|
37
|
+
const getAIRuntimeApiPrefix = () => window.AI_RUNTIME_API_PREFIX || (0, utils_1.getComponentMountPoint)(constants_1.AI_RUNTIME_DID);
|
|
38
|
+
exports.getAIRuntimeApiPrefix = getAIRuntimeApiPrefix;
|
|
35
39
|
exports.fetch = (0, js_sdk_1.createFetch)({}, { lazy: isDEV, lazyTime: 1000 });
|
|
36
40
|
function request(_a) {
|
|
37
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9,24 +9,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.createSecrets = void 0;
|
|
13
13
|
const ufo_1 = require("ufo");
|
|
14
|
-
const utils_1 = require("../../../utils");
|
|
15
|
-
const constants_1 = require("../constants");
|
|
16
14
|
const request_1 = require("./request");
|
|
17
|
-
function
|
|
18
|
-
return __awaiter(this, arguments, void 0, function* ({
|
|
15
|
+
function createSecrets(_a) {
|
|
16
|
+
return __awaiter(this, arguments, void 0, function* ({ input }) {
|
|
19
17
|
return (0, request_1.request)({
|
|
20
|
-
|
|
18
|
+
method: 'POST',
|
|
19
|
+
url: (0, ufo_1.joinURL)((0, request_1.getAIRuntimeApiPrefix)(), '/api/secrets'),
|
|
20
|
+
body: input,
|
|
21
21
|
});
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
exports.
|
|
25
|
-
function getRelease(_a) {
|
|
26
|
-
return __awaiter(this, arguments, void 0, function* ({ aid }) {
|
|
27
|
-
return (0, request_1.request)({
|
|
28
|
-
url: (0, ufo_1.withQuery)((0, ufo_1.joinURL)((0, utils_1.getComponentMountPoint)(constants_1.AI_STUDIO_DID), '/api/releases/by-aid'), { aid }),
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
exports.getRelease = getRelease;
|
|
24
|
+
exports.createSecrets = createSecrets;
|
|
@@ -25,13 +25,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
25
25
|
exports.runAgent = exports.deleteSession = exports.updateSession = exports.clearSession = exports.createSession = exports.getSession = exports.getSessions = void 0;
|
|
26
26
|
const ufo_1 = require("ufo");
|
|
27
27
|
const stream_1 = require("../../../stream");
|
|
28
|
-
const utils_1 = require("../../../utils");
|
|
29
|
-
const constants_1 = require("../constants");
|
|
30
28
|
const request_1 = require("./request");
|
|
31
29
|
function getSessions(_a) {
|
|
32
30
|
return __awaiter(this, arguments, void 0, function* ({ aid }) {
|
|
33
31
|
return (0, request_1.request)({
|
|
34
|
-
url: (0, ufo_1.joinURL)((0,
|
|
32
|
+
url: (0, ufo_1.joinURL)((0, request_1.getAIRuntimeApiPrefix)(), '/api/sessions'),
|
|
35
33
|
query: { aid },
|
|
36
34
|
});
|
|
37
35
|
});
|
|
@@ -40,7 +38,7 @@ exports.getSessions = getSessions;
|
|
|
40
38
|
function getSession(_a) {
|
|
41
39
|
return __awaiter(this, arguments, void 0, function* ({ sessionId }) {
|
|
42
40
|
return (0, request_1.request)({
|
|
43
|
-
url: (0, ufo_1.joinURL)((0,
|
|
41
|
+
url: (0, ufo_1.joinURL)((0, request_1.getAIRuntimeApiPrefix)(), '/api/sessions', sessionId),
|
|
44
42
|
});
|
|
45
43
|
});
|
|
46
44
|
}
|
|
@@ -49,7 +47,7 @@ function createSession(_a) {
|
|
|
49
47
|
return __awaiter(this, arguments, void 0, function* ({ aid, name, }) {
|
|
50
48
|
return (0, request_1.request)({
|
|
51
49
|
method: 'POST',
|
|
52
|
-
url: (0, ufo_1.joinURL)((0,
|
|
50
|
+
url: (0, ufo_1.joinURL)((0, request_1.getAIRuntimeApiPrefix)(), '/api/sessions'),
|
|
53
51
|
body: {
|
|
54
52
|
aid,
|
|
55
53
|
name,
|
|
@@ -62,7 +60,7 @@ function clearSession(_a) {
|
|
|
62
60
|
return __awaiter(this, arguments, void 0, function* ({ sessionId }) {
|
|
63
61
|
return (0, request_1.request)({
|
|
64
62
|
method: 'POST',
|
|
65
|
-
url: (0, ufo_1.joinURL)((0,
|
|
63
|
+
url: (0, ufo_1.joinURL)((0, request_1.getAIRuntimeApiPrefix)(), '/api/sessions', sessionId, '/clear'),
|
|
66
64
|
});
|
|
67
65
|
});
|
|
68
66
|
}
|
|
@@ -71,7 +69,7 @@ function updateSession(_a) {
|
|
|
71
69
|
return __awaiter(this, arguments, void 0, function* ({ sessionId, name, }) {
|
|
72
70
|
return (0, request_1.request)({
|
|
73
71
|
method: 'PATCH',
|
|
74
|
-
url: (0, ufo_1.joinURL)((0,
|
|
72
|
+
url: (0, ufo_1.joinURL)((0, request_1.getAIRuntimeApiPrefix)(), '/api/sessions', sessionId),
|
|
75
73
|
body: { name },
|
|
76
74
|
});
|
|
77
75
|
});
|
|
@@ -81,21 +79,22 @@ function deleteSession(_a) {
|
|
|
81
79
|
return __awaiter(this, arguments, void 0, function* ({ sessionId, }) {
|
|
82
80
|
return (0, request_1.request)({
|
|
83
81
|
method: 'DELETE',
|
|
84
|
-
url: (0, ufo_1.joinURL)((0,
|
|
82
|
+
url: (0, ufo_1.joinURL)((0, request_1.getAIRuntimeApiPrefix)(), '/api/sessions', sessionId),
|
|
85
83
|
});
|
|
86
84
|
});
|
|
87
85
|
}
|
|
88
86
|
exports.deleteSession = deleteSession;
|
|
89
87
|
function runAgent(_a) {
|
|
90
|
-
return __asyncGenerator(this, arguments, function* runAgent_1({ aid, sessionId, working, parameters, }) {
|
|
88
|
+
return __asyncGenerator(this, arguments, function* runAgent_1({ aid, sessionId, blockletDid, working, parameters, }) {
|
|
91
89
|
var _b;
|
|
92
|
-
const res = yield __await((0, request_1.fetch)((0, ufo_1.joinURL)((0,
|
|
90
|
+
const res = yield __await((0, request_1.fetch)((0, ufo_1.joinURL)((0, request_1.getAIRuntimeApiPrefix)(), '/api/ai/call'), {
|
|
93
91
|
method: 'POST',
|
|
94
92
|
headers: {
|
|
95
93
|
'Content-Type': 'application/json',
|
|
96
94
|
Accept: 'text/event-stream',
|
|
97
95
|
},
|
|
98
96
|
body: JSON.stringify({
|
|
97
|
+
blockletDid,
|
|
99
98
|
sessionId,
|
|
100
99
|
parameters: Object.assign(Object.assign({}, parameters), { $clientTime: new Date().toISOString() }),
|
|
101
100
|
aid,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentErrorView = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const react_error_boundary_1 = require("react-error-boundary");
|
|
7
|
+
const locale_1 = require("../../../locale");
|
|
8
|
+
const use_agent_admin_1 = require("../hooks/use-agent-admin");
|
|
9
|
+
const runtime_1 = require("../state/runtime");
|
|
10
|
+
const AgentSettingsDialog_1 = require("./AgentSettings/AgentSettingsDialog");
|
|
11
|
+
function AgentErrorBoundary() {
|
|
12
|
+
return (0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: AgentErrorView });
|
|
13
|
+
}
|
|
14
|
+
exports.default = AgentErrorBoundary;
|
|
15
|
+
function AgentErrorView({ error }) {
|
|
16
|
+
if (error.type === 'MissingSecretError') {
|
|
17
|
+
return (0, jsx_runtime_1.jsx)(MissingSecretErrorView, {});
|
|
18
|
+
}
|
|
19
|
+
return (0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "error", children: String(error === null || error === void 0 ? void 0 : error.message) });
|
|
20
|
+
}
|
|
21
|
+
exports.AgentErrorView = AgentErrorView;
|
|
22
|
+
function MissingSecretErrorView() {
|
|
23
|
+
const { t } = (0, locale_1.useLocaleContext)();
|
|
24
|
+
const { agent } = (0, runtime_1.useRuntimeState)();
|
|
25
|
+
const isAdmin = (0, use_agent_admin_1.useIsAgentAdmin)(agent);
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "error", sx: { [`.${material_1.alertClasses.message}`]: { flex: 1 } }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { width: "100%", children: ["Required configuration is missing. Please complete the setup before proceeding.", isAdmin && ((0, jsx_runtime_1.jsx)(material_1.Stack, { alignItems: "flex-end", children: (0, jsx_runtime_1.jsx)(material_1.Button, { size: "small", variant: "outlined", onClick: () => AgentSettingsDialog_1.settingsDialogState.getState().open(), children: t('setup') }) }))] }) }));
|
|
27
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.settingsDialogState = void 0;
|
|
24
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
25
|
+
const lab_1 = require("@mui/lab");
|
|
26
|
+
const material_1 = require("@mui/material");
|
|
27
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
28
|
+
const zustand_1 = require("zustand");
|
|
29
|
+
const immer_1 = require("zustand/middleware/immer");
|
|
30
|
+
const ux_1 = require("../../../../arcblock/ux");
|
|
31
|
+
const locale_1 = require("../../../../locale");
|
|
32
|
+
const secret_1 = require("../../api/secret");
|
|
33
|
+
const agent_1 = require("../../state/agent");
|
|
34
|
+
const runtime_1 = require("../../state/runtime");
|
|
35
|
+
exports.settingsDialogState = (0, zustand_1.create)()((0, immer_1.immer)((set) => ({
|
|
36
|
+
isOpen: false,
|
|
37
|
+
open() {
|
|
38
|
+
set((state) => {
|
|
39
|
+
state.isOpen = true;
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
onClose() {
|
|
43
|
+
set((state) => {
|
|
44
|
+
state.isOpen = false;
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
})));
|
|
48
|
+
function AgentSettingsDialog(_a) {
|
|
49
|
+
var props = __rest(_a, []);
|
|
50
|
+
const { t } = (0, locale_1.useLocaleContext)();
|
|
51
|
+
const isOpen = (0, exports.settingsDialogState)((state) => state.isOpen);
|
|
52
|
+
const onClose = (0, exports.settingsDialogState)((state) => state.onClose);
|
|
53
|
+
const { aid, blockletDid, working } = (0, runtime_1.useRuntimeState)();
|
|
54
|
+
const [agent, state] = (0, agent_1.useAgentState)({ aid, blockletDid, working });
|
|
55
|
+
const form = (0, react_hook_form_1.useForm)({
|
|
56
|
+
defaultValues: {
|
|
57
|
+
secrets: agent.config.secrets.map((i) => ({
|
|
58
|
+
projectId: agent.project.id,
|
|
59
|
+
targetProjectId: i.targetProjectId,
|
|
60
|
+
targetAgentId: i.targetAgentId,
|
|
61
|
+
targetInputKey: i.targetInput.key,
|
|
62
|
+
secret: '',
|
|
63
|
+
})),
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
const onSubmit = (input) => __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
try {
|
|
68
|
+
yield (0, secret_1.createSecrets)({ input });
|
|
69
|
+
yield state.load();
|
|
70
|
+
ux_1.Toast.success(t('saved'));
|
|
71
|
+
onClose();
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
ux_1.Toast.error(error.message);
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Dialog, Object.assign({ fullWidth: true, maxWidth: "md" }, props, { open: isOpen, onClose: onClose, component: "form", onSubmit: form.handleSubmit(onSubmit), children: [(0, jsx_runtime_1.jsx)(material_1.DialogTitle, { children: t('settings') }), (0, jsx_runtime_1.jsx)(material_1.DialogContent, { children: (0, jsx_runtime_1.jsx)(material_1.Stack, { gap: 1, children: agent.config.secrets.map(({ targetInput, hasValue }, index) => ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: 0.5, children: [(0, jsx_runtime_1.jsx)(material_1.FormLabel, { children: targetInput.label || targetInput.key }), (0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({ type: "password", fullWidth: true, hiddenLabel: true, size: "small", inputProps: { maxLength: 100 }, placeholder: hasValue ? '******' : targetInput.placeholder }, form.register(`secrets.${index}.secret`, { required: true })))] }, targetInput.id))) }) }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { onClick: onClose, children: t('cancel') }), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, { type: "submit", variant: "contained", loading: form.formState.isSubmitting, children: t('save') })] })] })));
|
|
79
|
+
}
|
|
80
|
+
exports.default = AgentSettingsDialog;
|
|
@@ -44,6 +44,6 @@ function LoadingMenuItem(_a) {
|
|
|
44
44
|
setLoading(false);
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({}, props, { onClick: handleClick, sx: Object.assign(Object.assign({}, props.sx), { display: 'flex', alignItems: 'center'
|
|
47
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({}, props, { onClick: handleClick, sx: Object.assign(Object.assign({}, props.sx), { display: 'flex', alignItems: 'center' }), children: [(clicked && confirmation) || children, (0, jsx_runtime_1.jsx)(material_1.Stack, { direction: "row", alignItems: "center", justifyContent: "flex-end", sx: { width: 18 }, children: loading && (0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 14 }) })] })));
|
|
48
48
|
}
|
|
49
49
|
exports.default = LoadingMenuItem;
|
|
@@ -85,11 +85,11 @@ const ShareActionsMap = {
|
|
|
85
85
|
saveAs: ShareSave,
|
|
86
86
|
};
|
|
87
87
|
function ShareTwitter() {
|
|
88
|
-
var _a, _b, _c, _d, _e, _f;
|
|
88
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
89
89
|
const { t } = (0, locale_1.useLocaleContext)();
|
|
90
90
|
const { message } = (0, CurrentMessage_1.useCurrentMessage)();
|
|
91
|
-
const content = ((_a = message.
|
|
92
|
-
((
|
|
91
|
+
const content = ((_c = (_b = (_a = message.outputs) === null || _a === void 0 ? void 0 : _a.objects) === null || _b === void 0 ? void 0 : _b.find((i) => i === null || i === void 0 ? void 0 : i[types_1.RuntimeOutputVariable.text])) === null || _c === void 0 ? void 0 : _c[types_1.RuntimeOutputVariable.text]) ||
|
|
92
|
+
((_h = (_g = (_f = (_e = (_d = message.outputs) === null || _d === void 0 ? void 0 : _d.objects) === null || _e === void 0 ? void 0 : _e.find((i) => { var _a; return (_a = i === null || i === void 0 ? void 0 : i[types_1.RuntimeOutputVariable.images]) === null || _a === void 0 ? void 0 : _a.length; })) === null || _f === void 0 ? void 0 : _f[types_1.RuntimeOutputVariable.images]) === null || _g === void 0 ? void 0 : _g.at(0)) === null || _h === void 0 ? void 0 : _h.url);
|
|
93
93
|
if (!content)
|
|
94
94
|
return null;
|
|
95
95
|
return ((0, jsx_runtime_1.jsx)(StyledActionButton, { tip: t('socialShare.shareToX'), title: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:brand-x" }), href: (0, ufo_1.withQuery)('https://twitter.com/intent/tweet', {
|
|
@@ -98,11 +98,11 @@ function ShareTwitter() {
|
|
|
98
98
|
}), target: '_blank' }));
|
|
99
99
|
}
|
|
100
100
|
function ShareCopy() {
|
|
101
|
-
var _a, _b, _c, _d, _e, _f;
|
|
101
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
102
102
|
const { t } = (0, locale_1.useLocaleContext)();
|
|
103
103
|
const { message } = (0, CurrentMessage_1.useCurrentMessage)();
|
|
104
|
-
const content = (_a = message.
|
|
105
|
-
const image = (
|
|
104
|
+
const content = (_c = (_b = (_a = message.outputs) === null || _a === void 0 ? void 0 : _a.objects) === null || _b === void 0 ? void 0 : _b.find((i) => i === null || i === void 0 ? void 0 : i[types_1.RuntimeOutputVariable.text])) === null || _c === void 0 ? void 0 : _c[types_1.RuntimeOutputVariable.text];
|
|
105
|
+
const image = (_h = (_g = (_f = (_e = (_d = message.outputs) === null || _d === void 0 ? void 0 : _d.objects) === null || _e === void 0 ? void 0 : _e.find((i) => { var _a; return (_a = i === null || i === void 0 ? void 0 : i[types_1.RuntimeOutputVariable.images]) === null || _a === void 0 ? void 0 : _a.length; })) === null || _f === void 0 ? void 0 : _f[types_1.RuntimeOutputVariable.images]) === null || _g === void 0 ? void 0 : _g.at(0)) === null || _h === void 0 ? void 0 : _h.url;
|
|
106
106
|
if (!content && !image)
|
|
107
107
|
return null;
|
|
108
108
|
return ((0, jsx_runtime_1.jsx)(StyledActionButton, { autoReset: true, tip: t('copy'), tipSucceed: t('copied'), title: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:copy" }), titleSucceed: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:copy-check" }), onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -116,13 +116,13 @@ function ShareCopy() {
|
|
|
116
116
|
}) }));
|
|
117
117
|
}
|
|
118
118
|
function ShareSave() {
|
|
119
|
-
var _a, _b, _c, _d, _e, _f;
|
|
119
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
120
120
|
const { t } = (0, locale_1.useLocaleContext)();
|
|
121
121
|
const { message } = (0, CurrentMessage_1.useCurrentMessage)();
|
|
122
122
|
const { aid, agent } = (0, runtime_1.useRuntimeState)();
|
|
123
123
|
const profile = (0, use_appearances_1.useProfile)({ aid });
|
|
124
|
-
const content = (_a = message.
|
|
125
|
-
const image = (
|
|
124
|
+
const content = (_c = (_b = (_a = message.outputs) === null || _a === void 0 ? void 0 : _a.objects) === null || _b === void 0 ? void 0 : _b.find((i) => i === null || i === void 0 ? void 0 : i[types_1.RuntimeOutputVariable.text])) === null || _c === void 0 ? void 0 : _c[types_1.RuntimeOutputVariable.text];
|
|
125
|
+
const image = (_h = (_g = (_f = (_e = (_d = message.outputs) === null || _d === void 0 ? void 0 : _d.objects) === null || _e === void 0 ? void 0 : _e.find((i) => { var _a; return (_a = i === null || i === void 0 ? void 0 : i[types_1.RuntimeOutputVariable.images]) === null || _a === void 0 ? void 0 : _a.length; })) === null || _f === void 0 ? void 0 : _f[types_1.RuntimeOutputVariable.images]) === null || _g === void 0 ? void 0 : _g.at(0)) === null || _h === void 0 ? void 0 : _h.url;
|
|
126
126
|
if (!content && !image)
|
|
127
127
|
return null;
|
|
128
128
|
return ((0, jsx_runtime_1.jsx)(StyledActionButton, { tip: t('save'), tipSucceed: t('saved'), title: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:file-download" }), titleSucceed: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:file-check" }), onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -134,7 +134,7 @@ function ShareSave() {
|
|
|
134
134
|
yield html2pdf()
|
|
135
135
|
.set({
|
|
136
136
|
margin: 1,
|
|
137
|
-
filename: `${profile.name || agent.id} - ${message.
|
|
137
|
+
filename: `${profile.name || agent.id} - ${message.id}.pdf`,
|
|
138
138
|
image: { type: 'jpeg', quality: 0.98 },
|
|
139
139
|
html2canvas: { scale: 2 },
|
|
140
140
|
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' },
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDefaultOutputComponent = exports.DEFAULT_OUTPUT_COMPONENTS = exports.OPENING_QUESTIONS_VIEW_ID = 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;
|
|
3
|
+
exports.getDefaultOutputComponent = exports.DEFAULT_OUTPUT_COMPONENTS = exports.OPENING_QUESTIONS_VIEW_ID = 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_RUNTIME_DID = exports.AI_STUDIO_DID = void 0;
|
|
4
4
|
const types_1 = require("@blocklet/ai-runtime/types");
|
|
5
5
|
exports.AI_STUDIO_DID = 'z8iZpog7mcgcgBZzTiXJCWESvmnRrQmnd3XBB';
|
|
6
|
+
exports.AI_RUNTIME_DID = 'z2qa5vnwATPJyAnBYm7SbLMMjfeXJgeBKkfMG';
|
|
6
7
|
exports.PAYMENT_KIT_DID = 'z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk';
|
|
7
8
|
exports.DEFAULT_PAGE_COMPONENT_ID = 'ctnxha29uu8cx4xv'; // Simple Layout
|
|
8
9
|
exports.DEFAULT_INPUT_COMPONENT_ID = '1wwtemqcdio6nqf0'; // Auto Form
|
|
@@ -19,7 +19,7 @@ function CurrentAgentProvider({ agentId, children }) {
|
|
|
19
19
|
}
|
|
20
20
|
exports.default = CurrentAgentProvider;
|
|
21
21
|
function useCurrentAgent(args = {}) {
|
|
22
|
-
const { aid: runtimeAid, working } = (0, runtime_1.useRuntimeState)();
|
|
22
|
+
const { blockletDid, aid: runtimeAid, working } = (0, runtime_1.useRuntimeState)();
|
|
23
23
|
const aidFromParam = (0, react_1.useMemo)(() => args.aid ||
|
|
24
24
|
(args.agentId
|
|
25
25
|
? (0, aid_1.stringifyIdentity)(Object.assign(Object.assign({}, (0, aid_1.parseIdentity)(runtimeAid, { rejectWhenError: true })), { assistantId: args.agentId }))
|
|
@@ -29,7 +29,7 @@ function useCurrentAgent(args = {}) {
|
|
|
29
29
|
if (!aid) {
|
|
30
30
|
throw new Error('No such current agent state. You should use `useCurrentAgent` within the `CurrentAgentProvider`');
|
|
31
31
|
}
|
|
32
|
-
const [agent] = (0, agent_1.useAgentState)({ aid, working });
|
|
32
|
+
const [agent] = (0, agent_1.useAgentState)({ blockletDid, aid, working });
|
|
33
33
|
return { aid, agent };
|
|
34
34
|
}
|
|
35
35
|
exports.useCurrentAgent = useCurrentAgent;
|
|
@@ -14,19 +14,20 @@ function useRuntimeContext() {
|
|
|
14
14
|
return context;
|
|
15
15
|
}
|
|
16
16
|
exports.useRuntimeContext = useRuntimeContext;
|
|
17
|
-
function RuntimeProvider({ aid, working, children, }) {
|
|
17
|
+
function RuntimeProvider({ blockletDid, aid, working, children, }) {
|
|
18
18
|
if (!aid)
|
|
19
19
|
throw new Error('Missing required props `aid`');
|
|
20
|
-
const value = (0, react_1.useMemo)(() => ({ aid, working }), [aid, working]);
|
|
20
|
+
const value = (0, react_1.useMemo)(() => ({ blockletDid, aid, working }), [blockletDid, aid, working]);
|
|
21
21
|
return (0, jsx_runtime_1.jsx)(runtimeContext.Provider, { value: value, children: children });
|
|
22
22
|
}
|
|
23
23
|
exports.default = RuntimeProvider;
|
|
24
24
|
function RuntimeProviderFromUrl({ children }) {
|
|
25
25
|
const [query] = (0, react_router_dom_1.useSearchParams)();
|
|
26
26
|
const aid = query.get('aid');
|
|
27
|
+
const blockletDid = query.get('blockletDid') || undefined;
|
|
27
28
|
const working = query.get('working') === 'true';
|
|
28
29
|
if (!aid)
|
|
29
30
|
throw new error_1.CustomError(404, 'Missing required query parameters `aid`');
|
|
30
|
-
return ((0, jsx_runtime_1.jsx)(RuntimeProvider, { aid: aid, working: working, children: children }));
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(RuntimeProvider, { blockletDid: blockletDid, aid: aid, working: working, children: children }));
|
|
31
32
|
}
|
|
32
33
|
exports.RuntimeProviderFromUrl = RuntimeProviderFromUrl;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useIsAgentAdmin = void 0;
|
|
4
|
+
const session_1 = require("../../../session");
|
|
5
|
+
function useIsAgentAdmin(agent) {
|
|
6
|
+
const { session } = (0, session_1.useSessionContext)();
|
|
7
|
+
if (!session.user)
|
|
8
|
+
return false;
|
|
9
|
+
return session.user.did === agent.createdBy;
|
|
10
|
+
}
|
|
11
|
+
exports.useIsAgentAdmin = useIsAgentAdmin;
|
|
@@ -18,20 +18,28 @@ const react_1 = require("@iconify/react");
|
|
|
18
18
|
const material_1 = require("@mui/material");
|
|
19
19
|
const locale_1 = require("../../../locale");
|
|
20
20
|
const header_1 = require("../../../page/header");
|
|
21
|
+
const AgentSettingsDialog_1 = require("../components/AgentSettings/AgentSettingsDialog");
|
|
21
22
|
const PopperMenuButton_1 = __importDefault(require("../components/PopperMenuButton"));
|
|
22
23
|
const LoadingMenuItem_1 = __importDefault(require("../components/PopperMenuButton/LoadingMenuItem"));
|
|
23
24
|
const ComponentPreferences_1 = require("../contexts/ComponentPreferences");
|
|
25
|
+
const runtime_1 = require("../state/runtime");
|
|
24
26
|
const session_1 = require("../state/session");
|
|
27
|
+
const use_agent_admin_1 = require("./use-agent-admin");
|
|
25
28
|
function useHeaderMenu() {
|
|
26
29
|
var _a;
|
|
27
30
|
const { t, locale } = (0, locale_1.useLocaleContext)();
|
|
28
31
|
const { hideHeaderMenuButton } = (_a = (0, ComponentPreferences_1.useComponentPreferences)()) !== null && _a !== void 0 ? _a : {};
|
|
29
32
|
const clearSession = (0, session_1.useSessionState)((s) => s.clearSession);
|
|
33
|
+
const { agent } = (0, runtime_1.useRuntimeState)();
|
|
34
|
+
const isAdmin = (0, use_agent_admin_1.useIsAgentAdmin)(agent);
|
|
30
35
|
(0, header_1.useHeader)(() => hideHeaderMenuButton
|
|
31
36
|
? {}
|
|
32
37
|
: {
|
|
33
|
-
addons: (
|
|
34
|
-
(0, jsx_runtime_1.jsx)(PopperMenuButton_1.default, { component: material_1.IconButton, PopperProps: { placement: 'bottom-end', sx: { zIndex: 'appBar' } }, menus:
|
|
38
|
+
addons: (exists) => [
|
|
39
|
+
(0, jsx_runtime_1.jsx)(PopperMenuButton_1.default, { component: material_1.IconButton, PopperProps: { placement: 'bottom-end', sx: { zIndex: 'appBar' } }, menus: [
|
|
40
|
+
isAdmin && ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, { onClick: () => AgentSettingsDialog_1.settingsDialogState.getState().open(), children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:settings" }) }), t('settings')] }, "settings")),
|
|
41
|
+
(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')] }, "clearSession"),
|
|
42
|
+
], children: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:dots" }) }),
|
|
35
43
|
...exists,
|
|
36
44
|
],
|
|
37
45
|
}, [locale, hideHeaderMenuButton]);
|
|
@@ -113,6 +113,8 @@ exports.translations = {
|
|
|
113
113
|
retry: 'Try Again',
|
|
114
114
|
errorCodeTip: 'Agent found some syntax errors in the code, and want to try again...',
|
|
115
115
|
},
|
|
116
|
+
settings: 'Settings',
|
|
117
|
+
setup: 'Setup',
|
|
116
118
|
},
|
|
117
119
|
zh: {
|
|
118
120
|
by: '作者',
|
|
@@ -225,5 +227,7 @@ exports.translations = {
|
|
|
225
227
|
retry: '重试',
|
|
226
228
|
errorCodeTip: 'Agent 发现代码存在一些语法问题,请求重试...',
|
|
227
229
|
},
|
|
230
|
+
settings: '设置',
|
|
231
|
+
setup: '设置',
|
|
228
232
|
},
|
|
229
233
|
};
|
|
@@ -35,6 +35,7 @@ const ux_1 = require("../../../../arcblock/ux");
|
|
|
35
35
|
const locale_1 = require("../../../../locale");
|
|
36
36
|
const header_1 = require("../../../../page/header");
|
|
37
37
|
const utils_1 = require("../../../../utils");
|
|
38
|
+
const AgentSettingsDialog_1 = __importDefault(require("../../components/AgentSettings/AgentSettingsDialog"));
|
|
38
39
|
const RuntimeCommonProvider_1 = __importStar(require("../../components/RuntimeCommonProvider"));
|
|
39
40
|
const SocialShare_1 = __importDefault(require("../../components/SocialShare"));
|
|
40
41
|
const ThemeProvider_1 = __importDefault(require("../../components/ThemeProvider"));
|
|
@@ -48,9 +49,9 @@ function AgentCreatedBy({ did }) {
|
|
|
48
49
|
const { t } = (0, locale_1.useLocaleContext)();
|
|
49
50
|
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 })] }));
|
|
50
51
|
}
|
|
51
|
-
function Runtime({ aid, working }) {
|
|
52
|
+
function Runtime({ blockletDid, aid, working, }) {
|
|
52
53
|
const children = ((0, jsx_runtime_1.jsx)(ThemeProvider_1.default, { children: (0, jsx_runtime_1.jsx)(ActiveAgent_1.default, { children: (0, jsx_runtime_1.jsx)(RuntimeView, {}) }) }));
|
|
53
|
-
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 })) }));
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)(RuntimeCommonProvider_1.default, { children: aid ? ((0, jsx_runtime_1.jsx)(Runtime_1.default, { blockletDid: blockletDid, aid: aid, working: working, children: children })) : ((0, jsx_runtime_1.jsx)(Runtime_1.RuntimeProviderFromUrl, { children: children })) }));
|
|
54
55
|
}
|
|
55
56
|
exports.default = Runtime;
|
|
56
57
|
function RuntimeView() {
|
|
@@ -83,9 +84,9 @@ ${agent === null || agent === void 0 ? void 0 : agent.description}
|
|
|
83
84
|
height: 12,
|
|
84
85
|
fontSize: 12,
|
|
85
86
|
}, children: (0, jsx_runtime_1.jsx)(AgentCreatedBy, { did: agent.project.createdBy }) }) })) : undefined,
|
|
86
|
-
addons: (
|
|
87
|
+
addons: (exists) => [(0, jsx_runtime_1.jsx)(SocialShare_1.default, { content: shareContent }), ...exists].filter(Boolean),
|
|
87
88
|
};
|
|
88
89
|
}, [locale, isMobile, agent]);
|
|
89
90
|
const componentId = (_a = appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentId) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_PAGE_COMPONENT_ID;
|
|
90
|
-
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 })] }));
|
|
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.componentProperties }), (0, jsx_runtime_1.jsx)(AgentSettingsDialog_1.default, {})] }));
|
|
91
92
|
}
|