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: