20 lines
800 B
Markdown
20 lines
800 B
Markdown
|
|
# DV-0006:ZVec 向量化 – 设计(Design)
|
|||
|
|
|
|||
|
|
## 上下文
|
|||
|
|
`zvec_service.py`、`file_vector_sync_service.py`、`project_vectorization_task_service.py`。
|
|||
|
|
|
|||
|
|
## 分块
|
|||
|
|
- 字符滑动窗口:chunk_size(默认 800)/ overlap(150);每块生成 anchor、content_hash。
|
|||
|
|
|
|||
|
|
## 写入
|
|||
|
|
- ZVec collection 每项目一个(`vector_index/<project_id>`);embedding 用配置的 `model_type=embedding` 模型。
|
|||
|
|
- `document_vector` 表逐块记录(zvec_id/chunk_text/status/error)。
|
|||
|
|
|
|||
|
|
## 触发
|
|||
|
|
- 写路径:`ProjectFileService → FileVectorSyncService`(后台、按项目串行)。
|
|||
|
|
- 全量:`ProjectVectorizationTaskService`(后台任务 + 进度表)。
|
|||
|
|
|
|||
|
|
## 维度变更
|
|||
|
|
- 检测现有 collection 维度与模型不一致 → 重建 collection,旧向量作废需重向量化。
|
|||
|
|
|