fix: stabilize admin ui and agent chat model fallback
This commit is contained in:
@@ -194,21 +194,24 @@ function initComponentAdapter() {
|
||||
),
|
||||
Checkbox: ElCheckbox,
|
||||
CheckboxGroup: (props, { attrs, slots }) => {
|
||||
const mergedProps = { ...props, ...attrs } as Recordable<any>;
|
||||
let defaultSlot;
|
||||
if (Reflect.has(slots, 'default')) {
|
||||
defaultSlot = slots.default;
|
||||
} else {
|
||||
const { options, isButton } = attrs;
|
||||
const { options, isButton } = mergedProps;
|
||||
if (Array.isArray(options)) {
|
||||
defaultSlot = () =>
|
||||
options.map((option) =>
|
||||
h(isButton ? ElCheckboxButton : ElCheckbox, option),
|
||||
h(isButton ? ElCheckboxButton : ElCheckbox, option, () =>
|
||||
option.label ?? option.value,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
return h(
|
||||
ElCheckboxGroup,
|
||||
{ ...props, ...attrs },
|
||||
mergedProps,
|
||||
{ ...slots, default: defaultSlot },
|
||||
);
|
||||
},
|
||||
@@ -232,21 +235,24 @@ function initComponentAdapter() {
|
||||
}),
|
||||
InputNumber: withDefaultPlaceholder(ElInputNumber, 'input'),
|
||||
RadioGroup: (props, { attrs, slots }) => {
|
||||
const mergedProps = { ...props, ...attrs } as Recordable<any>;
|
||||
let defaultSlot;
|
||||
if (Reflect.has(slots, 'default')) {
|
||||
defaultSlot = slots.default;
|
||||
} else {
|
||||
const { options } = attrs;
|
||||
const { options, isButton } = mergedProps;
|
||||
if (Array.isArray(options)) {
|
||||
defaultSlot = () =>
|
||||
options.map((option) =>
|
||||
h(attrs.isButton ? ElRadioButton : ElRadio, option),
|
||||
h(isButton ? ElRadioButton : ElRadio, option, () =>
|
||||
option.label ?? option.value,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
return h(
|
||||
ElRadioGroup,
|
||||
{ ...props, ...attrs },
|
||||
mergedProps,
|
||||
{ ...slots, default: defaultSlot },
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user