feat: 画图台并发重构 + 品牌定制 + 用户备注 + provider/UI 多项修复

画图台(并发出图):
- 不再锁定 UI:点「生成」开独立任务,可连续多次并发
- 结果网格一行5个、最多10张,进行中/成功/失败状态回显,刷新保留进行中
- 生图张数 1/2/3/4,各自独立计费出卡
- 点图=参考图(单张替换/多张替换末位);首尾帧模型点视频=抓末帧设为首帧,否则放大
- /logs 新增 statuses=pending,success 服务端过滤(status IN 专用 SQL)

品牌定制(设置→网站):
- 自定义 Logo 图片 + 子标题(公开页头部 + 管理侧栏)
- 邮件验证码标题改用站点名:{title} 邮箱验证码

提示词复制:
- 去掉复制按钮,点提示词文字即复制(预览/后台日志/图片管理/画图记录),统一弹「指令已复制」
- 新增 utils/clipboard.js:execCommand 回退,非安全上下文(http/IP)也能复制

用户管理:列表加「备注」列,新建/编辑可填改备注(默认空)

provider 修复:
- grok 401 正确判死封号(markTokenFailure 漏了 grok 池)
- grok 视频支持 15s
- custom 上游报错去敏感(抹掉上游 URL/IP,改英文短描述)
- custom 去掉额度耗尽锁定:429/欠费当临时错误,账号保持 active

