首页 > 其他分享 >本地部署GPT全流程自动化文件

本地部署GPT全流程自动化文件

时间:2024-07-24 11:28:49浏览次数:12  
标签:fastgpt false name 流程 openai 自动化 GPT model true

FastGPT

docker-compose.yml

# 数据库的默认账号和密码仅首次运行时设置有效
# 如果修改了账号密码,记得改数据库和项目连接参数,别只改一处~
# 该配置文件只是给快速启动,测试使用。正式使用,记得务必修改账号密码,以及调整合适的知识库参数,共享内存等。

version: '3.5'
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:
      - ./fastgpt/pg/data:/var/lib/postgresql/data
  mongo:
    # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18
    image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo
    container_name: mongo
    restart: always
    ports:
      - 27017:27017
    networks:
      - fastgpt
    command: mongod --keyFile /data/mongodb.key --replSet rs0
    environment:
      - MONGO_INITDB_ROOT_USERNAME=myusername
      - MONGO_INITDB_ROOT_PASSWORD=mypassword
    volumes:
      - ./fastgpt/mongo/data:/data/db
    entrypoint:
      - bash
      - -c
      - |
        openssl rand -base64 128 > /data/mongodb.key
        chmod 400 /data/mongodb.key
        chown 999:999 /data/mongodb.key
        echo 'const isInited = rs.status().ok === 1
        if(!isInited){
          rs.initiate({
              _id: "rs0",
              members: [
                  { _id: 0, host: "mongo:27017" }
              ]
          })
        }' > /data/initReplicaSet.js
        # 启动MongoDB服务
        exec docker-entrypoint.sh "$@" &

        # 等待MongoDB服务启动
        until mongo -u myusername -p mypassword --authenticationDatabase admin --eval "print('waited for connection')" > /dev/null 2>&1; do
          echo "Waiting for MongoDB to start..."
          sleep 2
        done

        # 执行初始化副本集的脚本
        mongo -u myusername -p mypassword --authenticationDatabase admin /data/initReplicaSet.js

        # 等待docker-entrypoint.sh脚本执行的MongoDB服务进程
        wait $!
  fastgpt:
    container_name: fastgpt
    image: ghcr.io/labring/fastgpt:latest # git
    # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:latest # 阿里云
    # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.7 # git
    # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.7 # 阿里云
    ports:
      - 3000:3000
    networks:
      - fastgpt
    depends_on:
      - mongo
      - pg
    restart: always
    environment:
      # root 密码,用户名为: root。如果需要修改 root 密码,直接修改这个环境变量,并重启即可。
      - DEFAULT_ROOT_PSW=1234
      # AI模型的API地址哦。务必加 /v1。这里默认填写了OneApi的访问地址。
      - OPENAI_BASE_URL=http://host.docker.internal:3001/v1
      # AI模型的API Key。(这里默认填写了OneAPI的快速默认key,测试通后,务必及时修改)
      - CHAT_API_KEY=sk-ofGHcFy1GxBggVez02AfCb179fF242AfAa4e01435674829c
      # 数据库最大连接数
      - DB_MAX_LINK=30
      # 登录凭证密钥
      - TOKEN_KEY=any
      # root的密钥,常用于升级时候的初始化请求
      - ROOT_KEY=root_key
      # 文件阅读加密
      - FILE_TOKEN_KEY=filetoken
      # MongoDB 连接参数. 用户名myusername,密码mypassword。
      - MONGODB_URI=mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
      # pg 连接参数
      - PG_URL=postgresql://username:password@pg:5432/postgres
    volumes:
      - ./config.json:/app/data/config.json
      - ./fastgpt/tmp:/app/tmp
  mysql:
    image: mysql:8.0.36
    container_name: mysql
    restart: always
    ports:
      - 3306:3306
    networks:
      - fastgpt
    command: --default-authentication-plugin=mysql_native_password
    environment:
      # 默认root密码,仅首次运行有效
      MYSQL_ROOT_PASSWORD: oneapimmysql
      MYSQL_DATABASE: oneapi
    volumes:
      - ./fastgpt/mysql:/var/lib/mysql
  oneapi:
    container_name: oneapi
    image: ghcr.io/songquanpeng/one-api:latest
    ports:
      - 3001:3000
    depends_on:
      - mysql
    networks:
      - fastgpt
    restart: always
    environment:
      # 日期
      - TZ=Asia/Shanghai
      # mysql 连接参数
      - SQL_DSN=root:oneapimmysql@tcp(mysql:3306)/oneapi
      # 登录凭证加密密钥
      - SESSION_SECRET=oneapikey
      # 内存缓存
      - MEMORY_CACHE_ENABLED=true
      # 启动聚合更新,减少数据交互频率
      - BATCH_UPDATE_ENABLED=true
      # 聚合更新时长
      - BATCH_UPDATE_INTERVAL=10
      # 初始化的 root 密钥(建议部署完后更改,否则容易泄露)
      - INITIAL_ROOT_TOKEN=fastgpt
    volumes:
      - ./fastgpt/oneapi:/data
  m3e:
    container_name: m3e
    image: registry.cn-hangzhou.aliyuncs.com/fastgpt_docker/m3e-large-api
    restart: always
    ports:
      - 6100:6008
    networks:
      - fastgpt
  openwebui:
    container_name: open-webui
    image: ghcr.io/open-webui/open-webui:main
    ports:
      - 3002:8080
    networks:
      - fastgpt
    restart: always
    environment:
      # root 密码,用户名为: root。如果需要修改 root 密码,直接修改这个环境变量,并重启即可。
      - OLLAMA_BASE_URL=http://host.docker.internal:11434
    volumes:
      - ./fastgpt/open-webui:/app/backend/data
  ollama:
    container_name: ollama
    image: ollama/ollama
    ports:
      - 11434:11434
    networks:
      - fastgpt
    restart: always
    volumes:
      - ./fastgpt/ollama:/root/.ollama
