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

Function recordVectorCleanupLog

api/model/file.go:1337–1362  ·  view source on GitHub ↗

recordVectorCleanupLog 记录向量清理操作日志

(eid int64, fileID int64, vectorCount int)

Source from the content-addressed store, hash-verified

1335
1336// recordVectorCleanupLog 记录向量清理操作日志
1337func recordVectorCleanupLog(eid int64, fileID int64, vectorCount int) error {
1338 // 创建操作日志
1339 logEntry := &ChunkOperationLog{
1340 Eid: eid,
1341 FileID: fileID,
1342 UserID: 0, // 系统操作
1343 OperationType: "vector_cleanup",
1344 }
1345
1346 // 设置操作数据
1347 operationData := &OperationData{
1348 Description: "文件删除后的向量数据清理",
1349 Details: map[string]interface{}{
1350 "vector_count": vectorCount,
1351 "cleanup_reason": "file_deleted",
1352 "cleanup_time": time.Now().UTC().UnixMilli(),
1353 },
1354 }
1355
1356 if err := logEntry.SetOperationData(operationData); err != nil {
1357 return fmt.Errorf("设置操作数据失败: %v", err)
1358 }
1359
1360 // 保存日志
1361 return logEntry.Save()
1362}
1363
1364func GetFilesByParentPath(eid int64, parentPath string, sort string) ([]File, error) {
1365 var files []File

Callers 1

cleanupVectorDataAsyncFunction · 0.85

Calls 3

SetOperationDataMethod · 0.95
SaveMethod · 0.95
ErrorfMethod · 0.80

Tested by

no test coverage detected