@blocklet/pages-kit 0.2.385 → 0.2.387
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/AgentInputField/LanguageField.js +13 -6
- package/lib/cjs/builtin/async/ai-runtime/components/ShareActions/index.js +2 -1
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +1 -1
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.js +26 -3
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.js +1 -1
- package/lib/cjs/components/CustomComponentRenderer/index.js +3 -2
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/LanguageField.js +10 -6
- package/lib/esm/builtin/async/ai-runtime/components/ShareActions/index.js +2 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.js +4 -4
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.js +1 -1
- package/lib/esm/components/CustomComponentRenderer/index.js +3 -2
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
|
@@ -10,10 +10,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
13
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = require("react");
|
|
14
18
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
19
|
const material_1 = require("@mui/material");
|
|
16
|
-
const
|
|
20
|
+
const pick_1 = __importDefault(require("lodash/pick"));
|
|
21
|
+
const react_2 = require("react");
|
|
17
22
|
const locale_1 = require("../../../../locale");
|
|
18
23
|
const languages_1 = require("../../utils/languages");
|
|
19
24
|
const filter = (options, state) => {
|
|
@@ -25,16 +30,18 @@ const filter = (options, state) => {
|
|
|
25
30
|
return true;
|
|
26
31
|
});
|
|
27
32
|
};
|
|
28
|
-
const LanguageField = (0,
|
|
33
|
+
const LanguageField = (0, react_2.forwardRef)((_a, ref) => {
|
|
29
34
|
var { readOnly, parameter, onChange } = _a, props = __rest(_a, ["readOnly", "parameter", "onChange"]);
|
|
30
35
|
const { locale } = (0, locale_1.useLocaleContext)();
|
|
31
36
|
const value = (props === null || props === void 0 ? void 0 : props.value) ? languages_1.languages.find((o) => o.en === props.value) : null;
|
|
32
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Autocomplete, { size: "small", ref: ref, renderInput: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({},
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Autocomplete, Object.assign({ size: "small", ref: ref }, (0, pick_1.default)(props, 'autoFocus', 'fullWidth', 'sx', 'className', 'style'), { renderInput: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, (0, pick_1.default)(props, 'inputRef', 'size', 'hiddenLabel', 'helperText', 'error', 'placeholder', 'InputProps', 'inputProps'), params))), options: languages_1.languages, getOptionKey: (i) => i.en, getOptionLabel: (o) => {
|
|
33
38
|
return locale === 'zh' ? o.cn : o.en;
|
|
34
|
-
}, value: value, filterOptions: filter, onChange: (_e, newValue) => {
|
|
39
|
+
}, autoHighlight: true, value: value, filterOptions: filter, onChange: (_e, newValue) => {
|
|
35
40
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue === null || newValue === void 0 ? void 0 : newValue.en);
|
|
36
41
|
}, renderOption: (props, option) => {
|
|
37
|
-
return ((0,
|
|
38
|
-
|
|
42
|
+
return ((0, react_1.createElement)(material_1.MenuItem, Object.assign({}, props, { key: option.name }),
|
|
43
|
+
(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(option.flag, {}) }),
|
|
44
|
+
(0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: `${option.name} ${locale === 'zh' ? option.cn : option.en} (${option.abbr})` })));
|
|
45
|
+
} })));
|
|
39
46
|
});
|
|
40
47
|
exports.default = LanguageField;
|
|
@@ -211,7 +211,7 @@ function ShareCommunity({ inputs, shareAttach, }) {
|
|
|
211
211
|
const images = (_j = (_h = (_g = (_f = (_e = message.outputs) === null || _e === void 0 ? void 0 : _e.objects) === null || _f === void 0 ? void 0 : _f.find) === null || _g === void 0 ? void 0 : _g.call(_f, (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 || _h === void 0 ? void 0 : _h[types_1.RuntimeOutputVariable.images]) === null || _j === void 0 ? void 0 : _j.map((i) => i.url);
|
|
212
212
|
let content = '';
|
|
213
213
|
if (shareAttach.shareAttachUrl) {
|
|
214
|
-
content +=
|
|
214
|
+
content += `[[]](${link})\n\n`;
|
|
215
215
|
}
|
|
216
216
|
if (shareAttach.shareAttachInputs) {
|
|
217
217
|
content += `> ${inputs}\n\n`;
|
|
@@ -225,6 +225,7 @@ function ShareCommunity({ inputs, shareAttach, }) {
|
|
|
225
225
|
format: 'markdown',
|
|
226
226
|
title: `${((_k = message.inputs) === null || _k === void 0 ? void 0 : _k.question) || inputs}`,
|
|
227
227
|
content,
|
|
228
|
+
labels: 'demo',
|
|
228
229
|
};
|
|
229
230
|
}, [inputs, shareAttach]);
|
|
230
231
|
return ((0, jsx_runtime_1.jsx)(StyledActionButton, { tip: t('socialShare.shareToCommunity'), title: (0, jsx_runtime_1.jsx)(Community_1.default, {}), target: "_blank", href: (0, ufo_1.withQuery)('https://community.arcblock.io/discussions/add?', query) }));
|
|
@@ -88,7 +88,7 @@ function AutoForm({ submitText, inlineLabel, autoFillLastForm = true, submitInQu
|
|
|
88
88
|
: undefined,
|
|
89
89
|
}, render: ({ field, fieldState }) => {
|
|
90
90
|
var _a;
|
|
91
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { className: "form-item", children: [parameter.label && (0, jsx_runtime_1.jsx)(material_1.FormLabel, { children: parameter.label }), (0, jsx_runtime_1.jsx)(AgentInputField_1.default, { inputProps: { 'data-testid': `runtime-input-${key}` }, inputRef: field.ref, autoFocus: index === 0, size: "small", hiddenLabel: true, fullWidth: true, label: undefined, parameter: parameter, maxRows: !(parameter === null || parameter === void 0 ? void 0 : parameter.type) || (parameter === null || parameter === void 0 ? void 0 : parameter.type) === 'string' ? 5 : undefined, value: field.value || '', onChange: (value) => field.onChange({ target: { value } }), error: Boolean(fieldState.error), helperText: ((_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message) || (parameter === null || parameter === void 0 ? void 0 : parameter.helper), InputProps: Object.assign({}, (parameter.key === 'question' && submitInQuestionField
|
|
91
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { className: "form-item", children: [parameter.label && (0, jsx_runtime_1.jsx)(material_1.FormLabel, { children: parameter.label }), (0, jsx_runtime_1.jsx)(AgentInputField_1.default, { inputProps: { 'data-testid': `runtime-input-${key}` }, inputRef: field.ref, autoFocus: index === 0, size: "small", hiddenLabel: true, fullWidth: true, label: undefined, parameter: parameter, maxRows: !(parameter === null || parameter === void 0 ? void 0 : parameter.type) || (parameter === null || parameter === void 0 ? void 0 : parameter.type) === 'string' ? 5 : undefined, value: field.value || '', onChange: (value) => field.onChange({ target: { value } }), error: Boolean(fieldState.error), helperText: ((_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message) || (parameter === null || parameter === void 0 ? void 0 : parameter.helper), sx: { flex: 1 }, InputProps: Object.assign({}, (parameter.key === 'question' && submitInQuestionField
|
|
92
92
|
? {
|
|
93
93
|
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "end", sx: { py: 3, mr: -0.75, alignSelf: 'flex-end' }, children: (0, jsx_runtime_1.jsx)(LoadingButton_1.default, { "data-testid": "runtime-submit-button", ref: submitRef, type: "submit", variant: "contained", loading: running, disabled: submitDisabled, sx: { borderRadius: 1.5 }, children: submitText }) })),
|
|
94
94
|
}
|
|
@@ -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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -16,7 +39,7 @@ exports.default = GoogleSearchRelatedView;
|
|
|
16
39
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
17
40
|
const material_1 = require("@mui/material");
|
|
18
41
|
const joi_1 = __importDefault(require("joi"));
|
|
19
|
-
const react_1 = require("react");
|
|
42
|
+
const react_1 = __importStar(require("react"));
|
|
20
43
|
const OutputFieldContainer_1 = __importDefault(require("../../components/OutputFieldContainer"));
|
|
21
44
|
const CurrentAgent_1 = require("../../contexts/CurrentAgent");
|
|
22
45
|
const CurrentMessage_1 = require("../../contexts/CurrentMessage");
|
|
@@ -48,7 +71,7 @@ function GoogleSearchRelatedView({ output, outputValue, onlyLastMessage, }) {
|
|
|
48
71
|
return null;
|
|
49
72
|
if ((!isLastMessage && onlyLastMessage) || !((_b = result === null || result === void 0 ? void 0 : result.related_questions) === null || _b === void 0 ? void 0 : _b.length))
|
|
50
73
|
return null;
|
|
51
|
-
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)(
|
|
74
|
+
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)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemButton, { sx: { py: 1, px: 2 }, onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
52
75
|
if (submitting)
|
|
53
76
|
return;
|
|
54
77
|
setSubmitting(true);
|
|
@@ -58,5 +81,5 @@ function GoogleSearchRelatedView({ output, outputValue, onlyLastMessage, }) {
|
|
|
58
81
|
finally {
|
|
59
82
|
setSubmitting(false);
|
|
60
83
|
}
|
|
61
|
-
}), children: item.question }
|
|
84
|
+
}), children: item.question }), (0, jsx_runtime_1.jsx)(material_1.Divider, {})] }, item.title))) }) }));
|
|
62
85
|
}
|
|
@@ -73,7 +73,7 @@ const AgentList = (0, react_1.memo)((_a) => {
|
|
|
73
73
|
const children = (0, react_1.useMemo)(() => { var _a, _b; return (_b = (_a = (0, runtime_output_schema_1.getOutputVariableInitialValue)(runtimeAgent, types_1.RuntimeOutputVariable.children)) === null || _a === void 0 ? void 0 : _a.agents) === null || _b === void 0 ? void 0 : _b.filter((i) => !!i.id); }, [runtimeAgent]);
|
|
74
74
|
if (!(children === null || children === void 0 ? void 0 : children.length) || children.length <= 1)
|
|
75
75
|
return null;
|
|
76
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ direction: "row", gap: 2, py: 1, overflow: "auto" }, props, { children: children === null || children === void 0 ? void 0 : children.map((child) => ((0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: child.id, children: (0, jsx_runtime_1.jsx)(AgentAvatar, { selected: activeAgentId === child.id, onClick: () => setActiveAgentId(child.id) }) }))) })));
|
|
76
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ direction: "row", gap: 2, py: 1, overflow: "auto" }, props, { children: children === null || children === void 0 ? void 0 : children.map((child) => ((0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: child.id, children: (0, jsx_runtime_1.jsx)(AgentAvatar, { selected: activeAgentId === child.id, onClick: () => setActiveAgentId(child.id) }) }, child.id))) })));
|
|
77
77
|
});
|
|
78
78
|
function AgentAvatar(_a) {
|
|
79
79
|
var _b;
|
|
@@ -39,11 +39,12 @@ const state_1 = require("./state");
|
|
|
39
39
|
__exportStar(require("./state"), exports);
|
|
40
40
|
const MAXIMUM_RENDER_STACK_SIZE = 20;
|
|
41
41
|
function CustomComponentRenderer(_a) {
|
|
42
|
-
var _b;
|
|
42
|
+
var _b, _c, _d;
|
|
43
43
|
var { dev } = _a, props = __rest(_a, ["dev"]);
|
|
44
44
|
const inheritedDev = (0, DevProvider_1.useDev)();
|
|
45
45
|
const BuiltinComponent = BuiltinComponents[props.componentId];
|
|
46
|
-
|
|
46
|
+
const renderer = (_c = (_b = dev === null || dev === void 0 ? void 0 : dev.components) === null || _b === void 0 ? void 0 : _b[props.componentId]) === null || _c === void 0 ? void 0 : _c.data.renderer;
|
|
47
|
+
return ((0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: (props === null || props === void 0 ? void 0 : props.fallbackRender) || ErrorView, resetKeys: [renderer && 'script' in renderer ? renderer.script : undefined], children: (0, jsx_runtime_1.jsx)(DevProvider_1.DevProvider, { dev: dev !== null && dev !== void 0 ? dev : inheritedDev, children: BuiltinComponent ? ((0, jsx_runtime_1.jsx)(BuiltinComponent, Object.assign({}, props))) : ((0, jsx_runtime_1.jsx)(ComponentRenderer, Object.assign({}, props, { instanceId: (_d = props.instanceId) !== null && _d !== void 0 ? _d : props.componentId }))) }) }));
|
|
47
48
|
}
|
|
48
49
|
const BuiltinComponents = {
|
|
49
50
|
'blocklet-react-component': BlockletReactComponentRenderer_1.default,
|