فهرست منبع

refac: pipe function support

Timothy J. Baek 10 ماه پیش
والد
کامیت
59fa2f8f26
2فایلهای تغییر یافته به همراه10 افزوده شده و 4 حذف شده
  1. 4 4
      backend/apps/webui/main.py
  2. 6 0
      backend/main.py

+ 4 - 4
backend/apps/webui/main.py

@@ -120,16 +120,16 @@ async def get_pipe_models():
                 manifold_pipes = []
                 manifold_pipes = []
 
 
                 # Check if pipes is a function or a list
                 # 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:
                 else:
-                    manifold_pipes = pipe.pipes
+                    manifold_pipes = function_module.pipes
 
 
                 for p in manifold_pipes:
                 for p in manifold_pipes:
                     manifold_pipe_id = f'{pipe.id}.{p["id"]}'
                     manifold_pipe_id = f'{pipe.id}.{p["id"]}'
                     manifold_pipe_name = p["name"]
                     manifold_pipe_name = p["name"]
 
 
-                    if hasattr(pipe, "name"):
+                    if hasattr(function_module, "name"):
                         manifold_pipe_name = f"{pipe.name}{manifold_pipe_name}"
                         manifold_pipe_name = f"{pipe.name}{manifold_pipe_name}"
 
 
                     pipe_models.append(
                     pipe_models.append(

+ 6 - 0
backend/main.py

@@ -802,6 +802,12 @@ async def generate_chat_completions(form_data: dict, user=Depends(get_verified_u
 
 
     pipe = model.get("pipe")
     pipe = model.get("pipe")
     if pipe:
     if pipe:
+        form_data["user"] = {
+            "id": user.id,
+            "email": user.email,
+            "name": user.name,
+            "role": user.role,
+        }
 
 
         def job():
         def job():
             pipe_id = form_data["model"]
             pipe_id = form_data["model"]