Commit c89b34fd authored by Michael Poluektov's avatar Michael Poluektov
Browse files

flatten job()

parent b9b1fdd1
......@@ -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()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment