🐛 Fix analyze result did not applied

This commit is contained in:
LittleSheep 2025-01-01 17:20:30 +08:00
parent 5e73d9acd4
commit 8cd1037759

View File

@ -220,7 +220,10 @@ func AnalyzeAttachment(file models.Attachment) error {
tx := database.C.Begin() tx := database.C.Begin()
if err := tx.Model(&file).Update("is_analyzed", true).Error; err != nil { if err := tx.Model(&file).Updates(&models.Attachment{
IsAnalyzed: true,
Metadata: file.Metadata,
}).Error; err != nil {
tx.Rollback() tx.Rollback()
return fmt.Errorf("unable to update file record: %v", err) return fmt.Errorf("unable to update file record: %v", err)
} }