Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Refactor: REST API langfuse api-key (#14315)

Wang Qie79b89663715
diff --git a/api/apps/langfuse_app.py b/api/apps/restful_apis/langfuse_api.py
similarity index 94%
rename from api/apps/langfuse_app.py
rename to api/apps/restful_apis/langfuse_api.py
index 1d7993d365..70b81b42c6 100644
--- a/api/apps/langfuse_app.py
+++ b/api/apps/restful_apis/langfuse_api.py
@@ -23,7 +23,7 @@ from api.db.services.langfuse_service import TenantLangfuseService
from api.utils.api_utils import get_error_data_result, get_json_result, get_request_json, server_error_response, validate_request
[email protected]("/api_key", methods=["POST", "PUT"]) # noqa: F821
[email protected]("/langfuse/api-key", methods=["POST", "PUT"]) # noqa: F821
@login_required
@validate_request("secret_key", "public_key", "host")
async def set_api_key():
@@ -58,7 +58,7 @@ async def set_api_key():
return server_error_response(e)
[email protected]("/api_key", methods=["GET"]) # noqa: F821
[email protected]("/langfuse/api-key", methods=["GET"]) # noqa: F821
@login_required
@validate_request()
def get_api_key():
@@ -82,7 +82,7 @@ def get_api_key():
return get_json_result(data=langfuse_entry)
[email protected]("/api_key", methods=["DELETE"]) # noqa: F821
[email protected]("/langfuse/api-key", methods=["DELETE"]) # noqa: F821
@login_required
@validate_request()
def delete_api_key():
diff --git a/test/testcases/test_web_api/test_connector_app/test_langfuse_app_unit.py b/test/testcases/test_web_api/test_connector_app/test_langfuse_app_unit.py
index f86d157313..8e6bef31fc 100644
--- a/test/testcases/test_web_api/test_connector_app/test_langfuse_app_unit.py
+++ b/test/testcases/test_web_api/test_connector_app/test_langfuse_app_unit.py
@@ -79,7 +79,7 @@ def _load_langfuse_app(monkeypatch):
stub_langfuse.Langfuse = _FakeLangfuseClient
monkeypatch.setitem(sys.modules, "langfuse", stub_langfuse)
- module_path = repo_root / "api" / "apps" / "langfuse_app.py"
+ module_path = repo_root / "api" / "apps" / "restful_apis" / "langfuse_api.py"
spec = importlib.util.spec_from_file_location("test_langfuse_app_unit", module_path)
module = importlib.util.module_from_spec(spec)
module.manager = _DummyManager()
diff --git a/web/src/utils/api.ts b/web/src/utils/api.ts
index 2eb640c77b..e300293964 100644
--- a/web/src/utils/api.ts
+++ b/web/src/utils/api.ts
@@ -175,7 +175,7 @@ export default {
createSystemToken: `${restAPIv1}/system/tokens`,
removeSystemToken: `${restAPIv1}/system/tokens`,
getSystemConfig: `${webAPI}/system/config`,
- setLangfuseConfig: `${webAPI}/langfuse/api_key`,
+ setLangfuseConfig: `${restAPIv1}/langfuse/api-key`,
// flow
listTemplates: `${webAPI}/canvas/templates`,