Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: aiproxy group api param id #5224

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions service/aiproxy/controller/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,21 +125,28 @@ func GetGroupDashboard(c *gin.Context) {
}

type UpdateGroupQPMRequest struct {
ID string `json:"id"`
QPM int64 `json:"qpm"`
QPM int64 `json:"qpm"`
}

func UpdateGroupQPM(c *gin.Context) {
id := c.Param("id")
if id == "" {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "invalid parameter",
})
return
}
req := UpdateGroupQPMRequest{}
err := json.NewDecoder(c.Request.Body).Decode(&req)
if err != nil || req.ID == "" {
if err != nil {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "invalid parameter",
})
return
}
err = model.UpdateGroupQPM(req.ID, req.QPM)
err = model.UpdateGroupQPM(id, req.QPM)
if err != nil {
c.JSON(http.StatusOK, gin.H{
"success": false,
Expand All @@ -154,21 +161,28 @@ func UpdateGroupQPM(c *gin.Context) {
}

type UpdateGroupStatusRequest struct {
ID string `json:"id"`
Status int `json:"status"`
Status int `json:"status"`
}

func UpdateGroupStatus(c *gin.Context) {
id := c.Param("id")
if id == "" {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "invalid parameter",
})
return
}
req := UpdateGroupStatusRequest{}
err := json.NewDecoder(c.Request.Body).Decode(&req)
if err != nil || req.ID == "" {
if err != nil {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "invalid parameter",
})
return
}
err = model.UpdateGroupStatus(req.ID, req.Status)
err = model.UpdateGroupStatus(id, req.Status)
if err != nil {
c.JSON(http.StatusOK, gin.H{
"success": false,
Expand Down
Loading