@blocklet/pages-kit 0.2.372 → 0.2.374
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/Header/SimpleHeader.js +4 -4
- package/lib/cjs/builtin/async/ai-runtime/hooks/use-appearances.js +5 -1
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +2 -6
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/builtin/async/ai-runtime/components/Header/SimpleHeader.js +4 -4
- package/lib/esm/builtin/async/ai-runtime/hooks/use-appearances.js +5 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +2 -6
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/builtin/async/ai-runtime/hooks/use-appearances.d.ts +2 -0
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
|
@@ -13,11 +13,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import { cx } from '@emotion/css';
|
|
14
14
|
import { Stack, Typography } from '@mui/material';
|
|
15
15
|
import Balancer, { Provider } from 'react-wrap-balancer';
|
|
16
|
+
import { useProfile } from '../../hooks/use-appearances';
|
|
16
17
|
import { useRuntimeState } from '../../state/runtime';
|
|
17
18
|
export default function SimpleHeader(_a) {
|
|
18
19
|
var { TitleProps, DescriptionProps } = _a, props = __rest(_a, ["TitleProps", "DescriptionProps"]);
|
|
19
|
-
const {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
return (_jsx(Stack, Object.assign({ gap: 2, mt: 8, mb: 4 }, props, { className: cx('aigne-header aigne-simple-header', props.className), children: _jsxs(Provider, { children: [title && (_jsx(Typography, Object.assign({ width: "100%", variant: "h4", fontSize: 30, fontWeight: 700, textAlign: "center" }, TitleProps, { children: _jsx(Balancer, { children: title }) }))), description && (_jsx(Typography, Object.assign({ width: "100%", textAlign: "center" }, DescriptionProps, { children: _jsx(Balancer, { children: description }) })))] }) })));
|
|
20
|
+
const { aid } = useRuntimeState();
|
|
21
|
+
const { name, description } = useProfile({ aid });
|
|
22
|
+
return (_jsx(Stack, Object.assign({ gap: 2, mt: 8, mb: 4 }, props, { className: cx('aigne-header aigne-simple-header', props.className), children: _jsxs(Provider, { children: [name && (_jsx(Typography, Object.assign({ width: "100%", variant: "h4", fontSize: 30, fontWeight: 700, textAlign: "center" }, TitleProps, { children: _jsx(Balancer, { children: name }) }))), description && (_jsx(Typography, Object.assign({ width: "100%", textAlign: "center" }, DescriptionProps, { children: _jsx(Balancer, { children: description }) })))] }) })));
|
|
23
23
|
}
|
|
@@ -58,7 +58,11 @@ export function useProfile(args) {
|
|
|
58
58
|
const runtimeProfile = getOutputVariableInitialValue(runtimeAgent, RuntimeOutputVariable.profile);
|
|
59
59
|
return {
|
|
60
60
|
avatar: (profile === null || profile === void 0 ? void 0 : profile.avatar) || (runtimeProfile === null || runtimeProfile === void 0 ? void 0 : runtimeProfile.avatar) || getProjectIconUrl({ blockletDid, aid }),
|
|
61
|
-
name: (profile === null || profile === void 0 ? void 0 : profile.name) || (runtimeProfile === null || runtimeProfile === void 0 ? void 0 : runtimeProfile.name) ||
|
|
61
|
+
name: (profile === null || profile === void 0 ? void 0 : profile.name) || (runtimeProfile === null || runtimeProfile === void 0 ? void 0 : runtimeProfile.name) || runtimeAgent.name || runtimeAgent.project.name,
|
|
62
|
+
description: (profile === null || profile === void 0 ? void 0 : profile.description) ||
|
|
63
|
+
(runtimeProfile === null || runtimeProfile === void 0 ? void 0 : runtimeProfile.description) ||
|
|
64
|
+
runtimeAgent.description ||
|
|
65
|
+
runtimeAgent.project.description,
|
|
62
66
|
};
|
|
63
67
|
}, [agent, runtimeAgent]);
|
|
64
68
|
}
|
|
@@ -82,15 +82,11 @@ export default function AutoForm({ submitText, inlineLabel, autoFillLastForm = t
|
|
|
82
82
|
: undefined,
|
|
83
83
|
}, render: ({ field, fieldState }) => {
|
|
84
84
|
var _a;
|
|
85
|
-
return (_jsxs(Stack, { className: "form-item", children: [parameter.label && _jsx(FormLabel, { children: parameter.label }), _jsx(AgentInputField
|
|
86
|
-
// inputProps={{ 'data-testid': `runtime-input-${key}` }}
|
|
87
|
-
, {
|
|
88
|
-
// inputProps={{ 'data-testid': `runtime-input-${key}` }}
|
|
89
|
-
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(Object.assign({}, (parameter.key === 'question' && submitInQuestionField
|
|
85
|
+
return (_jsxs(Stack, { className: "form-item", children: [parameter.label && _jsx(FormLabel, { children: parameter.label }), _jsx(AgentInputField, { 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(Object.assign({}, (parameter.key === 'question' && submitInQuestionField
|
|
90
86
|
? {
|
|
91
87
|
endAdornment: (_jsx(InputAdornment, { position: "end", sx: { py: 3, mr: -0.75, alignSelf: 'flex-end' }, children: _jsx(LoadingButton, { "data-testid": "runtime-submit-button", ref: submitRef, type: "submit", variant: "contained", loading: running, disabled: submitDisabled, sx: { borderRadius: 1.5 }, children: submitText }) })),
|
|
92
88
|
}
|
|
93
|
-
: {})),
|
|
89
|
+
: {})), { inputProps: { 'data-testid': `runtime-input-${key}` } }) })] }));
|
|
94
90
|
} }) }, parameter.id));
|
|
95
91
|
}), !(submitInQuestionField && (parameters === null || parameters === void 0 ? void 0 : parameters.some((i) => i.key === 'question'))) && (_jsx(LoadingButton, { "data-testid": "runtime-submit-button", ref: submitRef, type: "submit", variant: "contained", loading: running, disabled: submitDisabled, sx: { height: 40 }, children: submitText || t('generate') }))] }));
|
|
96
92
|
}
|