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:
Jin Hai
2026-06-26 13:51:56 +08:00
committed by GitHub
parent 65afaa1292
commit 8bc27d8df1
9 changed files with 133 additions and 7 deletions

View File

@@ -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"`