From 59fa2f8f26ca11d3089528dd01a479e59af77241 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Thu, 20 Jun 2024 04:47:40 -0700 Subject: [PATCH] refac: pipe function support --- backend/apps/webui/main.py | 8 ++++---- backend/main.py | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/backend/apps/webui/main.py b/backend/apps/webui/main.py index 5ccb8ae58..ce58047ed 100644 --- a/backend/apps/webui/main.py +++ b/backend/apps/webui/main.py @@ -120,16 +120,16 @@ async def get_pipe_models(): manifold_pipes = [] # Check if pipes is a function or a list - if callable(pipe.pipes): - manifold_pipes = pipe.pipes() + if callable(function_module.pipes): + manifold_pipes = function_module.pipes() else: - manifold_pipes = pipe.pipes + manifold_pipes = function_module.pipes for p in manifold_pipes: manifold_pipe_id = f'{pipe.id}.{p["id"]}' manifold_pipe_name = p["name"] - if hasattr(pipe, "name"): + if hasattr(function_module, "name"): manifold_pipe_name = f"{pipe.name}{manifold_pipe_name}" pipe_models.append( diff --git a/backend/main.py b/backend/main.py index d6a8c8831..47078b681 100644 --- a/backend/main.py +++ b/backend/main.py @@ -802,6 +802,12 @@ async def generate_chat_completions(form_data: dict, user=Depends(get_verified_u pipe = model.get("pipe") if pipe: + form_data["user"] = { + "id": user.id, + "email": user.email, + "name": user.name, + "role": user.role, + } def job(): pipe_id = form_data["model"]