API refactor: stats_api and plugin_api (#14324)

### What problem does this PR solve?

API refactor: stats_api and plugin_api

### Type of change

- [x] Refactoring
This commit is contained in:
Wang Qi
2026-04-23 17:16:04 +08:00
committed by GitHub
parent 7817b0d779
commit 4458763a93
5 changed files with 6 additions and 6 deletions

View File

@@ -21,7 +21,7 @@ from api.utils.api_utils import get_json_result
from agent.plugin import GlobalPluginManager
@manager.route('/llm_tools', methods=['GET']) # noqa: F821
@manager.route('/plugin/tools', methods=['GET']) # noqa: F821
@login_required
def llm_tools() -> Response:
tools = GlobalPluginManager.get_llm_tools()

View File

@@ -20,7 +20,7 @@ from api.db.services.user_service import UserTenantService
from api.utils.api_utils import get_data_error_result, get_json_result, server_error_response
from api.apps import login_required, current_user
@manager.route('/stats', methods=['GET']) # noqa: F821
@manager.route('/system/stats', methods=['GET']) # noqa: F821
@login_required
def stats():
try:

View File

@@ -38,7 +38,7 @@ API_APP_URL = f"/{VERSION}/api"
SYSTEM_APP_URL = f"/{VERSION}/system"
SYSTEM_API_URL = f"/api/{VERSION}/system"
LLM_APP_URL = f"/{VERSION}/llm"
PLUGIN_APP_URL = f"/{VERSION}/plugin"
PLUGIN_APP_URL = f"/api/{VERSION}/plugin"
SEARCHES_URL = f"/api/{VERSION}/searches"
CHATS_URL = f"/api/{VERSION}/chats"
@@ -118,7 +118,7 @@ def llm_list(auth, params=None, *, headers=HEADERS):
# PLUGIN APP
def plugin_llm_tools(auth, params=None, *, headers=HEADERS):
res = requests.get(url=f"{HOST_ADDRESS}{PLUGIN_APP_URL}/llm_tools", headers=headers, auth=auth, params=params)
res = requests.get(url=f"{HOST_ADDRESS}{PLUGIN_APP_URL}/tools", headers=headers, auth=auth, params=params)
return res.json()

View File

@@ -74,7 +74,7 @@ def _load_plugin_app(monkeypatch):
stub_plugin.GlobalPluginManager = _StubGlobalPluginManager
monkeypatch.setitem(sys.modules, "agent.plugin", stub_plugin)
module_path = Path(__file__).resolve().parents[4] / "api" / "apps" / "plugin_app.py"
module_path = Path(__file__).resolve().parents[4] / "api" / "apps" / "restful_apis" / "plugin_api.py"
spec = importlib.util.spec_from_file_location("test_plugin_app_unit", module_path)
module = importlib.util.module_from_spec(spec)
module.manager = _DummyManager()

View File

@@ -51,7 +51,7 @@ export default {
boxWebAuthResult: () => `${restAPIv1}/connectors/box/oauth/web/result`,
// plugin
llmTools: `${webAPI}/plugin/llm_tools`,
llmTools: `${restAPIv1}/plugin/tools`,
chatsTranscriptions: `${restAPIv1}/chat/audio/transcription`,