forked from lobehub/lobe-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: files and knowledge base (lobehub#3487)
* ✨ feat: add files and knowledge base Update edge.ts Update test.yml 🎨 chore: fix locale Update index.tsx 测试 pgvector workflow * 💄 style: improve upload detail * ✨ feat: support delete s3 file when delete files * 💄 style: improve chunks in message * ♻️ refactor: refactor the auth method * ✨ feat: support use user client api key * 💄 style: fix image list in mobile * ✨ feat: support file upload on mobile * ✅ test: fix test * fix vercel build * docs: update docs * 👷 build: improve docker * update i18n
- Loading branch information
Showing
352 changed files
with
20,334 additions
and
1,727 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# 知识库/文件上传 | ||
|
||
LobeChat 支持文件上传/知识库管理。该功能依赖于以下核心技术组件,了解这些组件将有助于你成功部署和维护知识库系统。 | ||
|
||
## 核心组件 | ||
|
||
### 1. PostgreSQL 与 PGVector | ||
|
||
PostgreSQL 是一个强大的开源关系型数据库系统,而 PGVector 是其扩展,为向量操作提供支持。 | ||
|
||
- **用途**:存储结构化数据和向量索引 | ||
- **部署建议**:使用官方 Docker 镜像可以快速部署 PostgreSQL 和 PGVector | ||
|
||
示例部署脚本: | ||
|
||
``` | ||
docker run -p 5432:5432 -d --name pg -e POSTGRES_PASSWORD=mysecretpassword pgvector/pgvector:pg16 | ||
``` | ||
|
||
- **注意事项**:确保分配足够的资源以处理向量操作 | ||
|
||
### 2. S3 兼容的对象存储 | ||
|
||
S3(或兼容 S3 协议的存储服务)用于存储上传的文件。 | ||
|
||
- **用途**:存储原始文件 | ||
- **选项**:可以使用 AWS S3、MinIO 或其他兼容 S3 协议的存储服务 | ||
- **注意事项**:配置适当的访问权限和安全策略 | ||
|
||
### 3. OpenAI Embedding | ||
|
||
OpenAI 的嵌入(Embedding)服务用于将文本转化为向量表示。 | ||
|
||
- **用途**:生成文本的向量表示,用于语义搜索 | ||
- **注意事项**: | ||
- 需要有效的 OpenAI API 密钥 | ||
- 实施适当的 API 调用限制和错误处理机制 | ||
|
||
### 4. Unstructured.io(可选) | ||
|
||
Unstructured.io 是一个强大的文档处理工具。 | ||
|
||
- **用途**:处理复杂的文档格式,提取结构化信息 | ||
- **应用场景**:处理 PDF、Word 等非纯文本格式的文档 | ||
- **注意事项**:评估处理需求,根据文档复杂度决定是否部署 | ||
|
||
## 部署注意事项 | ||
|
||
1. **数据安全**:确保所有组件都有适当的安全措施,特别是涉及敏感数据时。 | ||
|
||
2. **性能优化**: | ||
|
||
- 为 PostgreSQL 和 PGVector 配置足够的计算资源 | ||
- 优化 S3 存储的访问策略和缓存机制 | ||
|
||
3. **可扩展性**:设计架构时考虑未来可能的数据增长和用户增加。 | ||
|
||
4. **监控与维护**: | ||
|
||
- 实施日志记录和监控系统 | ||
- 定期备份数据库和对象存储 | ||
|
||
5. **合规性**:确保部署符合相关的数据保护法规和隐私政策。 | ||
|
||
通过正确配置和集成这些核心组件,您可以为 LobeChat 构建一个强大、高效的知识库系统。每个组件都在整体架构中扮演着关键角色,共同支持高级的文档管理和智能检索功能。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.