diff --git a/api/controllers/service_api/__init__.py b/api/controllers/service_api/__init__.py index 05fb3aa629..9032733e2c 100644 --- a/api/controllers/service_api/__init__.py +++ b/api/controllers/service_api/__init__.py @@ -36,9 +36,6 @@ from .dataset import ( ) from .workspace import models -# Register MethodView classes with the blueprint -bp.add_url_rule("/", view_func=index.IndexApi.as_view("index_api"), methods=["GET"]) - __all__ = [ "annotation", "app", @@ -59,5 +56,4 @@ __all__ = [ "workflow", ] -# Temporarily disable namespace registration to test MethodView -# api.add_namespace(service_api_ns) +api.add_namespace(service_api_ns) diff --git a/api/controllers/service_api/index.py b/api/controllers/service_api/index.py index 2252931b5b..a9d2d6fadc 100644 --- a/api/controllers/service_api/index.py +++ b/api/controllers/service_api/index.py @@ -1,9 +1,11 @@ -from flask.views import MethodView +from flask_restx import Resource from configs import dify_config +from controllers.service_api import service_api_ns -class IndexApi(MethodView): +@service_api_ns.route("/") +class IndexApi(Resource): def get(self): return { "welcome": "Dify OpenAPI",