UI/其它:
- 展示位弹窗浅色主题适配(tab 选中高亮、输入框边框)— 主题变量 + 中心补丁
- 自定义模型:时长可填任意秒数 + 15s 预设
- 首页设置/卡密弹窗去固定高度与滚动条
- 顶部菜单「记录」→「图片」
- 下线 Flow provider(代码移除)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-30 01:11:22 +08:00
co-authored by Claude Opus 4.8
parent 3ef84bb9b3
commit 1137d0bd1d
35 changed files with 810 additions and 347 deletions
+2 -7
View File
@@ -26,16 +26,11 @@ func (h *AdminReadHandler) Users(c *gin.Context) {
}
out := make([]gin.H, 0, len(users))
generationCounts := map[string]int64{}
if raw, ok := stats["generation_counts"].(map[string]int64); ok {
generationCounts = raw
}
for _, user := range users {
row := userPublic(user)
row["generation_count"] = generationCounts[user.ID]
row["generation_count"] = user.GenerationCount
out = append(out, row)
}
delete(stats, "generation_counts")
c.JSON(http.StatusOK, gin.H{"data": out, "stats": stats})
}
@@ -61,7 +56,7 @@ func (h *AdminReadHandler) Logs(c *gin.Context) {
}
}
items, total, stats, err := h.admin.Logs(c.Request.Context(), limit, offset, kind, status, since, "", "", c.Query("source"), false)
items, total, stats, err := h.admin.Logs(c.Request.Context(), limit, offset, kind, status, nil, since, "", "", c.Query("source"), false)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"detail": "failed to load logs"})
return
+7 -1
View File
@@ -21,5 +21,11 @@ func (h *SiteHandler) Public(c *gin.Context) {
c.JSON(http.StatusInternalServerError, gin.H{"detail": "failed to load site"})
return
}
c.JSON(http.StatusOK, gin.H{"title": title, "contact": h.site.Contact(c.Request.Context())})
ctx := c.Request.Context()
c.JSON(http.StatusOK, gin.H{
"title": title,
"logo": h.site.Logo(ctx),
"subtitle": h.site.Subtitle(ctx),
"contact": h.site.Contact(ctx),
})
}
+23 -7
View File
@@ -17,18 +17,27 @@ func NewSiteSettingsHandler(site *service.SiteService) *SiteSettingsHandler {
}
func (h *SiteSettingsHandler) Get(c *gin.Context) {
title, err := h.site.Title(c.Request.Context())
ctx := c.Request.Context()
title, err := h.site.Title(ctx)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"detail": "failed to load site settings"})
return
}
c.JSON(http.StatusOK, gin.H{"title": title, "contact": h.site.Contact(c.Request.Context())})
c.JSON(http.StatusOK, gin.H{
"title": title,
"logo": h.site.Logo(ctx),
"subtitle": h.site.Subtitle(ctx),
"contact": h.site.Contact(ctx),
})
}
func (h *SiteSettingsHandler) Put(c *gin.Context) {
ctx := c.Request.Context()
var body struct {
Title string `json:"title"`
Contact service.Contact `json:"contact"`
Title string `json:"title"`
Logo string `json:"logo"`
Subtitle string `json:"subtitle"`
Contact service.Contact `json:"contact"`
}
if err := c.ShouldBindJSON(&body); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"detail": "invalid request body"})
@@ -39,14 +48,21 @@ func (h *SiteSettingsHandler) Put(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"detail": "网页主标题不能为空"})
return
}
updated, err := h.site.SetTitle(c.Request.Context(), title)
updated, err := h.site.SetTitle(ctx, title)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"detail": "failed to save site settings"})
return
}
if err := h.site.SetContact(c.Request.Context(), body.Contact); err != nil {
if err := h.site.SetBranding(ctx, body.Logo, body.Subtitle); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"detail": "failed to save branding"})
return
}
if err := h.site.SetContact(ctx, body.Contact); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"detail": "failed to save contact info"})
return
}
c.JSON(http.StatusOK, gin.H{"ok": true, "data": gin.H{"title": updated, "contact": h.site.Contact(c.Request.Context())}})
c.JSON(http.StatusOK, gin.H{"ok": true, "data": gin.H{
"title": updated, "logo": h.site.Logo(ctx), "subtitle": h.site.Subtitle(ctx),
"contact": h.site.Contact(ctx),
}})
}
@@ -3,6 +3,7 @@ package handler
import (
"errors"
"net/http"
"strings"
"backend/internal/service"
"github.com/gin-gonic/gin"
@@ -176,6 +177,16 @@ func (h *UserGenerationHandler) Logs(c *gin.Context) {
offset := parseInt(c.Query("offset"), 0)
kind := c.Query("kind")
status := c.Query("status")
// statuses=pending,success → status IN (...). Used by the 画图台 grid so it can
// fetch exactly the rows it shows (进行中 + 成功) in one query, server-side.
var statuses []string
if s := strings.TrimSpace(c.Query("statuses")); s != "" {
for _, p := range strings.Split(s, ",") {
if p = strings.TrimSpace(p); p != "" {
statuses = append(statuses, p)
}
}
}
// Secure-by-default: always scope to the caller's OWN records. This endpoint
// serves the front-end 日志 / 创作记录 pages, so an admin viewing their personal
// records must NOT see other users' work. Only an admin who explicitly opts
@@ -195,7 +206,7 @@ func (h *UserGenerationHandler) Logs(c *gin.Context) {
// rows with real media (success + stored file), not failed/pending events.
hasFile := c.Query("has_file") == "1" || c.Query("has_file") == "true"
items, total, stats, err := h.admin.Logs(c.Request.Context(), limit, offset, kind, status, nil, userID, excludeSource, source, hasFile)
items, total, stats, err := h.admin.Logs(c.Request.Context(), limit, offset, kind, status, statuses, nil, userID, excludeSource, source, hasFile)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"detail": "failed to load logs"})
return
@@ -430,7 +441,7 @@ func (h *UserGenerationHandler) catalogEntries(c *gin.Context) ([]gin.H, error)
"type": "video",
"ratios": []string{"2:3", "3:2", "1:1", "9:16", "16:9"},
"resolutions": []string{"720p"},
"durations": []string{"6s", "10s"},
"durations": []string{"6s", "10s", "15s"},
"max_reference_images": 6,
"reference_mode": "asset",
"description": "Grok Imagine video (文/图生视频)",