fix: apikey filters

This commit is contained in:
jialin
2026-04-29 18:09:55 +08:00
committed by jialin
parent 217285223c
commit c68f546be9
3 changed files with 15 additions and 8 deletions
@@ -182,15 +182,20 @@ const AddModal: React.FC<AddModalProps> = ({
}
if (action === PageAction.EDIT && currentData && open) {
parseExpireValue(currentData as ListItem);
const isLegacyAllScope = currentData.scope?.includes('*');
const normalizedScope = isLegacyAllScope
? ['management', 'inference']
: currentData.scope;
const normalizedAllowedModelNames = isLegacyAllScope
? []
: currentData.allowed_model_names || [];
form.setFieldsValue({
name: currentData.name,
description: currentData.description,
scope: currentData.scope,
allowed_type: currentData.allowed_model_names?.length
? 'custom'
: 'all',
scope: normalizedScope,
allowed_type: normalizedAllowedModelNames.length ? 'custom' : 'all',
expires_in: parseExpireValue(currentData as ListItem),
allowed_model_names: currentData.allowed_model_names || []
allowed_model_names: normalizedAllowedModelNames
});
}