From 9f9122b6d7f573a20bf895e1522a229e26952163 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Thu, 11 Jul 2024 16:24:59 -0700 Subject: [PATCH] enh: ChatValves --- backend/apps/webui/main.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/backend/apps/webui/main.py b/backend/apps/webui/main.py index 325370482..570cad9f1 100644 --- a/backend/apps/webui/main.py +++ b/backend/apps/webui/main.py @@ -165,6 +165,10 @@ async def get_pipe_models(): f"{function_module.name}{manifold_pipe_name}" ) + pipe_flag = {"type": pipe.type} + if hasattr(function_module, "ChatValves"): + pipe_flag["valves_spec"] = function_module.ChatValves.schema() + pipe_models.append( { "id": manifold_pipe_id, @@ -172,10 +176,14 @@ async def get_pipe_models(): "object": "model", "created": pipe.created_at, "owned_by": "openai", - "pipe": {"type": pipe.type}, + "pipe": pipe_flag, } ) else: + pipe_flag = {"type": "pipe"} + if hasattr(function_module, "ChatValves"): + pipe_flag["valves_spec"] = function_module.ChatValves.schema() + pipe_models.append( { "id": pipe.id, @@ -183,7 +191,7 @@ async def get_pipe_models(): "object": "model", "created": pipe.created_at, "owned_by": "openai", - "pipe": {"type": "pipe"}, + "pipe": pipe_flag, } )