networks:
  fastgpt:

config.json

{
  "systemEnv": {
    "openapiPrefix": "fastgpt",
    "vectorMaxProcess": 15,
    "qaMaxProcess": 15,
    "pgHNSWEfSearch": 100
  },
  "llmModels": [
    {
      "model": "gpt-3.5-turbo",
      "name": "gpt-3.5-turbo",
      "maxContext": 16000,
      "avatar": "/imgs/model/openai.svg",
      "maxResponse": 4000,
      "quoteMaxToken": 13000,
      "maxTemperature": 1.2,
      "charsPointsPrice": 0,
      "censor": false,
      "vision": false,
      "datasetProcess": true,
      "usedInClassify": true,
      "usedInExtractFields": true,
      "usedInToolCall": true,
      "usedInQueryExtension": true,
      "toolChoice": true,
      "functionCall": true,
      "customCQPrompt": "",
      "customExtractPrompt": "",
      "defaultSystemChatPrompt": "",
      "defaultConfig": {}
    },
    {
      "model": "freegpt35",
      "name": "FreeGPT35",
      "maxContext": 16000,
      "avatar": "/imgs/model/openai.svg",
      "maxResponse": 4000,
      "quoteMaxToken": 13000,
      "maxTemperature": 1.2,
      "charsPointsPrice": 0,
      "censor": false,
      "vision": false,
      "datasetProcess": true,
      "usedInClassify": true,
      "usedInExtractFields": true,
      "usedInToolCall": true,
      "usedInQueryExtension": true,
      "toolChoice": true,
      "functionCall": true,
      "customCQPrompt": "",
      "customExtractPrompt": "",
      "defaultSystemChatPrompt": "",
      "defaultConfig": {}
    },
    {
      "model": "local-model",
      "name": "LM Studio",
      "avatar": "/imgs/model/openai.svg",
      "maxContext": 125000,
      "maxResponse": 4000,
      "quoteMaxToken": 100000,
      "maxTemperature": 1.2,
      "charsPointsPrice": 0,
      "censor": false,
      "vision": false,
      "datasetProcess": true,
      "usedInClassify": true,
      "usedInExtractFields": true,
      "usedInToolCall": true,
      "usedInQueryExtension": true,
      "toolChoice": true,
      "functionCall": false,
      "customCQPrompt": "",
      "customExtractPrompt": "",
      "defaultSystemChatPrompt": "",
      "defaultConfig": {}
    },
    {
      "model": "Kimi-free",
      "name": "Kimi-free",
      "avatar": "/imgs/model/openai.svg",
      "maxContext": 125000,
      "maxResponse": 4000,
      "quoteMaxToken": 100000,
      "maxTemperature": 1.2,
      "charsPointsPrice": 0,
      "censor": false,
      "vision": false,
      "datasetProcess": true,
      "usedInClassify": true,
      "usedInExtractFields": true,
      "usedInToolCall": true,
      "usedInQueryExtension": true,
      "toolChoice": true,
      "functionCall": false,
      "customCQPrompt": "",
      "customExtractPrompt": "",
      "defaultSystemChatPrompt": "",
      "defaultConfig": {}
    },
    {
      "model": "chatglm3",
      "name": "chatglm3",
      "avatar": "/imgs/model/openai.svg",
      "maxContext": 125000,
      "maxResponse": 4000,
      "quoteMaxToken": 100000,
      "maxTemperature": 1.2,
      "charsPointsPrice": 0,
      "censor": false,
      "vision": false,
      "datasetProcess": true,
      "usedInClassify": true,
      "usedInExtractFields": true,
      "usedInToolCall": true,
      "usedInQueryExtension": true,
      "toolChoice": true,
      "functionCall": false,
      "customCQPrompt": "",
      "customExtractPrompt": "",
      "defaultSystemChatPrompt": "",
      "defaultConfig": {}
    },
    {
      "model": "gemini-pro",
      "name": "gemini",
      "maxContext": 128000,
      "maxResponse": 4000,
      "quoteMaxToken": 100000,
      "maxTemperature": 1.2,
      "inputPrice": 0,
      "outputPrice": 0,
      "censor": false,
      "vision": false,
      "datasetProcess": false,
      "toolChoice": false,
      "functionCall": false,
      "customCQPrompt": "",
      "customExtractPrompt": "",
      "defaultSystemChatPrompt": "",
      "defaultConfig": {}
    },
    {
      "model": "TGW",
      "name": "TGW",
      "avatar": "/imgs/model/openai.svg",
      "maxContext": 125000,
      "maxResponse": 4000,
      "quoteMaxToken": 100000,
      "maxTemperature": 1.2,
      "charsPointsPrice": 0,
      "censor": false,
      "vision": false,
      "datasetProcess": true,
      "usedInClassify": true,
      "usedInExtractFields": true,
      "usedInToolCall": true,
      "usedInQueryExtension": true,
      "toolChoice": true,
      "functionCall": false,
      "customCQPrompt": "",
      "customExtractPrompt": "",
      "defaultSystemChatPrompt": "",
      "defaultConfig": {}
    },
    {
      "model": "gpt-4-0125-preview",
      "name": "gpt-4-turbo",
      "avatar": "/imgs/model/openai.svg",
      "maxContext": 125000,
      "maxResponse": 4000,
      "quoteMaxToken": 100000,
      "maxTemperature": 1.2,
      "charsPointsPrice": 0,
      "censor": false,
      "vision": false,
      "datasetProcess": false,
      "usedInClassify": true,
      "usedInExtractFields": true,
      "usedInToolCall": true,
      "usedInQueryExtension": true,
      "toolChoice": true,
      "functionCall": false,
      "customCQPrompt": "",
      "customExtractPrompt": "",
      "defaultSystemChatPrompt": "",
      "defaultConfig": {}
    },
    {
      "model": "gpt-4-vision-preview",
      "name": "gpt-4-vision",
      "avatar": "/imgs/model/openai.svg",
      "maxContext": 128000,
      "maxResponse": 4000,
      "quoteMaxToken": 100000,
      "maxTemperature": 1.2,
      "charsPointsPrice": 0,
      "censor": false,
      "vision": true,
      "datasetProcess": false,
      "usedInClassify": false,
      "usedInExtractFields": false,
      "usedInToolCall": false,
      "usedInQueryExtension": false,
      "toolChoice": true,
      "functionCall": false,
      "customCQPrompt": "",
      "customExtractPrompt": "",
      "defaultSystemChatPrompt": "",
      "defaultConfig": {}
    }
  ],
  "vectorModels": [
    {
      "model": "text-embedding-ada-002",
      "name": "Embedding-2",
      "avatar": "/imgs/model/openai.svg",
      "charsPointsPrice": 0,
      "defaultToken": 512,
      "maxToken": 3000,
      "weight": 100,
      "dbConfig": {},
      "queryConfig": {}
    },
    {
      "model": "m3e",
      "name": "m3e",
      "price": 0.1,
      "defaultToken": 500,
      "maxToken": 1800
    },
    {
      "model": "bge",
      "name": "bge",
      "price": 0.1,
      "defaultToken": 500,
      "maxToken": 1800
    }
  ],
  "reRankModels": [
    {
        "model": "bge-reranker-base",
        "name": "检索重排-base", 
        "charsPointsPrice": 0,
        "requestUrl": "http://192.168.50.63:6300/v1/rerank",
        "requestAuth": "sk-aaaabbbcccdddeeeefffggghhhiiijjjkkkk"
    }
],
  "audioSpeechModels": [
    {
      "model": "tts-1",
      "name": "OpenAI TTS1",
      "charsPointsPrice": 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",
    "charsPointsPrice": 0
  }
}

标签:fastgpt,false,name,流程,openai,自动化,GPT,model,true
From: https://www.cnblogs.com/WTAGO/p/18320480

相关文章

  • DB-GPT应用部署测试
    环境要求启动模式CPU*MEMGPU备注代理模型4C*8G代理模型不依赖GPU本地模型8C*32G24G本地启动最好有24G以上GPUconda环境安装默认数据库使用SQLite,因此默认启动模式下,无需安装数据库。如果需要使用其他数据库,可以看后面的高级教程。我们推荐通过conda......
  • Python项目流程图
    我有一个由多个文件夹组成的Python项目,每个文件夹包含多个脚本。我正在寻找一个Python库或软件/包,它们可以生成流程图,说明这些脚本如何互连并绘制出从开始到结束的整个过程。自动生成Python项目流程图确实是一个挑战,目前没有完美通用的解决方案。主要原因是:......
  • 【运维自动化-配置平台】如何跨业务转移主机
    在如何创建业务拓扑中,了解到业务是蓝鲸体系重要的资源管理纬度,主机在业务之前需要流转怎么做呢?比如要把A业务一台主机划给B业务使用权限中心跨业务转移主机一般场景是由源主机所在业务的负责人发起,需要申请目标业务的相关权限。(如果是管理员操作则无需申请权限)填写关联资源实......
  • 乒乓球比赛计分系统需求流程—用户故事、用户故事地图
    计应222_杜晓瑾_2210502012乒乓球比赛计分系统需求流程—用户故事、用户故事地图一、大用户故事作为某乒乓球赛事主办方,我希望建造一个乒乓球比赛计分系统,以便更好地让裁判、选手和观众看到他们的比赛成绩。二、中用户故事1、作为一名裁判,我希望能有一个软件系统,以便让我们抽......
  • 评估 ChatGPT 的数据分析改进:交互式表格和图表
           欢迎来到雲闪世界.2024年5月,随着GPT-4o的激动人心的发布,OpenAI宣布对ChatGPT中的数据分析进行改进,包括提供交互式表格和图表,以及与GoogleDrive和MicrosoftOneDrive的集成。在本文中,我将评估这些新功能并展望使用ChatGPT进行数据分析的未......
  • DeepSpeed x MiniGPT4Qwen
    #关于DeepSpeed的尝试知乎博客地址:https://zhuanlan.zhihu.com/p/673359684##参考Repo:https://github.com/microsoft/DeepSpeedExampleshttps://github.com/microsoft/DeepSpeedExamples/blob/master/training/HelloDeepSpeed/train_bert_ds.py,代码拷贝到了本项目的:htt......
  • 跟着ChatGPT学习设计模式 - 工厂模式
    1.前言在工作过程中,越发觉得设计模式的重要性。经常会有人说工作5年的人,大学生随便培训1-2月也能做同样的工作,没错,大学生的确可以做。但其写的代码,可维护性、可扩展性、添加新功能时方便还是简单。甚至是软实力的表现,如何沟通、如何推进项目进展、如何做项目排期,其实都是应届生......
  • 24年广东“双百社工”招聘报名流程详细步骤
    还在蹲公告的宝子们注意啦!......
  • 精通Gradle发布配置:打造自动化部署的高速公路
    精通Gradle发布配置:打造自动化部署的高速公路在现代软件开发中,自动化部署是持续集成/持续部署(CI/CD)流程的核心部分。Gradle作为一个强大的构建工具,提供了丰富的插件和任务来支持项目的发布配置。本文将详细介绍如何在Gradle中配置项目的发布配置,包括发布流程的设置、版本管......
  • VXE-Table+antvX6+element+DataV+vue2边框开发流程识别配置
    本demo为了实现自定义流程保存回显新增效果,复制即用,模拟数据太长没在代码中体现,需要可以找我拿vxe-table官方连接:VxeTablev4antVX6连接:https://x6.antv.antgroup.com/element连接:Element-Theworld'smostpopularVueUIframeworkDataV连接:DataV效果图H......