mirror of
https://github.com/open-webui/open-webui
synced 2025-04-21 23:07:40 +00:00
refac
This commit is contained in:
parent
8b67959695
commit
0c1fab09ff
@ -152,29 +152,33 @@ async def get_pipe_models():
|
|||||||
|
|
||||||
# Check if function is a manifold
|
# Check if function is a manifold
|
||||||
if hasattr(function_module, "pipes"):
|
if hasattr(function_module, "pipes"):
|
||||||
manifold_pipes = []
|
sub_pipes = []
|
||||||
|
|
||||||
# Check if pipes is a function or a list
|
# Check if pipes is a function or a list
|
||||||
if callable(function_module.pipes):
|
|
||||||
manifold_pipes = function_module.pipes()
|
|
||||||
else:
|
|
||||||
manifold_pipes = function_module.pipes
|
|
||||||
|
|
||||||
for p in manifold_pipes:
|
try:
|
||||||
manifold_pipe_id = f'{pipe.id}.{p["id"]}'
|
if callable(function_module.pipes):
|
||||||
manifold_pipe_name = p["name"]
|
sub_pipes = function_module.pipes()
|
||||||
|
else:
|
||||||
|
sub_pipes = function_module.pipes
|
||||||
|
except Exception as e:
|
||||||
|
log.exception(e)
|
||||||
|
sub_pipes = []
|
||||||
|
|
||||||
|
print(sub_pipes)
|
||||||
|
|
||||||
|
for p in sub_pipes:
|
||||||
|
sub_pipe_id = f'{pipe.id}.{p["id"]}'
|
||||||
|
sub_pipe_name = p["name"]
|
||||||
|
|
||||||
if hasattr(function_module, "name"):
|
if hasattr(function_module, "name"):
|
||||||
manifold_pipe_name = f"{function_module.name}{manifold_pipe_name}"
|
sub_pipe_name = f"{function_module.name}{sub_pipe_name}"
|
||||||
|
|
||||||
pipe_flag = {"type": pipe.type}
|
pipe_flag = {"type": pipe.type}
|
||||||
if hasattr(function_module, "ChatValves"):
|
|
||||||
pipe_flag["valves_spec"] = function_module.ChatValves.schema()
|
|
||||||
|
|
||||||
pipe_models.append(
|
pipe_models.append(
|
||||||
{
|
{
|
||||||
"id": manifold_pipe_id,
|
"id": sub_pipe_id,
|
||||||
"name": manifold_pipe_name,
|
"name": sub_pipe_name,
|
||||||
"object": "model",
|
"object": "model",
|
||||||
"created": pipe.created_at,
|
"created": pipe.created_at,
|
||||||
"owned_by": "openai",
|
"owned_by": "openai",
|
||||||
@ -183,8 +187,6 @@ async def get_pipe_models():
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
pipe_flag = {"type": "pipe"}
|
pipe_flag = {"type": "pipe"}
|
||||||
if hasattr(function_module, "ChatValves"):
|
|
||||||
pipe_flag["valves_spec"] = function_module.ChatValves.schema()
|
|
||||||
|
|
||||||
pipe_models.append(
|
pipe_models.append(
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user