Start with an Ubuntu instance running under WSL2 on a Windows host, and make sure Docker Desktop is installed and configured to use the WSL‑based engine.
Prepare the service definitions
Create a project directory and write a docker‑compose.yml that bundles all required services:
version: '3.8'
services:
vector_db:
image: ankane/pgvector:v0.5.0
container_name: vector_db
restart: always
ports:
- "5432:5432"
environment:
POSTGRES_USER: dbuser
POSTGRES_PASSWORD: dbpass
POSTGRES_DB: postgres
volumes:
- ./pg_data:/var/lib/postgresql/data
mongo:
image: mongo:5.0.18
container_name: mongo
restart: always
ports:
- "27017:27017"
command: mongod --keyFile /data/mongodb.key --replSet rs0
environment:
MONGO_INITDB_ROOT_USERNAME: mongouser
MONGO_INITDB_ROOT_PASSWORD: mongopass
volumes:
- ./mongo_data:/data/db
entrypoint: ["/bin/bash", "-c"]
command:
- |
openssl rand -base64 128 > /data/mongodb.key
chmod 400 /data/mongodb.key
chown 999:999 /data/mongodb.key
echo 'if (rs.status().ok !== 1) { rs.initiate({ _id: "rs0", members: [{ _id: 0, host: "mongo:27017" }] }) }' > /data/init.js
exec docker-entrypoint.sh mongod --keyFile /data/mongodb.key --replSet rs0 &
until mongo -u mongouser -p mongopass --authenticationDatabase admin --eval "print('connected')" > /dev/null 2>&1; do
sleep 2
done
mongo -u mongouser -p mongopass --authenticationDatabase admin /data/init.js
wait
fastgpt:
container_name: fastgpt
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.7
ports:
- "3200:3000"
depends_on:
- mongo
- vector_db
restart: always
environment:
DEFAULT_ROOT_PSW: myrootpass
OPENAI_BASE_URL: http://oneapi:3000/v1
CHAT_API_KEY: sk-LOCAL1234567890abcdef
DB_MAX_LINK: 30
TOKEN_KEY: any
ROOT_KEY: root_key
FILE_TOKEN_KEY: filetoken
MONGODB_URI: mongodb://mongouser:mongopass@mongo:27017/fastgpt?authSource=admin
PG_URL: postgresql://dbuser:dbpass@vector_db:5432/postgres
volumes:
- ./config.json:/app/data/config.json
oneapi_db:
image: mysql:8.0.36
container_name: oneapi_db
restart: always
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: mysqlrootpass
MYSQL_DATABASE: oneapi
volumes:
- ./mysql_data:/var/lib/mysql
oneapi:
container_name: oneapi
image: ghcr.io/songquanpeng/one-api:latest
ports:
- "3000:3000"
depends_on:
- oneapi_db
extra_hosts:
- "host.docker.internal:host-gateway"
restart: always
environment:
SQL_DSN: root:mysqlrootpass@tcp(oneapi_db:3306)/oneapi
SESSION_SECRET: oneapisecret
MEMORY_CACHE_ENABLED: "true"
BATCH_UPDATE_ENABLED: "true"
BATCH_UPDATE_INTERVAL: 10
INITIAL_ROOT_TOKEN: fastgpt
volumes:
- ./oneapi_data:/data
Place the config.json next to the compose file and add two model entries – a large language model and a text embedding model:
{
"llmModels": [
{
"model": "chatglm3",
"name": "chatglm3",
"maxContext": 16000,
"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
}
],
"vectorModels": [
{
"model": "m3e",
"name": "m3e",
"charsPointsPrice": 0,
"defaultToken": 700,
"maxToken": 3000,
"weight": 100
}
]
}
Copy any other required sections (such as feConfigs, systemEnv and the default OpenAI entries) from the official FastGPT configuration template.
Start the stack:
docker-compose pull
docker-compose up -d
Run the ChatGLM3 API locally on Windows
Download the ChatGLM3‑6B‑32k model weights (e.g., from Hugging Face) and a helper package containing an OpenAI‑compatible API demo. Edit the provided 02启动api.bat file to point to the absolute path of the model folder:
set MODEL_PATH=C:\LLM\chatglm3-6b-32k
Also adjust the Python and library paths if necessary. Then execute the batch file – it will start listening on http://0.0.0.0:8000.
Deploy the m3e embedding service
Run the m3e-large API inside Docker with GPU acceleration (remove --gpus all if you only have a CPU):
docker run -d --name m3e-large-api --gpus all -p 6008:6008 \
stawky/m3e-large-api:latest
Set up OneAPI as the unified gateway
-
Open
http://localhost:3000and log in withroot/123456. -
Create a new token. Use the generated key (e.g.,
sk-LOCAL1234567890abcdef) as theCHAT_API_KEYin the FastGPT environment. -
Create two channels:
- ChatGLM3 channel:
Base URL =http://host.docker.internal:8000
Model =chatglm3
Key =sk-key - m3e channel:
Base URL =http://host.docker.internal:6008
Model =m3e
Key =sk-aaabbbcccdddeeefffggghhhiiijjjkkk
Click Test on each channel. The m3e endpoint will respond with a 404, which is normal because it only provides embedding endpoints.
- ChatGLM3 channel:
Create a knowledge base in FastGPT
Visit http://localhost:3200, log in with root / myrootpass, and navigate to the knowledge base section.
1.acciónCreate a new knowledge base and select m3e as the indexing model and chatglm3 as the file‑processing model. 2. Upload your documents (for plain text, choose Text Dataset). 3. Once indexing completes (you can watch the ChatGLM3 terminal for progress),196a knowledge base will be ready.
Finally,955attach the knowledge Base to a chat application inside FastGPT to start querying your local documents.