feat: able to set group ratio now (close #62, close #142)

This commit is contained in:
JustSong committed 2023-06-11 11:08:16 +08:00
1 parent 2d2c6865d5
commit 1e791392f2
10 files changed
+134 -8

No files matched your search

+3 -2
View File
@@ -16,6 +16,9 @@ type ModelRequest struct {
func Distribute() func(c *gin.Context) {
return func(c *gin.Context) {
userId := c.GetInt("id")
userGroup, _ := model.GetUserGroup(userId)
c.Set("group", userGroup)
var channel *model.Channel
channelId, ok := c.Get("channelId")
if ok {
@@ -70,8 +73,6 @@ func Distribute() func(c *gin.Context) {
modelRequest.Model = "text-moderation-stable"
}
}
userId := c.GetInt("id")
userGroup, _ := model.GetUserGroup(userId)
channel, err = model.GetRandomSatisfiedChannel(userGroup, modelRequest.Model)
if err != nil {
c.JSON(200, gin.H{