mirror of
https://github.com/open-webui/mcpo
synced 2025-06-26 18:26:58 +00:00
refac
Some checks are pending
Create and publish Docker images with specific build args / build-main-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-main-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / merge-main-images (push) Blocked by required conditions
Some checks are pending
Create and publish Docker images with specific build args / build-main-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-main-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / merge-main-images (push) Blocked by required conditions
This commit is contained in:
parent
fe95c6a6fa
commit
4c948e2b51
@ -40,9 +40,8 @@ async def create_dynamic_endpoints(app: FastAPI, api_dependency=None):
|
||||
inputSchema = tool.inputSchema
|
||||
outputSchema = getattr(tool, "outputSchema", None)
|
||||
|
||||
form_model_name = f"{endpoint_name}_form_model"
|
||||
form_model_fields = get_model_fields(
|
||||
form_model_name,
|
||||
f"{endpoint_name}_form_model",
|
||||
inputSchema.get("properties", {}),
|
||||
inputSchema.get("required", []),
|
||||
inputSchema.get("$defs", {}),
|
||||
@ -50,9 +49,8 @@ async def create_dynamic_endpoints(app: FastAPI, api_dependency=None):
|
||||
|
||||
response_model_fields = None
|
||||
if outputSchema:
|
||||
response_model_name = f"{endpoint_name}_response_model"
|
||||
response_model_fields = get_model_fields(
|
||||
response_model_name,
|
||||
f"{endpoint_name}_response_model",
|
||||
outputSchema.get("properties", {}),
|
||||
outputSchema.get("required", []),
|
||||
outputSchema.get("$defs", {}),
|
||||
@ -61,7 +59,6 @@ async def create_dynamic_endpoints(app: FastAPI, api_dependency=None):
|
||||
tool_handler = get_tool_handler(
|
||||
session,
|
||||
endpoint_name,
|
||||
form_model_name,
|
||||
form_model_fields,
|
||||
response_model_fields,
|
||||
)
|
||||
|
||||
@ -195,12 +195,11 @@ def get_model_fields(form_model_name, properties, required_fields, schema_defs=N
|
||||
def get_tool_handler(
|
||||
session,
|
||||
endpoint_name,
|
||||
form_model_name,
|
||||
form_model_fields,
|
||||
response_model_fields=None,
|
||||
):
|
||||
if form_model_fields:
|
||||
FormModel = create_model(form_model_name, **form_model_fields)
|
||||
FormModel = create_model(f"{endpoint_name}_form_model", **form_model_fields)
|
||||
ResponseModel = (
|
||||
create_model(f"{endpoint_name}_response_model", **response_model_fields)
|
||||
if response_model_fields
|
||||
|
||||
Loading…
Reference in New Issue
Block a user