feat: analysis user del
This commit is contained in:
@@ -14,8 +14,6 @@ import (
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// PrepareImagePath 将上传字节或已有路径解析为 insightface 可读的本地路径。
|
||||
// 返回 cleanup 用于删除临时文件(共享路径不删)。
|
||||
func PrepareImagePath(file []byte, filePath string) (string, func(), error) {
|
||||
noop := func() {}
|
||||
if len(file) > utils.NumberZero {
|
||||
|
||||
@@ -144,6 +144,18 @@ func UpsertFace(userID int64, vector []float32) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func DeleteFace(userID int64) error {
|
||||
c := getMilvus()
|
||||
if c == nil {
|
||||
return errors.New("milvus client is nil")
|
||||
}
|
||||
if userID < utils.NumberOne {
|
||||
return errors.New("invalid face delete args")
|
||||
}
|
||||
ctx := context.Background()
|
||||
return c.Delete(ctx, collectionName, "", fmt.Sprintf("%s == %d", faceUserIDField, userID))
|
||||
}
|
||||
|
||||
func SearchUser(vector []float32) (int64, float32, error) {
|
||||
c := getMilvus()
|
||||
if c == nil {
|
||||
|
||||
Reference in New Issue
Block a user