fix(botForm): default value not set to adapter_config while creating bot

This commit is contained in:
Junyan Qin
2025-05-08 11:39:27 +08:00
parent 4604f70a57
commit 2893c30f5c
2 changed files with 13 additions and 2 deletions

View File

@@ -54,3 +54,10 @@ export function isDynamicFormItemType(
export function parseDynamicFormItemType(value: string): DynamicFormItemType {
return isDynamicFormItemType(value) ? value : DynamicFormItemType.UNKNOWN;
}
export function getDefaultValues(itemConfigList: IDynamicFormItemConfig[]): Record<string, any> {
return itemConfigList.reduce((acc, item) => {
acc[item.name] = item.default;
return acc;
}, {} as Record<string, any>);
}