赞
踩
安装Docker
登录Docker官网,找到适合自己电脑版本的docker下载,一路next即可
安装完成后,可在cmd中检查是否安装成功,同时检查是否安装docker-compose
配置
创建一个文件夹fastgpt,在文件夹中创建两个文件,分别为config.json和docker-compose.yml
- # Config.json
- {
- "FeConfig": {
- "show_emptyChat": false,
- "show_contact": false,
- "show_git": false,
- "show_doc": true,
- "systemTitle": "个人知识库",
- "limit": {
- "exportLimitMinutes": 0
- },
- "scripts": []
- },
- "SystemParams": {
- "vectorMaxProcess": 15,
- "qaMaxProcess": 15,
- "pgIvfflatProbe": 20
- },
- "ChatModels": [
- {
- "model": "gpt-3.5-turbo",
- "name": "GPT35-4k",
- "contextMaxToken": 4000,
- "quoteMaxToken": 2000,
- "maxTemperature": 1.2,
- "price": 0,
- "defaultSystem": ""
- },
- {
- "model": "gpt-3.5-turbo-16k",
- "name": "GPT35-16k",
- "contextMaxToken": 16000,
- "quoteMaxToken": 8000,
- "maxTemperature": 1.2,
- "price": 0,
- "defaultSystem": ""
- },
- {
- "model": "gpt-4",
- "name": "GPT4-8k",
- "contextMaxToken": 8000,
- "quoteMaxToken": 4000,
- "maxTemperature": 1.2,
- "price": 0,
- "defaultSystem": ""
- }
- ],
- "VectorModels": [
- {
- "model": "text-embedding-ada-002",
- "name": "Embedding-2",
- "price": 0,
- "defaultToken": 500,
- "maxToken": 3000
- }
- ],
- "QAModel": {
- "model": "gpt-3.5-turbo-16k",
- "name": "GPT35-16k",
- "maxToken": 16000,
- "price": 0
- },
- "ExtractModel": {
- "model": "gpt-3.5-turbo-16k",
- "functionCall": true,
- "name": "GPT35-16k",
- "maxToken": 16000,
- "price": 0,
- "prompt": ""
- },
- "CQModel": {
- "model": "gpt-3.5-turbo-16k",
- "functionCall": true,
- "name": "GPT35-16k",
- "maxToken": 16000,
- "price": 0,
- "prompt": ""
- },
- "QGModel": {
- "model": "gpt-3.5-turbo",
- "name": "GPT35-4k",
- "maxToken": 4000,
- "price": 0,
- "prompt": "",
- "functionCall": false
- }
- }
- # Docker-compose.yml
- # 非 host 版本, 不使用本机代理
- version: '3.3'
-
- services:
- pg:
- # 使用阿里云的 pgvector 镜像
- image: registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:v0.4.2
- container_name: pg
- restart: always
- # 生产环境建议不要暴露端口
- ports:
- - "5432:5432"
- networks:
- - fastgpt
- # 环境变量配置,首次运行生效,修改后需删除持久化数据再重启
- environment:
- - POSTGRES_USER=username
- - POSTGRES_PASSWORD=password
- - POSTGRES_DB=fastgpt
- # 卷挂载,包括初始化脚本和数据持久化
- volumes:
- - ./pg/init.sql:/docker-entrypoint-initdb.d/init.sh
- - ./pg/data:/var/lib/postgresql/data
-
- mongo:
- # 使用阿里云的 mongo 镜像
- image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18
- container_name: mongo
- restart: always
- # 生产环境建议不要暴露端口
- ports:
- - "27017:27017"
- networks:
- - fastgpt
- # 环境变量配置,首次运行生效,修改后需删除持久化数据再重启
- environment:
- - MONGO_INITDB_ROOT_USERNAME=username
- - MONGO_INITDB_ROOT_PASSWORD=password
- # 卷挂载,包括数据和日志
- volumes:
- - ./mongo/data:/data/db
- - ./mongo/logs:/var/log/mongodb
-
- fastgpt:
- container_name: fastgpt
- # 使用阿里云的 fastgpt 镜像
- image: registry.cn-hangzhou.aliyuncs.com/david_wang/fastgpt:latest
- ports:
- - "3000:3000"
- networks:
- - fastgpt
- # 确保在 mongo 和 pg 服务启动后再启动 fastgpt
- depends_on:
- - mongo
- - pg
- restart: always
- # 可配置的环境变量
- environment:
- - DEFAULT_ROOT_PSW=123456
- - OPENAI_BASE_URL=https://api.openai.com/v1
- - CHAT_API_KEY=sk-*****
- - DB_MAX_LINK=5
- - TOKEN_KEY=wenwenai
- - ROOT_KEY=wenwenai
- - FILE_TOKEN_KEY=filetoken
- - MONGODB_URI=mongodb://username:password@mongo:27017/fastgpt?authSource=admin
- - PG_URL=postgresql://username:password@pg:5432/fastgpt
- # 配置文件的卷挂载
- volumes:
- - ./config.json:/app/data/config.json
-
- # 定义使用的网络
- networks:
- fastgpt:
启动容器
在所创建的文件夹中打开cmd,运行以下命令
# 在 docker-compose.yml 同级目录下执行
docker-compose pull
docker-compose up -d
执行完成后,访问浏览器 http://localhost:3000/
构建知识库
访问 http://localhost:3000/ 登录后到以下界面后进行登录,选择知识库后,点击新建->知识库
如下图即创建成功
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。