@blocklet/pages-kit 0.2.322 → 0.2.323
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/runtime-components/V0/Input.js +2 -1
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +29 -4
- package/lib/cjs/builtin/async/ai-runtime/state/runtime.js +8 -2
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Input.js +2 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +8 -3
- package/lib/esm/builtin/async/ai-runtime/state/runtime.js +8 -2
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/builtin/async/ai-runtime/state/runtime.d.ts +1 -0
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -35,7 +35,7 @@ function V0Input({ submitText, inlineLabel, autoFillLastForm = false, submitInQu
|
|
|
35
35
|
const { aid, agent } = (0, CurrentAgent_1.useCurrentAgent)();
|
|
36
36
|
const [executeLoading, setExecuteLoading] = (0, react_2.useState)(false);
|
|
37
37
|
const opening = (0, use_appearances_1.useOpeningQuestions)();
|
|
38
|
-
const { execute } = (0, runtime_1.useRuntimeState)();
|
|
38
|
+
const { execute, checkLoginState } = (0, runtime_1.useRuntimeState)();
|
|
39
39
|
const { running } = (0, session_1.useCurrentSessionState)((s) => s) || {};
|
|
40
40
|
const { createSession, currentSessionId } = (0, session_1.useSessionState)((s) => s) || {};
|
|
41
41
|
const { setCurrentMessageTaskId } = (0, V0Runtime_1.useV0RuntimeContext)();
|
|
@@ -56,6 +56,7 @@ function V0Input({ submitText, inlineLabel, autoFillLastForm = false, submitInQu
|
|
|
56
56
|
}, [defaultForm, autoFillLastForm, form, chatMode]);
|
|
57
57
|
const onSubmit = (parameters) => __awaiter(this, void 0, void 0, function* () {
|
|
58
58
|
try {
|
|
59
|
+
yield checkLoginState();
|
|
59
60
|
if (!(parameters === null || parameters === void 0 ? void 0 : parameters.question))
|
|
60
61
|
return;
|
|
61
62
|
setExecuteLoading(true);
|
|
@@ -1,15 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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;
|
|
4
24
|
};
|
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
26
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
const ClickToCopy_1 =
|
|
27
|
+
const ClickToCopy_1 = __importStar(require("@arcblock/ux/lib/ClickToCopy"));
|
|
8
28
|
const material_1 = require("@mui/material");
|
|
9
29
|
const ux_1 = require("../../../../../arcblock/ux");
|
|
10
30
|
const locale_1 = require("../../../../../locale");
|
|
11
31
|
const session_1 = require("../../../../../session");
|
|
12
32
|
const utils_1 = require("../utils");
|
|
33
|
+
const BASE_QUESTION_SX = {
|
|
34
|
+
fontWeight: 500,
|
|
35
|
+
fontSize: 13,
|
|
36
|
+
};
|
|
13
37
|
function UserQuestion({ question }) {
|
|
14
38
|
var _a;
|
|
15
39
|
const { session: authSession } = (0, session_1.useSessionContext)();
|
|
@@ -27,6 +51,7 @@ function UserQuestion({ question }) {
|
|
|
27
51
|
borderRadius: 1,
|
|
28
52
|
// borderTopLeftRadius: 0,
|
|
29
53
|
backgroundColor: 'grey.200',
|
|
30
|
-
|
|
54
|
+
maxWidth: 300,
|
|
55
|
+
}, children: (0, jsx_runtime_1.jsx)(ClickToCopy_1.CopyButton, { locale: locale, unstyled: true, render: ({ containerRef }) => ((0, jsx_runtime_1.jsx)(material_1.Box, { ref: containerRef, display: "flex", alignItems: "center", sx: Object.assign(Object.assign({}, BASE_QUESTION_SX), { color: 'textColor' }), children: (0, jsx_runtime_1.jsx)(ClickToCopy_1.default, { locale: locale, unstyled: true, children: (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: (0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, { sx: Object.assign(Object.assign({}, BASE_QUESTION_SX), { color: 'white' }), children: question }) }), children: (0, jsx_runtime_1.jsx)(material_1.Typography, { sx: Object.assign(Object.assign(Object.assign({}, BASE_QUESTION_SX), { textAlign: 'left', alignItems: 'center' }), (0, utils_1.getLineClamp)(1)), children: question }) }) }) })) }) })] }));
|
|
31
56
|
}
|
|
32
57
|
exports.default = UserQuestion;
|
|
@@ -16,7 +16,7 @@ const Runtime_1 = require("../contexts/Runtime");
|
|
|
16
16
|
const agent_1 = require("./agent");
|
|
17
17
|
const session_2 = require("./session");
|
|
18
18
|
function useRuntimeState() {
|
|
19
|
-
var _a;
|
|
19
|
+
var _a, _b;
|
|
20
20
|
const { aid, working } = (0, Runtime_1.useRuntimeContext)();
|
|
21
21
|
const [agent] = (0, agent_1.useAgentState)({ aid, working });
|
|
22
22
|
const { session: authSession } = (0, session_1.useSessionContext)();
|
|
@@ -41,6 +41,12 @@ function useRuntimeState() {
|
|
|
41
41
|
}
|
|
42
42
|
return exec(Object.assign(Object.assign({}, args), { working }));
|
|
43
43
|
}), [authSession.user, exec, working, login]);
|
|
44
|
-
|
|
44
|
+
const checkLoginState = (0, react_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
var _c;
|
|
46
|
+
if (!((_c = authSession.user) === null || _c === void 0 ? void 0 : _c.did)) {
|
|
47
|
+
yield login();
|
|
48
|
+
}
|
|
49
|
+
}), [!((_b = authSession.user) === null || _b === void 0 ? void 0 : _b.did)]);
|
|
50
|
+
return { aid, working, agent, execute, checkLoginState };
|
|
45
51
|
}
|
|
46
52
|
exports.useRuntimeState = useRuntimeState;
|