flatten job()

This commit is contained in:
Michael Poluektov 2024-07-31 22:05:37 +01:00
parent b9b1fdd1a1
commit c89b34fd75

View File

@ -147,7 +147,7 @@ async def get_pipe_models():
function_module = get_function_module(pipe.id)
# Check if function is a manifold
if hasattr(function_module, "type") and function_module.type == "manifold":
if hasattr(function_module, "pipes"):
manifold_pipes = []
# 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 = populate_system_message(params, form_data, user)
async def job():
pipe_id = get_pipe_id(form_data)
function_module = get_function_module(pipe_id)
@ -371,9 +370,7 @@ async def generate_function_chat_completion(form_data, user):
return
if isinstance(res, str):
message = openai_chat_chunk_message_template(
form_data["model"], res
)
message = openai_chat_chunk_message_template(form_data["model"], res)
yield f"data: {json.dumps(message)}\n\n"
if isinstance(res, Iterator):
@ -408,5 +405,3 @@ async def generate_function_chat_completion(form_data, user):
message = await get_message_content(res)
return openai_chat_completion_message_template(form_data["model"], message)
return await job()