diff --git a/internal/web/ui.go b/internal/web/ui.go index 2fa01f6..c5f3c0c 100644 --- a/internal/web/ui.go +++ b/internal/web/ui.go @@ -3986,11 +3986,22 @@ func (u *UI) actionFaceGalleryBuild(w http.ResponseWriter, r *http.Request) { } output, err := builder.Build() if err != nil { - msg := fmt.Sprintf("生成失败: %v\n%s", err, output) + msg := fmt.Sprintf("生成失败: %v", err) http.Redirect(w, r, "/ui/face-gallery?msg="+url.QueryEscape(msg), http.StatusFound) return } - msg := "人脸库生成成功\n" + output + // Parse key stats from output for a clean message + persons := "0" + photos := "0" + for _, line := range strings.Split(output, "\n") { + if strings.HasPrefix(line, "enrolled_persons:") { + persons = strings.TrimSpace(strings.TrimPrefix(line, "enrolled_persons:")) + } + if strings.HasPrefix(line, "ok_images:") { + photos = strings.TrimSpace(strings.TrimPrefix(line, "ok_images:")) + } + } + msg := fmt.Sprintf("生成成功,共 %s 人,%s 张照片", persons, photos) http.Redirect(w, r, "/ui/face-gallery?msg="+url.QueryEscape(msg), http.StatusFound) }