Skip to content

Commit

Permalink
fix: maybe fail to sync config to remote node #775
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJacky committed Dec 15, 2024
1 parent a691532 commit 3fecf9e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/config/modify.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/sashabaranov/go-openai"
"github.com/uozi-tech/cosy"
"gorm.io/gen/field"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -55,7 +56,9 @@ func EditConfig(c *gin.Context) {
}

q := query.Config
cfg, err := q.Where(q.Filepath.Eq(absPath)).FirstOrCreate()
cfg, err := q.Assign(field.Attrs(&model.Config{
Name: filepath.Base(absPath),
})).Where(q.Filepath.Eq(absPath)).FirstOrCreate()
if err != nil {
api.ErrHandler(c, err)
return
Expand Down

0 comments on commit 3fecf9e

Please sign in to comment.