forked from phoenix/litellm-mirror
(feat) use user_notification table
This commit is contained in:
parent
a13565dd95
commit
6985880506
4 changed files with 19 additions and 12 deletions
|
@ -4149,9 +4149,10 @@ async def user_request_model(request: Request):
|
|||
"models": new_models,
|
||||
"justification": justification,
|
||||
"user_id": user_id,
|
||||
"status": "pending",
|
||||
"request_id": str(uuid.uuid4()),
|
||||
},
|
||||
table_name="model_request",
|
||||
table_name="user_notification",
|
||||
)
|
||||
return {"status": "success"}
|
||||
# update based on remaining passed in values
|
||||
|
|
|
@ -98,9 +98,10 @@ model LiteLLM_SpendLogs {
|
|||
}
|
||||
|
||||
// Beta - allow team members to request access to a model
|
||||
model LiteLLM_ModelRequests {
|
||||
model LiteLLM_UserNotifications {
|
||||
request_id String @unique
|
||||
user_id String
|
||||
models String[]
|
||||
justification String
|
||||
status String // approved, disapproved, pending
|
||||
}
|
|
@ -698,7 +698,9 @@ class PrismaClient:
|
|||
async def insert_data(
|
||||
self,
|
||||
data: dict,
|
||||
table_name: Literal["user", "key", "config", "spend", "team", "model_request"],
|
||||
table_name: Literal[
|
||||
"user", "key", "config", "spend", "team", "user_notification"
|
||||
],
|
||||
):
|
||||
"""
|
||||
Add a key to the database. If it already exists, do nothing.
|
||||
|
@ -780,17 +782,19 @@ class PrismaClient:
|
|||
)
|
||||
verbose_proxy_logger.info(f"Data Inserted into Spend Table")
|
||||
return new_spend_row
|
||||
elif table_name == "model_request":
|
||||
elif table_name == "user_notification":
|
||||
db_data = self.jsonify_object(data=data)
|
||||
new_model_request_row = await self.db.litellm_modelrequests.upsert(
|
||||
where={"request_id": data["request_id"]},
|
||||
data={
|
||||
"create": {**db_data}, # type: ignore
|
||||
"update": {}, # don't do anything if it already exists
|
||||
},
|
||||
new_user_notification_row = (
|
||||
await self.db.litellm_usernotifications.upsert(
|
||||
where={"request_id": data["request_id"]},
|
||||
data={
|
||||
"create": {**db_data}, # type: ignore
|
||||
"update": {}, # don't do anything if it already exists
|
||||
},
|
||||
)
|
||||
)
|
||||
verbose_proxy_logger.info(f"Data Inserted into Model Request Table")
|
||||
return new_model_request_row
|
||||
return new_user_notification_row
|
||||
|
||||
except Exception as e:
|
||||
print_verbose(f"LiteLLM Prisma Client Exception: {e}")
|
||||
|
|
|
@ -98,9 +98,10 @@ model LiteLLM_SpendLogs {
|
|||
}
|
||||
|
||||
// Beta - allow team members to request access to a model
|
||||
model LiteLLM_ModelRequests {
|
||||
model LiteLLM_UserNotifications {
|
||||
request_id String @unique
|
||||
user_id String
|
||||
models String[]
|
||||
justification String
|
||||
status String // approved, disapproved, pending
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue