Skip to content

Commit

Permalink
refactor: apply session allocation at specific agent when hide-agent …
Browse files Browse the repository at this point in the history
…option is disabled
  • Loading branch information
lizable committed Nov 5, 2024
1 parent 86fa565 commit 66a9b5b
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/ai/backend/manager/api/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,13 +650,18 @@ async def create_from_params(request: web.Request, params: dict[str, Any]) -> we
else:
raise InvalidAPIParameters("API version not supported")
params["config"] = creation_config
if params["config"]["agent_list"] is not None and request["user"]["role"] != (
UserRole.SUPERADMIN
):
raise InsufficientPrivilege(
"You are not allowed to manually assign agents for your session."
)
if request["user"]["role"] == (UserRole.SUPERADMIN):

root_ctx: RootContext = request.app["_root.context"]

# if params["config"]["agent_list"] is not None and request["user"]["role"] != (
# UserRole.SUPERADMIN
# ):
# raise InsufficientPrivilege(
# "You are not allowed to manually assign agents for your session."
# )
if not root_ctx.local_config["manager"][
"hide-agents"
]: # request["user"]["role"] == (UserRole.SUPERADMIN):
if not params["config"]["agent_list"]:
pass
else:
Expand Down

0 comments on commit 66a9b5b

Please sign in to comment.