1.到官网下载开源代码,根据文档进行下载和修改
2.修改我们的config.local.json为
{
"feConfigs": {
"lafEnv": "https: //laf.dev"
},
"systemEnv": {
"vectorMaxProcess": 15,
"qaMaxProcess": 15,
"pgHNSWEfSearch": 100
},
"llmModels": [
{
"model": "qwen:7b",
"name": "qwen:7b",
"maxContext": 32000,
"avatar": "/imgs/model/openai.svg",
"maxResponse": 8000,
"quoteMaxToken": 20000,
"maxTemperature": 1.0,
"charsPointsPrice": 0,
"censor": false,
"vision": false,
"datasetProcess": true,
"usedInClassify": true,
"usedInExtractFields": true,
"usedInToolCall": true,
"usedInQueryExtension": true,
"toolChoice": true,
"functionCall": true,
"customCQPrompt": "",
"customExtractPrompt": "",
"defaultSystemChatPrompt": "",
"defaultConfig": {}
}
],
"vectorModels": [
{
"model": "shaw/dmeta-embedding-zh",
"name": "dmeta-embedding-zh",
"avatar": "/imgs/model/openai.svg",
"charsPointsPrice": 0,
"defaultToken": 512,
"maxToken": 3000,
"weight": 100,
"dbConfig": {},
"queryConfig": {}
}
],
"reRankModels": [],
"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
}
}
我把没用到的模型都删了
3.修改.env.local为:
LOG_DEPTH=3
# 默认用户密码,用户名为 root,每次重启时会自动更新。
DEFAULT_ROOT_PSW=123456
# 数据库最大连接数
DB_MAX_LINK=5
# token
TOKEN_KEY=any
# 文件阅读时的密钥
FILE_TOKEN_KEY=filetokenkey
# root key, 最高权限
ROOT_KEY=root_key
# openai 基本地址,可用作中转。
OPENAI_BASE_URL=http://localhost:3001/v1
# oneapi 地址,可以使用 oneapi 来实现多模型接入
# ONEAPI_URL=https://xxxx.cloud.sealos.io/openai/v1
# 通用key。可以是 openai 的也可以是 oneapi 的。
# 此处逻辑:优先走 ONEAPI_URL,如果填写了 ONEAPI_URL,key 也需要是 ONEAPI 的 key
CHAT_API_KEY=sk-fastgpt
# mongo 数据库连接参数,本地开发连接远程数据库时,可能需要增加 directConnection=true 参数,才能连接上。
MONGODB_URI=mongodb://myusername:mypassword@localhost:27017/fastgpt?authSource=admin
# 向量库优先级: pg > milvus
# PG 向量库连接参数
PG_URL=postgresql://username:password@localhost:5432/postgres
# milvus 向量库连接参数
MILVUS_ADDRESS=https://in03-78bd7f60e6e2a7c.api.gcp-us-west1.zillizcloud.com
MILVUS_TOKEN=133964348b00b4b4e4b51bef680a61350950385c8c64a3ec16b1ab92d3c67dcc4e0370fb9dd15791bcd6dadaf765e98a98735d0d
# code sandbox url
SANDBOX_URL=http://localhost:3001
# 商业版地址
PRO_URL=
# 页面的地址,用于自动补全相对路径资源的 domain
# FE_DOMAIN=http://localhost:3000
# 日志等级: debug, info, warn, error
LOG_LEVEL=debug
STORE_LOG_LEVEL=warn
# 工作流最大运行次数,避免极端的死循环情况
WORKFLOW_MAX_RUN_TIMES=500
此时 如果nodejs和react那些没问题的话,项目就能跑起来了;下面,我们进入FastGPT的使用环节
本地运行会遇到的问题
先在app目录下创建tmp文件夹
cd到fastgpt目录下 执行 pnpm run gen:theme-typings
再来到app目录下 用git bash执行
就可以解决:
Scope: all 8 workspace projects
Lockfile is up to date, resolution step is skipped
Already up to date
. postinstall$ sh ./scripts/postinstall.sh
│ 'sh' �����ڲ����ⲿ���Ҳ���ǿ����еij���
│ ���������ļ���
└─ Failed in 11ms at C:\Users\Administrator\Desktop\rag\fastgpt
ELIFECYCLE Command failed with exit code 1.
这个错误