mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-06-29 15:31:05 +08:00
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:
@@ -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()
|
||||
@@ -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:
|
||||
@@ -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()
|
||||
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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`,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user