geo/docs/02-模块说明/knowledge-base.md

51 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 知识库
## 概述
GEO平台的知识库系统基于RAGRetrieval-Augmented Generation架构为内容生成提供领域知识支持。
## 系统架构
```
文档上传 → 文本分块 → 向量化 → RAG检索 → LLM增强生成
```
## 核心功能
### 文档管理
- 支持多种文档格式PDF、TXT、Markdown、DOCX
- 文档版本管理
- 分类和标签
### 文本分块
- 智能分块策略
- 重叠窗口机制
- 元数据保留
### 向量化
- 支持多种嵌入模型
- 向量数据库存储
- 相似度检索
## API接口
知识库相关API位于 `backend/app/api/knowledge.py`
### 主要端点
| 方法 | 路径 | 说明 |
|------|------|------|
| GET | /api/v1/knowledge/bases | 获取知识库列表 |
| POST | /api/v1/knowledge/bases | 创建知识库 |
| POST | /api/v1/knowledge/bases/{id}/documents | 上传文档 |
| GET | /api/v1/knowledge/search | 搜索知识 |
## 配置
环境变量:
- `KNOWLEDGE_EMBEDDING_MODEL` - 嵌入模型
- `KNOWLEDGE_VECTOR_DB` - 向量数据库类型