xinli/Archive/当前系统配置说明.md
2026-01-30 16:23:31 +08:00

115 lines
3.0 KiB
Markdown
Raw Permalink 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.

# 当前系统配置说明
## 🎉 好消息!
你的系统已经配置好了,**不需要额外安装ChromaDB**
## 当前配置
### ✅ 已启用的功能
1. **文档管理**
- 文档上传txt、pdf、doc、docx、md
- 文档解析和文本提取
- 文档列表查看
- 文档删除
2. **向量存储**
- 使用 **SimpleVectorStore**(内存向量存储)
- 无需安装ChromaDB
- 数据存储在内存中,重启后会丢失
3. **AI服务状态**
- AI服务已连接 ✓
- 向量存储:正常 ✓
## 系统架构
```
┌─────────────────┐
│ 知识库管理界面 │
└────────┬────────┘
┌─────────────────┐
│ 后端API服务 │
└────────┬────────┘
┌────┴────┐
│ │
▼ ▼
┌────────┐ ┌──────────────┐
│ Ollama │ │SimpleVector │
│ (可选) │ │Store (内存) │
└────────┘ └──────────────┘
```
## SimpleVectorStore vs ChromaDB
### SimpleVectorStore当前使用
**优点:**
- ✅ 无需安装额外服务
- ✅ 配置简单,开箱即用
- ✅ 适合开发和测试
- ✅ 性能快(内存操作)
**缺点:**
- ❌ 数据存储在内存中
- ❌ 重启后数据丢失
- ❌ 不适合大规模数据
- ❌ 无法持久化
### ChromaDB可选升级
**优点:**
- ✅ 数据持久化存储
- ✅ 支持大规模数据
- ✅ 专业的向量数据库
- ✅ 高级查询功能
**缺点:**
- ❌ 需要额外安装
- ❌ 需要独立运行服务
- ❌ 配置相对复杂
## 当前向量化状态
根据代码,向量化功能**已被临时禁用**,原因是:
1. 避免在AI服务未启动时超时
2. 确保文档上传功能正常工作
### 如果需要启用向量化
#### 方案1使用Ollama本地免费
1. 安装Ollama: https://ollama.ai/download
2. 下载模型:
```bash
ollama pull nomic-embed-text
ollama pull deepseek-r1:32b
```
3. 修改代码启用向量化(见下文)
#### 方案2使用OpenAI API付费
1. 获取API Key
2. 配置application.yml
3. 修改代码启用向量化
### 启用向量化的代码修改
打开文件:`ry-xinli-system/src/main/java/com/ddnai/system/rag/service/KnowledgeService.java`
找到第98-115行将注释的代码取消注释
**修改前:**
```java
// 5. 向量化 - 添加超时和异常处理
// 暂时跳过向量化,避免超时问题
List<float[]> embeddings = null;
boolean vectorizationSuccess = false;
// TODO: 启用向量化需要先启动AI服务Ollama或OpenAI
log.info("Vectorization is currently disabled to avoid timeout issues");
log.info("Document will be saved without vector embeddings");
/* 取消注释以启用向量化
try {
embeddings = embeddingService.