opt: adjust styles for ItemList component, cut string for chat role's hello message

This commit is contained in:
RockYang
2023-10-16 10:46:10 +08:00
parent d2a8d655c8
commit a80d01209c
14 changed files with 221 additions and 139 deletions

View File

@@ -78,8 +78,8 @@ func (h *ChatRoleHandler) List(c *gin.Context) {
resp.SUCCESS(c, roleVos)
}
// AddRole 为用户添加角色
func (h *ChatRoleHandler) AddRole(c *gin.Context) {
// UpdateRole 更新用户聊天角色
func (h *ChatRoleHandler) UpdateRole(c *gin.Context) {
user, err := utils.GetLoginUser(c, h.db)
if err != nil {
resp.NotAuth(c)

View File

@@ -8,7 +8,6 @@ import (
"chatplus/store/vo"
"chatplus/utils"
"chatplus/utils/resp"
"encoding/base64"
"fmt"
"github.com/gin-gonic/gin"
"github.com/go-redis/redis/v8"
@@ -160,7 +159,7 @@ func (h *SdJobHandler) Image(c *gin.Context) {
resp.SUCCESS(c)
}
// JobList 获取 MJ 任务列表
// JobList 获取 stable diffusion 任务列表
func (h *SdJobHandler) JobList(c *gin.Context) {
status := h.GetInt(c, "status", 0)
userId := h.GetInt(c, "user_id", 0)
@@ -201,12 +200,6 @@ func (h *SdJobHandler) JobList(c *gin.Context) {
h.db.Delete(&item)
continue
}
if item.ImgURL != "" { // 正在运行中任务使用代理访问图片
image, err := utils.DownloadImage(item.ImgURL, h.App.Config.ProxyURL)
if err == nil {
job.ImgURL = "data:image/png;base64," + base64.StdEncoding.EncodeToString(image)
}
}
}
jobs = append(jobs, job)
}

View File

@@ -185,7 +185,7 @@ func main() {
fx.Invoke(func(s *core.AppServer, h *handler.ChatRoleHandler) {
group := s.Engine.Group("/api/role/")
group.GET("list", h.List)
group.POST("add", h.AddRole)
group.POST("update", h.UpdateRole)
}),
fx.Invoke(func(s *core.AppServer, h *handler.UserHandler) {
group := s.Engine.Group("/api/user/")