mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-12 06:35:44 +08:00
Go CLI: fix show variable (#16370)
### What problem does this PR solve? ``` RAGFlow(api/default)> show var 'mail.port'; +-----------+-----------+--------------+-------+ | data_type | name | setting_type | value | +-----------+-----------+--------------+-------+ | integer | mail.port | config | 30 | +-----------+-----------+--------------+-------+ ``` ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -696,6 +696,28 @@ func (h *Handler) ListVariables(c *gin.Context) {
|
||||
success(c, variable, "")
|
||||
}
|
||||
|
||||
// ShowVariable handle show variable
|
||||
func (h *Handler) ShowVariable(c *gin.Context) {
|
||||
encodedVarName := c.Param("var_name")
|
||||
varName, err := common.DecodeFromBase64(encodedVarName)
|
||||
if err != nil {
|
||||
errorResponse(c, err.Error(), 400)
|
||||
return
|
||||
}
|
||||
if varName == "" {
|
||||
errorResponse(c, "Var name is required", 400)
|
||||
return
|
||||
}
|
||||
|
||||
variable, err := h.service.GetVariable(varName)
|
||||
if err != nil {
|
||||
errorResponse(c, err.Error(), 500)
|
||||
return
|
||||
}
|
||||
|
||||
success(c, variable, "")
|
||||
}
|
||||
|
||||
// SetVariableHTTPRequest set variable request
|
||||
type SetVariableHTTPRequest struct {
|
||||
VarName string `json:"var_name" binding:"required"`
|
||||
|
||||
Reference in New Issue
Block a user