From 23175708e68231dd63e857c09fefa15301412201 Mon Sep 17 00:00:00 2001 From: Reinier van der Leer Date: Thu, 12 Feb 2026 10:38:00 +0100 Subject: [PATCH] update OpenAPI schema and add back model_rebuild --- .../backend/backend/data/integrations.py | 16 ++++++++++------ .../components/legacy-builder/Flow/Flow.tsx | 2 +- .../frontend/src/app/api/openapi.json | 6 ------ .../frontend/src/lib/autogpt-server-api/types.ts | 2 +- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/autogpt_platform/backend/backend/data/integrations.py b/autogpt_platform/backend/backend/data/integrations.py index fe60c39531..a6f007ce99 100644 --- a/autogpt_platform/backend/backend/data/integrations.py +++ b/autogpt_platform/backend/backend/data/integrations.py @@ -61,9 +61,18 @@ class Webhook(BaseDbModel): ) +# LibraryAgentPreset import must be after Webhook definition to avoid +# broken circular import: +# integrations.py → library/model.py → integrations.py (for Webhook) +from backend.api.features.library.model import LibraryAgentPreset # noqa: E402 + +# Resolve forward refs +LibraryAgentPreset.model_rebuild() + + class WebhookWithRelations(Webhook): triggered_nodes: list[NodeModel] - triggered_presets: list["LibraryAgentPreset"] + triggered_presets: list[LibraryAgentPreset] @staticmethod def from_db(webhook: IntegrationWebhook): @@ -82,11 +91,6 @@ class WebhookWithRelations(Webhook): ) -# LibraryAgentPreset import must be after WebhookWithRelations definition to avoid -# broken circular import: -# integrations.py → library/model.py → integrations.py (for Webhook) -from backend.api.features.library.model import LibraryAgentPreset # noqa: E402 - # --------------------- CRUD functions --------------------- # diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx index 67b3cad9af..babe10b912 100644 --- a/autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx +++ b/autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx @@ -1137,7 +1137,7 @@ const FlowEditor: React.FC<{ You are building a Trigger Agent Your agent{" "} - {savedAgent?.nodes.some((node) => node.webhook) + {savedAgent?.nodes.some((node) => node.webhook_id) ? "is listening" : "will listen"}{" "} for its trigger and will run when the time is right. diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.json index 172419d27e..5d2cb83f7c 100644 --- a/autogpt_platform/frontend/src/app/api/openapi.json +++ b/autogpt_platform/frontend/src/app/api/openapi.json @@ -9498,12 +9498,6 @@ "webhook_id": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Webhook Id" - }, - "webhook": { - "anyOf": [ - { "$ref": "#/components/schemas/Webhook" }, - { "type": "null" } - ] } }, "type": "object", diff --git a/autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts b/autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts index 51e0b7d475..65625f1cfb 100644 --- a/autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts +++ b/autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts @@ -292,7 +292,7 @@ export type NodeCreatable = { export type Node = NodeCreatable & { input_links: Link[]; output_links: Link[]; - webhook?: Webhook; + webhook_id?: string | null; }; /* Mirror of backend/data/graph.py:Link */