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
}
}