forked from phoenix/litellm-mirror
Merge pull request #2809 from BerriAI/ui_use_token_id_in_key_gen
[UI] QA Fix Edit Key flow - return `token_id` in /key/generate respose
This commit is contained in:
commit
326f95244a
3 changed files with 10 additions and 1 deletions
|
@ -306,6 +306,7 @@ class GenerateKeyResponse(GenerateKeyRequest):
|
||||||
key_name: Optional[str] = None
|
key_name: Optional[str] = None
|
||||||
expires: Optional[datetime]
|
expires: Optional[datetime]
|
||||||
user_id: Optional[str] = None
|
user_id: Optional[str] = None
|
||||||
|
token_id: Optional[str] = None
|
||||||
|
|
||||||
@root_validator(pre=True)
|
@root_validator(pre=True)
|
||||||
def set_model_info(cls, values):
|
def set_model_info(cls, values):
|
||||||
|
|
|
@ -2563,7 +2563,10 @@ async def generate_key_helper_fn(
|
||||||
|
|
||||||
## CREATE KEY
|
## CREATE KEY
|
||||||
verbose_proxy_logger.debug("prisma_client: Creating Key= %s", key_data)
|
verbose_proxy_logger.debug("prisma_client: Creating Key= %s", key_data)
|
||||||
await prisma_client.insert_data(data=key_data, table_name="key")
|
create_key_response = await prisma_client.insert_data(
|
||||||
|
data=key_data, table_name="key"
|
||||||
|
)
|
||||||
|
key_data["token_id"] = getattr(create_key_response, "token", None)
|
||||||
elif custom_db_client is not None:
|
elif custom_db_client is not None:
|
||||||
if table_name is None or table_name == "user":
|
if table_name is None or table_name == "user":
|
||||||
## CREATE USER (If necessary)
|
## CREATE USER (If necessary)
|
||||||
|
|
|
@ -213,6 +213,11 @@ const ViewKeyTable: React.FC<ViewKeyTableProps> = ({
|
||||||
|
|
||||||
const handleEditClick = (token: any) => {
|
const handleEditClick = (token: any) => {
|
||||||
console.log("handleEditClick:", token);
|
console.log("handleEditClick:", token);
|
||||||
|
|
||||||
|
// set token.token to token.token_id if token_id is not null
|
||||||
|
if (token.token_id !== null) {
|
||||||
|
token.token = token.token_id;
|
||||||
|
}
|
||||||
setSelectedToken(token);
|
setSelectedToken(token);
|
||||||
setEditModalVisible(true);
|
setEditModalVisible(true);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue