(UI) fix - allow editing key alias on Admin UI (#6776)

* fix allow editing key alias on UI

* fix non type for budget duration
This commit is contained in:
Ishaan Jaff 2024-11-16 19:58:26 -08:00 committed by GitHub
parent 4ed270506a
commit bb16abc043
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 5 deletions

View file

@ -288,11 +288,15 @@ def prepare_key_update_data(
non_default_values["expires"] = expires
if "budget_duration" in non_default_values:
duration_s = _duration_in_seconds(
duration=non_default_values["budget_duration"]
)
key_reset_at = datetime.now(timezone.utc) + timedelta(seconds=duration_s)
non_default_values["budget_reset_at"] = key_reset_at
budget_duration = non_default_values.pop("budget_duration")
if (
budget_duration
and (isinstance(budget_duration, str))
and len(budget_duration) > 0
):
duration_s = _duration_in_seconds(duration=budget_duration)
key_reset_at = datetime.now(timezone.utc) + timedelta(seconds=duration_s)
non_default_values["budget_reset_at"] = key_reset_at
_metadata = existing_key_row.metadata or {}

View file

@ -291,6 +291,10 @@ const ViewKeyTable: React.FC<ViewKeyTableProps> = ({
>
<>
<Form.Item name="key_alias" label="Key Alias">
<TextInput />
</Form.Item>
<Form.Item label="Models" name="models" rules={[
{
validator: (rule, value) => {