get aiSummary and documents refactor

This commit is contained in:
Mazyar
2026-05-16 11:01:13 +03:30
parent f08982afb5
commit ca490f3acf
3 changed files with 302 additions and 58 deletions
+31
View File
@@ -0,0 +1,31 @@
package ai_summarizer
import (
"errors"
"net/http"
"strings"
"github.com/minio/minio-go/v7"
)
// isMinioNotFound reports whether err indicates the object or bucket key is missing.
// The MinIO Go SDK often returns success from GetObject and surfaces NoSuchKey on Read.
func isMinioNotFound(err error) bool {
if err == nil {
return false
}
var minioErr minio.ErrorResponse
if errors.As(err, &minioErr) {
if minioErr.StatusCode == http.StatusNotFound {
return true
}
switch strings.ToLower(minioErr.Code) {
case "nosuchkey", "notfound":
return true
}
}
msg := strings.ToLower(err.Error())
return strings.Contains(msg, "does not exist") ||
strings.Contains(msg, "nosuchkey") ||
strings.Contains(msg, "not found")
}