fix: 增加 AI 匹配失败弹窗并补齐部署配置 (#229)

This commit is contained in:
chengma
2026-08-14 17:48:58 +08:00
parent 03d3cb5ac9
commit 0208dc6b76
11 changed files with 105 additions and 6 deletions
+13 -2
View File
@@ -18,7 +18,7 @@ func (h *Handler) SybAIMatchCreate(c *gin.Context) {
actor := currentUser(c)
snapshot, err := service.LoadActiveAIMatchSnapshot(c.Request.Context(), h.db, h.aiSecrets, h.aiPolicy)
if err != nil {
h.sybRedirect(c, "AI 规格匹配未开始:"+err.Error())
h.sybRedirectAIMatchError(c, "AI 规格匹配未开始:"+err.Error())
return
}
batch, err := service.CreateAIMatchBatch(h.db, actor, c.PostFormArray("ids"), snapshot, time.Now())
@@ -27,7 +27,7 @@ func (h *Handler) SybAIMatchCreate(c *gin.Context) {
if service.IsValidationError(err) {
message = "AI 规格匹配未开始:" + err.Error()
}
h.sybRedirect(c, message)
h.sybRedirectAIMatchError(c, message)
return
}
actorCopy := *actor
@@ -42,6 +42,17 @@ func (h *Handler) SybAIMatchCreate(c *gin.Context) {
h.sybRedirectAIMatch(c, batch.BatchID, "AI 规格匹配已开始,可在进度窗口查看逐条结果")
}
// sybRedirectAIMatchError 使用独立参数返回列表,让页面明确弹出 AI 失败提示。
// 普通列表状态仍使用 msg,避免同步、采集等操作结果被误当成 AI 错误。
func (h *Handler) sybRedirectAIMatchError(c *gin.Context, message string) {
params := url.Values{}
appendSybFormState(params, c)
if message != "" {
params.Set("ai_error", strings.TrimSpace(message))
}
c.Redirect(http.StatusSeeOther, "/syb?"+params.Encode())
}
func (h *Handler) SybAIMatchStatus(c *gin.Context) {
view, err := service.GetAIMatchBatchView(h.db, currentUser(c), c.Param("batch_id"))
if errors.Is(err, service.ErrForbidden) {