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

@@ -289,6 +289,41 @@ func (h *SystemHandler) SetVariable(c *gin.Context) {
})
}
func (h *SystemHandler) ShowVariable(c *gin.Context) {
encodedVarName := c.Param("var_name")
varName, err := common.DecodeFromBase64(encodedVarName)
if err != nil {
c.JSON(http.StatusOK, gin.H{
"code": 400,
"message": err.Error(),
})
return
}
if varName == "" {
c.JSON(http.StatusOK, gin.H{
"code": 400,
"message": "Var name is required",
})
return
}
variable, err := h.systemService.ShowVariable(varName)
if err != nil {
c.JSON(http.StatusOK, gin.H{
"code": 500,
"message": err.Error(),
})
return
}
c.JSON(http.StatusOK, gin.H{
"code": 0,
"message": "SUCCESS",
"data": variable,
})
}
// ListEnvironments handle list environments
func (h *SystemHandler) ListEnvironments(c *gin.Context) {
environments, err := h.systemService.ListEnvironments()