Merge pull request #6429 from BerriAI/litellm_ui_show_created_at_for_key

(admin ui) - show created_at for virtual keys
This commit is contained in:
Ishaan Jaff 2024-10-25 10:50:38 +04:00 committed by GitHub
commit 5485a2a52f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 1 deletions

View file

@ -1371,6 +1371,8 @@ class LiteLLM_VerificationToken(LiteLLMBase):
blocked: Optional[bool] = None
litellm_budget_table: Optional[dict] = None
org_id: Optional[str] = None # org id for a given key
created_at: Optional[datetime] = None
updated_at: Optional[datetime] = None
model_config = ConfigDict(protected_namespaces=())

View file

@ -154,6 +154,8 @@ model LiteLLM_VerificationToken {
model_spend Json @default("{}")
model_max_budget Json @default("{}")
budget_id String?
created_at DateTime? @default(now()) @map("created_at")
updated_at DateTime? @default(now()) @updatedAt @map("updated_at")
litellm_budget_table LiteLLM_BudgetTable? @relation(fields: [budget_id], references: [budget_id])
}

View file

@ -154,6 +154,8 @@ model LiteLLM_VerificationToken {
model_spend Json @default("{}")
model_max_budget Json @default("{}")
budget_id String?
created_at DateTime? @default(now()) @map("created_at")
updated_at DateTime? @default(now()) @updatedAt @map("updated_at")
litellm_budget_table LiteLLM_BudgetTable? @relation(fields: [budget_id], references: [budget_id])
}

View file

@ -802,6 +802,7 @@ const ViewKeyTable: React.FC<ViewKeyTableProps> = ({
<TableRow>
<TableHeaderCell>Key Alias</TableHeaderCell>
<TableHeaderCell>Secret Key</TableHeaderCell>
<TableHeaderCell>Created</TableHeaderCell>
<TableHeaderCell>Expires</TableHeaderCell>
<TableHeaderCell>Spend (USD)</TableHeaderCell>
<TableHeaderCell>Budget (USD)</TableHeaderCell>
@ -843,10 +844,19 @@ const ViewKeyTable: React.FC<ViewKeyTableProps> = ({
<TableCell>
<Text>{item.key_name}</Text>
</TableCell>
<TableCell>
{item.created_at != null ? (
<div>
<p style={{ fontSize: '0.70rem' }}>{new Date(item.created_at).toLocaleDateString()}</p>
</div>
) : (
<p style={{ fontSize: '0.70rem' }}>Not available</p>
)}
</TableCell>
<TableCell>
{item.expires != null ? (
<div>
<p style={{ fontSize: '0.70rem' }}>{new Date(item.expires).toLocaleString()}</p>
<p style={{ fontSize: '0.70rem' }}>{new Date(item.expires).toLocaleDateString()}</p>
</div>
) : (
<p style={{ fontSize: '0.70rem' }}>Never</p>