赞
踩
1.Install the NVIDIA Container Toolkit.
Configure the repository
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey \
| sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \
| sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' \
| sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
2.Install the NVIDIA Container Toolkit packages
sudo apt-get install -y nvidia-container-toolkit
3.Start the container
docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
1.创建chatollama文件夹 然后下载docker-compose.yml
2.运行容器
docker-compose build
docker-compose up
3.首次运行需要初始化初始化SQLite数据库
docker compose exec chatollama npx prisma migrate dev
4.登录127.0.0.1:3000 访问chatOllama 配置ollama地址
5.下载embedding和chat模型 进行推理 以及可以插入本地数据库数据
sudo docker run --name oneapi -d --restart always -p 3000:3000 -e TZ=Asia/Shanghai -v /home/ubuntu/data/one-api:/data justsong/one-api
创建容器 访问127.0.0.1:3001 创建一个令牌 设置无线访问 以及无限访问时间
设置秘钥为 sk-aaabbbcccdddeeefffggghhhiiijjjkkk
docker-compose.yml # 非 host 版本, 不使用本机代理 version: '3.3' services: pg: image: ankane/pgvector:v0.5.0 # git # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:v0.5.0 # 阿里云 container_name: pg restart: always ports: # 生产环境建议不要暴露 - 5432:5432 networks: - fastgpt environment: # 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果 - POSTGRES_USER=username - POSTGRES_PASSWORD=password - POSTGRES_DB=postgres volumes: - ./pg/data:/var/lib/postgresql/data mongo: image: mongo:5.0.18 # 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 fastgpt: container_name: fastgpt #image: ghcr.io/labring/fastgpt:latest # git image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.6.6 # 阿里云 ports: - 3020:3000 #与One API的默认3000地址冲突,所有修改为3020 networks: - fastgpt depends_on: - mongo - pg restart: always environment: # root 密码,用户名为: root - DEFAULT_ROOT_PSW=1234 # 中转地址,如果是用官方号,不需要管 - OPENAI_BASE_URL=http://192.168.35.134:3000/v1 - CHAT_API_KEY=sk-ZZKMAmTrQcv5Xbiw16857a9a070d454bAdF95aEf814f0e38 - DB_MAX_LINK=5 # database max link - TOKEN_KEY=any - ROOT_KEY=root_key - FILE_TOKEN_KEY=filetoken # mongo 配置,不需要改. 如果连不上,可能需要去掉 ?authSource=admin - MONGODB_URI=mongodb://username:password@mongo:27017/fastgpt?authSource=admin # pg配置. 不需要改 - PG_URL=postgresql://username:password@pg:5432/postgres volumes: - ./config.json:/app/data/config.json networks: fastgpt:
主要修改以下
- OPENAI_BASE_URL=http://192.168.35.134:3000/v1 你的Ipv4地址
- CHAT_API_KEY=sk-ZZKMAmTrQcv5Xbiw16857a9a070d4 换成你的秘钥
config.json { "systemEnv": { "openapiPrefix": "fastgpt", "vectorMaxProcess": 15, "qaMaxProcess": 15, "pgHNSWEfSearch": 100 }, "chatModels": [ { "model": "chatglm3", "name": "chatglm3", "inputPrice": 0, "outputPrice": 0, "maxContext": 4000, "maxResponse": 4000, "quoteMaxToken": 2000, "maxTemperature": 1.2, "censor": false, "vision": false, "defaultSystemChatPrompt": "" } ], "qaModels": [ { "model": "chatglm3", "name": "chatglm3", "inputPrice": 0, "outputPrice": 0, "maxContext": 4000, "maxResponse": 4000, "quoteMaxToken": 2000, "maxTemperature": 1.2, "censor": false, "vision": false, "defaultSystemChatPrompt": "" } ], "cqModels": [ { "model": "chatglm3", "name": "chatglm3", "inputPrice": 0, "outputPrice": 0, "maxContext": 4000, "maxResponse": 4000, "quoteMaxToken": 2000, "maxTemperature": 1.2, "censor": false, "vision": false, "defaultSystemChatPrompt": "" } ], "extractModels": [ { "model": "chatglm3", "name": "chatglm3", "inputPrice": 0, "outputPrice": 0, "maxContext": 4000, "maxResponse": 4000, "quoteMaxToken": 2000, "maxTemperature": 1.2, "censor": false, "vision": false, "defaultSystemChatPrompt": "" } ], "qgModels": [ { "model": "chatglm3", "name": "chatglm3", "inputPrice": 0, "outputPrice": 0, "maxContext": 4000, "maxResponse": 4000, "quoteMaxToken": 2000, "maxTemperature": 1.2, "censor": false, "vision": false, "defaultSystemChatPrompt": "" } ], "vectorModels": [ { "model": "m3e", "name": "m3e", "price": 0.1, "defaultToken": 700, "maxToken": 3000 } ], "reRankModels": [], "audioSpeechModels": [ { "model": "tts-1", "name": "OpenAI TTS1", "inputPrice": 0, "outputPrice": 0, "voices": [ { "label": "Alloy", "value": "alloy", "bufferId": "openai-Alloy" }, { "label": "Echo", "value": "echo", "bufferId": "openai-Echo" }, { "label": "Fable", "value": "fable", "bufferId": "openai-Fable" }, { "label": "Onyx", "value": "onyx", "bufferId": "openai-Onyx" }, { "label": "Nova", "value": "nova", "bufferId": "openai-Nova" }, { "label": "Shimmer", "value": "shimmer", "bufferId": "openai-Shimmer" } ] } ], "whisperModel": { "model": "whisper-1", "name": "Whisper1", "inputPrice": 0, "outputPrice": 0 } }
然后在此目录下打开终端输入以下命令(创建的fastgpt文件夹内打开命令行):
docker-compose bulid #依据docker-compose.yum生成镜像
docker-compose up -d #启动容器加 -d代表后台守护进程启动
进入fastgpt的web页面:
输入默认的用户名root,密码1234 创建应用设置
设置知识库
进行对话
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。