recordVectorCleanupLog 记录向量清理操作日志
(eid int64, fileID int64, vectorCount int)
| 1335 | |
| 1336 | // recordVectorCleanupLog 记录向量清理操作日志 |
| 1337 | func 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 | |
| 1364 | func GetFilesByParentPath(eid int64, parentPath string, sort string) ([]File, error) { |
| 1365 | var files []File |
no test coverage detected