Go: refactor (#17635)

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-07-31 17:48:35 +08:00
committed by GitHub
parent 36ae39bc60
commit 165a5db07d
6 changed files with 19 additions and 14 deletions

View File

@@ -1347,7 +1347,7 @@ func (h *DocumentHandler) Ingest(c *gin.Context) {
userID := strings.TrimSpace(user.ID)
if userID == "" {
common.ResponseWithCodeData(c, common.CodeAuthenticationError, nil, "No Authentication")
common.ResponseWithCodeData(c, common.CodeAuthenticationError, nil, "no authentication")
return
}

View File

@@ -451,7 +451,7 @@ func (h *UserHandler) ChangePassword(c *gin.Context) {
// @Tags users
// @Success 200 {object} map[string]interface{}
// @Router /v1/user/login/channels [get]
func (h *UserHandler) GetLoginChannels(c *gin.Context) {
func (h *UserHandler) GetLoginChannelsDeprecated(c *gin.Context) {
channels, code, err := h.userService.GetLoginChannels()
if err != nil {
common.ResponseWithCodeData(c, code, []interface{}{}, "Load channels failure, error: "+err.Error())

View File

@@ -52,7 +52,7 @@ const oauthAuthCookie = "ragflow_auth"
// @Tags users
// @Param channel path string true "channel name"
// @Router /api/v1/auth/login/{channel} [get]
func (h *UserHandler) OAuthLogin(c *gin.Context) {
func (h *UserHandler) OAuthLoginDeprecated(c *gin.Context) {
channel := c.Param("channel")
if channel == "" {
common.ResponseWithHttpCodeData(c, http.StatusBadRequest, common.CodeArgumentError, nil, "channel is required")
@@ -89,7 +89,7 @@ func (h *UserHandler) OAuthLogin(c *gin.Context) {
// @Param code query string true "authorization code"
// @Param state query string true "state token"
// @Router /api/v1/auth/oauth/{channel}/callback [get]
func (h *UserHandler) OAuthChannelCallback(c *gin.Context) {
func (h *UserHandler) OAuthChannelCallbackDeprecated(c *gin.Context) {
channel := c.Param("channel")
// An empty channel segment (/auth/oauth//callback) is a malformed path,
// not a real channel. Python's router never matches it and returns 404;

View File

@@ -65,3 +65,15 @@ func (h *UserHandler) IsAdmin(c *gin.Context) {
func (h *UserHandler) GetMeta(c *gin.Context) {
common.ErrorWithCode(c, common.CodeNotImplemented, "GetMeta not implemented")
}
func (h *UserHandler) OAuthLogin(c *gin.Context) {
common.ErrorWithCode(c, common.CodeNotImplemented, "OAuthLogin not implemented")
}
func (h *UserHandler) OAuthChannelCallback(c *gin.Context) {
common.ErrorWithCode(c, common.CodeNotImplemented, "OAuthChannelCallback not implemented")
}
func (h *UserHandler) GetLoginChannels(c *gin.Context) {
common.SuccessWithData(c, []interface{}{}, "success")
}