0a9588abb7
- Add pagination support to findAll (page, limit query params) - Add findByTemplateId method to service - Add GET /by-template/:templateId endpoint to controller - Service already includes CRUD for QuestionBank and QuestionBankItem
94 lines
3.0 KiB
Markdown
94 lines
3.0 KiB
Markdown
# 内网部署指南 - Simple-KB 知识库系统
|
|
|
|
## 概述
|
|
|
|
本文档介绍如何在内部网络环境中部署Simple-KB知识库系统,确保所有外部依赖都被移除或替换为内部资源。
|
|
|
|
## 主要修改内容
|
|
|
|
### 1. 外部CDN资源移除
|
|
|
|
已完成修改:
|
|
- 将 KaTeX CSS 文件从外部 CDN (https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css) 移至本地
|
|
- `web/index.html` 已更新为引用本地 `/katex/katex.min.css`
|
|
- KaTeX CSS 文件已复制到 `web/public/katex/katex.min.css`
|
|
|
|
### 2. AI模型API配置
|
|
|
|
系统本身支持内部模型API配置:
|
|
- 模型配置通过 `ModelConfig` 实体管理
|
|
- 支持自定义 `baseUrl` 来指定内部模型服务
|
|
- 用户可通过UI界面配置内部模型端点
|
|
|
|
## 内网部署配置步骤
|
|
|
|
### 步骤1: 部署内部AI模型服务
|
|
|
|
在启动Simple-KB之前,请确保已部署内部AI模型服务,如:
|
|
- 自托管的OpenAI兼容接口 (如 vLLM, Text Generation WebUI等)
|
|
- 内部大语言模型服务
|
|
- 内部嵌入模型服务
|
|
|
|
### 步骤2: 配置模型端点
|
|
|
|
1. 启动Simple-KB系统
|
|
2. 登录系统后,在模型配置页面添加内部模型配置:
|
|
- LLM模型: 配置内部LLM服务的URL和API密钥
|
|
- 嵌入模型: 配置内部嵌入服务的URL和API密钥
|
|
- 重排序模型: 配置内部重排序服务的URL和API密钥
|
|
|
|
### 步骤3: Docker配置(可选高级配置)
|
|
|
|
如果需要修改Docker构建过程以使用内部注册表,请修改以下文件:
|
|
|
|
#### 修改 server/Dockerfile:
|
|
```dockerfile
|
|
# 替换这行:
|
|
RUN yarn config set registry https://registry.npmmirror.com && \
|
|
# 为:
|
|
RUN yarn config set registry http://your-internal-npm-registry && \
|
|
```
|
|
|
|
#### 修改 web/Dockerfile:
|
|
```dockerfile
|
|
# 替换这行:
|
|
RUN yarn config set registry https://registry.npmmirror.com && \
|
|
# 为:
|
|
RUN yarn config set registry http://your-internal-npm-registry && \
|
|
```
|
|
|
|
#### 修改 libreoffice-server/Dockerfile:
|
|
```dockerfile
|
|
# 替换APK仓库源
|
|
RUN echo "http://your-internal-mirror/alpine/v3.19/main" > /etc/apk/repositories && \
|
|
echo "http://your-internal-mirror/alpine/v3.19/community" >> /etc/apk/repositories && \
|
|
|
|
# 替换pip源
|
|
RUN pip install --no-cache-dir -r requirements.txt -i http://your-internal-pypi/
|
|
|
|
# 替换npm源
|
|
RUN npm install --registry=http://your-internal-npm-registry
|
|
```
|
|
|
|
### 步骤4: Nginx配置
|
|
|
|
如果需要修改Nginx配置以适应内部环境:
|
|
|
|
1. 更新 `nginx/conf.d/kb.conf` 中的SSL证书路径
|
|
2. 根据需要修改服务器名称
|
|
3. 确保代理路径正确指向内部服务
|
|
|
|
## 验证步骤
|
|
|
|
1. 确认前端界面正常加载且无外部资源错误
|
|
2. 测试数学公式渲染功能是否正常(KaTeX功能)
|
|
3. 配置内部模型服务并测试问答功能
|
|
4. 确认所有API调用都在内部网络中完成
|
|
|
|
## 注意事项
|
|
|
|
- 系统的所有核心功能现均可在内部网络中运行
|
|
- 外部CDN依赖已被完全移除
|
|
- AI模型服务需单独部署内部实例
|
|
- 在完全离线环境中,构建过程可能需要预先下载所有依赖包
|
|
- 如需完全离线部署,建议预构建镜像并部署到内部镜像仓库 |