From 1f47ea8452e81845e3bb1df5a88418cccbed4d3c Mon Sep 17 00:00:00 2001 From: QuantumGhost Date: Fri, 16 Jan 2026 14:06:32 +0800 Subject: [PATCH] Merge the two delivery test api (vibe-kanban 7e7941e4) The AdvancedChatDraftHumanInputDeliveryTestApi and WorkflowDraftHumanInputDeliveryTestApi are the same. Merge this two api by deleting AdvancedChatDraftHumanInputDeliveryTestApi and allowing Chatflow to use WorkflowDraftHumanInputDeliveryTestApi. Update tests accordingly. This project uses uv to manage dependencies. --- api/controllers/console/app/workflow.py | 32 +------------------ .../test_workflow_human_input_debug_api.py | 8 ++--- 2 files changed, 5 insertions(+), 35 deletions(-) diff --git a/api/controllers/console/app/workflow.py b/api/controllers/console/app/workflow.py index 3349c77879..351ac953dc 100644 --- a/api/controllers/console/app/workflow.py +++ b/api/controllers/console/app/workflow.py @@ -669,36 +669,6 @@ class WorkflowDraftHumanInputFormRunApi(Resource): return jsonable_encoder(result) -@console_ns.route("/apps//advanced-chat/workflows/draft/human-input/nodes//delivery-test") -class AdvancedChatDraftHumanInputDeliveryTestApi(Resource): - @console_ns.doc("test_advanced_chat_draft_human_input_delivery") - @console_ns.doc(description="Test human input delivery for advanced chat workflow") - @console_ns.doc(params={"app_id": "Application ID", "node_id": "Node ID"}) - @console_ns.expect(console_ns.models[HumanInputDeliveryTestPayload.__name__]) - @setup_required - @login_required - @account_initialization_required - @get_app_model(mode=[AppMode.ADVANCED_CHAT]) - @edit_permission_required - def post(self, app_model: App, node_id: str): - """ - Test human input delivery - """ - current_user, _ = current_account_with_tenant() - args = HumanInputDeliveryTestPayload.model_validate(console_ns.payload or {}) - workflow_service = WorkflowService() - try: - workflow_service.test_human_input_delivery( - app_model=app_model, - account=current_user, - node_id=node_id, - delivery_method_id=args.delivery_method_id, - ) - except ValueError as exc: - raise InvalidArgumentError(str(exc)) - return jsonable_encoder({}) - - @console_ns.route("/apps//workflows/draft/human-input/nodes//delivery-test") class WorkflowDraftHumanInputDeliveryTestApi(Resource): @console_ns.doc("test_workflow_draft_human_input_delivery") @@ -708,7 +678,7 @@ class WorkflowDraftHumanInputDeliveryTestApi(Resource): @setup_required @login_required @account_initialization_required - @get_app_model(mode=[AppMode.WORKFLOW]) + @get_app_model(mode=[AppMode.WORKFLOW, AppMode.ADVANCED_CHAT]) @edit_permission_required def post(self, app_model: App, node_id: str): """ diff --git a/api/tests/unit_tests/controllers/console/app/test_workflow_human_input_debug_api.py b/api/tests/unit_tests/controllers/console/app/test_workflow_human_input_debug_api.py index be1421e0e0..ce5a6d6c57 100644 --- a/api/tests/unit_tests/controllers/console/app/test_workflow_human_input_debug_api.py +++ b/api/tests/unit_tests/controllers/console/app/test_workflow_human_input_debug_api.py @@ -160,8 +160,8 @@ class DeliveryTestCase: "case", [ DeliveryTestCase( - resource_cls=workflow_module.AdvancedChatDraftHumanInputDeliveryTestApi, - path="/console/api/apps/app-123/advanced-chat/workflows/draft/human-input/nodes/node-7/delivery-test", + resource_cls=workflow_module.WorkflowDraftHumanInputDeliveryTestApi, + path="/console/api/apps/app-123/workflows/draft/human-input/nodes/node-7/delivery-test", mode=AppMode.ADVANCED_CHAT, ), DeliveryTestCase( @@ -207,12 +207,12 @@ def test_human_input_delivery_test_maps_validation_error(app: Flask, monkeypatch monkeypatch.setattr(workflow_module, "WorkflowService", MagicMock(return_value=service_instance)) with app.test_request_context( - "/console/api/apps/app-123/advanced-chat/workflows/draft/human-input/nodes/node-1/delivery-test", + "/console/api/apps/app-123/workflows/draft/human-input/nodes/node-1/delivery-test", method="POST", json={"delivery_method_id": "bad"}, ): with pytest.raises(InvalidArgumentError): - workflow_module.AdvancedChatDraftHumanInputDeliveryTestApi().post(app_id=app_model.id, node_id="node-1") + workflow_module.WorkflowDraftHumanInputDeliveryTestApi().post(app_id=app_model.id, node_id="node-1") def test_human_input_preview_rejects_non_mapping(app: Flask, monkeypatch: pytest.MonkeyPatch) -> None: