mirror of
https://github.com/open-webui/open-webui
synced 2025-04-07 14:14:50 +00:00
flatten job()
This commit is contained in:
parent
b9b1fdd1a1
commit
c89b34fd75
@ -147,7 +147,7 @@ async def get_pipe_models():
|
|||||||
function_module = get_function_module(pipe.id)
|
function_module = get_function_module(pipe.id)
|
||||||
|
|
||||||
# Check if function is a manifold
|
# Check if function is a manifold
|
||||||
if hasattr(function_module, "type") and function_module.type == "manifold":
|
if hasattr(function_module, "pipes"):
|
||||||
manifold_pipes = []
|
manifold_pipes = []
|
||||||
|
|
||||||
# Check if pipes is a function or a list
|
# Check if pipes is a function or a list
|
||||||
@ -343,7 +343,6 @@ async def generate_function_chat_completion(form_data, user):
|
|||||||
form_data = add_model_params(params, form_data)
|
form_data = add_model_params(params, form_data)
|
||||||
form_data = populate_system_message(params, form_data, user)
|
form_data = populate_system_message(params, form_data, user)
|
||||||
|
|
||||||
async def job():
|
|
||||||
pipe_id = get_pipe_id(form_data)
|
pipe_id = get_pipe_id(form_data)
|
||||||
function_module = get_function_module(pipe_id)
|
function_module = get_function_module(pipe_id)
|
||||||
|
|
||||||
@ -371,9 +370,7 @@ async def generate_function_chat_completion(form_data, user):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if isinstance(res, str):
|
if isinstance(res, str):
|
||||||
message = openai_chat_chunk_message_template(
|
message = openai_chat_chunk_message_template(form_data["model"], res)
|
||||||
form_data["model"], res
|
|
||||||
)
|
|
||||||
yield f"data: {json.dumps(message)}\n\n"
|
yield f"data: {json.dumps(message)}\n\n"
|
||||||
|
|
||||||
if isinstance(res, Iterator):
|
if isinstance(res, Iterator):
|
||||||
@ -408,5 +405,3 @@ async def generate_function_chat_completion(form_data, user):
|
|||||||
|
|
||||||
message = await get_message_content(res)
|
message = await get_message_content(res)
|
||||||
return openai_chat_completion_message_template(form_data["model"], message)
|
return openai_chat_completion_message_template(form_data["model"], message)
|
||||||
|
|
||||||
return await job()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user