Go: remove unused API route (#14028)

### What problem does this PR solve?

As title

### Type of change

- [x] Refactoring

---------

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-04-10 18:00:41 +08:00
committed by GitHub
parent 3d59448b0d
commit cfc2928de2
4 changed files with 65 additions and 94 deletions

View File

@ -1,71 +0,0 @@
#
# Copyright 2026 The InfiniFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from api.apps import login_required
from api.utils.api_utils import get_json_result, get_data_error_result
from common.log_utils import get_log_levels, set_log_level
@manager.route("/config/log", methods=["GET"]) # noqa: F821
@login_required
async def get_logger_levels():
"""
Get current log levels for all packages.
---
tags:
- System
responses:
200:
description: Return current log levels
"""
return get_json_result(data=get_log_levels())
@manager.route("/config/log", methods=["PUT"]) # noqa: F821
@login_required
async def set_logger_level():
"""
Set log level for a package.
---
tags:
- System
parameters:
- in: body
name: body
required: true
schema:
type: object
properties:
pkg_name:
type: string
description: Package name (e.g., "rag.utils.es_conn")
level:
type: string
description: Log level (DEBUG, INFO, WARNING, ERROR)
responses:
200:
description: Log level updated successfully
"""
from quart import request
data = await request.get_json()
if not data or "pkg_name" not in data or "level" not in data:
return get_data_error_result(message="pkg_name and level are required")
pkg_name = data["pkg_name"]
level = data["level"]
success = set_log_level(pkg_name, level)
if success:
return get_json_result(data={"pkg_name": pkg_name, "level": level})
else:
return get_data_error_result(message=f"Invalid log level: {level}")

View File

@ -25,6 +25,7 @@ from common.time_utils import current_timestamp, datetime_format
from api.db.db_models import APIToken
from api.db.services.api_service import APITokenService
from api.db.services.user_service import UserTenantService
from common.log_utils import get_log_levels, set_log_level
@manager.route("/system/ping", methods=["GET"]) # noqa: F821
async def ping():
@ -190,4 +191,57 @@ def rm(token):
APITokenService.filter_delete([APIToken.tenant_id == tenant_id, APIToken.token == token])
return get_json_result(data=True)
except Exception as e:
return server_error_response(e)
return server_error_response(e)
@manager.route("/system/config/log", methods=["GET"]) # noqa: F821
@login_required
async def get_logger_levels():
"""
Get current log levels for all packages.
---
tags:
- System
responses:
200:
description: Return current log levels
"""
return get_json_result(data=get_log_levels())
@manager.route("/system/config/log", methods=["PUT"]) # noqa: F821
@login_required
async def set_logger_level():
"""
Set log level for a package.
---
tags:
- System
parameters:
- in: body
name: body
required: true
schema:
type: object
properties:
pkg_name:
type: string
description: Package name (e.g., "rag.utils.es_conn")
level:
type: string
description: Log level (DEBUG, INFO, WARNING, ERROR)
responses:
200:
description: Log level updated successfully
"""
from quart import request
data = await request.get_json()
if not data or "pkg_name" not in data or "level" not in data:
return get_data_error_result(message="pkg_name and level are required")
pkg_name = data["pkg_name"]
level = data["level"]
success = set_log_level(pkg_name, level)
if success:
return get_json_result(data={"pkg_name": pkg_name, "level": level})
else:
return get_data_error_result(message=f"Invalid log level: {level}")

View File

@ -34,7 +34,7 @@ import (
// @Produce json
// @Security ApiKeyAuth
// @Success 200 {object} map[string]interface{}
// @Router /v1/system/token_list [get]
// @Router /api/v1/system/tokens [get]
func (h *SystemHandler) ListTokens(c *gin.Context) {
// Get current user from context
user, exists := c.Get("user")
@ -94,7 +94,7 @@ func (h *SystemHandler) ListTokens(c *gin.Context) {
// @Security ApiKeyAuth
// @Param name query string false "Name of the token"
// @Success 200 {object} map[string]interface{}
// @Router /v1/system/new_token [post]
// @Router /api/v1/system/tokens [post]
func (h *SystemHandler) CreateToken(c *gin.Context) {
// Get current user from context
user, exists := c.Get("user")
@ -164,7 +164,7 @@ func (h *SystemHandler) CreateToken(c *gin.Context) {
// @Security ApiKeyAuth
// @Param token path string true "The API token to remove"
// @Success 200 {object} map[string]interface{}
// @Router /v1/system/token/{token} [delete]
// @Router /api/v1/system/tokens/{token} [delete]
func (h *SystemHandler) DeleteToken(c *gin.Context) {
// Get current user from context
user, exists := c.Get("user")

View File

@ -117,11 +117,6 @@ func (r *Router) Setup(engine *gin.Engine) {
// User set tenant info endpoint
authorized.POST("/v1/user/set_tenant_info", r.userHandler.SetTenantInfo)
// System token endpoints (requires authentication)
authorized.GET("/v1/system/token_list", r.systemHandler.ListTokens)
authorized.POST("/v1/system/new_token", r.systemHandler.CreateToken)
authorized.DELETE("/v1/system/token/:token", r.systemHandler.DeleteToken)
// API v1 route group
v1 := authorized.Group("/api/v1")
{
@ -134,13 +129,6 @@ func (r *Router) Setup(engine *gin.Engine) {
// users.GET("/:id", r.userHandler.GetUserByID)
//}
//apiTokens := v1.Group("/tokens")
//{
// apiTokens.POST("", r.systemHandler.CreateToken)
// apiTokens.GET("", r.systemHandler.ListTokens)
// apiTokens.DELETE("/:token", r.systemHandler.DeleteToken)
//}
// Document routes
documents := v1.Group("/documents")
{
@ -193,13 +181,13 @@ func (r *Router) Setup(engine *gin.Engine) {
chats.GET("/:chat_id", r.chatHandler.GetChat)
}
searches := v1.Group("/searches")
{
searches.GET("", r.searchHandler.ListSearches)
searches.POST("", r.searchHandler.CreateSearch)
searches.GET("/:search_id", r.searchHandler.GetSearch)
searches.DELETE("/:search_id", r.searchHandler.DeleteSearch)
}
searches := v1.Group("/searches")
{
searches.GET("", r.searchHandler.ListSearches)
searches.POST("", r.searchHandler.CreateSearch)
searches.GET("/:search_id", r.searchHandler.GetSearch)
searches.DELETE("/:search_id", r.searchHandler.DeleteSearch)
}
file := v1.Group("/files")
{