MCPcopy Create free account
hub / github.com/53AI/53AIHub / getVectorIDsForFile

Function getVectorIDsForFile

api/model/file.go:1264–1278  ·  view source on GitHub ↗

getVectorIDsForFile 获取文件相关的所有向量ID

(eid int64, fileID int64)

Source from the content-addressed store, hash-verified

1262
1263// getVectorIDsForFile 获取文件相关的所有向量ID
1264func getVectorIDsForFile(eid int64, fileID int64) ([]string, error) {
1265 var vectorIDs []string
1266
1267 // 查询文件相关的所有检索块的向量ID
1268 err := DB.Model(&RetrievalChunk{}).
1269 Select("vector_id").
1270 Where("eid = ? AND file_id = ? AND vector_id IS NOT NULL AND vector_id != ''", eid, fileID).
1271 Pluck("vector_id", &vectorIDs).Error
1272
1273 if err != nil {
1274 return nil, fmt.Errorf("查询检索块向量ID失败: %v", err)
1275 }
1276
1277 return vectorIDs, nil
1278}
1279
1280// deleteVectorsFromDB 从向量数据库中删除向量
1281func deleteVectorsFromDB(eid int64, fileID int64, vectorIDs []string) error {

Callers 2

cascadeDeleteFileDataFunction · 0.85
CleanupVectorDataForFileFunction · 0.85

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected