fix(boundary): 修复多库边界问题、版本管理及删除清理
多库检索与存储修复: - RRF 融合去重改用 (collection, chunk_id) 复合键,修复同名文件结果被吞 - DocStore 存储路径加 collection 前缀,修复跨库同名切片数据覆盖 - search_multiple 去重改用复合键 - chunk_id 解析改用 rsplit 兼容下划线文件名 上传与版本管理修复: - 同名文件上传改为覆盖模式,自动清理旧切片 - 修复首次上传不创建版本记录 - 修复覆盖上传版本号回退到 v1 - sync ADDED 分支改用动态版本号生成 - _generate_version_id 改为基于全部版本递增 - 废止/恢复操作同步 SQLite 版本记录 - mark_document_as_superseded 改为仅更新 SQLite 删除清理修复: - 删除文档时同步清理 SQLite 版本记录和变更日志 - 删除向量库时同步清理该库所有版本记录 - cleanup 改为清理 SQLite 记录而非 ChromaDB 测试: - test_version_management.py: 27 条版本管理单元测试 - test_edge_cases.py: 28 条边界用例测试 - test_upload_dedup.py: 5 条上传去重测试 - e2e_risk_test.py: 27 条端到端风险测试 文档: - 新增风险边界问题修复注意事项.md(面向后端的对接文档) - 新增向量库边界风险分析.md - 更新多篇现有文档
This commit is contained in:
@@ -78,7 +78,7 @@
|
||||
```
|
||||
|
||||
**代码位置**:
|
||||
- `knowledge/sync.py` - process_change 方法(第553-600行)
|
||||
- `knowledge/sync.py` - process_change 方法
|
||||
|
||||
**效果**:
|
||||
- 旧版本:status = "superseded",查询时被过滤
|
||||
@@ -96,8 +96,8 @@ POST /api/kb/collections/public_kb/documents/报销制度.pdf/deprecate
|
||||
```
|
||||
|
||||
**代码位置**:
|
||||
- `knowledge/manager.py` - deprecate_document 方法(第1478-1543行)
|
||||
- `api/kb_routes.py` - deprecate_document 端点(第325-350行)
|
||||
- `knowledge/manager.py` - deprecate_document 方法
|
||||
- `api/kb_routes.py` - deprecate_document 端点
|
||||
|
||||
**效果**:
|
||||
- 文档状态:status = "deprecated"
|
||||
@@ -112,8 +112,8 @@ POST /api/kb/collections/public_kb/documents/报销制度.pdf/restore
|
||||
```
|
||||
|
||||
**代码位置**:
|
||||
- `knowledge/manager.py` - restore_document 方法(第1545-1602行)
|
||||
- `api/kb_routes.py` - restore_document 端点(第353-370行)
|
||||
- `knowledge/manager.py` - restore_document 方法
|
||||
- `api/kb_routes.py` - restore_document 端点
|
||||
|
||||
**效果**:
|
||||
- 文档状态:status = "active"
|
||||
@@ -127,8 +127,8 @@ GET /api/kb/collections/public_kb/documents/报销制度.pdf/versions?limit=10
|
||||
```
|
||||
|
||||
**代码位置**:
|
||||
- `knowledge/document_versions.py` - get_document_history 方法(第80-130行)
|
||||
- `api/kb_routes.py` - get_document_versions 端点(第373-420行)
|
||||
- `knowledge/document_versions.py` - get_document_history 方法
|
||||
- `api/kb_routes.py` - get_document_versions 端点
|
||||
|
||||
**返回**:
|
||||
```json
|
||||
@@ -154,7 +154,7 @@ GET /api/kb/collections/public_kb/documents/报销制度.pdf/versions?limit=10
|
||||
### 5. 查询过滤
|
||||
|
||||
**代码位置**:
|
||||
- `knowledge/manager.py` - search_single 方法(第1262-1340行)
|
||||
- `knowledge/manager.py` - search_single 方法
|
||||
|
||||
**默认行为**:
|
||||
```python
|
||||
@@ -365,9 +365,7 @@ for kb_name in kb_names:
|
||||
|
||||
## 📚 相关文档
|
||||
|
||||
- [企业文档管理方案分析](docs/企业文档管理方案分析.md)
|
||||
- [方案C详细说明](docs/方案C详细说明.md)
|
||||
- [实施计划](C:\Users\qq318\.claude\plans\valiant-herding-cookie.md)
|
||||
- [企业文档更新管理方案](docs/企业文档更新管理方案.md)
|
||||
|
||||
---
|
||||
|
||||
@@ -412,6 +410,6 @@ for kb_name in kb_names:
|
||||
|
||||
**实施完成时间**: 2026-04-20
|
||||
**实施者**: Claude Code
|
||||
**代码审查**: 待进行
|
||||
**测试状态**: 待测试
|
||||
**部署状态**: 待部署
|
||||
**代码审查**: 已完成
|
||||
**测试状态**: 已实施
|
||||
**部署状态**: 已部署
|
||||
|
||||
Reference in New Issue
Block a user