file: ./content/toc.en.mdx
meta: {
"title": "FastGPT Toc",
"description": "FastGPT Toc"
}
* [/en/faq/chat](/en/faq/chat)
* [/en/guide/admin/sso](/en/guide/admin/sso)
* [/en/guide/admin/teamMode](/en/guide/admin/teamMode)
* [/en/guide/build/agentv2/debug](/en/guide/build/agentv2/debug)
* [/en/guide/build/agentv2/settings](/en/guide/build/agentv2/settings)
* [/en/guide/build/agentv2/vm](/en/guide/build/agentv2/vm)
* [/en/guide/build/evaluation](/en/guide/build/evaluation)
* [/en/guide/build/faq](/en/guide/build/faq)
* [/en/guide/build/general/ai\_settings](/en/guide/build/general/ai_settings)
* [/en/guide/build/general/chat\_input\_guide](/en/guide/build/general/chat_input_guide)
* [/en/guide/build/general/fileInput](/en/guide/build/general/fileInput)
* [/en/guide/build/general/voiceInput](/en/guide/build/general/voiceInput)
* [/en/guide/build/general/welcomeText](/en/guide/build/general/welcomeText)
* [/en/guide/build/publish/dingtalk](/en/guide/build/publish/dingtalk)
* [/en/guide/build/publish/feishu](/en/guide/build/publish/feishu)
* [/en/guide/build/publish/link](/en/guide/build/publish/link)
* [/en/guide/build/publish/mcp\_server](/en/guide/build/publish/mcp_server)
* [/en/guide/build/publish/official\_account](/en/guide/build/publish/official_account)
* [/en/guide/build/publish/openapi](/en/guide/build/publish/openapi)
* [/en/guide/build/publish/wechat](/en/guide/build/publish/wechat)
* [/en/guide/build/publish/wecom](/en/guide/build/publish/wecom)
* [/en/guide/build/skill/development](/en/guide/build/skill/development)
* [/en/guide/build/skill/initialization](/en/guide/build/skill/initialization)
* [/en/guide/build/skill/integration](/en/guide/build/skill/integration)
* [/en/guide/build/skill/intro](/en/guide/build/skill/intro)
* [/en/guide/build/skill/version](/en/guide/build/skill/version)
* [/en/guide/build/tools/mcp\_tools](/en/guide/build/tools/mcp_tools)
* [/en/guide/build/tools/system-plugins/upload\_system\_tool](/en/guide/build/tools/system-plugins/upload_system_tool)
* [/en/guide/build/workflow/intro](/en/guide/build/workflow/intro)
* [/en/guide/build/workflow/nodes/ai\_chat](/en/guide/build/workflow/nodes/ai_chat)
* [/en/guide/build/workflow/nodes/content\_extract](/en/guide/build/workflow/nodes/content_extract)
* [/en/guide/build/workflow/nodes/coreferenceResolution](/en/guide/build/workflow/nodes/coreferenceResolution)
* [/en/guide/build/workflow/nodes/custom\_feedback](/en/guide/build/workflow/nodes/custom_feedback)
* [/en/guide/build/workflow/nodes/dataset\_search](/en/guide/build/workflow/nodes/dataset_search)
* [/en/guide/build/workflow/nodes/document\_parsing](/en/guide/build/workflow/nodes/document_parsing)
* [/en/guide/build/workflow/nodes/form\_input](/en/guide/build/workflow/nodes/form_input)
* [/en/guide/build/workflow/nodes/http](/en/guide/build/workflow/nodes/http)
* [/en/guide/build/workflow/nodes/knowledge\_base\_search\_merge](/en/guide/build/workflow/nodes/knowledge_base_search_merge)
* [/en/guide/build/workflow/nodes/loop](/en/guide/build/workflow/nodes/loop)
* [/en/guide/build/workflow/nodes/loop\_run](/en/guide/build/workflow/nodes/loop_run)
* [/en/guide/build/workflow/nodes/parallel\_run](/en/guide/build/workflow/nodes/parallel_run)
* [/en/guide/build/workflow/nodes/question\_classify](/en/guide/build/workflow/nodes/question_classify)
* [/en/guide/build/workflow/nodes/reply](/en/guide/build/workflow/nodes/reply)
* [/en/guide/build/workflow/nodes/sandbox-v2](/en/guide/build/workflow/nodes/sandbox-v2)
* [/en/guide/build/workflow/nodes/text\_editor](/en/guide/build/workflow/nodes/text_editor)
* [/en/guide/build/workflow/nodes/tfswitch](/en/guide/build/workflow/nodes/tfswitch)
* [/en/guide/build/workflow/nodes/tool](/en/guide/build/workflow/nodes/tool)
* [/en/guide/build/workflow/nodes/user-selection](/en/guide/build/workflow/nodes/user-selection)
* [/en/guide/build/workflow/nodes/variable\_update](/en/guide/build/workflow/nodes/variable_update)
* [/en/guide/chat/htmlRendering](/en/guide/chat/htmlRendering)
* [/en/guide/chat/quoteList](/en/guide/chat/quoteList)
* [/en/guide/dataset/collection\_tags](/en/guide/dataset/collection_tags)
* [/en/guide/dataset/dataset\_engine](/en/guide/dataset/dataset_engine)
* [/en/guide/dataset/faq](/en/guide/dataset/faq)
* [/en/guide/dataset/rag](/en/guide/dataset/rag)
* [/en/guide/dataset/template](/en/guide/dataset/template)
* [/en/guide/dataset/third-party/api\_dataset](/en/guide/dataset/third-party/api_dataset)
* [/en/guide/dataset/third-party/dingtalk\_dataset](/en/guide/dataset/third-party/dingtalk_dataset)
* [/en/guide/dataset/third-party/lark\_dataset](/en/guide/dataset/third-party/lark_dataset)
* [/en/guide/dataset/third-party/third\_dataset](/en/guide/dataset/third-party/third_dataset)
* [/en/guide/dataset/third-party/yuque\_dataset](/en/guide/dataset/third-party/yuque_dataset)
* [/en/guide/dataset/websync](/en/guide/dataset/websync)
* [/en/guide/getting-started/index](/en/guide/getting-started/index)
* [/en/guide/getting-started/quick-start](/en/guide/getting-started/quick-start)
* [/en/guide/index](/en/guide/index)
* [/en/guide/version/cloud/faq](/en/guide/version/cloud/faq)
* [/en/guide/version/cloud/intro](/en/guide/version/cloud/intro)
* [/en/guide/version/cloud/privacy](/en/guide/version/cloud/privacy)
* [/en/guide/version/cloud/terms](/en/guide/version/cloud/terms)
* [/en/guide/version/commercial](/en/guide/version/commercial)
* [/en/guide/version/opensource/intro](/en/guide/version/opensource/intro)
* [/en/guide/version/opensource/license](/en/guide/version/opensource/license)
* [/en/guide/workspace/customDomain](/en/guide/workspace/customDomain)
* [/en/guide/workspace/team/invitation\_link](/en/guide/workspace/team/invitation_link)
* [/en/guide/workspace/team/team\_roles\_permissions](/en/guide/workspace/team/team_roles_permissions)
* [/en/openapi/app](/en/openapi/app)
* [/en/openapi/chat](/en/openapi/chat)
* [/en/openapi/dataset](/en/openapi/dataset)
* [/en/openapi/index](/en/openapi/index)
* [/en/openapi/intro](/en/openapi/intro)
* [/en/plugin/index](/en/plugin/index)
* [/en/plugin/intro](/en/plugin/intro)
* [/en/plugin/model-presets](/en/plugin/model-presets)
* [/en/plugin/system-tool-development](/en/plugin/system-tool-development)
* [/en/self-host/config/env](/en/self-host/config/env)
* [/en/self-host/config/model/intro](/en/self-host/config/model/intro)
* [/en/self-host/config/model/minimax](/en/self-host/config/model/minimax)
* [/en/self-host/config/model/siliconCloud](/en/self-host/config/model/siliconCloud)
* [/en/self-host/config/object-storage](/en/self-host/config/object-storage)
* [/en/self-host/config/remote-debug-suite](/en/self-host/config/remote-debug-suite)
* [/en/self-host/config/sandbox/common](/en/self-host/config/sandbox/common)
* [/en/self-host/config/sandbox/opensandbox](/en/self-host/config/sandbox/opensandbox)
* [/en/self-host/config/sandbox/sealosdevbox](/en/self-host/config/sandbox/sealosdevbox)
* [/en/self-host/config/signoz](/en/self-host/config/signoz)
* [/en/self-host/custom-models/bge-rerank](/en/self-host/custom-models/bge-rerank)
* [/en/self-host/custom-models/chatglm2](/en/self-host/custom-models/chatglm2)
* [/en/self-host/custom-models/chatglm2-m3e](/en/self-host/custom-models/chatglm2-m3e)
* [/en/self-host/custom-models/m3e](/en/self-host/custom-models/m3e)
* [/en/self-host/custom-models/marker](/en/self-host/custom-models/marker)
* [/en/self-host/custom-models/mineru](/en/self-host/custom-models/mineru)
* [/en/self-host/custom-models/ollama](/en/self-host/custom-models/ollama)
* [/en/self-host/custom-models/xinference](/en/self-host/custom-models/xinference)
* [/en/self-host/deploy/docker](/en/self-host/deploy/docker)
* [/en/self-host/deploy/sealos](/en/self-host/deploy/sealos)
* [/en/self-host/design/dataset](/en/self-host/design/dataset)
* [/en/self-host/dev](/en/self-host/dev)
* [/en/self-host/index](/en/self-host/index)
* [/en/self-host/migration/docker\_db](/en/self-host/migration/docker_db)
* [/en/self-host/migration/docker\_mongo](/en/self-host/migration/docker_mongo)
* [/en/self-host/troubleshooting/attention](/en/self-host/troubleshooting/attention)
* [/en/self-host/troubleshooting/faq](/en/self-host/troubleshooting/faq)
* [/en/self-host/troubleshooting/methods](/en/self-host/troubleshooting/methods)
* [/en/self-host/troubleshooting/model-errors](/en/self-host/troubleshooting/model-errors)
* [/en/self-host/troubleshooting/s3-issues](/en/self-host/troubleshooting/s3-issues)
* [/en/self-host/upgrading/4-12/4120](/en/self-host/upgrading/4-12/4120)
* [/en/self-host/upgrading/4-12/4121](/en/self-host/upgrading/4-12/4121)
* [/en/self-host/upgrading/4-12/4122](/en/self-host/upgrading/4-12/4122)
* [/en/self-host/upgrading/4-12/4123](/en/self-host/upgrading/4-12/4123)
* [/en/self-host/upgrading/4-12/4124](/en/self-host/upgrading/4-12/4124)
* [/en/self-host/upgrading/4-13/4130](/en/self-host/upgrading/4-13/4130)
* [/en/self-host/upgrading/4-13/4131](/en/self-host/upgrading/4-13/4131)
* [/en/self-host/upgrading/4-13/4132](/en/self-host/upgrading/4-13/4132)
* [/en/self-host/upgrading/4-14/4140](/en/self-host/upgrading/4-14/4140)
* [/en/self-host/upgrading/4-14/4141](/en/self-host/upgrading/4-14/4141)
* [/en/self-host/upgrading/4-14/41410](/en/self-host/upgrading/4-14/41410)
* [/en/self-host/upgrading/4-14/41411](/en/self-host/upgrading/4-14/41411)
* [/en/self-host/upgrading/4-14/41412](/en/self-host/upgrading/4-14/41412)
* [/en/self-host/upgrading/4-14/41413](/en/self-host/upgrading/4-14/41413)
* [/en/self-host/upgrading/4-14/41414](/en/self-host/upgrading/4-14/41414)
* [/en/self-host/upgrading/4-14/41415](/en/self-host/upgrading/4-14/41415)
* [/en/self-host/upgrading/4-14/41416](/en/self-host/upgrading/4-14/41416)
* [/en/self-host/upgrading/4-14/41419](/en/self-host/upgrading/4-14/41419)
* [/en/self-host/upgrading/4-14/4142](/en/self-host/upgrading/4-14/4142)
* [/en/self-host/upgrading/4-14/41420](/en/self-host/upgrading/4-14/41420)
* [/en/self-host/upgrading/4-14/41421](/en/self-host/upgrading/4-14/41421)
* [/en/self-host/upgrading/4-14/41422](/en/self-host/upgrading/4-14/41422)
* [/en/self-host/upgrading/4-14/41424](/en/self-host/upgrading/4-14/41424)
* [/en/self-host/upgrading/4-14/41425](/en/self-host/upgrading/4-14/41425)
* [/en/self-host/upgrading/4-14/41426](/en/self-host/upgrading/4-14/41426)
* [/en/self-host/upgrading/4-14/41427](/en/self-host/upgrading/4-14/41427)
* [/en/self-host/upgrading/4-14/41428](/en/self-host/upgrading/4-14/41428)
* [/en/self-host/upgrading/4-14/41429](/en/self-host/upgrading/4-14/41429)
* [/en/self-host/upgrading/4-14/4143](/en/self-host/upgrading/4-14/4143)
* [/en/self-host/upgrading/4-14/4144](/en/self-host/upgrading/4-14/4144)
* [/en/self-host/upgrading/4-14/4145](/en/self-host/upgrading/4-14/4145)
* [/en/self-host/upgrading/4-14/41451](/en/self-host/upgrading/4-14/41451)
* [/en/self-host/upgrading/4-14/4146](/en/self-host/upgrading/4-14/4146)
* [/en/self-host/upgrading/4-14/4147](/en/self-host/upgrading/4-14/4147)
* [/en/self-host/upgrading/4-14/4148](/en/self-host/upgrading/4-14/4148)
* [/en/self-host/upgrading/4-14/41481](/en/self-host/upgrading/4-14/41481)
* [/en/self-host/upgrading/4-14/4149](/en/self-host/upgrading/4-14/4149)
* [/en/self-host/upgrading/4-15/41500](/en/self-host/upgrading/4-15/41500)
* [/en/self-host/upgrading/4-15/41501](/en/self-host/upgrading/4-15/41501)
* [/en/self-host/upgrading/4-15/41502](/en/self-host/upgrading/4-15/41502)
* [/en/self-host/upgrading/4-15/41503](/en/self-host/upgrading/4-15/41503)
* [/en/self-host/upgrading/4-15/41504](/en/self-host/upgrading/4-15/41504)
* [/en/self-host/upgrading/4-15/41505](/en/self-host/upgrading/4-15/41505)
* [/en/self-host/upgrading/4-15/41506](/en/self-host/upgrading/4-15/41506)
* [/en/self-host/upgrading/4-15/41507](/en/self-host/upgrading/4-15/41507)
* [/en/self-host/upgrading/4-15/4151](/en/self-host/upgrading/4-15/4151)
* [/en/self-host/upgrading/4-15/4152](/en/self-host/upgrading/4-15/4152)
* [/en/self-host/upgrading/4-15/4153](/en/self-host/upgrading/4-15/4153)
* [/en/self-host/upgrading/4-15/4154](/en/self-host/upgrading/4-15/4154)
* [/en/self-host/upgrading/4-15/4155](/en/self-host/upgrading/4-15/4155)
* [/en/self-host/upgrading/4-15/4156](/en/self-host/upgrading/4-15/4156)
* [/en/self-host/upgrading/4-16/41601](/en/self-host/upgrading/4-16/41601)
* [/en/self-host/upgrading/outdated/40](/en/self-host/upgrading/outdated/40)
* [/en/self-host/upgrading/outdated/41](/en/self-host/upgrading/outdated/41)
* [/en/self-host/upgrading/outdated/4100](/en/self-host/upgrading/outdated/4100)
* [/en/self-host/upgrading/outdated/4101](/en/self-host/upgrading/outdated/4101)
* [/en/self-host/upgrading/outdated/4110](/en/self-host/upgrading/outdated/4110)
* [/en/self-host/upgrading/outdated/4111](/en/self-host/upgrading/outdated/4111)
* [/en/self-host/upgrading/outdated/42](/en/self-host/upgrading/outdated/42)
* [/en/self-host/upgrading/outdated/421](/en/self-host/upgrading/outdated/421)
* [/en/self-host/upgrading/outdated/43](/en/self-host/upgrading/outdated/43)
* [/en/self-host/upgrading/outdated/44](/en/self-host/upgrading/outdated/44)
* [/en/self-host/upgrading/outdated/441](/en/self-host/upgrading/outdated/441)
* [/en/self-host/upgrading/outdated/442](/en/self-host/upgrading/outdated/442)
* [/en/self-host/upgrading/outdated/445](/en/self-host/upgrading/outdated/445)
* [/en/self-host/upgrading/outdated/446](/en/self-host/upgrading/outdated/446)
* [/en/self-host/upgrading/outdated/447](/en/self-host/upgrading/outdated/447)
* [/en/self-host/upgrading/outdated/45](/en/self-host/upgrading/outdated/45)
* [/en/self-host/upgrading/outdated/451](/en/self-host/upgrading/outdated/451)
* [/en/self-host/upgrading/outdated/452](/en/self-host/upgrading/outdated/452)
* [/en/self-host/upgrading/outdated/46](/en/self-host/upgrading/outdated/46)
* [/en/self-host/upgrading/outdated/461](/en/self-host/upgrading/outdated/461)
* [/en/self-host/upgrading/outdated/462](/en/self-host/upgrading/outdated/462)
* [/en/self-host/upgrading/outdated/463](/en/self-host/upgrading/outdated/463)
* [/en/self-host/upgrading/outdated/464](/en/self-host/upgrading/outdated/464)
* [/en/self-host/upgrading/outdated/465](/en/self-host/upgrading/outdated/465)
* [/en/self-host/upgrading/outdated/466](/en/self-host/upgrading/outdated/466)
* [/en/self-host/upgrading/outdated/467](/en/self-host/upgrading/outdated/467)
* [/en/self-host/upgrading/outdated/468](/en/self-host/upgrading/outdated/468)
* [/en/self-host/upgrading/outdated/469](/en/self-host/upgrading/outdated/469)
* [/en/self-host/upgrading/outdated/47](/en/self-host/upgrading/outdated/47)
* [/en/self-host/upgrading/outdated/471](/en/self-host/upgrading/outdated/471)
* [/en/self-host/upgrading/outdated/48](/en/self-host/upgrading/outdated/48)
* [/en/self-host/upgrading/outdated/481](/en/self-host/upgrading/outdated/481)
* [/en/self-host/upgrading/outdated/4810](/en/self-host/upgrading/outdated/4810)
* [/en/self-host/upgrading/outdated/4811](/en/self-host/upgrading/outdated/4811)
* [/en/self-host/upgrading/outdated/4812](/en/self-host/upgrading/outdated/4812)
* [/en/self-host/upgrading/outdated/4813](/en/self-host/upgrading/outdated/4813)
* [/en/self-host/upgrading/outdated/4814](/en/self-host/upgrading/outdated/4814)
* [/en/self-host/upgrading/outdated/4815](/en/self-host/upgrading/outdated/4815)
* [/en/self-host/upgrading/outdated/4816](/en/self-host/upgrading/outdated/4816)
* [/en/self-host/upgrading/outdated/4817](/en/self-host/upgrading/outdated/4817)
* [/en/self-host/upgrading/outdated/4818](/en/self-host/upgrading/outdated/4818)
* [/en/self-host/upgrading/outdated/4819](/en/self-host/upgrading/outdated/4819)
* [/en/self-host/upgrading/outdated/482](/en/self-host/upgrading/outdated/482)
* [/en/self-host/upgrading/outdated/4820](/en/self-host/upgrading/outdated/4820)
* [/en/self-host/upgrading/outdated/4821](/en/self-host/upgrading/outdated/4821)
* [/en/self-host/upgrading/outdated/4822](/en/self-host/upgrading/outdated/4822)
* [/en/self-host/upgrading/outdated/4823](/en/self-host/upgrading/outdated/4823)
* [/en/self-host/upgrading/outdated/483](/en/self-host/upgrading/outdated/483)
* [/en/self-host/upgrading/outdated/484](/en/self-host/upgrading/outdated/484)
* [/en/self-host/upgrading/outdated/485](/en/self-host/upgrading/outdated/485)
* [/en/self-host/upgrading/outdated/486](/en/self-host/upgrading/outdated/486)
* [/en/self-host/upgrading/outdated/487](/en/self-host/upgrading/outdated/487)
* [/en/self-host/upgrading/outdated/488](/en/self-host/upgrading/outdated/488)
* [/en/self-host/upgrading/outdated/489](/en/self-host/upgrading/outdated/489)
* [/en/self-host/upgrading/outdated/490](/en/self-host/upgrading/outdated/490)
* [/en/self-host/upgrading/outdated/491](/en/self-host/upgrading/outdated/491)
* [/en/self-host/upgrading/outdated/4910](/en/self-host/upgrading/outdated/4910)
* [/en/self-host/upgrading/outdated/4911](/en/self-host/upgrading/outdated/4911)
* [/en/self-host/upgrading/outdated/4912](/en/self-host/upgrading/outdated/4912)
* [/en/self-host/upgrading/outdated/4913](/en/self-host/upgrading/outdated/4913)
* [/en/self-host/upgrading/outdated/4914](/en/self-host/upgrading/outdated/4914)
* [/en/self-host/upgrading/outdated/492](/en/self-host/upgrading/outdated/492)
* [/en/self-host/upgrading/outdated/493](/en/self-host/upgrading/outdated/493)
* [/en/self-host/upgrading/outdated/494](/en/self-host/upgrading/outdated/494)
* [/en/self-host/upgrading/outdated/495](/en/self-host/upgrading/outdated/495)
* [/en/self-host/upgrading/outdated/496](/en/self-host/upgrading/outdated/496)
* [/en/self-host/upgrading/outdated/497](/en/self-host/upgrading/outdated/497)
* [/en/self-host/upgrading/outdated/498](/en/self-host/upgrading/outdated/498)
* [/en/self-host/upgrading/outdated/499](/en/self-host/upgrading/outdated/499)
* [/en/self-host/upgrading/upgrade-intruction](/en/self-host/upgrading/upgrade-intruction)
file: ./content/toc.mdx
meta: {
"title": "FastGPT 文档目录",
"description": "FastGPT 文档目录"
}
* [/faq/chat](/faq/chat)
* [/guide/admin/sso](/guide/admin/sso)
* [/guide/admin/teamMode](/guide/admin/teamMode)
* [/guide/build/agentv2/debug](/guide/build/agentv2/debug)
* [/guide/build/agentv2/settings](/guide/build/agentv2/settings)
* [/guide/build/agentv2/vm](/guide/build/agentv2/vm)
* [/guide/build/evaluation](/guide/build/evaluation)
* [/guide/build/faq](/guide/build/faq)
* [/guide/build/general/ai\_settings](/guide/build/general/ai_settings)
* [/guide/build/general/chat\_input\_guide](/guide/build/general/chat_input_guide)
* [/guide/build/general/fileInput](/guide/build/general/fileInput)
* [/guide/build/general/voiceInput](/guide/build/general/voiceInput)
* [/guide/build/general/welcomeText](/guide/build/general/welcomeText)
* [/guide/build/publish/dingtalk](/guide/build/publish/dingtalk)
* [/guide/build/publish/feishu](/guide/build/publish/feishu)
* [/guide/build/publish/link](/guide/build/publish/link)
* [/guide/build/publish/mcp\_server](/guide/build/publish/mcp_server)
* [/guide/build/publish/official\_account](/guide/build/publish/official_account)
* [/guide/build/publish/openapi](/guide/build/publish/openapi)
* [/guide/build/publish/wechat](/guide/build/publish/wechat)
* [/guide/build/publish/wecom](/guide/build/publish/wecom)
* [/guide/build/skill/development](/guide/build/skill/development)
* [/guide/build/skill/initialization](/guide/build/skill/initialization)
* [/guide/build/skill/integration](/guide/build/skill/integration)
* [/guide/build/skill/intro](/guide/build/skill/intro)
* [/guide/build/skill/version](/guide/build/skill/version)
* [/guide/build/tools/mcp\_tools](/guide/build/tools/mcp_tools)
* [/guide/build/tools/system-plugins/upload\_system\_tool](/guide/build/tools/system-plugins/upload_system_tool)
* [/guide/build/workflow/intro](/guide/build/workflow/intro)
* [/guide/build/workflow/nodes/ai\_chat](/guide/build/workflow/nodes/ai_chat)
* [/guide/build/workflow/nodes/content\_extract](/guide/build/workflow/nodes/content_extract)
* [/guide/build/workflow/nodes/coreferenceResolution](/guide/build/workflow/nodes/coreferenceResolution)
* [/guide/build/workflow/nodes/custom\_feedback](/guide/build/workflow/nodes/custom_feedback)
* [/guide/build/workflow/nodes/dataset\_search](/guide/build/workflow/nodes/dataset_search)
* [/guide/build/workflow/nodes/document\_parsing](/guide/build/workflow/nodes/document_parsing)
* [/guide/build/workflow/nodes/form\_input](/guide/build/workflow/nodes/form_input)
* [/guide/build/workflow/nodes/http](/guide/build/workflow/nodes/http)
* [/guide/build/workflow/nodes/knowledge\_base\_search\_merge](/guide/build/workflow/nodes/knowledge_base_search_merge)
* [/guide/build/workflow/nodes/loop](/guide/build/workflow/nodes/loop)
* [/guide/build/workflow/nodes/loop\_run](/guide/build/workflow/nodes/loop_run)
* [/guide/build/workflow/nodes/parallel\_run](/guide/build/workflow/nodes/parallel_run)
* [/guide/build/workflow/nodes/question\_classify](/guide/build/workflow/nodes/question_classify)
* [/guide/build/workflow/nodes/reply](/guide/build/workflow/nodes/reply)
* [/guide/build/workflow/nodes/sandbox-v2](/guide/build/workflow/nodes/sandbox-v2)
* [/guide/build/workflow/nodes/text\_editor](/guide/build/workflow/nodes/text_editor)
* [/guide/build/workflow/nodes/tfswitch](/guide/build/workflow/nodes/tfswitch)
* [/guide/build/workflow/nodes/tool](/guide/build/workflow/nodes/tool)
* [/guide/build/workflow/nodes/user-selection](/guide/build/workflow/nodes/user-selection)
* [/guide/build/workflow/nodes/variable\_update](/guide/build/workflow/nodes/variable_update)
* [/guide/chat/htmlRendering](/guide/chat/htmlRendering)
* [/guide/chat/quoteList](/guide/chat/quoteList)
* [/guide/dataset/collection\_tags](/guide/dataset/collection_tags)
* [/guide/dataset/dataset\_engine](/guide/dataset/dataset_engine)
* [/guide/dataset/faq](/guide/dataset/faq)
* [/guide/dataset/rag](/guide/dataset/rag)
* [/guide/dataset/template](/guide/dataset/template)
* [/guide/dataset/third-party/api\_dataset](/guide/dataset/third-party/api_dataset)
* [/guide/dataset/third-party/dingtalk\_dataset](/guide/dataset/third-party/dingtalk_dataset)
* [/guide/dataset/third-party/lark\_dataset](/guide/dataset/third-party/lark_dataset)
* [/guide/dataset/third-party/third\_dataset](/guide/dataset/third-party/third_dataset)
* [/guide/dataset/third-party/yuque\_dataset](/guide/dataset/third-party/yuque_dataset)
* [/guide/dataset/websync](/guide/dataset/websync)
* [/guide/getting-started/index](/guide/getting-started/index)
* [/guide/getting-started/quick-start](/guide/getting-started/quick-start)
* [/guide/index](/guide/index)
* [/guide/version/cloud/faq](/guide/version/cloud/faq)
* [/guide/version/cloud/intro](/guide/version/cloud/intro)
* [/guide/version/cloud/privacy](/guide/version/cloud/privacy)
* [/guide/version/cloud/terms](/guide/version/cloud/terms)
* [/guide/version/commercial](/guide/version/commercial)
* [/guide/version/opensource/intro](/guide/version/opensource/intro)
* [/guide/version/opensource/license](/guide/version/opensource/license)
* [/guide/workspace/customDomain](/guide/workspace/customDomain)
* [/guide/workspace/team/invitation\_link](/guide/workspace/team/invitation_link)
* [/guide/workspace/team/team\_roles\_permissions](/guide/workspace/team/team_roles_permissions)
* [/openapi/app](/openapi/app)
* [/openapi/chat](/openapi/chat)
* [/openapi/dataset](/openapi/dataset)
* [/openapi/index](/openapi/index)
* [/openapi/intro](/openapi/intro)
* [/plugin/index](/plugin/index)
* [/plugin/intro](/plugin/intro)
* [/plugin/model-presets](/plugin/model-presets)
* [/plugin/system-tool-development](/plugin/system-tool-development)
* [/self-host/config/env](/self-host/config/env)
* [/self-host/config/model/intro](/self-host/config/model/intro)
* [/self-host/config/model/minimax](/self-host/config/model/minimax)
* [/self-host/config/model/siliconCloud](/self-host/config/model/siliconCloud)
* [/self-host/config/object-storage](/self-host/config/object-storage)
* [/self-host/config/remote-debug-suite](/self-host/config/remote-debug-suite)
* [/self-host/config/sandbox/common](/self-host/config/sandbox/common)
* [/self-host/config/sandbox/opensandbox](/self-host/config/sandbox/opensandbox)
* [/self-host/config/sandbox/sealosdevbox](/self-host/config/sandbox/sealosdevbox)
* [/self-host/config/signoz](/self-host/config/signoz)
* [/self-host/custom-models/bge-rerank](/self-host/custom-models/bge-rerank)
* [/self-host/custom-models/chatglm2](/self-host/custom-models/chatglm2)
* [/self-host/custom-models/chatglm2-m3e](/self-host/custom-models/chatglm2-m3e)
* [/self-host/custom-models/m3e](/self-host/custom-models/m3e)
* [/self-host/custom-models/marker](/self-host/custom-models/marker)
* [/self-host/custom-models/mineru](/self-host/custom-models/mineru)
* [/self-host/custom-models/ollama](/self-host/custom-models/ollama)
* [/self-host/custom-models/xinference](/self-host/custom-models/xinference)
* [/self-host/deploy/docker](/self-host/deploy/docker)
* [/self-host/deploy/sealos](/self-host/deploy/sealos)
* [/self-host/design/dataset](/self-host/design/dataset)
* [/self-host/dev](/self-host/dev)
* [/self-host/index](/self-host/index)
* [/self-host/migration/docker\_db](/self-host/migration/docker_db)
* [/self-host/migration/docker\_mongo](/self-host/migration/docker_mongo)
* [/self-host/troubleshooting/attention](/self-host/troubleshooting/attention)
* [/self-host/troubleshooting/faq](/self-host/troubleshooting/faq)
* [/self-host/troubleshooting/methods](/self-host/troubleshooting/methods)
* [/self-host/troubleshooting/model-errors](/self-host/troubleshooting/model-errors)
* [/self-host/troubleshooting/s3-issues](/self-host/troubleshooting/s3-issues)
* [/self-host/upgrading/4-12/4120](/self-host/upgrading/4-12/4120)
* [/self-host/upgrading/4-12/4121](/self-host/upgrading/4-12/4121)
* [/self-host/upgrading/4-12/4122](/self-host/upgrading/4-12/4122)
* [/self-host/upgrading/4-12/4123](/self-host/upgrading/4-12/4123)
* [/self-host/upgrading/4-12/4124](/self-host/upgrading/4-12/4124)
* [/self-host/upgrading/4-13/4130](/self-host/upgrading/4-13/4130)
* [/self-host/upgrading/4-13/4131](/self-host/upgrading/4-13/4131)
* [/self-host/upgrading/4-13/4132](/self-host/upgrading/4-13/4132)
* [/self-host/upgrading/4-14/4140](/self-host/upgrading/4-14/4140)
* [/self-host/upgrading/4-14/4141](/self-host/upgrading/4-14/4141)
* [/self-host/upgrading/4-14/41410](/self-host/upgrading/4-14/41410)
* [/self-host/upgrading/4-14/41411](/self-host/upgrading/4-14/41411)
* [/self-host/upgrading/4-14/41412](/self-host/upgrading/4-14/41412)
* [/self-host/upgrading/4-14/41413](/self-host/upgrading/4-14/41413)
* [/self-host/upgrading/4-14/41414](/self-host/upgrading/4-14/41414)
* [/self-host/upgrading/4-14/41415](/self-host/upgrading/4-14/41415)
* [/self-host/upgrading/4-14/41416](/self-host/upgrading/4-14/41416)
* [/self-host/upgrading/4-14/41417](/self-host/upgrading/4-14/41417)
* [/self-host/upgrading/4-14/41418](/self-host/upgrading/4-14/41418)
* [/self-host/upgrading/4-14/41419](/self-host/upgrading/4-14/41419)
* [/self-host/upgrading/4-14/4142](/self-host/upgrading/4-14/4142)
* [/self-host/upgrading/4-14/41420](/self-host/upgrading/4-14/41420)
* [/self-host/upgrading/4-14/41421](/self-host/upgrading/4-14/41421)
* [/self-host/upgrading/4-14/41422](/self-host/upgrading/4-14/41422)
* [/self-host/upgrading/4-14/41424](/self-host/upgrading/4-14/41424)
* [/self-host/upgrading/4-14/41425](/self-host/upgrading/4-14/41425)
* [/self-host/upgrading/4-14/41426](/self-host/upgrading/4-14/41426)
* [/self-host/upgrading/4-14/41427](/self-host/upgrading/4-14/41427)
* [/self-host/upgrading/4-14/41428](/self-host/upgrading/4-14/41428)
* [/self-host/upgrading/4-14/41429](/self-host/upgrading/4-14/41429)
* [/self-host/upgrading/4-14/4143](/self-host/upgrading/4-14/4143)
* [/self-host/upgrading/4-14/4144](/self-host/upgrading/4-14/4144)
* [/self-host/upgrading/4-14/4145](/self-host/upgrading/4-14/4145)
* [/self-host/upgrading/4-14/41451](/self-host/upgrading/4-14/41451)
* [/self-host/upgrading/4-14/4146](/self-host/upgrading/4-14/4146)
* [/self-host/upgrading/4-14/4147](/self-host/upgrading/4-14/4147)
* [/self-host/upgrading/4-14/4148](/self-host/upgrading/4-14/4148)
* [/self-host/upgrading/4-14/41481](/self-host/upgrading/4-14/41481)
* [/self-host/upgrading/4-14/4149](/self-host/upgrading/4-14/4149)
* [/self-host/upgrading/4-15/41500](/self-host/upgrading/4-15/41500)
* [/self-host/upgrading/4-15/41501](/self-host/upgrading/4-15/41501)
* [/self-host/upgrading/4-15/41502](/self-host/upgrading/4-15/41502)
* [/self-host/upgrading/4-15/41503](/self-host/upgrading/4-15/41503)
* [/self-host/upgrading/4-15/41504](/self-host/upgrading/4-15/41504)
* [/self-host/upgrading/4-15/41505](/self-host/upgrading/4-15/41505)
* [/self-host/upgrading/4-15/41506](/self-host/upgrading/4-15/41506)
* [/self-host/upgrading/4-15/41507](/self-host/upgrading/4-15/41507)
* [/self-host/upgrading/4-15/4151](/self-host/upgrading/4-15/4151)
* [/self-host/upgrading/4-15/4152](/self-host/upgrading/4-15/4152)
* [/self-host/upgrading/4-15/4153](/self-host/upgrading/4-15/4153)
* [/self-host/upgrading/4-15/4154](/self-host/upgrading/4-15/4154)
* [/self-host/upgrading/4-15/4155](/self-host/upgrading/4-15/4155)
* [/self-host/upgrading/4-15/4156](/self-host/upgrading/4-15/4156)
* [/self-host/upgrading/4-16/41601](/self-host/upgrading/4-16/41601)
* [/self-host/upgrading/outdated/40](/self-host/upgrading/outdated/40)
* [/self-host/upgrading/outdated/41](/self-host/upgrading/outdated/41)
* [/self-host/upgrading/outdated/4100](/self-host/upgrading/outdated/4100)
* [/self-host/upgrading/outdated/4101](/self-host/upgrading/outdated/4101)
* [/self-host/upgrading/outdated/4110](/self-host/upgrading/outdated/4110)
* [/self-host/upgrading/outdated/4111](/self-host/upgrading/outdated/4111)
* [/self-host/upgrading/outdated/42](/self-host/upgrading/outdated/42)
* [/self-host/upgrading/outdated/421](/self-host/upgrading/outdated/421)
* [/self-host/upgrading/outdated/43](/self-host/upgrading/outdated/43)
* [/self-host/upgrading/outdated/44](/self-host/upgrading/outdated/44)
* [/self-host/upgrading/outdated/441](/self-host/upgrading/outdated/441)
* [/self-host/upgrading/outdated/442](/self-host/upgrading/outdated/442)
* [/self-host/upgrading/outdated/445](/self-host/upgrading/outdated/445)
* [/self-host/upgrading/outdated/446](/self-host/upgrading/outdated/446)
* [/self-host/upgrading/outdated/447](/self-host/upgrading/outdated/447)
* [/self-host/upgrading/outdated/45](/self-host/upgrading/outdated/45)
* [/self-host/upgrading/outdated/451](/self-host/upgrading/outdated/451)
* [/self-host/upgrading/outdated/452](/self-host/upgrading/outdated/452)
* [/self-host/upgrading/outdated/46](/self-host/upgrading/outdated/46)
* [/self-host/upgrading/outdated/461](/self-host/upgrading/outdated/461)
* [/self-host/upgrading/outdated/462](/self-host/upgrading/outdated/462)
* [/self-host/upgrading/outdated/463](/self-host/upgrading/outdated/463)
* [/self-host/upgrading/outdated/464](/self-host/upgrading/outdated/464)
* [/self-host/upgrading/outdated/465](/self-host/upgrading/outdated/465)
* [/self-host/upgrading/outdated/466](/self-host/upgrading/outdated/466)
* [/self-host/upgrading/outdated/467](/self-host/upgrading/outdated/467)
* [/self-host/upgrading/outdated/468](/self-host/upgrading/outdated/468)
* [/self-host/upgrading/outdated/469](/self-host/upgrading/outdated/469)
* [/self-host/upgrading/outdated/47](/self-host/upgrading/outdated/47)
* [/self-host/upgrading/outdated/471](/self-host/upgrading/outdated/471)
* [/self-host/upgrading/outdated/48](/self-host/upgrading/outdated/48)
* [/self-host/upgrading/outdated/481](/self-host/upgrading/outdated/481)
* [/self-host/upgrading/outdated/4810](/self-host/upgrading/outdated/4810)
* [/self-host/upgrading/outdated/4811](/self-host/upgrading/outdated/4811)
* [/self-host/upgrading/outdated/4812](/self-host/upgrading/outdated/4812)
* [/self-host/upgrading/outdated/4813](/self-host/upgrading/outdated/4813)
* [/self-host/upgrading/outdated/4814](/self-host/upgrading/outdated/4814)
* [/self-host/upgrading/outdated/4815](/self-host/upgrading/outdated/4815)
* [/self-host/upgrading/outdated/4816](/self-host/upgrading/outdated/4816)
* [/self-host/upgrading/outdated/4817](/self-host/upgrading/outdated/4817)
* [/self-host/upgrading/outdated/4818](/self-host/upgrading/outdated/4818)
* [/self-host/upgrading/outdated/4819](/self-host/upgrading/outdated/4819)
* [/self-host/upgrading/outdated/482](/self-host/upgrading/outdated/482)
* [/self-host/upgrading/outdated/4820](/self-host/upgrading/outdated/4820)
* [/self-host/upgrading/outdated/4821](/self-host/upgrading/outdated/4821)
* [/self-host/upgrading/outdated/4822](/self-host/upgrading/outdated/4822)
* [/self-host/upgrading/outdated/4823](/self-host/upgrading/outdated/4823)
* [/self-host/upgrading/outdated/483](/self-host/upgrading/outdated/483)
* [/self-host/upgrading/outdated/484](/self-host/upgrading/outdated/484)
* [/self-host/upgrading/outdated/485](/self-host/upgrading/outdated/485)
* [/self-host/upgrading/outdated/486](/self-host/upgrading/outdated/486)
* [/self-host/upgrading/outdated/487](/self-host/upgrading/outdated/487)
* [/self-host/upgrading/outdated/488](/self-host/upgrading/outdated/488)
* [/self-host/upgrading/outdated/489](/self-host/upgrading/outdated/489)
* [/self-host/upgrading/outdated/490](/self-host/upgrading/outdated/490)
* [/self-host/upgrading/outdated/491](/self-host/upgrading/outdated/491)
* [/self-host/upgrading/outdated/4910](/self-host/upgrading/outdated/4910)
* [/self-host/upgrading/outdated/4911](/self-host/upgrading/outdated/4911)
* [/self-host/upgrading/outdated/4912](/self-host/upgrading/outdated/4912)
* [/self-host/upgrading/outdated/4913](/self-host/upgrading/outdated/4913)
* [/self-host/upgrading/outdated/4914](/self-host/upgrading/outdated/4914)
* [/self-host/upgrading/outdated/492](/self-host/upgrading/outdated/492)
* [/self-host/upgrading/outdated/493](/self-host/upgrading/outdated/493)
* [/self-host/upgrading/outdated/494](/self-host/upgrading/outdated/494)
* [/self-host/upgrading/outdated/495](/self-host/upgrading/outdated/495)
* [/self-host/upgrading/outdated/496](/self-host/upgrading/outdated/496)
* [/self-host/upgrading/outdated/497](/self-host/upgrading/outdated/497)
* [/self-host/upgrading/outdated/498](/self-host/upgrading/outdated/498)
* [/self-host/upgrading/outdated/499](/self-host/upgrading/outdated/499)
* [/self-host/upgrading/upgrade-intruction](/self-host/upgrading/upgrade-intruction)
file: ./content/faq/chat.en.mdx
meta: {
"title": "Chat Interface",
"description": "Common FastGPT chat interface questions"
}
## I updated my app in the workspace, but the chat isn't reflecting the changes?
You need to publish the app first. Chat only picks up changes after publishing.
## Browser doesn't support voice input
1. Make sure microphone permissions are enabled in both your browser and OS settings.
2. Confirm the browser has permission to use the microphone for this site, and that the correct microphone source is selected.
3. The site must have an SSL certificate for microphone access to work.
file: ./content/faq/chat.mdx
meta: {
"title": "聊天框问题",
"description": "FastGPT 常见聊天框问题"
}
## 我修改了工作台的应用,为什么在“聊天”时没有更新配置?
应用需要点击发布后,聊天才会更新应用。
## 浏览器不支持语音输入
1. 首先需要确保浏览器、电脑本身麦克风权限的开启。
2. 确认浏览器允许该站点使用麦克风,并且选择正确的麦克风来源。
3. 需有 SSL 证书的站点才可以使用麦克风。
file: ./content/faq/index.en.mdx
meta: {
"title": "FAQ",
"description": "FastGPT frequently asked questions"
}
import { Redirect } from '@/components/docs/Redirect';
file: ./content/faq/index.mdx
meta: {
"title": "使用案例",
"description": "FastGPT 使用案例"
}
import { Redirect } from '@/components/docs/Redirect';
file: ./content/openapi/app.en.mdx
meta: {
"title": "Application API",
"description": "FastGPT OpenAPI Application Interface"
}
## Prerequisites
1. Prepare your API Key: You can use the global API Key directly
2. Get your application's AppId

## Log API
### Get Application Overall Statistics
```bash
curl --location --request GET 'https://cloud.fastgpt.cn/api/proApi/core/app/logs/getTotalData?appId=68c46a70d950e8850ae564ba' \
--header 'Authorization: Bearer apikey'
```
```bash
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"totalUsers": 0,
"totalChats": 0,
"totalPoints": 0
}
}
```
**Request Parameters:**
* appId: Application ID
**Response Parameters:**
* totalUsers: Total number of users
* totalChats: Total number of conversations
* totalPoints: Total points consumed
### Get Application Chart Data
```bash
curl --location --request POST 'https://cloud.fastgpt.cn/api/proApi/core/app/logs/getChartData' \
--header 'Authorization: Bearer apikey' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "68c46a70d950e8850ae564ba",
"dateStart": "2025-09-19T16:00:00.000Z",
"dateEnd": "2025-09-27T15:59:59.999Z",
"offset": 1,
"source": [
"test",
"online",
"share",
"api",
"cronJob",
"team",
"feishu",
"official_account",
"wecom",
"mcp"
],
"userTimespan": "day",
"chatTimespan": "day",
"appTimespan": "day"
}'
```
```bash
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"userData": [
{
"timestamp": 1758585600000,
"summary": {
"userCount": 1,
"newUserCount": 0,
"retentionUserCount": 0,
"points": 1.1132600000000001,
"sourceCountMap": {
"test": 1,
"online": 0,
"share": 0,
"api": 0,
"cronJob": 0,
"team": 0,
"feishu": 0,
"official_account": 0,
"wecom": 0,
"mcp": 0
}
}
}
],
"chatData": [
{
"timestamp": 1758585600000,
"summary": {
"chatItemCount": 1,
"chatCount": 1,
"errorCount": 0,
"points": 1.1132600000000001
}
}
],
"appData": [
{
"timestamp": 1758585600000,
"summary": {
"goodFeedBackCount": 0,
"badFeedBackCount": 0,
"chatCount": 1,
"totalResponseTime": 22.31
}
}
]
}
}
```
**Request Parameters:**
* appId: Application ID
* dateStart: Start time
* dateEnd: End time
* source: Log source
* offset: User retention offset. The unit follows userTimespan
* userTimespan: User data timespan //day|week|month|quarter
* chatTimespan: Chat data timespan //day|week|month|quarter
* appTimespan: Application data timespan //day|week|month|quarter
**Response Parameters:**
* userData: User data array
* timestamp: Timestamp
* summary: Summary data object
* userCount: Active user count
* newUserCount: New user count
* retentionUserCount: Retained user count
* points: Total points consumed
* sourceCountMap: User count by source
* chatData: Chat data array
* timestamp: Timestamp
* summary: Summary data object
* chatItemCount: Chat message count
* chatCount: Session count
* errorCount: Error count
* points: Total points consumed
* appData: Application data array
* timestamp: Timestamp
* summary: Summary data object
* goodFeedBackCount: Positive feedback count
* badFeedBackCount: Negative feedback count
* chatCount: Chat count
* totalResponseTime: Total response time
file: ./content/openapi/app.mdx
meta: {
"title": "应用接口",
"description": "FastGPT OpenAPI 应用接口"
}
## 前置准备
1. 准备 API key: 可用直接使用全局 apikey
2. 准备应用的 AppId

## 日志接口
### 获取应用总体数据统计
```bash
curl --location --request GET 'https://cloud.fastgpt.cn/api/proApi/core/app/logs/getTotalData?appId=68c46a70d950e8850ae564ba' \
--header 'Authorization: Bearer apikey'
```
```bash
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"totalUsers": 0,
"totalChats": 0,
"totalPoints": 0
}
}
```
**入参:**
* appId: 应用 ID
**出参:**
* totalUsers: 累积使用用户数量
* totalChats: 累积对话数量
* totalPoints: 累积积分消耗
### 获取应用图表数据
```bash
curl --location --request POST 'https://cloud.fastgpt.cn/api/proApi/core/app/logs/getChartData' \
--header 'Authorization: Bearer apikey' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "68c46a70d950e8850ae564ba",
"dateStart": "2025-09-19T16:00:00.000Z",
"dateEnd": "2025-09-27T15:59:59.999Z",
"offset": 1,
"source": [
"test",
"online",
"share",
"api",
"cronJob",
"team",
"feishu",
"official_account",
"wecom",
"mcp"
],
"userTimespan": "day",
"chatTimespan": "day",
"appTimespan": "day"
}'
```
```bash
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"userData": [
{
"timestamp": 1758585600000,
"summary": {
"userCount": 1,
"newUserCount": 0,
"retentionUserCount": 0,
"points": 1.1132600000000001,
"sourceCountMap": {
"test": 1,
"online": 0,
"share": 0,
"api": 0,
"cronJob": 0,
"team": 0,
"feishu": 0,
"official_account": 0,
"wecom": 0,
"mcp": 0
}
}
}
],
"chatData": [
{
"timestamp": 1758585600000,
"summary": {
"chatItemCount": 1,
"chatCount": 1,
"errorCount": 0,
"points": 1.1132600000000001
}
}
],
"appData": [
{
"timestamp": 1758585600000,
"summary": {
"goodFeedBackCount": 0,
"badFeedBackCount": 0,
"chatCount": 1,
"totalResponseTime": 22.31
}
}
]
}
}
```
**入参:**
* appId: 应用 ID
* dateStart: 开始时间
* dateEnd: 结束时间
* source: 日志来源
* offset: 用户留存偏移量,单位随 userTimespan 变化
* userTimespan: 用户数据时间跨度 //day|week|month|quarter
* chatTimespan: 对话数据时间跨度 //day|week|month|quarter
* appTimespan: 应用数据时间跨度 //day|week|month|quarter
**出参:**
* userData: 用户数据数组
* timestamp: 时间戳
* summary: 汇总数据对象
* userCount: 活跃用户数量
* newUserCount: 新用户数量
* retentionUserCount: 留存用户数量
* points: 总积分消耗
* sourceCountMap: 各来源用户数量
* chatData: 对话数据数组
* timestamp: 时间戳
* summary: 汇总数据对象
* chatItemCount: 对话次数
* chatCount - 会话次数
* errorCount - 错误对话次数
* points - 总积分消耗
* appData: 应用数据数组
* timestamp - 时间戳
* summary - 汇总数据对象
* goodFeedBackCount - 好评反馈数量
* badFeedBackCount - 差评反馈数量
* chatCount - 对话次数
* totalResponseTime - 总响应时间
file: ./content/openapi/chat.en.mdx
meta: {
"title": "Chat API",
"description": "FastGPT OpenAPI Chat Interface"
}
# How to Get AppId
You can find the AppId in your application details URL.

# Start a Conversation
* Authenticate with an API Key. When calling `chat/completions` , passing `appId` in the request body is recommended.
* For OpenAI SDK compatibility, `Authorization: Bearer -` is also supported. The suffix is only a transport compatibility format and is not stored.
* To proxy a team member identity through `authProxy` , the team owner must enable `authProxy` when creating or editing the key. The proxied member must still have permission to access the target app and chat.
* Some packages require adding `v1` to the `BaseUrl` . If you get a 404 error, try adding `v1` and retry.
{/* * 对话现在有`v1`和`v2`两个接口,可以按需使用,v2 自 4.9.4 版本新增,v1 接口同时不再维护 */}
## Start Chat
The `v1` chat API is compatible with the `GPT` interface! If you're using the standard `GPT` official API, you can access FastGPT by simply changing the `BaseUrl` and `Authorization` . However, note these rules:
* Parameters like `model` and `temperature` are ignored. These values are determined by your workflow configuration.
* Won't return actual `Token` consumed. If needed, set `detail=true` and manually calculate `tokens` from `responseData` .
### Request
```bash
curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \
--header 'Authorization: Bearer fastgpt-xxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "your_app_id",
"chatId": "my_chatId",
"stream": false,
"detail": false,
"responseChatItemId": "my_responseChatItemId",
"variables": {
"uid": "asdfadsfasfd2323",
"name": "张三"
},
"messages": [
{
"role": "user",
"content": "导演是谁"
}
]
}'
```
* Only `messages` differs slightly; other parameters are the same.
* Direct file uploads are not supported. Upload files to your object storage and provide the URL.
```bash
curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \
--header 'Authorization: Bearer fastgpt-xxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "your_app_id",
"chatId": "abcd",
"stream": false,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "导演是谁"
},
{
"type": "image_url",
"image_url": {
"url": "图片链接"
}
},
{
"type": "file_url",
"name": "文件名",
"url": "文档链接,支持 txt md html word pdf ppt csv excel"
}
]
}
]
}'
```
* headers.Authorization: Bearer \[apikey]
* chatId: string | undefined.
* Empty or omitted: FastGPT context is not used, and context is built entirely from `messages` .
* Non-empty string: uses `chatId` for the chat, automatically reads messages from the FastGPT session, and uses only the last item in `messages` as the user question. Other messages are ignored. Make sure `chatId` is unique and shorter than 250 characters.
* messages: Same structure as [GPT chat messages](https://platform.openai.com/docs/api-reference/chat/object) .
* responseChatItemId: string | undefined. If provided, FastGPT uses it as the response message ID and stores it in the database. Make sure it is unique under the current `chatId` .
* detail: Whether to return intermediate values. In `stream` mode, they are separated by `event` ; in non-stream mode, they are stored in `responseData` .
* variables: Module variables. This object replaces `[key]` placeholders in input fields.
### Response
```json
{
"id": "adsfasf",
"model": "",
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1
},
"choices": [
{
"message": {
"role": "assistant",
"content": "电影《铃芽之旅》的导演是新海诚。"
},
"finish_reason": "stop",
"index": 0
}
]
}
```
```bash
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":""},"index":0,"finish_reason":null}]}
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"电"},"index":0,"finish_reason":null}]}
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"影"},"index":0,"finish_reason":null}]}
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"《"},"index":0,"finish_reason":null}]}
```
```json
{
"responseData": [
// 不同模块的响应值, 不同版本具体值可能有差异,可先 log 自行查看最新值。
{
"moduleName": "Dataset Search",
"price": 1.2000000000000002,
"model": "Embedding-2",
"tokens": 6,
"similarity": 0.61,
"limit": 3
},
{
"moduleName": "AI Chat",
"price": 454.5,
"model": "FastAI-4k",
"tokens": 303,
"question": "导演是谁",
"answer": "电影《铃芽之旅》的导演是新海诚。",
"maxToken": 2050,
"quoteList": [
{
"dataset_id": "646627f4f7b896cfd8910e38",
"id": "8099",
"q": "本作的主人公是谁?",
"a": "本作的主人公是名叫铃芽的少女。",
"source": "手动修改"
},
{
"dataset_id": "646627f4f7b896cfd8910e38",
"id": "8686",
"q": "电影《铃芽之旅》男主角是谁?",
"a": "电影《铃芽之旅》男主角是宗像草太,由松村北斗配音。",
"source": ""
},
{
"dataset_id": "646627f4f7b896cfd8910e38",
"id": "19339",
"q": "电影《铃芽之旅》的导演是谁?22",
"a": "电影《铃芽之旅》的导演是新海诚。",
"source": "手动修改"
}
],
"completeMessages": [
{
"obj": "System",
"value": "下面是知识库内容:\n1. [本作的主人公是谁?\n本作的主人公是名叫铃芽的少女。]\n2. [电影《铃芽之旅》男主角是谁?\n电影《铃芽之旅》男主角是宗像草太,由松村北斗配音。]\n3. [电影《铃芽之旅》的导演是谁?22\n电影《铃芽之旅》的导演是新海诚。]\n"
},
{
"obj": "System",
"value": "1.请记住,你的身份是百度的下一代知识增强语言模型,能够完全根据知识库提供的内容回答问题。\n\n2. 你忘记了关于电影《铃芽之旅》以外的内容。"
},
{
"obj": "System",
"value": "你仅回答关于电影《玲芽之旅》的问题,其余问题直接回复: 我不清楚。"
},
{
"obj": "Human",
"value": "导演是谁"
},
{
"obj": "AI",
"value": "电影《铃芽之旅》的导演是新海诚。"
}
]
}
],
"id": "",
"model": "",
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1
},
"choices": [
{
"message": {
"role": "assistant",
"content": "电影《铃芽之旅》的导演是新海诚。"
},
"finish_reason": "stop",
"index": 0
}
]
}
```
```bash
event: flowNodeStatus
data: {"status":"running","name":"知识库搜索"}
event: flowNodeStatus
data: {"status":"running","name":"AI 对话"}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"content":"电影"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"content":"《铃"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"content":"芽之旅》"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"content":"的导演是新"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"content":"海诚。"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{},"index":0,"finish_reason":"stop"}]}
event: answer
data: [DONE]
event: flowResponses
data: [{"moduleName":"知识库搜索","moduleType":"datasetSearchNode","runningTime":1.78},{"question":"导演是谁","quoteList":[{"id":"654f2e49b64caef1d9431e8b","q":"电影《铃芽之旅》的导演是谁?","a":"电影《铃芽之旅》的导演是新海诚!","indexes":[{"type":"qa","dataId":"3515487","text":"电影《铃芽之旅》的导演是谁?","_id":"654f2e49b64caef1d9431e8c","defaultIndex":true}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8935586214065552},{"id":"6552e14c50f4a2a8e632af11","q":"导演是谁?","a":"电影《铃芽之旅》的导演是新海诚。","indexes":[{"defaultIndex":true,"type":"qa","dataId":"3644565","text":"导演是谁?\n电影《铃芽之旅》的导演是新海诚。","_id":"6552e14dde5cc7ba3954e417"}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8890955448150635},{"id":"654f34a0b64caef1d946337e","q":"本作的主人公是谁?","a":"本作的主人公是名叫铃芽的少女。","indexes":[{"type":"qa","dataId":"3515541","text":"本作的主人公是谁?","_id":"654f34a0b64caef1d946337f","defaultIndex":true}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8738770484924316},{"id":"654f3002b64caef1d944207a","q":"电影《铃芽之旅》男主角是谁?","a":"电影《铃芽之旅》男主角是宗像草太,由松村北斗配音。","indexes":[{"type":"qa","dataId":"3515538","text":"电影《铃芽之旅》男主角是谁?","_id":"654f3002b64caef1d944207b","defaultIndex":true}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8607980012893677},{"id":"654f2fc8b64caef1d943fd46","q":"电影《铃芽之旅》的编剧是谁?","a":"新海诚是本片的编剧。","indexes":[{"defaultIndex":true,"type":"qa","dataId":"3515550","text":"电影《铃芽之旅》的编剧是谁?22","_id":"654f2fc8b64caef1d943fd47"}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8468944430351257}],"moduleName":"AI 对话","moduleType":"chatNode","runningTime":1.86}]
```
Event values:
* answer: Text returned to the client (counts as the final answer)
* chatTitle: Chat title generated from the current user question
* fastAnswer: Preset reply text returned to the client (counts as the final answer)
* toolCall: Tool execution
* toolParams: Tool parameters
* toolResponse: Tool response
* flowNodeStatus: Current workflow step status
* flowResponses: Complete workflow step responses
* updateVariables: Updated variables
* interactive: Interactive config
* error: Error
### Response
If your workflow contains interactive nodes, still call this API with `detail=true` :
* `stream=true` : read the interactive config from `event=interactive` in `data.interactive` .
* `stream=false` : read the element that contains the `interactive` field from `choices[].message.content` .
The `interactive` payload returned to external callers is display config only. It contains only `type` and `params` ; internal runtime fields such as `entryNodeIds` , `memoryEdges` , `nodeOutputs` , and `nodeResponseId` are not returned. If the workflow internally hits a children / loop / tool wrapper interaction, the API returns the deepest user-facing interaction.
When calling a workflow with interactive steps, if an interaction is encountered, it returns immediately. The examples below show the element inside `choices[].message.content[]` when `stream=false` ; when `stream=true` , `event=interactive` returns `{ "interactive": ... }` as its `data` :
```json
{
"interactive": {
"type": "userSelect",
"params": {
"description": "测试",
"userSelectOptions": [
{
"value": "Confirm",
"key": "option1"
},
{
"value": "Cancel",
"key": "option2"
}
]
}
}
}
```
```json
{
"interactive": {
"type": "userInput",
"params": {
"description": "测试",
"inputForm": [
{
"type": "input",
"key": "测试 1",
"label": "测试 1",
"description": "",
"value": "",
"defaultValue": "",
"valueType": "string",
"required": false,
"list": [
{
"label": "",
"value": ""
}
]
},
{
"type": "numberInput",
"key": "测试 2",
"label": "测试 2",
"description": "",
"value": "",
"defaultValue": "",
"valueType": "number",
"required": false,
"list": [
{
"label": "",
"value": ""
}
]
}
]
}
}
}
```
### Continue Interaction
After receiving interactive info, render your UI to guide user input or selection. Then call this API again to continue the workflow. Use this format:
For user selection, simply pass the selected value to messages.
```bash
curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \
--header 'Authorization: Bearer fastgpt-xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "your_app_id",
"stream": true,
"detail": true,
"chatId":"22222231",
"messages": [
{
"role": "user",
"content": "Confirm"
}
]
}'
```
Form input is slightly more complex. Serialize the input as a JSON string for `messages` . Object keys match form keys, values are user inputs. Ensure `chatId` is consistent.
```bash
curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \
--header 'Authorization: Bearer fastgpt-xxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "your_app_id",
"stream": true,
"detail": true,
"chatId":"22231",
"messages": [
{
"role": "user",
"content": "{\"测试 1\":\"这是输入框的内容\",\"测试 2\":666}"
}
]
}'
```
## Request Plugin
Plugin API is identical to chat API, with slight parameter differences:
* 调用插件 Type 的应用时,接口默认为 `detail` 模式。
* No need to pass `chatId` since plugins run only once.
* No need to pass `messages` .
* Pass `variables` to represent plugin inputs.
* Get plugin outputs from `pluginData` .
### Request
```bash
curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \
--header 'Authorization: Bearer test-xxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "your_app_id",
"stream": false,
"chatId": "test",
"variables": {
"query":"你好" # 我的插件输入有一个参数,变量名叫 query
}
}'
```
### Response
* Find plugin output by locating `moduleType=pluginOutput` in `responseData` . Its `pluginOutput` contains the output.
* Stream output is still available via `choices` .
```json
{
"responseData": [
{
"nodeId": "fdDgXQ6SYn8v",
"moduleName": "AI 对话",
"moduleType": "chatNode",
"totalPoints": 0.685,
"model": "FastAI-3.5",
"tokens": 685,
"query": "你好",
"maxToken": 2000,
"historyPreview": [
{
"obj": "Human",
"value": "你好"
},
{
"obj": "AI",
"value": "你好!有什么可以帮助你的吗?欢迎向我提问。"
}
],
"contextTotalLen": 14,
"runningTime": 1.73
},
{
"nodeId": "pluginOutput",
"moduleName": "插件输出",
"moduleType": "pluginOutput",
"totalPoints": 0,
"pluginOutput": {
"result": "你好!有什么可以帮助你的吗?欢迎向我提问。"
},
"runningTime": 0
}
],
"newVariables": {
"query": "你好"
},
"id": "safsafsa",
"model": "",
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1
},
"choices": [
{
"message": {
"role": "assistant",
"content": "你好!有什么可以帮助你的吗?欢迎向我提问。"
},
"finish_reason": "stop",
"index": 0
}
]
}
```
* Get plugin output by deserializing the `event=flowResponses` string into an array. Find `moduleType=pluginOutput` element; its `pluginOutput` contains the output.
* Stream output works the same as chat API.
```bash
event: flowNodeStatus
data: {"status":"running","name":"AI 对话"}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":""},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"你"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"好"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"!"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"有"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"什"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"么"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"可以"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"帮"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"助"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"你"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"的"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"吗"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"?"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":""},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{},"index":0,"finish_reason":"stop"}]}
event: answer
data: [DONE]
event: flowResponses
data: [{"nodeId":"fdDgXQ6SYn8v","moduleName":"AI 对话","moduleType":"chatNode","totalPoints":0.033,"model":"FastAI-3.5","tokens":33,"query":"你好","maxToken":2000,"historyPreview":[{"obj":"Human","value":"你好"},{"obj":"AI","value":"你好!有什么可以帮助你的吗?"}],"contextTotalLen":2,"runningTime":1.42},{"nodeId":"pluginOutput","moduleName":"插件输出","moduleType":"pluginOutput","totalPoints":0,"pluginOutput":{"result":"你好!有什么可以帮助你的吗?"},"runningTime":0}]
```
event 取值:
* answer: 返回给客户端的文本(最终会算作回答)
* fastAnswer: 指定回复返回给客户端的文本(最终会算作回答)
* toolCall: 执行工具
* toolParams: 工具参数
* toolResponse: 工具返回
* flowNodeStatus: 运行到的节点状态
* flowResponses: 节点完整响应
* updateVariables: 更新变量
* error: 报错
# Chat CRUD
* The following APIs can be called with any `API Key` .
* 4.8.12 and above
\***\*Important Fields\*\***
* chatId - The ID of a session under an application
* dataId - The ID of a message under a session
## Session Management
### Get Session List
```bash
curl --location --request POST 'http://localhost:3000/api/core/chat/history/getHistories' \
--header 'Authorization: Bearer [apikey]' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "appId",
"offset": 0,
"pageSize": 20,
"source": "api"
}'
```
* appId - Application ID
* offset - Offset (starting position)
* pageSize - Number of items
* source - Chat source. `source=api` means get API-created sessions only (excludes web UI sessions)
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"list": [
{
"chatId": "usdAP1GbzSGu",
"updateTime": "2024-10-13T03:29:05.779Z",
"appId": "66e29b870b24ce35330c0f08",
"customTitle": "",
"title": "你好",
"top": false
},
{
"chatId": "lC0uTAsyNBlZ",
"updateTime": "2024-10-13T03:22:19.950Z",
"appId": "66e29b870b24ce35330c0f08",
"customTitle": "",
"title": "测试",
"top": false
}
],
"total": 2
}
}
```
### Update Session Title
```bash
curl --location --request PUT 'http://localhost:3000/api/core/chat/history/updateHistory' \
--header 'Authorization: Bearer [apikey]' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "appId",
"chatId": "chatId",
"customTitle": "自定义标题"
}'
```
* appId - Application ID
* chatId - Session ID
* customTitle - Custom session title
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
### Update Session Pin Status
```bash
curl --location --request PUT 'http://localhost:3000/api/core/chat/history/updateHistory' \
--header 'Authorization: Bearer [apikey]' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "appId",
"chatId": "chatId",
"top": true
}'
```
* appId - Application ID
* chatId - Session ID
* top - Whether to pin. true = pin, false = unpin
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
### Delete a Session
```bash
curl --location --request DELETE 'http://localhost:3000/api/core/chat/history/delHistory?chatId=[chatId]&appId=[appId]' \
--header 'Authorization: Bearer [apikey]'
```
* appId - Application ID
* chatId - Session ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
### Clear App Sessions
Only clears sessions created via API Key. Does not clear sessions from web UI, share links, or other sources.
```bash
curl --location --request DELETE 'http://localhost:3000/api/core/chat/history/clearHistories?appId=[appId]' \
--header 'Authorization: Bearer [apikey]'
```
* appId - Application ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
## Message Management
Operations on messages under a specific session.
### Get Session Basic Info
```bash
curl --location --request GET 'http://localhost:3000/api/core/chat/init?appId=[appId]&chatId=[chatId]' \
--header 'Authorization: Bearer [apikey]'
```
* appId - Application ID
* chatId - Session ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"chatId": "sPVOuEohjo3w",
"appId": "66e29b870b24ce35330c0f08",
"variables": {},
"app": {
"chatConfig": {
"questionGuide": true,
"ttsConfig": {
"type": "web"
},
"whisperConfig": {
"open": false,
"autoSend": false,
"autoTTSResponse": false
},
"chatInputGuide": {
"open": false,
"textList": [],
"customUrl": ""
},
"instruction": "",
"variables": [],
"fileSelectConfig": {
"canSelectFile": true,
"canSelectImg": true,
"maxFiles": 10
},
"_id": "66f1139aaab9ddaf1b5c596d",
"welcomeText": ""
},
"chatModels": ["GPT-4o-mini"],
"name": "测试",
"avatar": "/imgs/app/avatar/workflow.svg",
"intro": "",
"type": "advanced",
"pluginInputs": []
}
}
}
```
### Get Message List
```bash
curl --location --request POST 'http://localhost:3000/api/core/chat/record/getPaginationRecords' \
--header 'Authorization: Bearer [apikey]' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "appId",
"chatId": "chatId",
"offset": 0,
"pageSize": 10,
"loadCustomFeedbacks": true
}'
```
* appId - Application ID
* chatId - Session ID
* offset - Offset
* pageSize - Number of items
* loadCustomFeedbacks - Whether to load custom feedbacks (optional)
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"list": [
{
"_id": "670b84e6796057dda04b0fd2",
"dataId": "jzqdV4Ap1u004rhd2WW8yGLn",
"obj": "Human",
"value": [
{
"text": {
"content": "你好"
}
}
],
"customFeedbacks": []
},
{
"_id": "670b84e6796057dda04b0fd3",
"dataId": "x9KQWcK9MApGdDQH7z7bocw1",
"obj": "AI",
"value": [
{
"text": {
"content": "你好!有什么我可以帮助你的吗?"
}
}
],
"customFeedbacks": [],
"totalQuoteList": [],
"totalRunningTime": 2.42,
"useAgentSandbox": false
}
],
"total": 2
}
}
```
### Get Message Run Details
```bash
curl --location --request GET 'http://localhost:3000/api/core/chat/record/getResData?appId=[appId]&chatId=[chatId]&dataId=[dataId]' \
--header 'Authorization: Bearer [apikey]'
```
* appId - Application ID
* chatId - Session ID
* dataId - Message ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": [
{
"id": "mVlxkz8NfyfU",
"nodeId": "448745",
"moduleName": "common:core.module.template.work_start",
"moduleType": "workflowStart",
"runningTime": 0
},
{
"id": "b3FndAdHSobY",
"nodeId": "z04w8JXSYjl3",
"moduleName": "AI 对话",
"moduleType": "chatNode",
"runningTime": 1.22,
"totalPoints": 0.02475,
"model": "GPT-4o-mini",
"tokens": 75,
"query": "测试",
"maxToken": 2000,
"historyPreview": [
{
"obj": "Human",
"value": "你好"
},
{
"obj": "AI",
"value": "你好!有什么我可以帮助你的吗?"
},
{
"obj": "Human",
"value": "测试"
},
{
"obj": "AI",
"value": "测试成功!请问你有什么具体的问题或者需要讨论的话题吗?"
}
],
"contextTotalLen": 4
}
]
}
```
### Delete Message
```bash
curl --location --request DELETE 'http://localhost:3000/api/core/chat/record/delete?contentId=[contentId]&chatId=[chatId]&appId=[appId]' \
--header 'Authorization: Bearer [apikey]'
```
* appId - Application ID
* chatId - Session ID
* contentId - Message ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
### Update Feedback (Like / Dislike)
Like / unlike:
```bash
curl --location --request POST 'http://localhost:3000/api/core/chat/feedback/updateUserFeedback' \
--header 'Authorization: Bearer [apikey]' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "appId",
"chatId": "chatId",
"dataId": "dataId",
"userGoodFeedback": "yes"
}'
```
Dislike / remove dislike:
```bash
curl --location --request POST 'http://localhost:3000/api/core/chat/feedback/updateUserFeedback' \
--header 'Authorization: Bearer [apikey]' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "appId",
"chatId": "chatId",
"dataId": "dataId",
"userBadFeedback": "yes"
}'
```
* appId - Application ID
* chatId - Session ID
* dataId - Message ID
* userGoodFeedback - User feedback when liking (optional). Omit to unlike.
* userBadFeedback - User feedback when disliking (optional). Omit to remove dislike.
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
## Question Suggestions
**4.8.16 New API (version**
The suggested questions feature requires both appId and chatId. It automatically fetches the last 6 message turns from the session as context.
```bash
curl --location --request POST 'http://localhost:3000/api/core/ai/agent/v2/createQuestionGuide' \
--header 'Authorization: Bearer [apikey]' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "appId",
"chatId": "chatId",
"questionGuide": {
"open": true,
"model": "GPT-4o-mini",
"customPrompt": "你是一个智能助手,请根据用户的问题生成猜你想问。"
}
}'
```
| 参数名 | 类型 | 必填 | 说明 |
| ------------- | ------ | -- | -------------------------------- |
| appId | string | ✅ | 应用 ID |
| chatId | string | ✅ | Session ID |
| questionGuide | object | | 自定义配置,不传的话,则会根据 appId,取最新发布版本的配置 |
```ts
type CreateQuestionGuideParams = OutLinkChatAuthProps & {
appId: string;
chatId: string;
questionGuide?: {
open: boolean;
model?: string;
customPrompt?: string;
};
};
```
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": ["你对AI有什么看法?", "想了解AI的应用吗?", "你希望AI能做什么?"]
}
```
file: ./content/openapi/chat.mdx
meta: {
"title": "对话接口",
"description": "FastGPT OpenAPI 对话接口"
}
## 如何获取 AppId
可在应用详情的路径里获取 AppId。

## 发起会话
### 密钥使用规范
* 使用 APIKey 鉴权。调用 `chat/completions` 时,推荐在请求体传入 `body.appId`。
* 为兼容 OpenAI SDK,也支持 `Authorization: Bearer -`,此时不需要传递 `body.appId`。
* 有些 SDK 调用时,`BaseUrl` 需要添加 `v1` 路径,有些不需要,如果出现 404 情况,可补充 `v1` 重试。
* appId 的优先级:`body.appId` , `-` , `apikey 关联的 appId(旧版适配)`
### 注意事项
* 如需通过 `authProxy` 代理团队成员身份,需要团队所有者在创建或编辑该 key 时开启 `authProxy`;代理身份仍需要具备目标应用和会话权限。(仅适用于 FastGPT >= v4.15.0)
* 传入的 `model`,`temperature` 等参数字段均无效,这些字段由编排决定,不会根据 API 参数改变。
* 不会返回实际消耗 `Token` 值,如果需要,可以设置 `detail=true`,并手动计算 `responseData` 里的 `tokens` 值。
### 请求
```bash
curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \
--header 'Authorization: Bearer fastgpt-xxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "your_app_id",
"chatId": "my_chatId",
"stream": false,
"detail": false,
"responseChatItemId": "my_responseChatItemId",
"variables": {
"uid": "asdfadsfasfd2323",
"name": "张三"
},
"messages": [
{
"role": "user",
"content": "导演是谁"
}
]
}'
```
* 仅 `messages` 有部分区别,其他参数一致。
* 目前不支持上传文件,需上传到自己的对象存储中,获取对应的文件链接。
```bash
curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \
--header 'Authorization: Bearer fastgpt-xxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "your_app_id",
"chatId": "abcd",
"stream": false,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "导演是谁"
},
{
"type": "image_url",
"image_url": {
"url": "图片链接"
}
},
{
"type": "file_url",
"name": "文件名",
"url": "文档链接,支持 txt md html word pdf ppt csv excel"
}
]
}
]
}'
```
* headers.Authorization: Bearer \[apikey]
* chatId: string | undefined。
* 为时(不传入),不使用 FastGpt 提供的上下文功能,完全通过传入的 messages 构建上下文。
* 为 `非空字符串` 时,意味着使用 chatId 进行对话,自动从 FastGpt 数据库取会话,并使用 messages 数组最后一个内容作为用户问题,其余 message 会被忽略。请自行确保 chatId 唯一,长度小于 250,通常可以是自己系统的对话框 ID。
* messages: 结构与 [GPT 接口](https://platform.openai.com/docs/api-reference/chat/object) chat 模式一致。
* responseChatItemId: string | undefined。如果传入,则会将该值作为本次对话的响应消息的 ID,FastGPT 会自动将该 ID 存入数据库。请确保,在当前 `chatId` 下,`responseChatItemId` 是唯一的。
* detail: 是否返回中间值(模块状态,响应的完整结果等),`stream 模式` 下会通过 `event` 进行区分,`非 stream 模式` 结果保存在 `responseData` 中。
* variables: 模块变量,一个对象,会替换模块中,输入框内容里的 `[key]`
### 响应
```json
{
"id": "adsfasf",
"model": "",
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1
},
"choices": [
{
"message": {
"role": "assistant",
"content": "电影《铃芽之旅》的导演是新海诚。"
},
"finish_reason": "stop",
"index": 0
}
]
}
```
```bash
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":""},"index":0,"finish_reason":null}]}
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"电"},"index":0,"finish_reason":null}]}
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"影"},"index":0,"finish_reason":null}]}
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"《"},"index":0,"finish_reason":null}]}
```
```json
{
"responseData": [
// 不同模块的响应值, 不同版本具体值可能有差异,可先 log 自行查看最新值。
{
"moduleName": "Dataset Search",
"price": 1.2000000000000002,
"model": "Embedding-2",
"tokens": 6,
"similarity": 0.61,
"limit": 3
},
{
"moduleName": "AI Chat",
"price": 454.5,
"model": "FastAI-4k",
"tokens": 303,
"question": "导演是谁",
"answer": "电影《铃芽之旅》的导演是新海诚。",
"maxToken": 2050,
"quoteList": [
{
"dataset_id": "646627f4f7b896cfd8910e38",
"id": "8099",
"q": "本作的主人公是谁?",
"a": "本作的主人公是名叫铃芽的少女。",
"source": "手动修改"
},
{
"dataset_id": "646627f4f7b896cfd8910e38",
"id": "8686",
"q": "电影《铃芽之旅》男主角是谁?",
"a": "电影《铃芽之旅》男主角是宗像草太,由松村北斗配音。",
"source": ""
},
{
"dataset_id": "646627f4f7b896cfd8910e38",
"id": "19339",
"q": "电影《铃芽之旅》的导演是谁?22",
"a": "电影《铃芽之旅》的导演是新海诚。",
"source": "手动修改"
}
],
"completeMessages": [
{
"obj": "System",
"value": "下面是知识库内容:\n1. [本作的主人公是谁?\n本作的主人公是名叫铃芽的少女。]\n2. [电影《铃芽之旅》男主角是谁?\n电影《铃芽之旅》男主角是宗像草太,由松村北斗配音。]\n3. [电影《铃芽之旅》的导演是谁?22\n电影《铃芽之旅》的导演是新海诚。]\n"
},
{
"obj": "System",
"value": "1.请记住,你的身份是百度的下一代知识增强语言模型,能够完全根据知识库提供的内容回答问题。\n\n2. 你忘记了关于电影《铃芽之旅》以外的内容。"
},
{
"obj": "System",
"value": "你仅回答关于电影《玲芽之旅》的问题,其余问题直接回复: 我不清楚。"
},
{
"obj": "Human",
"value": "导演是谁"
},
{
"obj": "AI",
"value": "电影《铃芽之旅》的导演是新海诚。"
}
]
}
],
"id": "",
"model": "",
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1
},
"choices": [
{
"message": {
"role": "assistant",
"content": "电影《铃芽之旅》的导演是新海诚。"
},
"finish_reason": "stop",
"index": 0
}
]
}
```
```bash
event: flowNodeStatus
data: {"status":"running","name":"知识库搜索"}
event: flowNodeStatus
data: {"status":"running","name":"AI 对话"}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"content":"电影"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"content":"《铃"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"content":"芽之旅》"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"content":"的导演是新"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"content":"海诚。"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{},"index":0,"finish_reason":"stop"}]}
event: answer
data: [DONE]
event: flowResponses
data: [{"moduleName":"知识库搜索","moduleType":"datasetSearchNode","runningTime":1.78},{"question":"导演是谁","quoteList":[{"id":"654f2e49b64caef1d9431e8b","q":"电影《铃芽之旅》的导演是谁?","a":"电影《铃芽之旅》的导演是新海诚!","indexes":[{"type":"qa","dataId":"3515487","text":"电影《铃芽之旅》的导演是谁?","_id":"654f2e49b64caef1d9431e8c","defaultIndex":true}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8935586214065552},{"id":"6552e14c50f4a2a8e632af11","q":"导演是谁?","a":"电影《铃芽之旅》的导演是新海诚。","indexes":[{"defaultIndex":true,"type":"qa","dataId":"3644565","text":"导演是谁?\n电影《铃芽之旅》的导演是新海诚。","_id":"6552e14dde5cc7ba3954e417"}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8890955448150635},{"id":"654f34a0b64caef1d946337e","q":"本作的主人公是谁?","a":"本作的主人公是名叫铃芽的少女。","indexes":[{"type":"qa","dataId":"3515541","text":"本作的主人公是谁?","_id":"654f34a0b64caef1d946337f","defaultIndex":true}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8738770484924316},{"id":"654f3002b64caef1d944207a","q":"电影《铃芽之旅》男主角是谁?","a":"电影《铃芽之旅》男主角是宗像草太,由松村北斗配音。","indexes":[{"type":"qa","dataId":"3515538","text":"电影《铃芽之旅》男主角是谁?","_id":"654f3002b64caef1d944207b","defaultIndex":true}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8607980012893677},{"id":"654f2fc8b64caef1d943fd46","q":"电影《铃芽之旅》的编剧是谁?","a":"新海诚是本片的编剧。","indexes":[{"defaultIndex":true,"type":"qa","dataId":"3515550","text":"电影《铃芽之旅》的编剧是谁?22","_id":"654f2fc8b64caef1d943fd47"}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8468944430351257}],"moduleName":"AI 对话","moduleType":"chatNode","runningTime":1.86}]
```
event 取值:
* answer: 返回给客户端的文本(最终会算作回答)
* chatTitle: 根据本轮用户问题生成的对话标题
* fastAnswer: 指定回复返回给客户端的文本(最终会算作回答)
* toolCall: 执行工具
* toolParams: 工具参数
* toolResponse: 工具返回
* flowNodeStatus: 运行到的节点状态
* flowResponses: 节点完整响应
* updateVariables: 更新变量
* interactive: 交互节点配置
* error: 报错
### 交互节点响应
如果工作流中包含交互节点,依然是调用该 API 接口,需要设置 `detail=true`:
* `stream=true`:可从 `event=interactive` 的 `data.interactive` 中获取交互节点配置。
* `stream=false`:可从 `choices[].message.content` 中获取包含 `interactive` 字段的元素。
返回给外部调用方的 `interactive` 是展示配置,只包含 `type` 和 `params`;`entryNodeIds` / `memoryEdges` / `nodeOutputs` / `nodeResponseId` 等内部运行态字段不会返回。若内部命中 children / loop / tool 包装交互,接口会返回最深层面向用户的交互节点。
当你调用一个带交互节点的工作流时,如果工作流遇到了交互节点,那么会直接返回。下面示例展示 `stream=false` 时 `choices[].message.content[]` 中的元素;`stream=true` 时 `event=interactive` 的 `data` 为 `{ "interactive": ... }`:
```json
{
"interactive": {
"type": "userSelect",
"params": {
"description": "测试",
"userSelectOptions": [
{
"value": "Confirm",
"key": "option1"
},
{
"value": "Cancel",
"key": "option2"
}
]
}
}
}
```
```json
{
"interactive": {
"type": "userInput",
"params": {
"description": "测试",
"inputForm": [
{
"type": "input",
"key": "测试 1",
"label": "测试 1",
"description": "",
"value": "",
"defaultValue": "",
"valueType": "string",
"required": false,
"list": [
{
"label": "",
"value": ""
}
]
},
{
"type": "numberInput",
"key": "测试 2",
"label": "测试 2",
"description": "",
"value": "",
"defaultValue": "",
"valueType": "number",
"required": false,
"list": [
{
"label": "",
"value": ""
}
]
}
]
}
}
}
```
### 交互节点继续运行
紧接着上一节,当你接收到交互节点信息后,可以根据这些数据进行 UI 渲染,引导用户输入或选择相关信息。然后需要再次发起会话,来继续工作流。调用的接口与仍是该接口,你需要按以下格式来发起请求:
对于用户选择,你只需要直接传递一个选择的结果给 messages 即可。
```bash
curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \
--header 'Authorization: Bearer fastgpt-xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "your_app_id",
"stream": true,
"detail": true,
"chatId":"22222231",
"messages": [
{
"role": "user",
"content": "Confirm"
}
]
}'
```
表单输入稍微麻烦一点,需要将输入的内容,以对象形式并序列化成字符串,作为 `messages` 的值。对象的 key 对应表单的 key,value 为用户输入的值。务必确保 `chatId` 是一致的。
```bash
curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \
--header 'Authorization: Bearer fastgpt-xxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "your_app_id",
"stream": true,
"detail": true,
"chatId":"22231",
"messages": [
{
"role": "user",
"content": "{\"测试 1\":\"这是输入框的内容\",\"测试 2\":666}"
}
]
}'
```
## 请求插件
插件的接口与对话接口一致,仅请求参数略有区别,有以下规定:
* 调用插件类型的应用时,接口默认为 `detail` 模式。
* 无需传入 `chatId`,因为插件只能运行一轮。
* 无需传入 `messages`。
* 通过传递 `variables` 来代表插件的输入。
* 通过获取 `pluginData` 来获取插件输出。
### 请求示例
```bash
curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \
--header 'Authorization: Bearer test-xxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "your_app_id",
"stream": false,
"chatId": "test",
"variables": {
"query":"你好" # 我的插件输入有一个参数,变量名叫 query
}
}'
```
### 响应示例
* 插件的输出可以通过查找 `responseData` 中, `moduleType=pluginOutput` 的元素,其 `pluginOutput` 是插件的输出。
* 流输出,仍可以通过 `choices` 进行获取。
```json
{
"responseData": [
{
"nodeId": "fdDgXQ6SYn8v",
"moduleName": "AI 对话",
"moduleType": "chatNode",
"totalPoints": 0.685,
"model": "FastAI-3.5",
"tokens": 685,
"query": "你好",
"maxToken": 2000,
"historyPreview": [
{
"obj": "Human",
"value": "你好"
},
{
"obj": "AI",
"value": "你好!有什么可以帮助你的吗?欢迎向我提问。"
}
],
"contextTotalLen": 14,
"runningTime": 1.73
},
{
"nodeId": "pluginOutput",
"moduleName": "插件输出",
"moduleType": "pluginOutput",
"totalPoints": 0,
"pluginOutput": {
"result": "你好!有什么可以帮助你的吗?欢迎向我提问。"
},
"runningTime": 0
}
],
"newVariables": {
"query": "你好"
},
"id": "safsafsa",
"model": "",
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1
},
"choices": [
{
"message": {
"role": "assistant",
"content": "你好!有什么可以帮助你的吗?欢迎向我提问。"
},
"finish_reason": "stop",
"index": 0
}
]
}
```
* 插件的输出可以通过获取 `event=flowResponses` 中的字符串,并将其反序列化后得到一个数组。同样的,查找 `moduleType=pluginOutput` 的元素,其 `pluginOutput` 是插件的输出。
* 流输出,仍和对话接口一样获取。
```bash
event: flowNodeStatus
data: {"status":"running","name":"AI 对话"}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":""},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"你"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"好"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"!"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"有"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"什"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"么"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"可以"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"帮"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"助"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"你"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"的"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"吗"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"?"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":""},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{},"index":0,"finish_reason":"stop"}]}
event: answer
data: [DONE]
event: flowResponses
data: [{"nodeId":"fdDgXQ6SYn8v","moduleName":"AI 对话","moduleType":"chatNode","totalPoints":0.033,"model":"FastAI-3.5","tokens":33,"query":"你好","maxToken":2000,"historyPreview":[{"obj":"Human","value":"你好"},{"obj":"AI","value":"你好!有什么可以帮助你的吗?"}],"contextTotalLen":2,"runningTime":1.42},{"nodeId":"pluginOutput","moduleName":"插件输出","moduleType":"pluginOutput","totalPoints":0,"pluginOutput":{"result":"你好!有什么可以帮助你的吗?"},"runningTime":0}]
```
event 取值:
* answer: 返回给客户端的文本(最终会算作回答)
* fastAnswer: 指定回复返回给客户端的文本(最终会算作回答)
* toolCall: 执行工具
* toolParams: 工具参数
* toolResponse: 工具返回
* flowNodeStatus: 运行到的节点状态
* flowResponses: 节点完整响应
* updateVariables: 更新变量
* error: 报错
# 对话 CRUD
**重要字段**
* appId - 应用 ID。
* chatId - 指一个应用下,某一个会话的 ID
* dataId - 指一个会话下,某一个对话的 ID
## 会话管理
### 获取会话列表
```bash
curl --location --request POST 'http://localhost:3000/api/core/chat/history/getHistories' \
--header 'Authorization: Bearer [apikey]' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "appId",
"offset": 0,
"pageSize": 20,
"source": "api"
}'
```
* appId - 应用 ID
* offset - 偏移量,即从第几条数据开始取
* pageSize - 记录数量
* source - 对话源。source=api,表示获取通过 API 创建的会话(不会获取页面上的会话)
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"list": [
{
"chatId": "usdAP1GbzSGu",
"updateTime": "2024-10-13T03:29:05.779Z",
"appId": "66e29b870b24ce35330c0f08",
"customTitle": "",
"title": "你好",
"top": false
},
{
"chatId": "lC0uTAsyNBlZ",
"updateTime": "2024-10-13T03:22:19.950Z",
"appId": "66e29b870b24ce35330c0f08",
"customTitle": "",
"title": "测试",
"top": false
}
],
"total": 2
}
}
```
### 修改会话标题
```bash
curl --location --request PUT 'http://localhost:3000/api/core/chat/history/updateHistory' \
--header 'Authorization: Bearer [apikey]' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "appId",
"chatId": "chatId",
"customTitle": "自定义标题"
}'
```
* appId - 应用 ID
* chatId - 会话 ID
* customTitle - 自定义会话名
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
### 修改会话置顶状态
```bash
curl --location --request PUT 'http://localhost:3000/api/core/chat/history/updateHistory' \
--header 'Authorization: Bearer [apikey]' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "appId",
"chatId": "chatId",
"top": true
}'
```
* appId - 应用 ID
* chatId - 会话 ID
* top - 是否置顶,true 置顶,false 取消置顶
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
### 删除单个会话
```bash
curl --location --request DELETE 'http://localhost:3000/api/core/chat/history/delHistory?chatId=[chatId]&appId=[appId]' \
--header 'Authorization: Bearer [apikey]'
```
* appId - 应用 ID
* chatId - 会话 ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
### 清空应用会话
仅会清空通过 API Key 创建的会话,不会清空在线使用、分享链接等其他来源的会话。
```bash
curl --location --request DELETE 'http://localhost:3000/api/core/chat/history/clearHistories?appId=[appId]' \
--header 'Authorization: Bearer [apikey]'
```
* appId - 应用 ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
## 对话管理
指的是某个会话下的会话操作。
### 获取会话基本信息
```bash
curl --location --request GET 'http://localhost:3000/api/core/chat/init?appId=[appId]&chatId=[chatId]' \
--header 'Authorization: Bearer [apikey]'
```
* appId - 应用 ID
* chatId - 会话 ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"chatId": "sPVOuEohjo3w",
"appId": "66e29b870b24ce35330c0f08",
"variables": {},
"app": {
"chatConfig": {
"questionGuide": true,
"ttsConfig": {
"type": "web"
},
"whisperConfig": {
"open": false,
"autoSend": false,
"autoTTSResponse": false
},
"chatInputGuide": {
"open": false,
"textList": [],
"customUrl": ""
},
"instruction": "",
"variables": [],
"fileSelectConfig": {
"canSelectFile": true,
"canSelectImg": true,
"maxFiles": 10
},
"_id": "66f1139aaab9ddaf1b5c596d",
"welcomeText": ""
},
"chatModels": ["GPT-4o-mini"],
"name": "测试",
"avatar": "/imgs/app/avatar/workflow.svg",
"intro": "",
"type": "advanced",
"pluginInputs": []
}
}
}
```
### 获取对话列表
```bash
curl --location --request POST 'http://localhost:3000/api/core/chat/record/getPaginationRecords' \
--header 'Authorization: Bearer [apikey]' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "appId",
"chatId": "chatId",
"offset": 0,
"pageSize": 10,
"loadCustomFeedbacks": true
}'
```
* appId - 应用 ID
* chatId - 会话 ID
* offset - 偏移量
* pageSize - 记录数量
* loadCustomFeedbacks - 是否读取自定义反馈(可选)
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"list": [
{
"_id": "670b84e6796057dda04b0fd2",
"dataId": "jzqdV4Ap1u004rhd2WW8yGLn",
"obj": "Human",
"value": [
{
"text": {
"content": "你好"
}
}
],
"customFeedbacks": []
},
{
"_id": "670b84e6796057dda04b0fd3",
"dataId": "x9KQWcK9MApGdDQH7z7bocw1",
"obj": "AI",
"value": [
{
"text": {
"content": "你好!有什么我可以帮助你的吗?"
}
}
],
"customFeedbacks": [],
"totalQuoteList": [],
"totalRunningTime": 2.42
}
],
"total": 2
}
}
```
### 获取单个对话运行详情
```bash
curl --location --request GET 'http://localhost:3000/api/core/chat/record/getResData?appId=[appId]&chatId=[chatId]&dataId=[dataId]' \
--header 'Authorization: Bearer [apikey]'
```
* appId - 应用 ID
* chatId - 会话 ID
* dataId - 对话 ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": [
{
"id": "mVlxkz8NfyfU",
"nodeId": "448745",
"moduleName": "common:core.module.template.work_start",
"moduleType": "workflowStart",
"runningTime": 0
},
{
"id": "b3FndAdHSobY",
"nodeId": "z04w8JXSYjl3",
"moduleName": "AI 对话",
"moduleType": "chatNode",
"runningTime": 1.22,
"totalPoints": 0.02475,
"model": "GPT-4o-mini",
"tokens": 75,
"query": "测试",
"maxToken": 2000,
"historyPreview": [
{
"obj": "Human",
"value": "你好"
},
{
"obj": "AI",
"value": "你好!有什么我可以帮助你的吗?"
},
{
"obj": "Human",
"value": "测试"
},
{
"obj": "AI",
"value": "测试成功!请问你有什么具体的问题或者需要讨论的话题吗?"
}
],
"contextTotalLen": 4
}
]
}
```
### 删除对话
```bash
curl --location --request DELETE 'http://localhost:3000/api/core/chat/record/delete?contentId=[contentId]&chatId=[chatId]&appId=[appId]' \
--header 'Authorization: Bearer [apikey]'
```
* appId - 应用 ID
* chatId - 会话 ID
* contentId - 对话 ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
### 更新反馈(点赞 / 点踩)
点赞 / 取消点赞:
```bash
curl --location --request POST 'http://localhost:3000/api/core/chat/feedback/updateUserFeedback' \
--header 'Authorization: Bearer [apikey]' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "appId",
"chatId": "chatId",
"dataId": "dataId",
"userGoodFeedback": "yes"
}'
```
点踩 / 取消点踩:
```bash
curl --location --request POST 'http://localhost:3000/api/core/chat/feedback/updateUserFeedback' \
--header 'Authorization: Bearer [apikey]' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "appId",
"chatId": "chatId",
"dataId": "dataId",
"userBadFeedback": "yes"
}'
```
* appId - 应用 ID
* chatId - 会话 ID
* dataId - 对话 ID
* userGoodFeedback - 用户点赞时的信息(可选),取消点赞时不填此参数即可
* userBadFeedback - 用户点踩时的信息(可选),取消点踩时不填此参数即可
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
## 猜你想问
**4.8.16 后新版接口**
新版猜你想问必须包含 appId 和 chatId 参数。系统会根据 chatId 拉取最近 6 轮对话作为上下文来引导回答。
```bash
curl --location --request POST 'http://localhost:3000/api/core/ai/agent/v2/createQuestionGuide' \
--header 'Authorization: Bearer [apikey]' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "appId",
"chatId": "chatId",
"questionGuide": {
"open": true,
"model": "GPT-4o-mini",
"customPrompt": "你是一个智能助手,请根据用户的问题生成猜你想问。"
}
}'
```
| 参数名 | 类型 | 必填 | 说明 |
| ------------- | ------ | -- | -------------------------------- |
| appId | string | ✅ | 应用 ID |
| chatId | string | ✅ | 会话 ID |
| questionGuide | object | | 自定义配置,不传的话,则会根据 appId,取最新发布版本的配置 |
```ts
type CreateQuestionGuideParams = OutLinkChatAuthProps & {
appId: string;
chatId: string;
questionGuide?: {
open: boolean;
model?: string;
customPrompt?: string;
};
};
```
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": ["你对AI有什么看法?", "想了解AI的应用吗?", "你希望AI能做什么?"]
}
```
file: ./content/openapi/dataset.en.mdx
meta: {
"title": "Dataset API",
"description": "FastGPT OpenAPI Dataset API"
}
| How to Get Dataset ID (datasetId) | How to Get Collection ID (collection\_id) |
| --------------------------------------- | ----------------------------------------- |
|  |  |
## Create Training Order
**New Example**
```bash
curl --location --request POST 'http://localhost:3000/api/support/wallet/usage/createTrainingUsage' \
--header 'Authorization: Bearer {{apikey}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"datasetId": "Dataset ID",
"name": "Optional, custom order name, e.g.: Document Training-fastgpt.docx"
}'
```
data is the billId, which can be used for bill aggregation when adding dataset data.
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": "65112ab717c32018f4156361"
}
```
## Dataset
### Create Knowledge Base
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/create' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"parentId": null,
"type": "dataset",
"name":"测试",
"intro":"介绍",
"avatar": "",
"vectorModel": "text-embedding-ada-002",
"agentModel": "gpt-3.5-turbo-16k",
"vlmModel": "gpt-4.1"
}'
```
* parentId - Parent ID for building directory structure. Usually can be null or omitted.
* type - `dataset` or `folder`, represents regular dataset or folder. If not provided, creates a regular dataset.
* name - Dataset name (required)
* intro - Description (optional)
* avatar - Avatar URL (optional)
* vectorModel - Vector model (recommended to leave empty, use system default)
* agentModel - Text processing model (recommended to leave empty, use system default)
* vlmModel - Image understanding model (recommended to leave empty, use system default)
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": "65abc9bd9d1448617cba5e6c"
}
```
### Get Dataset List
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/list?parentId=' \
--header 'Authorization: Bearer xxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"parentId":""
}'
```
* parentId - Parent ID. Pass empty string or null to get datasets in the root directory
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": [
{
"_id": "65abc9bd9d1448617cba5e6c",
"parentId": null,
"avatar": "",
"name": "测试",
"intro": "",
"type": "dataset",
"permission": "private",
"canWrite": true,
"isOwner": true,
"vectorModel": {
"model": "text-embedding-ada-002",
"name": "Embedding-2",
"charsPointsPrice": 0,
"defaultToken": 512,
"maxToken": 8000,
"weight": 100
}
}
]
}
```
### Get Knowledge Base Details
```bash
curl --location --request GET 'http://localhost:3000/api/core/dataset/detail?id=6593e137231a2be9c5603ba7' \
--header 'Authorization: Bearer {{authorization}}' \
```
* id: Dataset ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"_id": "6593e137231a2be9c5603ba7",
"parentId": null,
"teamId": "65422be6aa44b7da77729ec8",
"tmbId": "65422be6aa44b7da77729ec9",
"type": "dataset",
"status": "active",
"avatar": "/icon/logo.svg",
"name": "FastGPT test",
"vectorModel": {
"model": "text-embedding-ada-002",
"name": "Embedding-2",
"charsPointsPrice": 0,
"defaultToken": 512,
"maxToken": 8000,
"weight": 100
},
"agentModel": {
"model": "gpt-3.5-turbo-16k",
"name": "FastAI-16k",
"maxContext": 16000,
"maxResponse": 16000,
"charsPointsPrice": 0
},
"intro": "",
"permission": "private",
"updateTime": "2024-01-02T10:11:03.084Z",
"canWrite": true,
"isOwner": true
}
}
```
### Delete Knowledge Base
```bash
curl --location --request DELETE 'http://localhost:3000/api/core/dataset/delete?id=65abc8729d1448617cba5df6' \
--header 'Authorization: Bearer {{authorization}}' \
```
* id: Dataset ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
## Collection
### Common Creation Parameters (Must Read)
**Request**
| Parameter | Description | Required |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| datasetId | Dataset ID | ✅ |
| parentId: | Parent ID. Defaults to root directory if not provided | |
| trainingType | Data processing method. chunk: split by text length; qa: Q\&A extraction | ✅ |
| indexPrefixTitle | Whether to auto-generate title index | |
| customPdfParse | Whether to enable enhanced PDF parsing. Default false: disabled; true: enabled | |
| autoIndexes | Whether to auto-generate indexes (commercial version only) | |
| imageIndex | Whether to auto-generate image indexes (commercial version only) | |
| chunkSettingMode | Chunk parameter mode. auto: system default; custom: manual specification | |
| chunkSplitMode | Chunk split mode. size: split by length; char: split by character. Ineffective when chunkSettingMode=auto. | |
| chunkSize | Chunk size, default 1500. Ineffective when chunkSettingMode=auto. | |
| indexSize | Index size, default 512, must be less than index model max token. Ineffective when chunkSettingMode=auto. | |
| chunkSplitter | Custom highest priority split symbol. Won't split further unless exceeding file processing max context. Ineffective when chunkSettingMode=auto. | |
| qaPrompt | QA split prompt | |
| tags | Collection tags (string array) | |
| createTime | File creation time (Date / String) | |
**Response**
* collectionId - New collection ID
* insertLen:Number of inserted chunks
### Create Empty Collection/Folder
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/create' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"datasetId":"6593e137231a2be9c5603ba7",
"parentId": null,
"name":"测试",
"type":"virtual",
"metadata":{
"test":111
}
}'
```
* datasetId: Dataset ID (required)
* parentId: Parent ID. Defaults to root directory if not provided
* name: Collection name (required)
* type:
* folder: Folder
* virtual: Virtual collection (manual collection)
* metadata: Metadata (not currently used)
data is the collection ID.
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": "65abcd009d1448617cba5ee1"
}
```
### Create a Text Collection
Pass in text to create a collection. The text will be split accordingly.
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/create/text' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"text":"xxxxxxxx",
"datasetId":"6593e137231a2be9c5603ba7",
"parentId": null,
"name":"测试训练",
"trainingType": "qa",
"chunkSettingMode": "auto",
"qaPrompt":"",
"metadata":{}
}'
```
* text: Original text
* datasetId: Dataset ID (required)
* parentId: Parent ID. Defaults to root directory if not provided
* name: Collection name (required)
* metadata: Metadata (not currently used)
data is the collection ID.
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"collectionId": "65abcfab9d1448617cba5f0d",
"results": {
"insertLen": 5, // Split into how many segments
"overToken": [],
"repeat": [],
"error": []
}
}
}
```
### Create a Link Collection
Pass in a web link to create a collection. Content will be fetched from the webpage first, then split.
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/create/link' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"link":"https://doc.fastgpt.io/guide/getting-started/quick-start",
"datasetId":"6593e137231a2be9c5603ba7",
"parentId": null,
"trainingType": "chunk",
"chunkSettingMode": "auto",
"qaPrompt":"",
"metadata":{
"webPageSelector":".docs-content"
}
}'
```
* link: Web link
* datasetId: Dataset ID (required)
* parentId: Parent ID. Defaults to root directory if not provided
* metadata.webPageSelector: Web page selector to specify which element to use as text (optional)
data is the collection ID.
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"collectionId": "65abd0ad9d1448617cba6031",
"results": {
"insertLen": 1,
"overToken": [],
"repeat": [],
"error": []
}
}
}
```
### Create a File Collection
Pass in a file to create a collection. File content will be read and split. Currently supports: pdf, docx, md, txt, html, csv.
When uploading via code, note that Chinese filenames need to be encoded to avoid garbled text.
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/create/localFile' \
--header 'Authorization: Bearer {{authorization}}' \
--form 'file=@"C:\\Users\\user\\Desktop\\fastgpt测试File\\index.html"' \
--form 'data="{\"datasetId\":\"6593e137231a2be9c5603ba7\",\"parentId\":null,\"trainingType\":\"chunk\",\"chunkSize\":512,\"chunkSplitter\":\"\",\"qaPrompt\":\"\",\"metadata\":{}}"'
```
Use POST form-data format for upload. Contains file and data fields.
* file: File
* data: Dataset-related info (pass as serialized JSON). See "Common Creation Parameters" above
data is the collection ID.
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"collectionId": "65abc044e4704bac793fbd81",
"results": {
"insertLen": 1,
"overToken": [],
"repeat": [],
"error": []
}
}
}
```
### Create a Collection from an API Dataset (V1)
Pass in a file ID to create a collection. File content will be read and split. Currently supports: pdf, docx, md, txt, html, csv.
When uploading via code, note that Chinese filenames need to be encoded to avoid garbled text.
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/create/apiCollection' \
--header 'Authorization: Bearer fastgpt-xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "A Quick Guide to Building a Discord Bot.pdf",
"apiFileId":"A Quick Guide to Building a Discord Bot.pdf",
"datasetId": "674e9e479c3503c385495027",
"parentId": null,
"trainingType": "chunk",
"chunkSize":512,
"chunkSplitter":"",
"qaPrompt":""
}'
```
Use POST form-data format for upload. Contains file and data fields.
* name: Collection name, recommended to use filename, required.
* apiFileId: File ID, required.
* datasetId: Dataset ID (required)
* parentId: Parent ID. Defaults to root directory if not provided
* trainingType: Training mode (required)
* chunkSize: Length of each chunk (optional). chunk mode: 100~~3000; qa mode: 4000~~model max token (16k models usually recommended not to exceed 10000)
* chunkSplitter: Custom highest priority split symbol (optional)
* qaPrompt: QA split custom prompt (optional)
data is the collection ID.
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"collectionId": "65abc044e4704bac793fbd81",
"results": {
"insertLen": 1,
"overToken": [],
"repeat": [],
"error": []
}
}
}
```
### Create an External File Collection (Commercial)
```bash
curl --location --request POST 'http://localhost:3000/api/proApi/core/dataset/collection/create/externalFileUrl' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'Content-Type: application/json' \
--data-raw '{
"externalFileUrl":"https://image.xxxxx.com/fastgpt-dev/%E6%91%82.pdf",
"externalFileId":"1111",
"createTime": "2024-05-01T00:00:00.000Z",
"filename":"自定义File名.pdf",
"datasetId":"6642d105a5e9d2b00255b27b",
"parentId": null,
"tags": ["tag1","tag2"],
"trainingType": "chunk",
"chunkSize":512,
"chunkSplitter":"",
"qaPrompt":""
}'
```
| Parameter | Description | Required |
| --------------- | ----------------------------------------------- | -------- |
| externalFileUrl | File access URL (can be temporary) | ✅ |
| externalFileId | External file ID | |
| filename | Custom filename with extension | |
| createTime | File creation time (Date or ISO string both ok) | |
data is the collection ID.
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"collectionId": "6646fcedfabd823cdc6de746",
"results": {
"insertLen": 1,
"overToken": [],
"repeat": [],
"error": []
}
}
}
```
### Get Collection List
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/listV2' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"offset":0,
"pageSize": 10,
"datasetId":"6593e137231a2be9c5603ba7",
"parentId": null,
"searchText":""
}'
```
* offset: Offset
* pageSize: Items per page, max 30 (optional)
* datasetId: Dataset ID (required)
* parentId: Parent ID (optional)
* searchText: Fuzzy search text (optional)
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"list": [
{
"_id": "6593e137231a2be9c5603ba9",
"parentId": null,
"tmbId": "65422be6aa44b7da77729ec9",
"type": "virtual",
"name": "Manual entry",
"updateTime": "2099-01-01T00:00:00.000Z",
"dataAmount": 3,
"trainingAmount": 0,
"externalFileId": "1111",
"tags": ["11", "测试的"],
"forbid": false,
"trainingType": "chunk",
"permission": {
"value": 4294967295,
"isOwner": true,
"hasManagePer": true,
"hasWritePer": true,
"hasReadPer": true
}
},
{
"_id": "65abd0ad9d1448617cba6031",
"parentId": null,
"tmbId": "65422be6aa44b7da77729ec9",
"type": "link",
"name": "快速上手 | FastGPT",
"rawLink": "https://doc.fastgpt.io/guide/getting-started/quick-start",
"updateTime": "2024-01-20T13:54:53.031Z",
"dataAmount": 3,
"trainingAmount": 0,
"externalFileId": "222",
"tags": ["测试的"],
"forbid": false,
"trainingType": "chunk",
"permission": {
"value": 4294967295,
"isOwner": true,
"hasManagePer": true,
"hasWritePer": true,
"hasReadPer": true
}
}
],
"total": 93
}
}
```
### Get Collection Details
```bash
curl --location --request GET 'http://localhost:3000/api/core/dataset/collection/detail?id=65abcfab9d1448617cba5f0d' \
--header 'Authorization: Bearer {{authorization}}' \
```
* id: Collection ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"_id": "65abcfab9d1448617cba5f0d",
"parentId": null,
"teamId": "65422be6aa44b7da77729ec8",
"tmbId": "65422be6aa44b7da77729ec9",
"datasetId": {
"_id": "6593e137231a2be9c5603ba7",
"parentId": null,
"teamId": "65422be6aa44b7da77729ec8",
"tmbId": "65422be6aa44b7da77729ec9",
"type": "dataset",
"status": "active",
"avatar": "/icon/logo.svg",
"name": "FastGPT test",
"vectorModel": "text-embedding-ada-002",
"agentModel": "gpt-3.5-turbo-16k",
"intro": "",
"permission": "private",
"updateTime": "2024-01-02T10:11:03.084Z"
},
"type": "virtual",
"name": "测试训练",
"trainingType": "qa",
"chunkSize": 8000,
"chunkSplitter": "",
"qaPrompt": "11",
"rawTextLength": 40466,
"hashRawText": "47270840614c0cc122b29daaddc09c2a48f0ec6e77093611ab12b69cba7fee12",
"createTime": "2024-01-20T13:50:35.838Z",
"updateTime": "2024-01-20T13:50:35.838Z",
"canWrite": true,
"sourceName": "测试训练"
}
}
```
### Update Dataset Collection Info
**Update Collection Info by Collection ID**
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/update' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"id":"65abcfab9d1448617cba5f0d",
"parentId": null,
"name": "测2222试",
"tags": ["tag1", "tag2"],
"forbid": false,
"createTime": "2024-01-01T00:00:00.000Z"
}'
```
**Update Collection Info by External File ID**, Just replace id with datasetId and externalFileId.
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/update' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"datasetId":"6593e137231a2be9c5603ba7",
"externalFileId":"1111",
"parentId": null,
"name": "测2222试",
"tags": ["tag1", "tag2"],
"forbid": false,
"createTime": "2024-01-01T00:00:00.000Z"
}'
```
* id: Collection ID
* parentId: Update parent ID (optional)
* name: Update collection name (optional)
* tags: Update collection tags (optional)
* forbid: Update collection disabled status (optional)
* createTime: Update collection creation time (optional)
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
### Delete Collection
```bash
curl --location --request DELETE 'http://localhost:3000/api/core/dataset/collection/delete' \
--header 'Authorization: Bearer fastgpt-' \
--header 'Content-Type: application/json' \
--data-raw '{
"collectionIds": ["65a8cdcb0d70d3de0bf08d0a"]
}'
```
* collectionIds: Collection ID list
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
## Data
### Data Structure
**Data Structure**
| Field | Type | Description | Required |
| ------------- | -------- | -------------- | -------- |
| teamId | String | Team ID | ✅ |
| tmbId | String | Member ID | ✅ |
| datasetId | String | Dataset ID | ✅ |
| collectionId | String | CollectionID | ✅ |
| q | String | Primary data | ✅ |
| a | String | Auxiliary data | ✖ |
| fullTextToken | String | Tokenization | ✖ |
| indexes | Index\[] | Vector indexes | ✅ |
| updateTime | Date | Update time | ✅ |
| chunkIndex | Number | Chunk index | ✖ |
**Index Structure**
Maximum 5 custom indexes per data group
| Field | Type | Description | Required |
| ------ | ------ | ----------------------------------------------------------------------------------------------------------------------------------- | -------- |
| type | String | Optional index types: default-default index; custom-custom index; summary-summary index; question-question index; image-image index | |
| dataId | String | Associated vector ID. Pass this ID when updating data for incremental updates instead of full updates | |
| text | String | Text content | ✅ |
`type` If not provided, defaults to `custom` index. A default index will also be created based on q/a. If a default index is provided, no additional one will be created.
### Push Data to Training Queue
Note: Maximum 200 data groups per push.
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/data/pushData' \
--header 'Authorization: Bearer apikey' \
--header 'Content-Type: application/json' \
--data-raw '{
"collectionId": "64663f451ba1676dbdef0499",
"trainingType": "chunk",
"prompt": "Optional. QA split guide prompt, ignored in chunk mode",
"billId": "可选。如果有这个值,本次的Data会被聚合到一个订单中,这个值可以重复使用。可以参考 [Create Training Order] 获取该值。",
"data": [
{
"q": "Who are you?",
"a": "I'm FastGPT Assistant"
},
{
"q": "What can you do?",
"a": "I can do anything",
"indexes": [
{
"text":"Custom index 1"
},
{
"text":"Custom index 2"
}
]
}
]
}'
```
* collectionId: Collection ID (required)
* trainingType: Training mode (required)
* prompt: Custom QA split prompt. Must follow template strictly. Recommended not to pass. (optional)
* data:(Specific data)
* q: Primary data(Required)
* a: Auxiliary data (optional)
* indexes: Custom indexes (optional). Can omit or pass empty array. By default, an index will be created from q and a.
```json
{
"code": 200,
"statusText": "",
"data": {
"insertLen": 1, // Final number of successful insertions
"overToken": [], // Exceeding token
"repeat": [], // Number of duplicates
"error": [] // Other errors
}
}
```
\[theme] content can be replaced with the data theme. Default: They may contain multiple theme contents
```
I'll give you a text, [theme], learn it, and organize the learning results, requirements:
1. Propose up to 25 questions.
2. Provide answers to each question.
3. Answers should be detailed and complete, and can include plain text, links, code, tables, formulas, media links, and other markdown elements.
4. Return multiple questions and answers in format:
Q1: Question.
A1: Answer.
Q2:
A2:
……
My text:"""{{text}}"""
```
### Get Collection Data List
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/data/v2/list' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"offset": 0,
"pageSize": 10,
"collectionId":"65abd4ac9d1448617cba6171",
"searchText":""
}'
```
* offset: Offset (optional)
* pageSize: Items per page, max 30 (optional)
* collectionId: Collection ID (required)
* searchText: Fuzzy search term (optional)
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"list": [
{
"_id": "65abd4b29d1448617cba61db",
"datasetId": "65abc9bd9d1448617cba5e6c",
"collectionId": "65abd4ac9d1448617cba6171",
"q": "N o . 2 0 2 2 1 2中 国 信 息 通 信 研 究 院京东探索研究院2022年 9月人工智能生成内容(AIGC)白皮书(2022 年)版权声明本白皮书版权属于中国信息通信研究院和京东探索研究院,并受法律保护。转载、摘编或利用其它方式使用本白皮书文字or观点的,应注明“来源:中国信息通信研究院和京东探索研究院”。违反上述声明者,编者将追究其相关法律责任。前 言习近平总书记曾指出,“数字技术正以新理念、新业态、新模式全面融入人类经济、政治、文化、社会、生态文明建设各领域和全过程”。在当前数字世界和物理世界加速融合的大背景下,人工智能生成内容(Artificial Intelligence Generated Content,简称 AIGC)正在悄然引导着一场深刻的变革,重塑甚至颠覆数字内容的生产方式和消费模式,将极大地丰富人们的数字生活,是未来全面迈向数字文明新时代不可或缺的支撑力量。",
"a": "",
"chunkIndex": 0
},
{
"_id": "65abd4b39d1448617cba624d",
"datasetId": "65abc9bd9d1448617cba5e6c",
"collectionId": "65abd4ac9d1448617cba6171",
"q": "本白皮书重点从 AIGC 技术、应用和治理等维度进行了阐述。在技术层面,梳理提出了 AIGC 技术体系,既涵盖了对现实世界各种内容的数字化呈现和增强,也包括了基于人工智能的自主内容创作。在应用层面,重点分析了 AIGC 在传媒、电商、影视等行业和场景的应用情况,探讨了以虚拟数字人、写作机器人等为代表的新业态和新应用。在治理层面,从政策监管、技术能力、企业应用等视角,分析了AIGC 所暴露出的版权纠纷、虚假信息传播等各种Question.最后,从政府、行业、企业、社会等层面,给出了 AIGC 发展和治理建议。由于人工智能仍处于飞速发展阶段,我们对 AIGC 的认识还有待进一步深化,白皮书中存在不足之处,敬请大家批评指正。目 录一、 人工智能生成内容的发展历程与概念.............................................................. 1(一)AIGC 历史沿革 .......................................................................................... 1(二)AIGC 的概念与内涵 .................................................................................. 4二、人工智能生成内容的技术体系及其演进方向.................................................... 7(一)AIGC 技术升级步入深化阶段 .................................................................. 7(二)AIGC 大模型架构潜力凸显 .................................................................... 10(三)AIGC 技术演化出三大前沿能力 ............................................................ 18三、人工智能生成内容的应用场景.......................................................................... 26(一)AIGC+传媒:人机协同生产,",
"a": "",
"chunkIndex": 1
}
],
"total": 63
}
}
```
### Get Single Data Details
```bash
curl --location --request GET 'http://localhost:3000/api/core/dataset/data/detail?id=65abd4b29d1448617cba61db' \
--header 'Authorization: Bearer {{authorization}}' \
```
* id: Data ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"id": "65abd4b29d1448617cba61db",
"q": "N o . 2 0 2 2 1 2中 国 信 息 通 信 研 究 院京东探索研究院2022年 9月人工智能生成内容(AIGC)白皮书(2022 年)版权声明本白皮书版权属于中国信息通信研究院和京东探索研究院,并受法律保护。转载、摘编或利用其它方式使用本白皮书文字or观点的,应注明“来源:中国信息通信研究院和京东探索研究院”。违反上述声明者,编者将追究其相关法律责任。前 言习近平总书记曾指出,“数字技术正以新理念、新业态、新模式全面融入人类经济、政治、文化、社会、生态文明建设各领域和全过程”。在当前数字世界和物理世界加速融合的大背景下,人工智能生成内容(Artificial Intelligence Generated Content,简称 AIGC)正在悄然引导着一场深刻的变革,重塑甚至颠覆数字内容的生产方式和消费模式,将极大地丰富人们的数字生活,是未来全面迈向数字文明新时代不可或缺的支撑力量。",
"a": "",
"chunkIndex": 0,
"indexes": [
{
"type": "default",
"dataId": "3720083",
"text": "N o . 2 0 2 2 1 2中 国 信 息 通 信 研 究 院京东探索研究院2022年 9月人工智能生成内容(AIGC)白皮书(2022 年)版权声明本白皮书版权属于中国信息通信研究院和京东探索研究院,并受法律保护。转载、摘编或利用其它方式使用本白皮书文字or观点的,应注明“来源:中国信息通信研究院和京东探索研究院”。违反上述声明者,编者将追究其相关法律责任。前 言习近平总书记曾指出,“数字技术正以新理念、新业态、新模式全面融入人类经济、政治、文化、社会、生态文明建设各领域和全过程”。在当前数字世界和物理世界加速融合的大背景下,人工智能生成内容(Artificial Intelligence Generated Content,简称 AIGC)正在悄然引导着一场深刻的变革,重塑甚至颠覆数字内容的生产方式和消费模式,将极大地丰富人们的数字生活,是未来全面迈向数字文明新时代不可或缺的支撑力量。",
"_id": "65abd4b29d1448617cba61dc"
}
],
"datasetId": "65abc9bd9d1448617cba5e6c",
"collectionId": "65abd4ac9d1448617cba6171",
"sourceName": "中文-AIGC白皮书2022.pdf",
"sourceId": "65abd4ac9d1448617cba6166",
"isOwner": true,
"canWrite": true
}
}
```
### Update Single Data
```bash
curl --location --request PUT 'http://localhost:3000/api/core/dataset/data/update' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"dataId":"65abd4b29d1448617cba61db",
"q":"Test 111",
"a":"sss",
"indexes":[
{
"dataId": "xxxx",
"type": "default",
"text": "Default index"
},
{
"dataId": "xxx",
"type": "custom",
"text": "旧的Custom index 1"
},
{
"type":"custom",
"text":"New custom index"
}
]
}'
```
* dataId: Data ID
* q: Primary data (optional)
* a: Auxiliary data (optional)
* indexes: Custom indexes (optional). See `Batch Add Data to Collection` for types. If custom indexes exist when created,
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
### Delete Single Data
```bash
curl --location --request DELETE 'http://localhost:3000/api/core/dataset/data/delete?id=65abd4b39d1448617cba624d' \
--header 'Authorization: Bearer {{authorization}}' \
```
* id: Data ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": "success"
}
```
## Search Test
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/searchTest' \
--header 'Authorization: Bearer fastgpt-xxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"datasetId": "Dataset ID",
"text": "Who is the director",
"limit": 5000,
"similarity": 0,
"searchMode": "embedding",
"usingReRank": false,
"datasetSearchUsingExtensionQuery": true,
"datasetSearchExtensionModel": "gpt-5",
"datasetSearchExtensionBg": ""
}'
```
* datasetId - Dataset ID
* text - Text to test
* limit - Maximum tokens
* similarity - Minimum similarity (0\~1, optional)
* searchMode - Search mode: embedding | fullTextRecall | mixedRecall
* usingReRank - Use rerank
* datasetSearchUsingExtensionQuery - Use query extension
* datasetSearchExtensionModel - Query extension model
* datasetSearchExtensionBg - Query extension background description
Returns top k results. limit is the maximum tokens, up to 20000 tokens.
```json
{
"code": 200,
"statusText": "",
"data": [
{
"id": "65599c54a5c814fb803363cb",
"q": "你是谁",
"a": "I'm FastGPT Assistant",
"datasetId": "6554684f7f9ed18a39a4d15c",
"collectionId": "6556cd795e4b663e770bb66d",
"sourceName": "GBT 15104-2021 装饰单板贴面人造板.pdf",
"sourceId": "6556cd775e4b663e770bb65c",
"score": 0.8050316572189331
},
......
]
}
```
file: ./content/openapi/dataset.mdx
meta: {
"title": "知识库接口",
"description": "FastGPT OpenAPI 知识库接口"
}
| 如何获取知识库 ID(datasetId) | 如何获取文件集合 ID(collection\_id) |
| --------------------------------------- | -------------------------------------- |
|  |  |
## 创建训练订单
**新例子**
```bash
curl --location --request POST 'http://localhost:3000/api/support/wallet/usage/createTrainingUsage' \
--header 'Authorization: Bearer {{apikey}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"datasetId": "知识库 ID",
"name": "可选,自定义订单名称,例如:文档训练-fastgpt.docx"
}'
```
data 为 billId,可用于添加知识库数据时进行账单聚合。
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": "65112ab717c32018f4156361"
}
```
## 知识库
### 创建知识库
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/create' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"parentId": null,
"type": "dataset",
"name":"测试",
"intro":"介绍",
"avatar": "",
"vectorModel": "text-embedding-ada-002",
"agentModel": "gpt-3.5-turbo-16k",
"vlmModel": "gpt-4.1"
}'
```
* parentId - 父级 ID,用于构建目录结构。通常可以为 null 或者直接不传。
* type - `dataset` 或者 `folder`,代表普通知识库和文件夹。不传则代表创建普通知识库。
* name - 知识库名(必填)
* intro - 介绍(可选)
* avatar - 头像地址(可选)
* vectorModel - 向量模型(建议传空,用系统默认的)
* agentModel - 文本处理模型(建议传空,用系统默认的)
* vlmModel - 图片理解模型(建议传空,用系统默认的)
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": "65abc9bd9d1448617cba5e6c"
}
```
### 获取知识库列表
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/list?parentId=' \
--header 'Authorization: Bearer xxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"parentId":""
}'
```
* parentId - 父级 ID,传空字符串或者 null,代表获取根目录下的知识库
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": [
{
"_id": "65abc9bd9d1448617cba5e6c",
"parentId": null,
"avatar": "",
"name": "测试",
"intro": "",
"type": "dataset",
"permission": "private",
"canWrite": true,
"isOwner": true,
"vectorModel": {
"model": "text-embedding-ada-002",
"name": "Embedding-2",
"charsPointsPrice": 0,
"defaultToken": 512,
"maxToken": 8000,
"weight": 100
}
}
]
}
```
### 获取知识库详情
```bash
curl --location --request GET 'http://localhost:3000/api/core/dataset/detail?id=6593e137231a2be9c5603ba7' \
--header 'Authorization: Bearer {{authorization}}' \
```
* id: 知识库的 ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"_id": "6593e137231a2be9c5603ba7",
"parentId": null,
"teamId": "65422be6aa44b7da77729ec8",
"tmbId": "65422be6aa44b7da77729ec9",
"type": "dataset",
"status": "active",
"avatar": "/icon/logo.svg",
"name": "FastGPT test",
"vectorModel": {
"model": "text-embedding-ada-002",
"name": "Embedding-2",
"charsPointsPrice": 0,
"defaultToken": 512,
"maxToken": 8000,
"weight": 100
},
"agentModel": {
"model": "gpt-3.5-turbo-16k",
"name": "FastAI-16k",
"maxContext": 16000,
"maxResponse": 16000,
"charsPointsPrice": 0
},
"intro": "",
"permission": "private",
"updateTime": "2024-01-02T10:11:03.084Z",
"canWrite": true,
"isOwner": true
}
}
```
### 删除知识库
```bash
curl --location --request DELETE 'http://localhost:3000/api/core/dataset/delete?id=65abc8729d1448617cba5df6' \
--header 'Authorization: Bearer {{authorization}}' \
```
* id: 知识库的 ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
## 集合
### 通用创建参数说明(必看)
**入参**
| 参数 | 说明 | 必填 |
| ---------------- | ----------------------------------------------------------------- | -- |
| datasetId | 知识库 ID | ✅ |
| parentId | 父级 ID,不填则默认为根目录 | |
| trainingType | 数据处理方式。chunk: 按文本长度进行分割;qa: 问答对提取 | ✅ |
| indexPrefixTitle | 是否自动生成标题索引 | |
| customPdfParse | 是否开启 PDF 增强解析, 默认 false: 关闭;true: 开启; | |
| autoIndexes | 是否自动生成索引(仅商业版支持) | |
| imageIndex | 是否自动生成图片索引(仅商业版支持) | |
| chunkSettingMode | 分块参数模式。auto: 系统默认参数; custom: 手动指定参数 | |
| chunkSplitMode | 分块拆分模式。size: 按长度拆分; char: 按字符拆分。chunkSettingMode=auto 时不生效。 | |
| chunkSize | 分块大小,默认 1500。chunkSettingMode=auto 时不生效。 | |
| indexSize | 索引大小,默认 512,必须小于索引模型最大 token。chunkSettingMode=auto 时不生效。 | |
| chunkSplitter | 自定义最高优先分割符号,除非超出文件处理最大上下文,否则不会进行进一步拆分。chunkSettingMode=auto 时不生效。 | |
| qaPrompt | qa 拆分提示词 | |
| tags | 集合标签(字符串数组) | |
| createTime | 文件创建时间(Date / String) | |
**出参**
* collectionId - 新建的集合 ID
* insertLen:插入的块数量
### 创建空集合/目录
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/create' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"datasetId":"6593e137231a2be9c5603ba7",
"parentId": null,
"name":"测试",
"type":"virtual",
"metadata":{
"test":111
}
}'
```
* datasetId: 知识库的 ID(必填)
* parentId:父级 ID,不填则默认为根目录
* name: 集合名称(必填)
* type:
* folder:文件夹
* virtual:虚拟集合(手动集合)
* metadata:元数据(暂时没啥用)
data 为集合的 ID。
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": "65abcd009d1448617cba5ee1"
}
```
### 创建一个纯文本集合
传入一段文字,创建一个集合,会根据传入的文字进行分割。
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/create/text' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"text":"xxxxxxxx",
"datasetId":"6593e137231a2be9c5603ba7",
"parentId": null,
"name":"测试训练",
"trainingType": "qa",
"chunkSettingMode": "auto",
"qaPrompt":"",
"metadata":{}
}'
```
* text: 原文本
* datasetId: 知识库的 ID(必填)
* parentId:父级 ID,不填则默认为根目录
* name: 集合名称(必填)
* metadata:元数据(暂时没啥用)
data 为集合的 ID。
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"collectionId": "65abcfab9d1448617cba5f0d",
"results": {
"insertLen": 5
}
}
}
```
### 创建一个链接集合
传入一个网络链接,创建一个集合,会先去对应网页抓取内容,再抓取的文字进行分割。
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/create/link' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"link":"https://doc.fastgpt.io/guide/getting-started/quick-start",
"datasetId":"6593e137231a2be9c5603ba7",
"parentId": null,
"trainingType": "chunk",
"chunkSettingMode": "auto",
"qaPrompt":"",
"metadata":{
"webPageSelector":".docs-content"
}
}'
```
* link: 网络链接
* datasetId: 知识库的 ID(必填)
* parentId:父级 ID,不填则默认为根目录
* metadata.webPageSelector: 网页选择器,用于指定网页中的哪个元素作为文本(可选)
data 为集合的 ID。
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"collectionId": "65abd0ad9d1448617cba6031",
"results": {
"insertLen": 1
}
}
}
```
### 创建一个文件集合
传入一个文件,创建一个集合,会读取文件内容进行分割。目前支持:pdf, docx, md, txt, html, csv。
使用代码上传时,请注意中文 filename 需要进行 encode 处理,否则容易乱码。
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/create/localFile' \
--header 'Authorization: Bearer {{authorization}}' \
--form 'file=@"C:\\Users\\user\\Desktop\\fastgpt测试文件\\index.html"' \
--form 'data="{\"datasetId\":\"6593e137231a2be9c5603ba7\",\"parentId\":null,\"trainingType\":\"chunk\",\"chunkSize\":512,\"chunkSplitter\":\"\",\"qaPrompt\":\"\",\"metadata\":{}}"'
```
需要使用 POST form-data 的格式上传。包含 file 和 data 两个字段。
* file: 文件
* data: 知识库相关信息(json 序列化后传入),参数说明见上方"通用创建参数说明"
data 为集合的 ID。
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"collectionId": "65abc044e4704bac793fbd81",
"results": {
"insertLen": 1
}
}
}
```
### 通过 API 数据集创建集合(V1)
传入一个文件的 id,创建一个集合,会读取文件内容进行分割。目前支持:pdf, docx, md, txt, html, csv。
使用代码上传时,请注意中文 filename 需要进行 encode 处理,否则容易乱码。
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/create/apiCollection' \
--header 'Authorization: Bearer fastgpt-xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "A Quick Guide to Building a Discord Bot.pdf",
"apiFileId":"A Quick Guide to Building a Discord Bot.pdf",
"datasetId": "674e9e479c3503c385495027",
"parentId": null,
"trainingType": "chunk",
"chunkSize":512,
"chunkSplitter":"",
"qaPrompt":""
}'
```
需要使用 POST form-data 的格式上传。包含 file 和 data 两个字段。
* name: 集合名,建议就用文件名,必填。
* apiFileId: 文件的 ID,必填。
* datasetId: 知识库的 ID(必填)
* parentId:父级 ID,不填则默认为根目录
* trainingType:训练模式(必填)
* chunkSize: 每个 chunk 的长度(可选). chunk 模式:100~~3000; qa 模式: 4000~~ 模型最大 token(16k 模型通常建议不超过 10000)
* chunkSplitter: 自定义最高优先分割符号(可选)
* qaPrompt: qa 拆分自定义提示词(可选)
data 为集合的 ID。
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"collectionId": "65abc044e4704bac793fbd81",
"results": {
"insertLen": 1
}
}
}
```
### 创建一个外部文件库集合(商业版)
```bash
curl --location --request POST 'http://localhost:3000/api/proApi/core/dataset/collection/create/externalFileUrl' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'Content-Type: application/json' \
--data-raw '{
"externalFileUrl":"https://image.xxxxx.com/fastgpt-dev/%E6%91%82.pdf",
"externalFileId":"1111",
"createTime": "2024-05-01T00:00:00.000Z",
"filename":"自定义文件名.pdf",
"datasetId":"6642d105a5e9d2b00255b27b",
"parentId": null,
"tags": ["tag1","tag2"],
"trainingType": "chunk",
"chunkSize":512,
"chunkSplitter":"",
"qaPrompt":""
}'
```
| 参数 | 说明 | 必填 |
| --------------- | ------------------------ | -- |
| externalFileUrl | 文件访问链接(可以是临时链接) | ✅ |
| externalFileId | 外部文件 ID | |
| filename | 自定义文件名,需要带后缀 | |
| createTime | 文件创建时间(Date ISO 字符串都 ok) | |
data 为集合的 ID。
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"collectionId": "6646fcedfabd823cdc6de746",
"results": {
"insertLen": 1
}
}
}
```
### 获取集合列表
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/listV2' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"offset":0,
"pageSize": 10,
"datasetId":"6593e137231a2be9c5603ba7",
"parentId": null,
"searchText":""
}'
```
* offset: 偏移量
* pageSize: 每页数量,最大 30(选填)
* datasetId: 知识库的 ID(必填)
* parentId: 父级 ID(选填)
* searchText: 模糊搜索文本(选填)
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"list": [
{
"_id": "6593e137231a2be9c5603ba9",
"parentId": null,
"tmbId": "65422be6aa44b7da77729ec9",
"type": "virtual",
"name": "手动录入",
"updateTime": "2099-01-01T00:00:00.000Z",
"dataAmount": 3,
"trainingAmount": 0,
"externalFileId": "1111",
"tags": ["11", "测试的"],
"forbid": false,
"trainingType": "chunk",
"permission": {
"value": 4294967295,
"isOwner": true,
"hasManagePer": true,
"hasWritePer": true,
"hasReadPer": true
}
},
{
"_id": "65abd0ad9d1448617cba6031",
"parentId": null,
"tmbId": "65422be6aa44b7da77729ec9",
"type": "link",
"name": "快速上手 | FastGPT",
"rawLink": "https://doc.fastgpt.io/guide/getting-started/quick-start",
"updateTime": "2024-01-20T13:54:53.031Z",
"dataAmount": 3,
"trainingAmount": 0,
"externalFileId": "222",
"tags": ["测试的"],
"forbid": false,
"trainingType": "chunk",
"permission": {
"value": 4294967295,
"isOwner": true,
"hasManagePer": true,
"hasWritePer": true,
"hasReadPer": true
}
}
],
"total": 93
}
}
```
### 获取集合详情
```bash
curl --location --request GET 'http://localhost:3000/api/core/dataset/collection/detail?id=65abcfab9d1448617cba5f0d' \
--header 'Authorization: Bearer {{authorization}}' \
```
* id: 集合的 ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"_id": "65abcfab9d1448617cba5f0d",
"parentId": null,
"teamId": "65422be6aa44b7da77729ec8",
"tmbId": "65422be6aa44b7da77729ec9",
"datasetId": {
"_id": "6593e137231a2be9c5603ba7",
"parentId": null,
"teamId": "65422be6aa44b7da77729ec8",
"tmbId": "65422be6aa44b7da77729ec9",
"type": "dataset",
"status": "active",
"avatar": "/icon/logo.svg",
"name": "FastGPT test",
"vectorModel": "text-embedding-ada-002",
"agentModel": "gpt-3.5-turbo-16k",
"intro": "",
"permission": "private",
"updateTime": "2024-01-02T10:11:03.084Z"
},
"type": "virtual",
"name": "测试训练",
"trainingType": "qa",
"chunkSize": 8000,
"chunkSplitter": "",
"qaPrompt": "11",
"rawTextLength": 40466,
"hashRawText": "47270840614c0cc122b29daaddc09c2a48f0ec6e77093611ab12b69cba7fee12",
"createTime": "2024-01-20T13:50:35.838Z",
"updateTime": "2024-01-20T13:50:35.838Z",
"canWrite": true,
"sourceName": "测试训练"
}
}
```
### 更新数据集集合信息
**通过集合 ID 修改集合信息**
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/update' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"id":"65abcfab9d1448617cba5f0d",
"parentId": null,
"name": "测2222试",
"tags": ["tag1", "tag2"],
"forbid": false,
"createTime": "2024-01-01T00:00:00.000Z"
}'
```
**通过外部文件 ID 修改集合信息**,只需要把 ID 换成 datasetId 和 externalFileId。
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/update' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"datasetId":"6593e137231a2be9c5603ba7",
"externalFileId":"1111",
"parentId": null,
"name": "测2222试",
"tags": ["tag1", "tag2"],
"forbid": false,
"createTime": "2024-01-01T00:00:00.000Z"
}'
```
* id: 集合的 ID
* parentId: 修改父级 ID(可选)
* name: 修改集合名称(可选)
* tags: 修改集合标签(可选)
* forbid: 修改集合禁用状态(可选)
* createTime: 修改集合创建时间(可选)
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
### 删除集合
```bash
curl --location --request DELETE 'http://localhost:3000/api/core/dataset/collection/delete' \
--header 'Authorization: Bearer fastgpt-' \
--header 'Content-Type: application/json' \
--data-raw '{
"collectionIds": ["65a8cdcb0d70d3de0bf08d0a"]
}'
```
* collectionIds: 集合的 ID 列表
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
## 数据
### 数据的结构
**Data 结构**
| 字段 | 类型 | 说明 | 必填 |
| ------------- | -------- | ------ | -- |
| teamId | String | 团队 ID | ✅ |
| tmbId | String | 成员 ID | ✅ |
| datasetId | String | 知识库 ID | ✅ |
| collectionId | String | 集合 ID | ✅ |
| q | String | 主要数据 | ✅ |
| a | String | 辅助数据 | ✖ |
| fullTextToken | String | 分词 | ✖ |
| indexes | Index\[] | 向量索引 | ✅ |
| updateTime | Date | 更新时间 | ✅ |
| chunkIndex | Number | 分块下表 | ✖ |
**Index 结构**
每组数据的自定义索引最多 5 个
| 字段 | 类型 | 说明 | 必填 |
| ------ | ------ | ------------------------------------------------------------------------------- | -- |
| type | String | 可选索引类型:default- 默认索引; custom- 自定义索引; summary- 总结索引; question- 问题索引; image- 图片索引 | |
| dataId | String | 关联的向量 ID,变更数据时候传入该 ID,会进行差量更新,而不是全量更新 | |
| text | String | 文本内容 | ✅ |
`type` 不填则默认为 `custom` 索引,还会基于 q/a 组成一个默认索引。如果传入了默认索引,则不会额外创建。
### 推送数据到训练队列
注意,每次最多推送 200 组数据。
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/data/pushData' \
--header 'Authorization: Bearer apikey' \
--header 'Content-Type: application/json' \
--data-raw '{
"collectionId": "64663f451ba1676dbdef0499",
"trainingType": "chunk",
"prompt": "可选。qa 拆分引导词,chunk 模式下忽略",
"billId": "可选。如果有这个值,本次的数据会被聚合到一个订单中,这个值可以重复使用。可以参考 [创建训练订单] 获取该值。",
"data": [
{
"q": "你是谁?",
"a": "我是FastGPT助手"
},
{
"q": "你会什么?",
"a": "我什么都会",
"indexes": [
{
"text":"自定义索引1"
},
{
"text":"自定义索引2"
}
]
}
]
}'
```
* collectionId: 集合 ID(必填)
* trainingType:训练模式(必填)
* prompt: 自定义 QA 拆分提示词,需严格按照模板,建议不要传入。(选填)
* data:(具体数据)
* q: 主要数据(必填)
* a: 辅助数据(选填)
* indexes: 自定义索引(选填)。可以不传或者传空数组,默认都会使用 q 和 a 组成一个索引。
```json
{
"code": 200,
"statusText": "",
"data": {
"insertLen": 1 // 最终插入成功的数量
}
}
```
\[theme] 里的内容可以换成数据的主题。默认为:它们可能包含多个主题内容
```
我会给你一段文本,[theme],学习它们,并整理学习成果,要求为:
1. 提出最多 25 个问题。
2. 给出每个问题的答案。
3. 答案要详细完整,答案可以包含普通文字、链接、代码、表格、公示、媒体链接等 markdown 元素。
4. 按格式返回多个问题和答案:
Q1: 问题。
A1: 答案。
Q2:
A2:
……
我的文本:"""{{text}}"""
```
### 获取集合的数据列表
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/data/v2/list' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"offset": 0,
"pageSize": 10,
"collectionId":"65abd4ac9d1448617cba6171",
"searchText":""
}'
```
* offset: 偏移量(选填)
* pageSize: 每页数量,最大 30(选填)
* collectionId: 集合的 ID(必填)
* searchText: 模糊搜索词(选填)
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"list": [
{
"_id": "65abd4b29d1448617cba61db",
"datasetId": "65abc9bd9d1448617cba5e6c",
"collectionId": "65abd4ac9d1448617cba6171",
"q": "N o . 2 0 2 2 1 2中 国 信 息 通 信 研 究 院京东探索研究院2022年 9月人工智能生成内容(AIGC)白皮书(2022 年)版权声明本白皮书版权属于中国信息通信研究院和京东探索研究院,并受法律保护。转载、摘编或利用其它方式使用本白皮书文字或者观点的,应注明“来源:中国信息通信研究院和京东探索研究院”。违反上述声明者,编者将追究其相关法律责任。前 言习近平总书记曾指出,“数字技术正以新理念、新业态、新模式全面融入人类经济、政治、文化、社会、生态文明建设各领域和全过程”。在当前数字世界和物理世界加速融合的大背景下,人工智能生成内容(Artificial Intelligence Generated Content,简称 AIGC)正在悄然引导着一场深刻的变革,重塑甚至颠覆数字内容的生产方式和消费模式,将极大地丰富人们的数字生活,是未来全面迈向数字文明新时代不可或缺的支撑力量。",
"a": "",
"chunkIndex": 0
},
{
"_id": "65abd4b39d1448617cba624d",
"datasetId": "65abc9bd9d1448617cba5e6c",
"collectionId": "65abd4ac9d1448617cba6171",
"q": "本白皮书重点从 AIGC 技术、应用和治理等维度进行了阐述。在技术层面,梳理提出了 AIGC 技术体系,既涵盖了对现实世界各种内容的数字化呈现和增强,也包括了基于人工智能的自主内容创作。在应用层面,重点分析了 AIGC 在传媒、电商、影视等行业和场景的应用情况,探讨了以虚拟数字人、写作机器人等为代表的新业态和新应用。在治理层面,从政策监管、技术能力、企业应用等视角,分析了AIGC 所暴露出的版权纠纷、虚假信息传播等各种问题。最后,从政府、行业、企业、社会等层面,给出了 AIGC 发展和治理建议。由于人工智能仍处于飞速发展阶段,我们对 AIGC 的认识还有待进一步深化,白皮书中存在不足之处,敬请大家批评指正。目 录一、 人工智能生成内容的发展历程与概念.............................................................. 1(一)AIGC 历史沿革 .......................................................................................... 1(二)AIGC 的概念与内涵 .................................................................................. 4二、人工智能生成内容的技术体系及其演进方向.................................................... 7(一)AIGC 技术升级步入深化阶段 .................................................................. 7(二)AIGC 大模型架构潜力凸显 .................................................................... 10(三)AIGC 技术演化出三大前沿能力 ............................................................ 18三、人工智能生成内容的应用场景.......................................................................... 26(一)AIGC+传媒:人机协同生产,",
"a": "",
"chunkIndex": 1
}
],
"total": 63
}
}
```
### 获取单条数据详情
```bash
curl --location --request GET 'http://localhost:3000/api/core/dataset/data/detail?id=65abd4b29d1448617cba61db' \
--header 'Authorization: Bearer {{authorization}}' \
```
* id: 数据的 ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": {
"id": "65abd4b29d1448617cba61db",
"q": "N o . 2 0 2 2 1 2中 国 信 息 通 信 研 究 院京东探索研究院2022年 9月人工智能生成内容(AIGC)白皮书(2022 年)版权声明本白皮书版权属于中国信息通信研究院和京东探索研究院,并受法律保护。转载、摘编或利用其它方式使用本白皮书文字或者观点的,应注明“来源:中国信息通信研究院和京东探索研究院”。违反上述声明者,编者将追究其相关法律责任。前 言习近平总书记曾指出,“数字技术正以新理念、新业态、新模式全面融入人类经济、政治、文化、社会、生态文明建设各领域和全过程”。在当前数字世界和物理世界加速融合的大背景下,人工智能生成内容(Artificial Intelligence Generated Content,简称 AIGC)正在悄然引导着一场深刻的变革,重塑甚至颠覆数字内容的生产方式和消费模式,将极大地丰富人们的数字生活,是未来全面迈向数字文明新时代不可或缺的支撑力量。",
"a": "",
"chunkIndex": 0,
"indexes": [
{
"type": "default",
"dataId": "3720083",
"text": "N o . 2 0 2 2 1 2中 国 信 息 通 信 研 究 院京东探索研究院2022年 9月人工智能生成内容(AIGC)白皮书(2022 年)版权声明本白皮书版权属于中国信息通信研究院和京东探索研究院,并受法律保护。转载、摘编或利用其它方式使用本白皮书文字或者观点的,应注明“来源:中国信息通信研究院和京东探索研究院”。违反上述声明者,编者将追究其相关法律责任。前 言习近平总书记曾指出,“数字技术正以新理念、新业态、新模式全面融入人类经济、政治、文化、社会、生态文明建设各领域和全过程”。在当前数字世界和物理世界加速融合的大背景下,人工智能生成内容(Artificial Intelligence Generated Content,简称 AIGC)正在悄然引导着一场深刻的变革,重塑甚至颠覆数字内容的生产方式和消费模式,将极大地丰富人们的数字生活,是未来全面迈向数字文明新时代不可或缺的支撑力量。",
"_id": "65abd4b29d1448617cba61dc"
}
],
"datasetId": "65abc9bd9d1448617cba5e6c",
"collectionId": "65abd4ac9d1448617cba6171",
"sourceName": "中文-AIGC白皮书2022.pdf",
"sourceId": "65abd4ac9d1448617cba6166",
"isOwner": true,
"canWrite": true
}
}
```
### 修改单条数据
```bash
curl --location --request PUT 'http://localhost:3000/api/core/dataset/data/update' \
--header 'Authorization: Bearer {{authorization}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"dataId":"65abd4b29d1448617cba61db",
"q":"测试111",
"a":"sss",
"indexes":[
{
"dataId": "xxxx",
"type": "default",
"text": "默认索引"
},
{
"dataId": "xxx",
"type": "custom",
"text": "旧的自定义索引1"
},
{
"type":"custom",
"text":"新增的自定义索引"
}
]
}'
```
* dataId: 数据的 ID
* q: 主要数据(选填)
* a: 辅助数据(选填)
* indexes: 自定义索引(选填),类型参考 `为集合批量添加添加数据`。如果创建时候有自定义索引,
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": null
}
```
### 删除单条数据
```bash
curl --location --request DELETE 'http://localhost:3000/api/core/dataset/data/delete?id=65abd4b39d1448617cba624d' \
--header 'Authorization: Bearer {{authorization}}' \
```
* id: 数据的 ID
```json
{
"code": 200,
"statusText": "",
"message": "",
"data": "success"
}
```
## 搜索测试
```bash
curl --location --request POST 'http://localhost:3000/api/core/dataset/searchTest' \
--header 'Authorization: Bearer fastgpt-xxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"datasetId": "知识库的ID",
"text": "导演是谁",
"limit": 5000,
"similarity": 0,
"searchMode": "embedding",
"usingReRank": false,
"datasetSearchUsingExtensionQuery": true,
"datasetSearchExtensionModel": "gpt-5",
"datasetSearchExtensionBg": ""
}'
```
* datasetId - 知识库 ID
* text - 需要测试的文本
* limit - 最大 tokens 数量
* similarity - 最低相关度(0\~1,可选)
* searchMode - 搜索模式:embedding | fullTextRecall | mixedRecall
* usingReRank - 使用重排
* datasetSearchUsingExtensionQuery - 使用问题优化
* datasetSearchExtensionModel - 问题优化模型
* datasetSearchExtensionBg - 问题优化背景描述
返回 top k 结果,limit 为最大 Tokens 数量,最多 20000 tokens。
```json
{
"code": 200,
"statusText": "",
"data": [
{
"id": "65599c54a5c814fb803363cb",
"q": "你是谁",
"a": "我是FastGPT助手",
"datasetId": "6554684f7f9ed18a39a4d15c",
"collectionId": "6556cd795e4b663e770bb66d",
"sourceName": "GBT 15104-2021 装饰单板贴面人造板.pdf",
"sourceId": "6556cd775e4b663e770bb65c",
"score": 0.8050316572189331
},
......
]
}
```
file: ./content/openapi/index.en.mdx
meta: {
"title": "OpenAPI Documentation",
"description": "FastGPT OpenAPI Documentation"
}
import { Redirect } from '@/components/docs/Redirect';
file: ./content/openapi/index.mdx
meta: {
"title": "OpenAPI 文档",
"description": "FastGPT OpenAPI 文档"
}
import { Redirect } from '@/components/docs/Redirect';
file: ./content/openapi/intro.en.mdx
meta: {
"title": "API Documentation Introduction",
"description": "Introduction to FastGPT API Documentation"
}
Starting with `4.15.0`, FastGPT API documentation is generated automatically with `zod-openapi` (some legacy endpoints have not been migrated, so they are not shown). You can view the latest endpoint status by opening the API documentation URL. The manually edited endpoint descriptions in the left sidebar of this documentation are no longer updated.
FastGPT API documentation is split into two sets:
* Dev API: all development APIs. Not every endpoint can be called with an API Key.
* System OpenAPI: all system public endpoints, callable with a system API Key.
## API Documentation URL
`endpoint` is your FastGPT access URL. Append the corresponding path to open the documentation.
* Dev API: `{{endpoint}}/apidoc/devapi`
* System OpenAPI: `{{endpoint}}/apidoc/systemopenapi`
## Cloud API Documentation URL
**Dev API:**
* [China Mainland documentation](https://cloud.fastgpt.cn/apidoc/devapi)
* [International documentation](https://cloud.fastgpt.io/apidoc/devapi)
**System OpenAPI**
* [China Mainland documentation](https://cloud.fastgpt.cn/apidoc/systemopenapi)
* [International documentation](https://cloud.fastgpt.io/apidoc/systemopenapi)
## Usage Notes
FastGPT OpenAPI endpoints let you authenticate with an API Key to operate related FastGPT services and resources, such as calling app chat endpoints, uploading Knowledge Base data, and running search tests. For compatibility and security reasons, not all endpoints can be accessed with an API Key.
### How to Get an API Key
You can find API Keys in two places:
1. `Account` - `API Keys`
2. `App` - `Publish Channels` - `API Access`
### API Key Scope
An API Key acts as the current account's access credential within the current team. In other words, any resource the account can access in that team can also be operated through the API Key.
### How to Find the BaseURL
**Note: BaseURL is not an endpoint URL. It is the root URL for all endpoints, and requesting the BaseURL directly does nothing.**

### Basic Configuration
In OpenAPI, all endpoints authenticate through `Header.Authorization`.
```
baseUrl: "http://localhost:3000/api"
headers: {
Authorization: "Bearer {{apikey}}"
}
```
file: ./content/openapi/intro.mdx
meta: {
"title": "API 文档介绍",
"description": "FastGPT API 文档介绍"
}
从 `4.15.0` 开始,FastGPT API 文档均采用 `zod-openapi` 自动生成的方式(部分旧接口未改造,所以不显示)。可通过访问 API 文档地址查看最新的接口情况,该文档里左侧手动编辑的接口说明不再更新。
FastGPT API 文档一共分成两套:
* Dev API: 所有开发的 API,不一定能通过 ApiKey 调用。
* System OpenAPI: 系统所有开放的接口,可以通过系统 ApiKey 调用。
## API 文档地址
endpoint 是你的 FastGPT 访问地址,拼上对应 path 即可打开文档。
* Dev API: `{{endpoint}}/apidoc/devapi`
* System OpenAPI: `{{endpoint}}/apidoc/systemopenapi`
## 云服务 API 文档地址
**Dev API:**
* [中国大陆版文档](https://cloud.fastgpt.cn/apidoc/devapi)
* [国际版文档](https://cloud.fastgpt.io/apidoc/devapi)
**System OpenAPI**
* [中国大陆版文档](https://cloud.fastgpt.cn/apidoc/systemopenapi)
* [国际版文档](https://cloud.fastgpt.io/apidoc/systemopenapi)
## 使用说明
FastGPT OpenAPI 接口允许你使用 API Key 进行鉴权,从而操作 FastGPT 上的相关服务和资源,例如:调用应用对话接口、上传知识库数据、搜索测试等等。出于兼容性和安全考虑,并不是所有的接口都允许通过 API Key 访问。
### 如何获取 API Key
系统里有两个地方可看到 API 密钥
1. 在 `账号` - `Api 密钥` 中获取
2. 在 `应用` - `发布渠道` - `API 访问` 里查看。
### API 密钥可用范围
API 密钥相当于当前账号,在当前团队下的访问凭证。也就是,在该团队下有权限的资源,都可以通过 API 密钥进行操作。
### 如何查看 BaseURL
**注意:BaseURL 不是接口地址,而是所有接口的根地址,直接请求 BaseURL 是没有用的。**

### 基本配置
OpenAPI 中,所有的接口都通过 Header.Authorization 进行鉴权。
```
baseUrl: "http://localhost:3000/api"
headers: {
Authorization: "Bearer {{apikey}}"
}
```
file: ./content/plugin/index.en.mdx
meta: {
"title": "Plugin System",
"description": "FastGPT plugin system documentation"
}
import { Redirect } from '@/components/docs/Redirect';
file: ./content/plugin/index.mdx
meta: {
"title": "插件系统",
"description": "FastGPT 插件系统文档"
}
import { Redirect } from '@/components/docs/Redirect';
file: ./content/plugin/intro.en.mdx
meta: {
"title": "Plugin System Overview",
"description": "FastGPT plugin system overview"
}
> This document applies to FastGPT Plugin v1.0.0 and later.
## Background
FastGPT capabilities were previously maintained inside the FastGPT main service and organized as a Monorepo. System plugins also existed as a sub-repository under `FastGPT/packages/plugin`.
As the number of system tools and community contributions grew, the old structure exposed several problems:
1. System plugins had to be released together with the FastGPT main service, which slowed plugin iteration.
2. Community contributors needed to run the full FastGPT application and submit PRs directly to the main repository.
3. Custom plugins required maintaining a FastGPT fork and manually handling upgrades and merges.
4. The Next.js/webpack build model was not suitable for mounting new plugins at runtime.
System plugins have therefore been split into a standalone repository:
[FastGPT Plugin](https://github.com/labring/fastgpt-plugin)
FastGPT Plugin v1.0.0 systematically refactors the plugin project so plugin installation, version management, runtime isolation, and operations configuration share one model.
## Design Goals
The main goals of FastGPT Plugin are:
1. Decoupling and modularization: system tools, model presets, app templates, and future capabilities such as RAG algorithms, Agent strategies, and third-party integrations can evolve independently.
2. Unified plugin package protocol: `.pkg` files manage plugin installation, updates, and distribution, with extension points reserved for future plugin types.
3. Runtime isolation: plugin execution is managed by a unified runtime. Each plugin version has its own process pool, queue, and runtime configuration.
4. Lower development complexity: contributors can develop, debug, check, and package system tools independently through the CLI and SDK.
5. Plugin Marketplace: official and community plugins can be displayed and distributed through Marketplace.
## Core Concepts
| Name | Description |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
| Plugin | An independent, reusable capability module. Plugins can have different types, such as tools, model presets, and dataset sources. |
| Plugin package | The packaged `.pkg` file for a plugin. All plugin types are installed, updated, and managed through plugin packages. |
| Tool | A plugin type that usually wraps third-party services, internal APIs, or local computation and can be called by workflows and Agents. |
| Tool suite | A plugin that exposes multiple related child tools while sharing plugin metadata and secret configuration. |
| Plugin Marketplace | A centralized platform where users can search, download, and install plugins. |
| Runtime | The backend implementation responsible for executing plugin code. The current default runtime is `local-pool`. |
| Pod | A single plugin child process in the local process pool. One plugin service can own multiple Pods. |
## Repository Structure
`fastgpt-plugin` is a pnpm workspace Monorepo designed with Clean Architecture and DDD as references.
```text
fastgpt-plugin/
├── apps/
│ ├── cli/ # CLI for plugin development, build, check, pack, and debug
│ ├── server/ # FastGPT Plugin HTTP service
│ └── debug-runtime-monitor/ # Local runtime monitoring and debugging panel
├── packages/
│ ├── domain/ # Domain entities, value objects, and port definitions
│ ├── usecase/ # Application use cases for plugins, tools, models, runtime, and more
│ ├── interface-adapter/ # HTTP contracts, DTOs, and auth adapters
│ ├── infrastructure/ # Hono, Mongo, S3, Redis, runtime, logging, metrics, and other implementations
│ └── shared/ # Cross-layer pure utilities
├── sdk/
│ ├── client/ # Client SDK for calling the FastGPT Plugin service
│ └── factory/ # Plugin author SDK
├── test/ # Cross-package test utilities and fixtures
└── docs/ # Project documentation
```
Core dependency direction:
* `domain` defines business concepts and ports. It is the innermost layer and does not depend on application entrypoints or infrastructure.
* `usecase` orchestrates business flows and depends on `domain` entities, value objects, and ports.
* `interface-adapter` defines HTTP contracts, DTOs, and auth inputs/outputs. It converts external protocols into structures the application can understand.
* `infrastructure` implements ports and runtime capabilities, including the HTTP framework, database, object storage, Redis, plugin runtime, logging, and metrics.
* `apps/*` are composition roots that assemble dependencies, register routes, start processes, or provide development commands.
* `sdk/*` is published for external users and provides service calls and plugin development capabilities.
For system tool development, see [System Tool Development Guide](./system-tool-development.en.mdx). For model presets, see [Add Model Presets](./model-presets.en.mdx).
## Repository Responsibilities
The FastGPT Plugin ecosystem mainly involves these repositories:
| Repository | Purpose |
| --------------------------- | ---------------------------------------------------------------------- |
| `labring/fastgpt-plugin` | Plugin service, SDK, CLI, debug monitor, and infrastructure code. |
| `fastgpt-official-plugins` | Plugins maintained or reviewed by FastGPT officials. |
| `fastgpt-community-plugins` | Community third-party plugins. |
| `fastgpt-business-plugins` | Private plugins, customer-customized plugins, and commercial delivery. |
The `fastgpt-plugin` repository only provides development, build, check, packaging, and server runtime capabilities. Specific plugin source code is usually placed in the official, community, or business plugin repositories.
## Marketplace And Usage Boundaries
FastGPT Marketplace is the plugin distribution channel for centrally displaying and distributing official and community plugins. Current boundaries:
* Marketplace is a SaaS distribution service and does not provide a private deployment version.
* Community plugins must first be submitted to the Community Plugins repository, pass basic review, and then enter Marketplace.
* The FastGPT cloud service does not yet support direct custom plugin uploads by users.
* Third-party custom plugins are currently mainly used through self-deployment or administrator upload in the business edition.
## Plugin Installation And Management
The FastGPT Plugin service is responsible for plugin package management, runtime registration, plugin call forwarding, and system-level configuration. The FastGPT main service invokes plugins through the plugin runtime interface, and the plugin service dispatches each call to the corresponding runtime.
System plugins can be installed in two main ways:
1. System-level installation: the root user uploads a `.pkg` file on the plugin management page or installs a plugin from Marketplace. The installed plugin is visible to the whole system.
2. Team-level installation: reserved for team administrators or members with plugin management permission. The plugin is visible only within that team.
After a plugin is installed, the service saves the plugin package file, parses plugin metadata, and registers the plugin with the runtime when it is enabled. System administrators can manage plugin status, system secrets, and runtime parameters.
Plugin statuses include:
* Normal: the plugin is available for normal use.
* Pending offline: existing workflows continue to run, but the plugin can no longer be added to new workflows.
* Offline: the plugin cannot be used.
System-level plugins can configure system secrets for other users in the system to reuse when invoking the plugin. Secrets are hosted by the plugin service. Callers reference them through plugin configuration and never access plaintext secrets directly.
## `.pkg` Plugin Package Protocol
New system tools no longer depend on the legacy built-in source directory `modules/tool/packages`; they are delivered through unified `.pkg` files.
Build artifacts usually include:
* `dist/index.js`
* `dist/manifest.json`
* icon files
* optional `README.md`
* optional `assets/**`
`.pkg` files are used for upload, installation, listing, and version management. Plugin metadata, input/output schemas, secret schemas, and icon assets are included in the build output for FastGPT pages, workflows, and Agents.
## local-pool Runtime
The current default runtime is the local process pool, `local-pool`. It manages Pods and request queues per plugin service.
After a plugin call enters a service, scheduling proceeds as follows:
1. Prefer an existing available Pod and dispatch the request immediately.
2. If no Pod is available and `pods + pendingPods < maxPods`, create a new Pod first and dispatch the current request after startup succeeds.
3. If `maxPods` has been reached, startup backoff is active, or a Pod cannot be created temporarily, the request enters a bounded queue.
4. When a Pod is released, startup succeeds, configuration is updated, or a crash is recovered, the queue continues to drain.
5. When queue length reaches `maxQueueSize`, new requests are rejected. Requests also fail after waiting longer than `queueTimeout`.
Each tool plugin can configure four runtime parameters:
| Parameter | Default | Description |
| ------------------------------------ | ---------- | -------------------------------------------------------------------------------- |
| Minimum worker nodes | `0` | Values above `0` warm up Pods and try to keep at least this many Pods available. |
| Maximum worker nodes | `5` | The service can scale out to this limit when no Pod is available. |
| Node timeout | `120000ms` | Timeout for one plugin call inside a Pod. |
| Maximum concurrent requests per node | `10` | Maximum concurrent requests one Pod can process. |
Environment variables provide default runtime parameters and global limits:
| Environment variable | Description |
| ---------------------------------------------- | --------------------------------------------------------------------------------- |
| `POOL_HEALTH_CHECK_INTERVAL` | Health check interval in milliseconds. |
| `POOL_MAX_TOTAL_PODS` | Total limit for all plugin Pods in the current server process. |
| `POOL_SERVICE_MIN_PODS` | Default minimum worker nodes for one plugin. |
| `POOL_SERVICE_MAX_PODS` | Default maximum worker nodes for one plugin. |
| `POOL_SERVICE_IDLE_TIMEOUT` | Pod idle recycle time in milliseconds. |
| `POOL_SERVICE_POD_TIMEOUT` | Execution timeout for one plugin call in milliseconds. |
| `POOL_SERVICE_MAX_CONCURRENT_REQUESTS_PER_POD` | Default maximum concurrent requests for one Pod. |
| `POOL_SERVICE_MAX_REQUESTS_PER_POD` | Maximum requests one Pod can process before replacement. |
| `POOL_SERVICE_MAX_QUEUE_SIZE` | Maximum request queue capacity for one plugin service. |
| `POOL_SERVICE_QUEUE_TIMEOUT` | Maximum time a request can wait in queue for an available Pod, in milliseconds. |
| `POOL_SERVICE_STARTUP_RETRY_BASE_DELAY` | Base delay for exponential backoff after Pod startup timeout, in milliseconds. |
| `POOL_SERVICE_STARTUP_RETRY_MAX_DELAY` | Maximum delay for exponential backoff after Pod startup timeout, in milliseconds. |
Pod startup errors are recorded and classified. Consecutive non-timeout startup failures trigger startup circuit breaking after the threshold is reached, preventing more Pods from being created. Startup timeouts are usually treated as resource pressure, enter exponential backoff, and retry later.
## Development And Distribution
System tool plugins are developed with `@fastgpt-plugin/cli` and `@fastgpt-plugin/sdk-factory`.
Developers use the CLI to create single-tool or tool-suite skeletons, and use the SDK to declare `manifest`, `inputSchema`, `outputSchema`, `secretSchema`, and handler logic. After development, run tests, build, check, and pack to generate a `.pkg` file.
Continue with [System Tool Development Guide](./system-tool-development.en.mdx) to develop system tools.
## References
* [FastGPT Plugin](https://github.com/labring/fastgpt-plugin)
* [FastGPT Plugin System Design](https://github.com/labring/fastgpt-plugin/blob/main/docs/dev/design.md)
* [FastGPT Plugin Architecture](https://github.com/labring/fastgpt-plugin/blob/main/docs/dev/architecture.md)
* [System Plugin Development Guide](https://github.com/labring/fastgpt-plugin/blob/main/docs/dev/how-to-devlop-plugin.en.md)
file: ./content/plugin/intro.mdx
meta: {
"title": "插件系统说明",
"description": "FastGPT 插件系统说明"
}
> 本文档适用于 FastGPT Plugin v1.0.0 及以上版本的插件系统。
## 背景
原先 FastGPT 的各项能力均在 FastGPT 主服务内维护,并通过 Monorepo 方式组织。系统插件也曾作为一个子仓库存在于 `FastGPT/packages/plugin` 下。
随着系统工具数量和社区贡献增加,旧结构暴露出几个问题:
1. 系统插件必须伴随 FastGPT 主服务一起发版,限制了插件迭代速度。
2. 社区贡献插件需要运行完整 FastGPT 应用,并直接向主仓库提交 PR。
3. 使用自定义插件需要维护 FastGPT fork,手动处理升级和合并。
4. Next.js/webpack 构建模型不适合在运行时挂载新插件。
因此,系统插件被拆分到独立仓库:
[FastGPT Plugin](https://github.com/labring/fastgpt-plugin)
FastGPT Plugin v1.0.0 对插件项目进行了系统性重构,目标是让插件的安装、版本管理、运行隔离和运维配置形成统一模型。
## 设计目标
FastGPT Plugin 的核心目标:
1. 解耦和模块化:系统工具、模型预设、App 模板等能力可以独立迭代,后续也能扩展 RAG 算法、Agent 策略和第三方接入。
2. 插件包统一协议:使用 `.pkg` 文件管理插件安装、更新和分发,为后续插件类型预留扩展空间。
3. 运行隔离:通过运行时统一管理插件执行,每个插件版本拥有独立进程池、队列和运行配置。
4. 降低开发复杂度:贡献系统工具时可以通过 CLI 和 SDK 独立开发、调试、检查和打包。
5. 插件市场:通过 Marketplace 集中展示和分发官方及社区插件。
## 核心概念
| 名称 | 说明 |
| ---- | ------------------------------------------- |
| 插件 | 独立、可复用的功能模块,可以有不同类型,例如工具、模型预设、知识库来源等。 |
| 插件包 | 插件打包后的 `.pkg` 文件。不同类型插件都通过插件包完成安装、更新和管理。 |
| 工具 | 一类插件,通常封装第三方服务、内部接口或本地计算逻辑,可被工作流和 Agent 调用。 |
| 工具集 | 一个插件暴露多个相关子工具,共享插件元信息和密钥配置。 |
| 插件市场 | 集中管理插件的平台,用户可以在其中搜索、下载和安装插件。 |
| 运行时 | 负责执行插件代码的后端实现,当前默认运行时是 `local-pool`。 |
| Pod | 本地进程池中的单个插件子进程。一个插件 service 可以拥有多个 Pod。 |
## 仓库结构
`fastgpt-plugin` 使用 pnpm workspace 组织 Monorepo,参考 Clean Architecture 和 DDD 分层设计。
```text
fastgpt-plugin/
├── apps/
│ ├── cli/ # 插件开发、构建、检查、打包、调试命令行
│ ├── server/ # FastGPT Plugin HTTP 服务
│ └── debug-runtime-monitor/ # 本地运行时监控调试面板
├── packages/
│ ├── domain/ # 领域实体、值对象、端口定义
│ ├── usecase/ # 插件、工具、模型、runtime 等应用用例
│ ├── interface-adapter/ # HTTP contract、DTO、鉴权适配
│ ├── infrastructure/ # Hono、Mongo、S3、Redis、运行时、日志、指标等实现
│ └── shared/ # 跨层复用的纯工具函数
├── sdk/
│ ├── client/ # 调用 FastGPT Plugin 服务的客户端 SDK
│ └── factory/ # 插件作者侧 SDK
├── test/ # 跨包测试工具与 fixtures
└── docs/ # 项目文档
```
核心依赖方向:
* `domain` 定义业务概念和端口,是最内层,不依赖应用入口和基础设施。
* `usecase` 负责编排业务流程,依赖 `domain` 的实体、值对象和端口。
* `interface-adapter` 定义 HTTP 合约、DTO、鉴权输入输出,负责把外部协议转换为应用可理解的数据结构。
* `infrastructure` 实现端口和运行环境能力,包括 HTTP 框架、数据库、对象存储、Redis、插件运行时、日志与指标。
* `apps/*` 是组合根,负责装配依赖、注册路由、启动进程或提供开发命令。
* `sdk/*` 面向外部使用者发布,提供服务调用和插件开发能力。
系统工具开发结构可以参考 [系统工具开发指南](./system-tool-development.mdx)。模型预设维护可以参考 [增加模型预设](./model-presets.mdx)。
## 仓库分工
FastGPT Plugin 生态主要涉及以下仓库:
| 仓库 | 作用 |
| --------------------------- | -------------------------- |
| `labring/fastgpt-plugin` | 插件服务、SDK、CLI、调试监视器和基础设施代码。 |
| `fastgpt-official-plugins` | 官方维护或审核通过的插件。 |
| `fastgpt-community-plugins` | 社区第三方插件。 |
| `fastgpt-business-plugins` | 私有插件、客户定制插件和商业交付插件。 |
`fastgpt-plugin` 仓库只提供开发、构建、检查、打包和服务端运行能力。具体插件源码通常放在 official、community 或 business 插件仓库中。
## 插件市场与使用边界
FastGPT Marketplace 是插件分发渠道,用于集中展示和分发官方及社区插件。当前边界如下:
* Marketplace 是 SaaS 分发服务,不提供私有化部署版本。
* 社区插件需要先提交到 Community Plugins 仓库,经基础审核后再进入 Marketplace。
* 云服务版本 FastGPT 暂未支持用户直接上传自定义插件。
* 第三方自定义插件目前主要通过自部署或商业版的管理员上传方式使用。
## 插件安装与管理
FastGPT Plugin 服务负责插件包管理、运行时注册、插件调用转发和系统级配置管理。FastGPT 主服务通过插件运行时接口调用插件,插件服务负责把调用分发到对应运行时。
系统插件安装主要有两种方式:
1. 系统级安装:root 用户在插件管理页面上传 `.pkg` 文件,或从插件市场安装。安装后全系统可见。
2. 团队级安装:预留给团队管理员或有插件管理权限的成员,仅团队内可见。
插件安装后会保存插件包文件、解析插件元信息,并在插件启用时注册到运行时。系统管理员可以管理插件状态、系统密钥和运行时参数。
插件状态包括:
* 正常:插件正常使用。
* 即将下线:不影响已有工作流运行,但无法再被新增到工作流中。
* 已下线:插件无法正常使用。
系统级插件可以配置“系统密钥”,供系统内其他用户在调用插件时复用。密钥由插件服务托管,调用方通过插件配置引用,不直接接触明文密钥。
## `.pkg` 插件包协议
新版系统工具不再依赖旧的 `modules/tool/packages` 内置源码目录,而是使用统一 `.pkg` 文件交付。
构建产物通常包含:
* `dist/index.js`
* `dist/manifest.json`
* 图标文件
* 可选的 `README.md`
* 可选的 `assets/**`
`.pkg` 文件用于上传、安装、上架和版本管理。插件元信息、输入输出 schema、密钥 schema 和图标资源都会进入构建产物,供 FastGPT 页面、工作流和 Agent 调用使用。
## local-pool 运行时
当前默认运行时是本地进程池,即 `local-pool`。它按单插件 service 维度管理 Pod 和请求队列。
一次插件调用进入 service 后,调度顺序如下:
1. 优先选择已有可用 Pod,立即派发请求。
2. 没有可用 Pod 且 `pods + pendingPods < maxPods` 时,先创建新 Pod,启动成功后派发当前请求。
3. 达到 `maxPods`、处于启动退避期或暂时无法创建 Pod 时,请求进入有界队列等待。
4. Pod 释放、创建成功、配置更新或崩溃恢复时,队列继续被消费。
5. 队列长度达到 `maxQueueSize` 后,新请求会被拒绝;请求等待超过 `queueTimeout` 后会超时失败。
每个工具插件可以单独配置 4 个运行参数:
| 参数 | 默认值 | 说明 |
| -------- | ---------- | --------------------------------- |
| 最小工作节点数 | `0` | 大于 `0` 时会预热 Pod,并尽量维持不少于该数量的 Pod。 |
| 最大工作节点数 | `5` | 没有可用 Pod 时可扩容到该上限。 |
| 节点超时时间 | `120000ms` | 单次插件调用在 Pod 内执行的超时时间。 |
| 每节点最大并发数 | `10` | 单个 Pod 同时处理的最大并发请求数。 |
环境变量提供默认运行参数和全局限制:
| 环境变量 | 说明 |
| ---------------------------------------------- | --------------------------- |
| `POOL_HEALTH_CHECK_INTERVAL` | 健康检查间隔,单位毫秒。 |
| `POOL_MAX_TOTAL_PODS` | 当前 server 进程内所有插件 Pod 的总上限。 |
| `POOL_SERVICE_MIN_PODS` | 单插件默认最小工作节点数。 |
| `POOL_SERVICE_MAX_PODS` | 单插件默认最大工作节点数。 |
| `POOL_SERVICE_IDLE_TIMEOUT` | Pod 空闲回收时间,单位毫秒。 |
| `POOL_SERVICE_POD_TIMEOUT` | 单次插件调用执行超时时间,单位毫秒。 |
| `POOL_SERVICE_MAX_CONCURRENT_REQUESTS_PER_POD` | 单个 Pod 默认最大并发请求数。 |
| `POOL_SERVICE_MAX_REQUESTS_PER_POD` | 单个 Pod 最大处理请求数;超过后自动替换。 |
| `POOL_SERVICE_MAX_QUEUE_SIZE` | 单插件 service 请求队列最大容量。 |
| `POOL_SERVICE_QUEUE_TIMEOUT` | 请求在队列中等待可用 Pod 的最长时间,单位毫秒。 |
| `POOL_SERVICE_STARTUP_RETRY_BASE_DELAY` | Pod 启动超时后的指数退避基础延迟,单位毫秒。 |
| `POOL_SERVICE_STARTUP_RETRY_MAX_DELAY` | Pod 启动超时后的指数退避最大延迟,单位毫秒。 |
Pod 启动错误会被记录并分类。连续非超时启动失败达到阈值后会触发启动熔断,阻止继续创建 Pod;启动超时通常按资源繁忙处理,会进入指数退避后重试。
## 开发与分发
系统工具插件使用 `@fastgpt-plugin/cli` 和 `@fastgpt-plugin/sdk-factory` 开发。
开发者通过 CLI 创建单工具或工具集骨架,使用 SDK 声明 `manifest`、`inputSchema`、`outputSchema`、`secretSchema` 和 handler。插件开发完成后运行测试、构建、检查和打包,最终生成 `.pkg` 文件。
开发系统工具可以继续阅读 [系统工具开发指南](./system-tool-development.mdx)。
## 参考
* [FastGPT Plugin](https://github.com/labring/fastgpt-plugin)
* [FastGPT 插件系统设计文档](https://github.com/labring/fastgpt-plugin/blob/main/docs/dev/design.zh.md)
* [FastGPT Plugin 架构文档](https://github.com/labring/fastgpt-plugin/blob/main/docs/dev/architecture.zh.md)
* [系统插件开发指南](https://github.com/labring/fastgpt-plugin/blob/main/docs/dev/how-to-devlop-plugin.md)
file: ./content/plugin/model-presets.en.mdx
meta: {
"title": "Add Model Presets",
"description": "Model preset notes for the FastGPT plugin system"
}
Model presets are maintained in the `fastgpt-plugin` repository. They provide FastGPT with built-in model providers, model lists, model capabilities, and default request parameters. After FastGPT loads these static presets, users can select the corresponding models in model configuration, AIProxy channels, and plugin-related features.
This page follows the plugin system code structure for version 1.0 and later. The old `modules/model/*` paths are no longer the primary maintenance entry point.
## Related Directories
```text
packages/infrastructure/src/static-data/models/
├── index.ts
├── model.ts
├── type.ts
├── channel-avatar/
└── provider/
└── {Provider}/
├── index.ts
└── logo.svg
```
* `provider/{Provider}/index.ts`: model presets for one provider.
* `index.ts`: registers all providers and generates `staticModelList` and provider lists.
* `model.ts`: maintains provider display names in `ModelProviderMap` and AIProxy channels in `aiproxyChannels`.
* `type.ts`: defines schemas for provider configs and model presets.
* `provider/{Provider}/logo.svg`: provider logo.
* `channel-avatar/`: AIProxy channel avatars.
## Add a Model to an Existing Provider
### 1. Confirm the provider is registered
First check `packages/infrastructure/src/static-data/models/index.ts` and make sure the provider is imported and included in `staticModelProviderConfigs`:
```ts
import openai from './provider/OpenAI';
export const staticModelProviderConfigs = [openai];
```
If you are only adding a model to an existing provider, you do not need to change `index.ts`.
### 2. Update the provider model list
Open the provider file, for example:
```text
packages/infrastructure/src/static-data/models/provider/OpenAI/index.ts
```
Add the model to the `list` array. Prefer cloning the closest model from the same provider, type, and family, then adjust the fields based on official documentation.
Examples for all five model types:
```ts
import { ModelTypeEnum, type ProviderConfigType } from '../../type';
const ttsVoices = [
{
label: 'Default voice',
value: 'default'
}
];
const models: ProviderConfigType = {
provider: 'ExampleProvider',
list: [
{
type: ModelTypeEnum.llm,
model: 'example-chat',
maxContext: 128000,
maxTokens: 16384,
quoteMaxToken: 120000,
maxTemperature: 1,
responseFormatList: ['text', 'json_schema'],
vision: true,
reasoning: false,
reasoningEffort: false,
toolChoice: true
},
{
type: ModelTypeEnum.embedding,
model: 'example-embedding',
defaultToken: 512,
maxToken: 8192,
normalization: true
},
{
type: ModelTypeEnum.rerank,
model: 'example-rerank',
maxToken: 8192
},
{
type: ModelTypeEnum.tts,
model: 'example-tts',
voices: ttsVoices
},
{
type: ModelTypeEnum.stt,
model: 'example-stt'
}
]
};
export default models;
```
Common fields:
| Field | Description |
| -------------------- | ------------------------------------------------------------------------------ |
| `type` | Model type from `ModelTypeEnum`: `llm`, `embedding`, `rerank`, `tts`, or `stt` |
| `model` | Actual model ID used in requests |
| `name` | Optional display name; defaults to `model` when omitted |
| `maxContext` | Maximum LLM context length |
| `maxTokens` | Maximum LLM output length |
| `quoteMaxToken` | Maximum token budget FastGPT can use for quoted Knowledge Base content |
| `maxTemperature` | Maximum temperature; use `null` when the model does not support temperature |
| `responseFormatList` | Supported response formats, such as `text`, `json_object`, and `json_schema` |
| `vision` | Whether vision input is supported |
| `reasoning` | Whether this is a reasoning model |
| `reasoningEffort` | Whether reasoning effort can be configured |
| `toolChoice` | Whether tool choice is supported |
| `fieldMap` | Field-name mapping for non-standard OpenAI-compatible APIs |
| `defaultConfig` | Default request parameters sent with the model request |
| `defaultToken` | Default chunk token count for Embedding models |
| `maxToken` | Maximum input token count for Embedding/Rerank models |
| `normalization` | Whether Embedding vectors should be normalized |
| `voices` | Available voice list for TTS models |
`index.ts` automatically adds the following when building `staticModelList`:
* `provider`: from the current provider config.
* `name`: defaults to `model` when not explicitly set.
* Some default LLM capability switches, such as Knowledge Base processing, classification, extraction, tool calling, and evaluation.
### 3. Do not rely on model names alone
Before adding or changing a model, verify it against official model docs, official model-list APIs, or official pricing/model pages. Do not rely on search results, third-party blogs, or aggregator pages as proof that a model exists.
Recommended rules:
* Model presets support five model types: `llm`, `embedding`, `rerank`, `tts`, and `stt`. Choose the type based on the model's real capabilities and fill in the fields required by that type's schema.
* Do not remove preview, experimental, or dated models just because a stable-looking sibling exists. Remove them only when official docs mark them as deprecated, retired, unavailable, or no longer recommended.
* For open catalogs such as OpenRouter, Ollama, HuggingFace, and Other, avoid deleting local placeholders or models users may customize.
* Preserve the existing ordering style in each provider file. Newer or more capable models are usually placed first.
## Add a New Model Provider
Only add a provider directory when you need to support a completely new provider.
### 1. Create the provider directory
Create a directory under `provider/` using the provider identifier:
```text
packages/infrastructure/src/static-data/models/provider/NewProvider/
├── index.ts
└── logo.svg
```
`logo.svg` is the model provider avatar. When the plugin service initializes static model assets, it uploads `provider/{Provider}/logo.svg` as `models/{Provider}/logo`, and the `/models/get-providers` API returns that URL as the provider `avatar`.
Basic `index.ts` structure:
```ts
import { ModelTypeEnum, type ProviderConfigType } from '../../type';
const models: ProviderConfigType = {
provider: 'NewProvider',
list: [
{
type: ModelTypeEnum.llm,
model: 'new-provider-chat',
maxContext: 128000,
maxTokens: 8192,
quoteMaxToken: 120000,
maxTemperature: 1,
responseFormatList: ['text'],
vision: false,
reasoning: false,
reasoningEffort: false,
toolChoice: true
}
]
};
export default models;
```
### 2. Register the provider
Import it in `packages/infrastructure/src/static-data/models/index.ts` and add it to `staticModelProviderConfigs`:
```ts
import newProvider from './provider/NewProvider';
export const staticModelProviderConfigs: ProviderConfigType[] = [newProvider];
```
### 3. Add provider display names
Add multilingual display names to `ModelProviderMap` in `packages/infrastructure/src/static-data/models/model.ts`:
```ts
NewProvider: {
en: 'NewProvider',
'zh-CN': 'New Provider',
'zh-Hant': 'New Provider'
}
```
If you do not add the provider to `ModelProviderMap`, the system falls back to the raw `provider` string as its display name. Formal providers should include multilingual display names.
## Add an AIProxy Protocol
Adding an AIProxy protocol is not the same as adding a model provider:
* Model provider: decides which `provider` owns the model presets, maintains the model list and model capabilities, and uses `provider/{Provider}/logo.svg` as its avatar.
* AIProxy protocol: decides whether the protocol appears in the AIProxy channel list. AIProxy routes requests to the corresponding adaptor by `channelId`, and FastGPT uses `channel-avatar/{avatar}.svg` as the channel avatar.
If you are only adding model presets, you may not need to add an AIProxy protocol. Maintain `aiproxyChannels` only when FastGPT needs to display that protocol in the AIProxy channel list.
### 1. Check AIProxy protocols and get channelId
The `channelId` must match the `ChannelType` value defined in [`core/model/chtype.go`](https://github.com/labring/aiproxy/blob/main/core/model/chtype.go) in the AIProxy repository. Do not guess the `channelId` from the provider name.
Run this in the AIProxy repository:
```bash
rg -n "ChannelType.*=" core/model/chtype.go
```
Examples:
| AIProxy type | ID | FastGPT `channelId` |
| ------------------------- | ---- | ------------------- |
| `ChannelTypeOpenAI` | `1` | `1` |
| `ChannelTypeAnthropic` | `14` | `14` |
| `ChannelTypeAli` | `17` | `17` |
| `ChannelTypeGoogleGemini` | `24` | `24` |
| `ChannelTypeDeepseek` | `36` | `36` |
| `ChannelTypeDoubao` | `40` | `40` |
| `ChannelTypeSiliconflow` | `43` | `43` |
| `ChannelTypeAntLing` | `54` | `54` |
Use the current `core/model/chtype.go` file on the AIProxy main branch as the source of truth.
### 2. Add the protocol declaration in fastgpt-plugin
After confirming AIProxy supports the protocol, add an entry to `aiproxyChannels` in `packages/infrastructure/src/static-data/models/model.ts`:
```ts
export const aiproxyChannels: AIProxyChannelsType = [
{
channelId: 54,
name: {
en: 'Ant Ling',
'zh-CN': '蚂蚁百灵',
'zh-Hant': '螞蟻百靈'
},
avatar: 'antling'
}
];
```
Field reference:
| Field | Description |
| ----------- | ---------------------------------------------------------------------- |
| `channelId` | Numeric AIProxy `ChannelType` ID. It must match `core/model/chtype.go` |
| `name` | Multilingual display name in the FastGPT channel list |
| `avatar` | Channel avatar filename without the extension |
Also add the avatar file under `channel-avatar/`:
```text
packages/infrastructure/src/static-data/models/channel-avatar/antling.svg
```
The `avatar` value must match the filename under `channel-avatar/`. Supported avatar extensions are `svg`, `png`, `jpeg`, `webp`, and `jpg`.
If AIProxy does not support the protocol yet, add the `ChannelType` and adaptor in the AIProxy repository first, and confirm the adaptor is imported in [`core/relay/adaptors/register.go`](https://github.com/labring/aiproxy/blob/main/core/relay/adaptors/register.go). The FastGPT plugin side only declares channel display data; it does not implement AIProxy adaptor logic.
## Validation
After updating presets, run at least:
```bash
pnpm typecheck
```
If you changed many providers, model schemas, or static asset loading logic, also run:
```bash
pnpm test
```
Before submitting, review the diff under `packages/infrastructure/src/static-data/models/` and make sure no unrelated provider models were removed, model types are correct, and the new provider logo or `channel-avatar` file is included.
file: ./content/plugin/model-presets.mdx
meta: {
"title": "增加模型预设",
"description": "FastGPT 插件系统中的模型预设说明"
}
模型预设维护在 `fastgpt-plugin` 仓库中,用于向 FastGPT 提供内置模型供应商、模型列表、模型能力和默认参数。FastGPT 读取这些静态预设后,用户才能在模型配置、AIProxy 渠道和相关插件能力中选择对应模型。
本文基于 1.0 版本以上的插件系统代码结构,旧版 `modules/model/*` 路径已经不再作为主要维护入口。
## 相关目录
```text
packages/infrastructure/src/static-data/models/
├── index.ts
├── model.ts
├── type.ts
├── channel-avatar/
└── provider/
└── {Provider}/
├── index.ts
└── logo.svg
```
* `provider/{Provider}/index.ts`:单个模型供应商的模型预设列表。
* `index.ts`:注册所有供应商,生成 `staticModelList` 和供应商列表。
* `model.ts`:维护供应商显示名 `ModelProviderMap` 和 AIProxy 渠道 `aiproxyChannels`。
* `type.ts`:定义供应商配置和模型预设的输入 schema。
* `provider/{Provider}/logo.svg`:模型供应商 Logo。
* `channel-avatar/`:AIProxy 渠道头像。
## 给已有供应商增加模型
### 1. 确认供应商已经注册
先在 `packages/infrastructure/src/static-data/models/index.ts` 中确认供应商已经被引入,并存在于 `staticModelProviderConfigs`:
```ts
import openai from './provider/OpenAI';
export const staticModelProviderConfigs = [openai];
```
如果只是给已有供应商增加模型,不需要修改 `index.ts`。
### 2. 修改供应商模型列表
进入对应供应商目录,例如:
```text
packages/infrastructure/src/static-data/models/provider/OpenAI/index.ts
```
在 `list` 数组中增加模型。优先复制同供应商、同类型、同模型家族中最接近的一项,再根据官方文档调整字段。
五类模型示例:
```ts
import { ModelTypeEnum, type ProviderConfigType } from '../../type';
const ttsVoices = [
{
label: '默认音色',
value: 'default'
}
];
const models: ProviderConfigType = {
provider: 'ExampleProvider',
list: [
{
type: ModelTypeEnum.llm,
model: 'example-chat',
maxContext: 128000,
maxTokens: 16384,
quoteMaxToken: 120000,
maxTemperature: 1,
responseFormatList: ['text', 'json_schema'],
vision: true,
reasoning: false,
reasoningEffort: false,
toolChoice: true
},
{
type: ModelTypeEnum.embedding,
model: 'example-embedding',
defaultToken: 512,
maxToken: 8192,
normalization: true
},
{
type: ModelTypeEnum.rerank,
model: 'example-rerank',
maxToken: 8192
},
{
type: ModelTypeEnum.tts,
model: 'example-tts',
voices: ttsVoices
},
{
type: ModelTypeEnum.stt,
model: 'example-stt'
}
]
};
export default models;
```
常用字段说明:
| 字段 | 说明 |
| -------------------- | ----------------------------------------------------------------- |
| `type` | 模型类型,来自 `ModelTypeEnum`,可选 `llm`、`embedding`、`rerank`、`tts`、`stt` |
| `model` | 真实请求时使用的模型 ID |
| `name` | 可选显示名,不填时默认使用 `model` |
| `maxContext` | LLM 最大上下文长度 |
| `maxTokens` | LLM 最大输出长度 |
| `quoteMaxToken` | FastGPT 引用知识库内容时可使用的最大 token |
| `maxTemperature` | 最大温度;不支持温度时填 `null` |
| `responseFormatList` | 支持的返回格式,如 `text`、`json_object`、`json_schema` |
| `vision` | 是否支持视觉输入 |
| `reasoning` | 是否为推理模型 |
| `reasoningEffort` | 是否支持推理强度配置 |
| `toolChoice` | 是否支持工具调用选择 |
| `fieldMap` | 字段名映射,用于适配非标准 OpenAI 兼容接口 |
| `defaultConfig` | 请求默认参数,会随模型请求一起发送 |
| `defaultToken` | Embedding 默认分段 token 数 |
| `maxToken` | Embedding/Rerank 最大输入 token 数 |
| `normalization` | Embedding 是否做归一化处理 |
| `voices` | TTS 可选音色列表 |
`index.ts` 会在生成 `staticModelList` 时自动补充:
* `provider`:来自当前供应商配置的 `provider`。
* `name`:未显式填写时使用 `model`。
* LLM 的部分默认能力开关,例如知识库处理、分类、内容提取、工具调用和评测。
### 3. 不要只看模型名称
新增或修改模型前,需要以官方模型文档、官方模型列表 API 或官方价格/模型页为依据。不要只根据搜索结果、第三方博客或聚合站判断模型是否存在。
维护时建议遵守以下规则:
* 模型预设支持 `llm`、`embedding`、`rerank`、`tts`、`stt` 五类模型。按模型真实能力选择对应类型,并补齐该类型 schema 要求的字段。
* 不要仅因为存在稳定版名称就删除 preview、experimental 或 dated 模型;只有官方明确废弃、下线或不再推荐时再移除。
* 对 OpenRouter、Ollama、HuggingFace、Other 这类开放目录,避免删除本地占位或用户可能自定义的模型。
* 保持文件内原有排序风格,通常把更新或能力更强的模型放在前面。
## 新增模型供应商
只有在需要接入全新的模型供应商时才新增供应商目录。
### 1. 创建供应商目录
在 `provider/` 下新增目录,目录名使用供应商标识:
```text
packages/infrastructure/src/static-data/models/provider/NewProvider/
├── index.ts
└── logo.svg
```
`logo.svg` 是模型供应商头像。插件服务初始化静态模型资源时,会把 `provider/{Provider}/logo.svg` 上传为 `models/{Provider}/logo`,`/models/get-providers` 接口会把它作为该模型供应商的 `avatar` 返回。
`index.ts` 基本结构:
```ts
import { ModelTypeEnum, type ProviderConfigType } from '../../type';
const models: ProviderConfigType = {
provider: 'NewProvider',
list: [
{
type: ModelTypeEnum.llm,
model: 'new-provider-chat',
maxContext: 128000,
maxTokens: 8192,
quoteMaxToken: 120000,
maxTemperature: 1,
responseFormatList: ['text'],
vision: false,
reasoning: false,
reasoningEffort: false,
toolChoice: true
}
]
};
export default models;
```
### 2. 注册供应商
在 `packages/infrastructure/src/static-data/models/index.ts` 中引入并加入 `staticModelProviderConfigs`:
```ts
import newProvider from './provider/NewProvider';
export const staticModelProviderConfigs: ProviderConfigType[] = [newProvider];
```
### 3. 增加供应商显示名
在 `packages/infrastructure/src/static-data/models/model.ts` 的 `ModelProviderMap` 中增加多语言显示名:
```ts
NewProvider: {
en: 'NewProvider',
'zh-CN': '新供应商',
'zh-Hant': '新供應商'
}
```
如果不增加 `ModelProviderMap`,系统会使用 `provider` 字符串作为兜底显示名,但正式供应商应补齐多语言显示名。
## 增加 AIProxy 协议
增加 AIProxy 协议不等于增加模型供应商:
* 模型供应商:决定模型预设属于哪个 `provider`,维护模型列表和模型能力,使用 `provider/{Provider}/logo.svg` 作为头像。
* AIProxy 协议:决定 AIProxy 渠道列表中是否出现该协议,最终由 AIProxy 根据 `channelId` 路由到对应 adaptor,使用 `channel-avatar/{avatar}.svg` 作为头像。
如果只是新增模型预设,不一定要增加 AIProxy 协议。只有当 FastGPT 需要在 AIProxy 渠道列表中展示该协议时,才需要维护 `aiproxyChannels`。
### 1. 查看 AIProxy 支持的协议并获取 channelId
`channelId` 必须和 AIProxy 仓库中 [`core/model/chtype.go`](https://github.com/labring/aiproxy/blob/main/core/model/chtype.go) 定义的 `ChannelType` 数值一致。不要根据供应商名称猜测 `channelId`。
在 AIProxy 仓库中执行:
```bash
rg -n "ChannelType.*=" core/model/chtype.go
```
例如:
| AIProxy 类型 | ID | FastGPT `channelId` |
| ------------------------- | ---- | ------------------- |
| `ChannelTypeOpenAI` | `1` | `1` |
| `ChannelTypeAnthropic` | `14` | `14` |
| `ChannelTypeAli` | `17` | `17` |
| `ChannelTypeGoogleGemini` | `24` | `24` |
| `ChannelTypeDeepseek` | `36` | `36` |
| `ChannelTypeDoubao` | `40` | `40` |
| `ChannelTypeSiliconflow` | `43` | `43` |
| `ChannelTypeAntLing` | `54` | `54` |
完整列表以 AIProxy 主分支的 `core/model/chtype.go` 为准。
### 2. 在 fastgpt-plugin 中增加协议声明
确认 AIProxy 已经支持该协议后,在 `packages/infrastructure/src/static-data/models/model.ts` 的 `aiproxyChannels` 中增加声明:
```ts
export const aiproxyChannels: AIProxyChannelsType = [
{
channelId: 54,
name: {
en: 'Ant Ling',
'zh-CN': '蚂蚁百灵',
'zh-Hant': '螞蟻百靈'
},
avatar: 'antling'
}
];
```
字段说明:
| 字段 | 说明 |
| ----------- | ------------------------------------------------------------ |
| `channelId` | AIProxy `ChannelType` 对应的数字 ID,必须和 `core/model/chtype.go` 一致 |
| `name` | FastGPT 渠道列表中的多语言显示名 |
| `avatar` | 渠道头像文件名,不包含扩展名 |
同时在 `channel-avatar/` 下增加头像文件:
```text
packages/infrastructure/src/static-data/models/channel-avatar/antling.svg
```
`avatar` 字段必须和 `channel-avatar/` 下的文件名一致。支持的头像扩展名包括 `svg`、`png`、`jpeg`、`webp`、`jpg`。
如果 AIProxy 仓库还没有该协议,需要先在 AIProxy 中新增 `ChannelType` 和 adaptor,并确认 adaptor 已在 [`core/relay/adaptors/register.go`](https://github.com/labring/aiproxy/blob/main/core/relay/adaptors/register.go) 中被引入。FastGPT 插件侧只声明渠道展示信息,不负责实现 AIProxy 协议适配逻辑。
## 校验
修改完成后,至少运行:
```bash
pnpm typecheck
```
如果修改了较多供应商、模型 schema 或静态资源加载逻辑,再运行:
```bash
pnpm test
```
提交前检查 `packages/infrastructure/src/static-data/models/` 的 diff,确认没有误删其他供应商模型、没有填错模型类型,并且新增的 `provider` Logo 或 `channel-avatar` 头像文件已经提交。
file: ./content/plugin/system-tool-development.en.mdx
meta: {
"title": "System Tool Development Guide",
"description": "FastGPT system tool development guide"
}
## Introduction
This document targets system tool development after FastGPT v4.15.0. The new FastGPT Plugin service unifies system tools, model presets, and similar capabilities as installable, updatable, runtime-isolated plugin packages. A plugin is eventually delivered to the FastGPT Plugin service as a `.pkg` file.
The currently stable system tool plugin types are:
* Single tool: one plugin exposes one tool and is declared with `defineTool()`.
* Tool suite: one plugin exposes multiple related child tools and is declared with `defineToolSet()`.
System tool plugins run in the runtime provided by the FastGPT Plugin service. The FastGPT main service invokes tools through the plugin service, and plugin code uses `@fastgpt-plugin/sdk-factory` to describe input, output, secret configuration, and execution logic.
## Differences From The Legacy Mechanism
1. The deployment relationship between FastGPT and FastGPT Plugin remains an external extension model, and the overall architecture is still microservice-based.
2. The plugin package protocol upgrades from the old built-in system tool directory to a unified `.pkg` format, making installation, version management, hot updates, and future plugin type expansion easier.
3. The plugin runtime is managed by the server. The current default runtime is `local-pool`, where each plugin version has its own process pool, queue, and runtime configuration.
4. Plugin metadata, input/output schemas, secret schemas, and icon assets are included in build artifacts for use by FastGPT pages, workflows, and Agents.
5. Tool development uses `@fastgpt-plugin/cli` and `@fastgpt-plugin/sdk-factory`. The legacy `config.ts`, `versionList`, and `bun run build:pkg` flow is no longer the primary development model.
## Information To Collect Before Development
Clarify these items before coding:
| Information | Description |
| -------------------------------- | ------------------------------------------------------------------------------------------- |
| Plugin type | `tool` or `tool-suite`. |
| Plugin ID | `pluginId`, globally stable and unique. Keep it unchanged after release. |
| Child tool ID | Required for tool suites. `children[].id` stays unchanged after release. |
| Chinese and English names | `name.en` and `name.zh-CN`. |
| Chinese and English descriptions | `description.en` and `description.zh-CN`. |
| Inputs | Type, constraints, default value, UI title, and description for each field. |
| Outputs | Type, meaning, and downstream usage for each field. |
| Secrets | API Key, Base URL, username/password, and similar values, described through `secretSchema`. |
| External API | Request method, auth method, timeout, rate limit, error response, and test account. |
| File capability | Use `ctx.invoke.uploadFile()` when file upload is needed. |
| Streaming output | Use `ctx.streamResponse()` when intermediate progress should be shown to the user. |
| Test cases | Include at least success, invalid parameters, auth failure, and upstream failure. |
Missing information that affects plugin ID, auth method, billing, or listing security should be confirmed first. Other missing information can use reasonable defaults, with assumptions recorded in the submission notes.
## Developing With An Agent
When using Claude Code, Codex, or another agent tool, copy this prompt:
```plaintext
请根据以下 FastGPT 官方插件开发 Skill 开发插件:
https://raw.githubusercontent.com/labring/fastgpt-official-plugins/refs/heads/main/.agents/skills/develop-fastgpt-plugin/SKILL.md
执行要求:
1. 先读取并理解该 Skill 的完整内容,后续开发流程以该 Skill 为准。
2. 在开始编码前,收集插件名称、插件类型、中文/英文名称与描述、输入输出、密钥、外部 API、预期行为、错误处理和测试样例。
3. 如需求缺失,最多提出 3 个关键问题;如果可以合理默认,说明假设后继续推进。
4. 使用 `@fastgpt-plugin/cli` 创建插件骨架,并优先遵循仓库内已有插件的结构、命名、测试和构建方式。
5. 实现完成后运行必要验证,包括测试、构建、插件检查和打包;无法验证的项目需要说明原因。
6. 最终输出变更文件、验证结果、剩余假设和需要人工确认的外部 API 行为。
```
When developing or maintaining SDK/CLI in the `fastgpt-plugin` repository, also refer to local skills:
* `sdk/factory/skills/fastgpt-plugin-development/SKILL.md`
* `sdk/factory/skills/fastgpt-system-tool-development/SKILL.md`
* `sdk/factory/skills/fastgpt-sdk-factory/SKILL.md`
## 1. Prepare Environment
Recommended environment:
* Node.js version that satisfies the target plugin repository.
* `pnpm`; the `fastgpt-plugin` repository uses pnpm workspace.
* Git.
* GitHub CLI `gh`, used for forking, creating repositories, and submitting PRs.
When developing community plugins, first fork and clone the community repository:
```bash
gh repo fork labring/fastgpt-community-plugins --clone
cd fastgpt-community-plugins
pnpm install
```
When debugging the CLI or SDK in the `fastgpt-plugin` repository, install dependencies and build the CLI/SDK first:
```bash
pnpm install
pnpm build:sdk-factory
pnpm build:cli
```
## 2. Create Plugin Skeleton
Single-tool plugin:
```bash
pnpx @fastgpt-plugin/cli create my-tool --type tool --cwd packages/tools
```
Tool-suite plugin:
```bash
pnpx @fastgpt-plugin/cli create my-tool-suite --type tool-suite --cwd packages/tools
```
You can also enter the target directory and create interactively:
```bash
pnpx @fastgpt-plugin/cli create
```
The CLI creates the plugin directory and common files:
| File | Purpose |
| ------------------ | ------------------------------------------------------------------------- |
| `index.ts` | Plugin entry, default-exporting `defineTool()` or `defineToolSet()`. |
| `package.json` | Plugin dependencies and `build`, `build:dev`, `pack`, and `test` scripts. |
| `tsconfig.json` | TypeScript config. |
| `vitest.config.ts` | Test config. |
| `README.md` | Plugin description. |
| `logo.svg` | Main plugin icon. |
## 3. Implement Single Tool
The system tool entry must default-export an SDK factory instance:
```ts
import {
createToolHandler,
defineTool,
type InputSchemaMetaType,
type OutputSchemaMetaType,
type SecretSchemaMetaType
} from '@fastgpt-plugin/sdk-factory';
import z from 'zod';
const secretSchema = z.object({
apiKey: z
.string()
.min(1)
.meta({
title: 'API Key',
isSecret: true
} satisfies SecretSchemaMetaType)
});
const handler = createToolHandler({
inputSchema: z.object({
query: z
.string()
.min(1)
.meta({
title: 'Query',
description: 'Search keyword'
} satisfies InputSchemaMetaType)
}),
outputSchema: z.object({
result: z.string().meta({
title: 'Result'
} satisfies OutputSchemaMetaType)
}),
secretSchema,
handler: async (input, ctx) => {
return {
result: input.query
};
}
});
export default defineTool({
manifest: {
pluginId: 'example-search',
version: '1.0.0',
name: {
en: 'Example Search',
'zh-CN': '示例搜索'
},
description: {
en: 'Search example data',
'zh-CN': '搜索示例数据'
},
versionDescription: {
en: 'Initial version',
'zh-CN': '初始版本'
},
tags: ['tools']
},
handler
});
```
Core rules:
* Keep `pluginId`, child tool `id`, input field names, and output field names stable after publishing.
* Use `{ en, 'zh-CN' }` for `manifest.name`, `manifest.description`, and `versionDescription`.
* Describe inputs, outputs, and secrets with Zod schemas.
* Add `InputSchemaMetaType` to input fields and `OutputSchemaMetaType` to output fields.
* Add `SecretSchemaMetaType` to secret fields and set `isSecret: true` for sensitive fields.
* Handler return values must match `outputSchema`.
* Convert external API errors into actionable messages and avoid exposing secrets, tokens, or complete sensitive responses.
* Use `ctx.invoke.uploadFile()` when host file upload is needed, and prefer preserving the returned `err`.
* Use `ctx.streamResponse()` when progress should be shown to users.
## 4. Implement Tool Suite
Use `defineToolSet()` for tool suites. Put shared information in the top-level `manifest` and `secretSchema`, and declare each child tool's independent `id`, name, description, and handler in `children`.
```ts
import {
createToolHandler,
defineToolSet,
type InputSchemaMetaType,
type OutputSchemaMetaType,
type SecretSchemaMetaType
} from '@fastgpt-plugin/sdk-factory';
import z from 'zod';
const secretSchema = z.object({
apiKey: z.string().meta({
title: 'API Key',
isSecret: true
} satisfies SecretSchemaMetaType)
});
const searchHandler = createToolHandler({
inputSchema: z.object({
query: z.string().meta({
title: 'Query'
} satisfies InputSchemaMetaType)
}),
outputSchema: z.object({
items: z.array(z.string()).meta({
title: 'Items'
} satisfies OutputSchemaMetaType)
}),
secretSchema,
handler: async (input) => ({ items: [input.query] })
});
const summaryHandler = createToolHandler({
inputSchema: z.object({
content: z.string().meta({
title: 'Content'
} satisfies InputSchemaMetaType)
}),
outputSchema: z.object({
summary: z.string().meta({
title: 'Summary'
} satisfies OutputSchemaMetaType)
}),
secretSchema,
handler: async (input) => ({ summary: input.content.slice(0, 100) })
});
export default defineToolSet({
manifest: {
pluginId: 'text-tools',
version: '1.0.0',
name: {
en: 'Text Tools',
'zh-CN': '文本工具集'
},
description: {
en: 'Search and summarize text',
'zh-CN': '搜索和总结文本'
}
},
children: [
{
id: 'search',
name: { en: 'Search', 'zh-CN': '搜索' },
description: { en: 'Search text', 'zh-CN': '搜索文本' },
toolDescription: 'Search text by query',
handler: searchHandler
},
{
id: 'summary',
name: { en: 'Summary', 'zh-CN': '总结' },
description: { en: 'Summarize text', 'zh-CN': '总结文本' },
toolDescription: 'Summarize text content',
handler: summaryHandler
}
],
secretSchema
});
```
## 5. Icon Conventions
During build, the CLI scans icons in the plugin root and writes them into the built `manifest.json`.
| Scenario | File name |
| --------------------- | --------------------------------------------------------------------------- |
| Main plugin icon | `logo.svg`, `logo.png`, `logo.jpg`, `logo.jpeg`, `logo.webp`, or `logo.gif` |
| Tool-suite child icon | `.logo.svg`, `.logo.png`, and similar names |
Notes:
* Put icon files in the plugin root.
* The `` of a child icon must exactly match `children[].id`.
* Keep only one extension for the same icon to avoid ambiguous scan results.
* Child tools without their own icons reuse the main plugin icon by default.
* After build, check the `icon` field in `dist/manifest.json`.
## 6. Local Debugging
Install dependencies in the plugin directory first:
```bash
cd packages/tools/my-tool
pnpm install
```
View plugin and debuggable tool information:
```bash
pnpx @fastgpt-plugin/cli debug .
```
Run one single-tool debug invocation:
```bash
pnpx @fastgpt-plugin/cli debug . --run --input '{"query":"hello"}' --secrets '{"apiKey":"test"}'
```
Run a child tool in a tool suite:
```bash
pnpx @fastgpt-plugin/cli debug . --run --tool search --input '{"query":"hello"}' --secrets '{"apiKey":"test"}'
```
Use files when input, secrets, or system variables are large:
```bash
pnpx @fastgpt-plugin/cli debug . --run --input-file input.json --secrets-file secrets.json --system-var-file system-var.json
```
Local debug boundaries:
* `ctx.invoke.uploadFile()` uses a local mock implementation and defaults to `.fastgpt-plugin-debug/uploads`.
* Local debug quickly validates plugin logic and schemas.
* Local debug does not simulate the production child-process pool, real Node.js IPC, network environment, server timeout, or queue scheduling.
* Before listing official plugins, still manually install plugins in a test environment and complete end-to-end testing.
## 7. Remote Debugging
Remote debugging connects a locally developed plugin to a FastGPT test environment. The FastGPT page authenticates the user and generates a debug link, while the CLI uses that link to create a WSS debug channel. Debug plugins are visible only to the current debugger.
Before using it, confirm that the test environment has deployed the FastGPT Plugin service and Connection Gateway, and that your local machine can reach the Gateway WSS endpoint returned by the test environment.
### 7.1 Generate A Debug Link
1. Sign in to the FastGPT test environment.
2. Go to the System Tools page and click Local Debug.

3. In the modal, click Generate Link and copy the debug link.
4. If a debug session already exists, click Refresh Link to generate a new connection key; the old link becomes invalid.

The debug link is only for connecting your local CLI to the test environment. Do not commit it to code repositories, documentation examples, or chat logs.
### 7.2 Start A Local Remote-Debug Session
Run this command in a plugin directory or a workspace that contains multiple plugin directories:
```bash
fastgpt-plugin dev
```
After startup, paste the debug link copied from FastGPT into the TUI. The CLI exchanges the connection key from the link for a short-lived WSS connect token, then mounts local plugins to the FastGPT debug channel.
Scripts and Agents can use non-interactive mode:
```bash
fastgpt-plugin dev --no-interactive \
--connect "https://fastgpt.example.com/api/plugin/debug-channel/connection-key/exchange?connectionKey=fpg_dbg_..."
```
When passing only a raw connection key, tell the CLI where the exchange endpoint is:
```bash
FASTGPT_PLUGIN_DEBUG_CONNECT_URL=https://fastgpt.example.com/api/plugin/debug-channel/connection-key/exchange \
fastgpt-plugin dev --no-interactive --connect "fpg_dbg_..."
```
After `--connect` connects successfully, it saves the connection key so later `fastgpt-plugin dev` runs can reuse the local config. In the TUI, press `c` to enter and save a new debug link or connection key.
### 7.3 Specify Plugin Directories And Watch Changes
When no plugin directory is passed, `dev` auto-discovers plugins from the current directory. If the current directory contains `index.ts`, it is used as the plugin entry; otherwise, the CLI scans one level of child directories for `index.ts`.
You can also pass one or more plugin directories explicitly:
```bash
fastgpt-plugin dev ./plugins/getTime ./plugins/dbops --watch
```
`--watch` reloads local plugins and recreates the remote-debug session after local file changes. The CLI reconnects by default when disconnected; use `--no-reconnect` to disable automatic reconnect.
### 7.4 Verify In FastGPT
After the CLI reports that remote debugging is ready, return to the FastGPT test environment:
1. Check the debug plugin on the System Tools page.
2. Select the debug tool in an app, workflow, or Agent.
3. Fill in secrets and input parameters, then start a real invocation.
4. Check local handler logs and errors in the CLI terminal.
The debug tool `source` is bound to the currently signed-in member, so other members do not see that debug plugin by default.
### 7.5 End Debugging
Press `Ctrl+C` in the local terminal to close the current CLI debug session; press `Ctrl+C` again to force exit.
The End Debugging action in FastGPT revokes the current member's debug channel and removes the debug plugin entry from the page. If the debug link is exposed, the signed-in member changes, or authorization needs to be renewed, use Refresh Link to generate a new link.
## 8. Build, Check, And Pack
Inside a plugin directory, usually run:
```bash
pnpm run test
pnpm run build
pnpx @fastgpt-plugin/cli check --entry . --output ./dist
pnpm run pack
```
You can also pass directories explicitly:
```bash
pnpx @fastgpt-plugin/cli build --entry packages/tools/my-tool --output packages/tools/my-tool/dist --minify
pnpx @fastgpt-plugin/cli check --entry packages/tools/my-tool --output packages/tools/my-tool/dist
pnpx @fastgpt-plugin/cli pack --entry packages/tools/my-tool --dist ./dist --output packages/tools/my-tool/out
```
Build artifacts should include:
* `dist/index.js`
* `dist/manifest.json`
* icon files
* optional `README.md`
* optional `assets/**`
Packaging produces a `.pkg` file. Uploading, installation, and listing should all use that `.pkg` file.
## 9. Verification Checklist
Before submitting, confirm:
* `index.ts` default export is correct.
* `manifest.pluginId`, `manifest.version`, Chinese and English names, and descriptions are complete.
* Tool suite `children[].id` values are stable and unique.
* `inputSchema` covers all user inputs and includes required type and range constraints.
* `outputSchema` matches handler return values.
* `secretSchema` covers all secret configuration and sensitive fields set `isSecret: true`.
* External API success, failure, empty response, timeout, and auth failure are handled.
* Error messages help locate issues and do not leak secrets or sensitive responses.
* `pnpm run test` passes, or the reason it cannot be tested is documented.
* `build`, `check`, and `pack` pass.
* Icons and schemas in `dist/manifest.json` are as expected.
* Remote debugging completes a real invocation in the test environment, or the reason remote debugging is not needed for this change is documented.
* `.pkg` can be installed in a test environment and complete a real invocation.
## 10. Release Flow
### Community Plugins
Community plugins usually start by creating and pushing an independent GitHub repository from the plugin directory:
```bash
cd packages/tools/my-tool
git init
git add .
git commit -m "feat: add my-tool plugin"
gh repo create --public --source=. --remote=origin --push
```
Then return to the `fastgpt-community-plugins` repository, submit the submodule or reference update, and open a PR to `labring/fastgpt-community-plugins`.
### Official Plugins
Official plugins require:
1. Code review.
2. Build, check, test, and package.
3. Manual `.pkg` installation in a test environment.
4. Complete functional testing, including external APIs, secret configuration, error paths, and concurrent calls.
5. Pre-listing security checks, focusing on SSRF, secret leakage, arbitrary file access, command execution, and dependency risk.
### Business Plugins
Business plugins are released to private repositories. Manage versions, secrets, installation packages, and acceptance records according to the customer delivery process. Security boundaries for external APIs, customer private addresses, and account secrets should be recorded separately.
If you do not need official inclusion, see [Upload System Tool](../guide/build/tools/system-plugins/upload_system_tool.en.mdx) to use the plugin in your own FastGPT deployment.
## FAQ
### How should I choose between `tool` and `tool-suite`?
Use `tool` for a single capability. Use `tool-suite` for multiple capabilities that share authentication, the same upstream API, and strong business relevance, such as search, detail, and task creation in one plugin.
### How should plugin versions be managed?
Use semantic versioning for `manifest.version`. Upgrade patch for compatible fixes, minor for compatible new features, and major when changing input/output fields, child tool IDs, or user configuration. Evaluate existing workflow compatibility before major changes.
### Can I put API keys in code or environment variables?
Plugins should declare secrets through `secretSchema` and read them through `ctx.secrets`. Real secrets should not appear in code repositories, test snapshots, error logs, or README files.
### Is a test environment still needed after local debug passes?
Yes. Local debug quickly validates plugin logic and schemas. Test environment validation confirms real installation, runtime, host reverse invocation, network, and permission behavior.
## References
* [FastGPT Plugin Repository](https://github.com/labring/fastgpt-plugin)
* [System Plugin Development Guide](https://github.com/labring/fastgpt-plugin/blob/main/docs/dev/how-to-devlop-plugin.en.md)
* [SDK Factory Guide](https://github.com/labring/fastgpt-plugin/blob/main/sdk/factory/README.en.md)
* [CLI Guide](https://github.com/labring/fastgpt-plugin/blob/main/apps/cli/README.en.md)
file: ./content/plugin/system-tool-development.mdx
meta: {
"title": "系统工具开发指南",
"description": "FastGPT 系统工具开发指南"
}
## 介绍
本文面向 FastGPT v4.15.0 之后的系统工具开发。新版 FastGPT Plugin 服务把系统工具、模型预设等能力统一抽象为可安装、可更新、可运行隔离的插件包,插件最终以 `.pkg` 文件交付给 FastGPT Plugin 服务。
当前稳定支持的系统工具插件类型有两种:
* 单工具:一个插件只暴露一个工具,使用 `defineTool()` 声明。
* 工具集:一个插件暴露多个相关子工具,使用 `defineToolSet()` 声明。
系统工具插件运行在 FastGPT Plugin 服务提供的运行时中。FastGPT 主服务通过插件服务调用工具,插件代码通过 `@fastgpt-plugin/sdk-factory` 描述输入、输出、密钥配置和执行逻辑。
## 与旧版机制的区别
1. FastGPT 和 FastGPT Plugin 的部署关系保持外置扩展模式,整体仍然是微服务架构。
2. 插件包协议从旧的内置系统工具目录升级为统一 `.pkg` 格式,便于安装、版本管理、热更新和后续扩展其他插件类型。
3. 插件运行时由服务端统一管理,当前默认运行时是 `local-pool`,每个插件版本拥有独立进程池、队列和运行时配置。
4. 插件元信息、输入输出 schema、密钥 schema 和图标资源都会进入构建产物,供 FastGPT 页面、工作流和 Agent 调用使用。
5. 工具开发使用 `@fastgpt-plugin/cli` 和 `@fastgpt-plugin/sdk-factory`,不再以旧版 `config.ts`、`versionList` 和 `bun run build:pkg` 作为主要开发方式。
## 开发前准备
开始编码前先明确这些信息:
| 信息 | 说明 |
| ------ | -------------------------------------------- |
| 插件类型 | `tool` 或 `tool-suite`。 |
| 插件 ID | `pluginId`,全局稳定唯一,发布后保持不变。 |
| 子工具 ID | 工具集需要,`children[].id` 发布后保持不变。 |
| 中英文名称 | `name.en` 和 `name.zh-CN`。 |
| 中英文描述 | `description.en` 和 `description.zh-CN`。 |
| 输入 | 每个字段的类型、约束、默认值、UI 标题和说明。 |
| 输出 | 每个字段的类型、含义和下游使用方式。 |
| 密钥 | API Key、Base URL、账号密码等,通过 `secretSchema` 描述。 |
| 外部 API | 请求方式、鉴权方式、超时、限流、错误响应和测试账号。 |
| 文件能力 | 需要上传文件时使用 `ctx.invoke.uploadFile()`。 |
| 流式输出 | 需要展示中间进度时使用 `ctx.streamResponse()`。 |
| 测试样例 | 至少包含成功路径、参数错误、鉴权失败和上游失败。 |
影响插件 ID、鉴权方式、计费或上架安全性的信息需要先确认。其他信息可以使用合理默认值继续推进,并在提交说明中记录假设。
## 使用 Agent 开发
使用 Claude Code、Codex 或其他 Agent 工具时,可直接复制下面的提示词:
```plaintext
请根据以下 FastGPT 官方插件开发 Skill 开发插件:
https://raw.githubusercontent.com/labring/fastgpt-official-plugins/refs/heads/main/.agents/skills/develop-fastgpt-plugin/SKILL.md
执行要求:
1. 先读取并理解该 Skill 的完整内容,后续开发流程以该 Skill 为准。
2. 在开始编码前,收集插件名称、插件类型、中文/英文名称与描述、输入输出、密钥、外部 API、预期行为、错误处理和测试样例。
3. 如需求缺失,最多提出 3 个关键问题;如果可以合理默认,说明假设后继续推进。
4. 使用 `@fastgpt-plugin/cli` 创建插件骨架,并优先遵循仓库内已有插件的结构、命名、测试和构建方式。
5. 实现完成后运行必要验证,包括测试、构建、插件检查和打包;无法验证的项目需要说明原因。
6. 最终输出变更文件、验证结果、剩余假设和需要人工确认的外部 API 行为。
```
在 `fastgpt-plugin` 仓库内开发或维护 SDK/CLI 时,也可以参考本地 Skill:
* `sdk/factory/skills/fastgpt-plugin-development/SKILL.md`
* `sdk/factory/skills/fastgpt-system-tool-development/SKILL.md`
* `sdk/factory/skills/fastgpt-sdk-factory/SKILL.md`
## 1. 准备开发环境
推荐环境:
* Node.js 版本满足目标插件仓库要求。
* `pnpm`,当前 `fastgpt-plugin` 仓库使用 pnpm workspace。
* Git。
* GitHub CLI `gh`,用于 fork、创建仓库和提交 PR。
开发社区插件时,先 fork 并 clone 社区插件仓库:
```bash
gh repo fork labring/fastgpt-community-plugins --clone
cd fastgpt-community-plugins
pnpm install
```
在 `fastgpt-plugin` 仓库内调试 CLI 或 SDK 时,先安装依赖并构建 CLI/SDK:
```bash
pnpm install
pnpm build:sdk-factory
pnpm build:cli
```
## 2. 创建插件骨架
单工具插件:
```bash
pnpx @fastgpt-plugin/cli create my-tool --type tool --cwd packages/tools
```
工具集插件:
```bash
pnpx @fastgpt-plugin/cli create my-tool-suite --type tool-suite --cwd packages/tools
```
也可以进入目标目录后交互式创建:
```bash
pnpx @fastgpt-plugin/cli create
```
CLI 会创建插件目录,并生成常见文件:
| 文件 | 作用 |
| ------------------ | --------------------------------------------- |
| `index.ts` | 插件入口,默认导出 `defineTool()` 或 `defineToolSet()`。 |
| `package.json` | 插件依赖和 `build`、`build:dev`、`pack`、`test` 脚本。 |
| `tsconfig.json` | TypeScript 配置。 |
| `vitest.config.ts` | 测试配置。 |
| `README.md` | 插件说明。 |
| `logo.svg` | 插件主图标。 |
## 3. 实现单工具
系统工具入口必须默认导出 SDK factory 实例:
```ts
import {
createToolHandler,
defineTool,
type InputSchemaMetaType,
type OutputSchemaMetaType,
type SecretSchemaMetaType
} from '@fastgpt-plugin/sdk-factory';
import z from 'zod';
const secretSchema = z.object({
apiKey: z
.string()
.min(1)
.meta({
title: 'API Key',
isSecret: true
} satisfies SecretSchemaMetaType)
});
const handler = createToolHandler({
inputSchema: z.object({
query: z
.string()
.min(1)
.meta({
title: 'Query',
description: 'Search keyword'
} satisfies InputSchemaMetaType)
}),
outputSchema: z.object({
result: z.string().meta({
title: 'Result'
} satisfies OutputSchemaMetaType)
}),
secretSchema,
handler: async (input, ctx) => {
return {
result: input.query
};
}
});
export default defineTool({
manifest: {
pluginId: 'example-search',
version: '1.0.0',
name: {
en: 'Example Search',
'zh-CN': '示例搜索'
},
description: {
en: 'Search example data',
'zh-CN': '搜索示例数据'
},
versionDescription: {
en: 'Initial version',
'zh-CN': '初始版本'
},
tags: ['tools']
},
handler
});
```
核心规则:
* `pluginId`、子工具 `id`、输入字段名、输出字段名发布后保持稳定。
* `manifest.name`、`manifest.description` 和 `versionDescription` 使用 `{ en, 'zh-CN' }`。
* 输入、输出和密钥都用 Zod schema 描述。
* 输入字段补充 `InputSchemaMetaType`,输出字段补充 `OutputSchemaMetaType`。
* 密钥字段补充 `SecretSchemaMetaType`,敏感字段设置 `isSecret: true`。
* handler 返回值必须匹配 `outputSchema`。
* 外部 API 错误需要转成可定位的错误信息,并避免输出密钥、令牌和完整敏感响应。
* 调用宿主文件上传能力时,使用 `ctx.invoke.uploadFile()`,并优先保留返回的 `err`。
* 展示进度时,使用 `ctx.streamResponse()`。
## 4. 实现工具集
工具集使用 `defineToolSet()`,把共用信息放在顶层 `manifest` 和 `secretSchema`,每个子工具在 `children` 中声明独立 `id`、名称、描述和 handler。
```ts
import {
createToolHandler,
defineToolSet,
type InputSchemaMetaType,
type OutputSchemaMetaType,
type SecretSchemaMetaType
} from '@fastgpt-plugin/sdk-factory';
import z from 'zod';
const secretSchema = z.object({
apiKey: z.string().meta({
title: 'API Key',
isSecret: true
} satisfies SecretSchemaMetaType)
});
const searchHandler = createToolHandler({
inputSchema: z.object({
query: z.string().meta({
title: 'Query'
} satisfies InputSchemaMetaType)
}),
outputSchema: z.object({
items: z.array(z.string()).meta({
title: 'Items'
} satisfies OutputSchemaMetaType)
}),
secretSchema,
handler: async (input) => ({ items: [input.query] })
});
const summaryHandler = createToolHandler({
inputSchema: z.object({
content: z.string().meta({
title: 'Content'
} satisfies InputSchemaMetaType)
}),
outputSchema: z.object({
summary: z.string().meta({
title: 'Summary'
} satisfies OutputSchemaMetaType)
}),
secretSchema,
handler: async (input) => ({ summary: input.content.slice(0, 100) })
});
export default defineToolSet({
manifest: {
pluginId: 'text-tools',
version: '1.0.0',
name: {
en: 'Text Tools',
'zh-CN': '文本工具集'
},
description: {
en: 'Search and summarize text',
'zh-CN': '搜索和总结文本'
}
},
children: [
{
id: 'search',
name: { en: 'Search', 'zh-CN': '搜索' },
description: { en: 'Search text', 'zh-CN': '搜索文本' },
toolDescription: 'Search text by query',
handler: searchHandler
},
{
id: 'summary',
name: { en: 'Summary', 'zh-CN': '总结' },
description: { en: 'Summarize text', 'zh-CN': '总结文本' },
toolDescription: 'Summarize text content',
handler: summaryHandler
}
],
secretSchema
});
```
## 5. 图标规范
CLI 构建时会扫描插件根目录中的图标并写入构建后的 `manifest.json`。
| 场景 | 文件名 |
| -------- | --------------------------------------------------------------------- |
| 主插件图标 | `logo.svg`、`logo.png`、`logo.jpg`、`logo.jpeg`、`logo.webp` 或 `logo.gif` |
| 工具集子工具图标 | `.logo.svg`、`.logo.png` 等 |
注意事项:
* 图标文件放在插件根目录。
* 子工具图标的 `` 与 `children[].id` 完全一致。
* 同一个图标只保留一个扩展名,避免扫描结果不明确。
* 子工具没有独立图标时,默认复用主插件图标。
* 构建后检查 `dist/manifest.json` 中的 `icon` 字段。
## 6. 本地调试
先进入插件目录安装依赖:
```bash
cd packages/tools/my-tool
pnpm install
```
查看插件和可调试工具信息:
```bash
pnpx @fastgpt-plugin/cli debug .
```
执行一次单工具调试:
```bash
pnpx @fastgpt-plugin/cli debug . --run --input '{"query":"hello"}' --secrets '{"apiKey":"test"}'
```
执行工具集中的某个子工具:
```bash
pnpx @fastgpt-plugin/cli debug . --run --tool search --input '{"query":"hello"}' --secrets '{"apiKey":"test"}'
```
输入、密钥和系统变量较大时,使用文件传入:
```bash
pnpx @fastgpt-plugin/cli debug . --run --input-file input.json --secrets-file secrets.json --system-var-file system-var.json
```
本地 debug 的边界:
* `ctx.invoke.uploadFile()` 使用本地虚拟实现,默认输出到 `.fastgpt-plugin-debug/uploads`。
* 本地 debug 用于快速验证插件逻辑和 schema。
* 本地 debug 不模拟生产子进程池、真实 Node.js IPC、网络环境、服务端超时和队列调度。
* 上架官方插件前仍需在测试环境中手动安装插件并完成端到端测试。
## 7. 远程调试
远程调试用于把本地正在开发的插件接入 FastGPT 测试环境。FastGPT 页面负责鉴权并生成调试链接,CLI 通过该链接建立 WSS 调试通道;调试插件仅对当前调试者本人可见。
使用前确认测试环境已部署 FastGPT Plugin 服务和 Connection Gateway,并且本地开发机可以访问测试环境返回的 Gateway WSS 地址。
### 7.1 生成调试链接
1. 登录 FastGPT 测试环境。
2. 进入「系统工具」页面,点击「本地调试」。

3. 在弹窗中点击「生成链接」,复制生成的调试链接。
4. 已有调试会话时,可点击「刷新链接」生成新的 connection key;旧链接会失效。

调试链接只用于本地 CLI 连接测试环境,不应提交到代码仓库、文档示例或聊天记录中。
### 7.2 启动本地远程调试会话
在插件目录或包含多个插件目录的工作区中运行:
```bash
fastgpt-plugin dev
```
启动后,将 FastGPT 页面复制的调试链接粘贴到 TUI 中。CLI 会用链接中的 connection key 换取短期 WSS connect token,并把本地插件挂载到 FastGPT 的调试通道。
脚本或 Agent 场景可以使用非交互模式:
```bash
fastgpt-plugin dev --no-interactive \
--connect "https://fastgpt.example.com/api/plugin/debug-channel/connection-key/exchange?connectionKey=fpg_dbg_..."
```
如果只传入裸 connection key,需要让 CLI 知道 exchange 接口地址:
```bash
FASTGPT_PLUGIN_DEBUG_CONNECT_URL=https://fastgpt.example.com/api/plugin/debug-channel/connection-key/exchange \
fastgpt-plugin dev --no-interactive --connect "fpg_dbg_..."
```
`--connect` 成功连接后会保存 connection key,后续可直接运行 `fastgpt-plugin dev` 复用本地配置。TUI 中按 `c` 可重新输入并保存新的调试链接或 connection key。
### 7.3 指定插件目录和监听变化
`dev` 未传插件目录时会自动探测当前目录:当前目录存在 `index.ts` 时使用当前目录;否则扫描下一层子目录中的 `index.ts`。
也可以手动传入一个或多个插件目录:
```bash
fastgpt-plugin dev ./plugins/getTime ./plugins/dbops --watch
```
`--watch` 会在本地文件变化后重新加载插件并重建远程调试会话。CLI 默认开启断线重连;如需关闭自动重连,可加 `--no-reconnect`。
### 7.4 在 FastGPT 中验证
CLI 显示远程调试已就绪后,回到 FastGPT 测试环境:
1. 在「系统工具」页面查看调试插件。
2. 在应用、工作流或 Agent 中选择该调试工具。
3. 填写密钥和输入参数,发起真实调用。
4. 在 CLI 终端查看本地 handler 日志和错误信息。
调试工具的 `source` 会绑定到当前登录成员,其他成员默认看不到该调试插件。
### 7.5 结束调试
本地终端按 `Ctrl+C` 会关闭当前 CLI 调试会话;再次按 `Ctrl+C` 会强制退出。
FastGPT 页面中的「结束调试」会撤销当前成员的 debug channel,并清理页面上的调试插件入口。调试链接泄露、成员切换或需要重新授权时,优先使用「刷新链接」生成新链接。
## 8. 构建、检查和打包
插件目录中通常可以直接运行:
```bash
pnpm run test
pnpm run build
pnpx @fastgpt-plugin/cli check --entry . --output ./dist
pnpm run pack
```
也可以显式传入目录:
```bash
pnpx @fastgpt-plugin/cli build --entry packages/tools/my-tool --output packages/tools/my-tool/dist --minify
pnpx @fastgpt-plugin/cli check --entry packages/tools/my-tool --output packages/tools/my-tool/dist
pnpx @fastgpt-plugin/cli pack --entry packages/tools/my-tool --dist ./dist --output packages/tools/my-tool/out
```
构建产物应包含:
* `dist/index.js`
* `dist/manifest.json`
* 图标文件
* 可选的 `README.md`
* 可选的 `assets/**`
打包后会生成 `.pkg` 文件。上传、安装和上架都应使用该 `.pkg` 文件。
## 9. 验证清单
提交前至少确认:
* `index.ts` 默认导出正确。
* `manifest.pluginId`、`manifest.version`、中英文名称和描述完整。
* 工具集的 `children[].id` 稳定且没有重复。
* `inputSchema` 覆盖所有用户输入,并有必要的类型和范围约束。
* `outputSchema` 与 handler 返回值一致。
* `secretSchema` 覆盖全部密钥配置,敏感字段设置 `isSecret: true`。
* 外部 API 的成功、失败、空响应、超时和鉴权失败都有处理。
* 错误信息可定位问题,并且不会泄露密钥或敏感响应。
* `pnpm run test` 通过,或明确说明无法测试的原因。
* `build`、`check`、`pack` 通过。
* `dist/manifest.json` 中图标和 schema 符合预期。
* 使用远程调试完成测试环境真实调用,或明确说明本次无需远程调试的原因。
* `.pkg` 能在测试环境中安装并完成真实调用。
## 10. 发布流程
### 社区插件
社区插件通常先在插件目录创建并推送独立 GitHub 仓库:
```bash
cd packages/tools/my-tool
git init
git add .
git commit -m "feat: add my-tool plugin"
gh repo create --public --source=. --remote=origin --push
```
然后回到 `fastgpt-community-plugins` 仓库,提交 submodule 或引用更新,并向 `labring/fastgpt-community-plugins` 提 PR。
### 官方插件
官方插件需要完成:
1. 代码 review。
2. 构建、检查、测试和打包。
3. 在测试环境手动安装 `.pkg`。
4. 完整功能测试,包括外部 API、密钥配置、错误路径和并发调用。
5. 上架前安全检查,重点关注 SSRF、密钥泄露、任意文件访问、命令执行和依赖风险。
### 商业插件
商业插件发布到私有仓库,按客户交付流程管理版本、密钥、安装包和验收记录。对外部 API、客户私有地址和账号密钥的处理需要单独记录安全边界。
如无需官方收录,可参考 [上传系统工具](../guide/build/tools/system-plugins/upload_system_tool.mdx) 在自己部署的 FastGPT 中使用。
## 常见问题
### `tool` 和 `tool-suite` 如何选择?
单一能力使用 `tool`。多个共享鉴权、共享上游 API、业务上强相关的能力使用 `tool-suite`,例如搜索、详情、创建任务放在同一个插件中。
### 插件版本如何管理?
`manifest.version` 使用语义化版本。修复兼容性问题升级 patch,新增兼容功能升级 minor,修改输入输出字段、子工具 ID 或用户配置方式时升级 major,并提前评估已有工作流兼容性。
### 可以把 API Key 写在代码或环境变量里吗?
插件应通过 `secretSchema` 声明密钥,并通过 `ctx.secrets` 读取。代码仓库、测试快照、错误日志和 README 中都不应出现真实密钥。
### 本地 debug 通过后还需要测试环境验证吗?
需要。本地 debug 用于快速验证插件逻辑和 schema,测试环境验证用于确认真实安装、运行时、宿主反向调用、网络和权限行为。
## 参考
* [FastGPT Plugin 仓库](https://github.com/labring/fastgpt-plugin)
* [系统插件开发指南](https://github.com/labring/fastgpt-plugin/blob/main/docs/dev/how-to-devlop-plugin.md)
* [SDK Factory 使用指南](https://github.com/labring/fastgpt-plugin/blob/main/sdk/factory/README.md)
* [CLI 使用指南](https://github.com/labring/fastgpt-plugin/blob/main/apps/cli/README.md)
file: ./content/guide/index.en.mdx
meta: {
"title": "User Guide",
"description": "FastGPT User Guide"
}
import { Redirect } from '@/components/docs/Redirect';
file: ./content/guide/index.mdx
meta: {
"title": "使用指南",
"description": "FastGPT 使用指南"
}
import { Redirect } from '@/components/docs/Redirect';
file: ./content/self-host/dev.en.mdx
meta: {
"title": "Local Development Setup",
"description": "Develop and debug FastGPT locally"
}
import { Alert } from '@/components/docs/Alert';
import FastGPTLink from '@/components/docs/linkFastGPT';
This guide covers how to set up your development environment to build and test FastGPT.
## Prerequisites
Install and configure these dependencies on your machine to build FastGPT:
* [Git](https://git-scm.com/)
* [Docker](https://www.docker.com/)
* [Node.js v20.14.0](https://nodejs.org) (match this version closely; use [nvm](https://github.com/nvm-sh/nvm) to manage Node versions)
* [pnpm](https://pnpm.io/) recommended version 9.4.0 (current official dev environment)
We recommend developing on \*nix environments (Linux, macOS, Windows WSL).
## Local Development
### 1. Fork the FastGPT Repository
Fork the [FastGPT repository](https://github.com/labring/FastGPT).
### 2. Clone the Repository
Clone your forked repository from GitHub:
```
git clone git@github.com:/FastGPT.git
```
### 3. Start the Development Environment with Docker
If you're already running FastGPT locally via Docker, stop it first to avoid port conflicts.
Navigate to `FastGPT/deploy/dev` and run `docker compose up -d` to start FastGPT's dependencies:
```bash
cd FastGPT/deploy/dev
docker compose up -d
```
1. If you can't pull images, use the China mirror version: `docker compose -f
docker-compose.cn.yml up -d` 2. For MongoDB, add the `directConnection=true` parameter to your
connection string to connect to the replica set.
### 4. Initial Configuration
All files below are in the `projects/app` directory.
```bash
# Make sure you're in projects/app
pwd
# Should output /xxxx/xxxx/xxx/FastGPT/projects/app
```
**1. Environment Variables**
Copy `.env.template` to create `.env.local` in the same directory. Only changes in `.env.local` take effect.
See `.env.template` for variable descriptions.
If you haven't modified variables in docker-compose.yaml, the defaults in `.env.template` work as-is. Otherwise, match the values in your `yml` file.
```bash
cp .env.template .env.local
```
**2. config.json Configuration File**
Copy `data/config.json` to create `data/config.local.json`. For detailed parameters, see [Configuration Guide](./config/model/intro.en.mdx).
```bash
cp data/config.json data/config.local.json
```
This file usually doesn't need changes. Key `systemEnv` parameters:
* `vectorMaxProcess`: Max vector generation processes. Depends on database and key concurrency — for a 2c4g server, set to 10–15.
* `qaMaxProcess`: Max QA generation processes
* `vlmMaxProcess`: Max image understanding model processes
* `hnswEfSearch`: Vector search parameter (PG and OB only). Higher values = better accuracy but slower speed.
### 5. Run
See `dev.md` in the project root. The first compile may take a while — be patient.
```bash
# Run from the code root directory to install all dependencies
# If isolate-vm installation fails, see: https://github.com/laverdet/isolated-vm?tab=readme-ov-file#requirements
pwd # Should be in the code root directory
pnpm i
cd projects/app
pnpm dev
```
Next.js runs on port 3000 by default. Visit [http://localhost:3000](http://localhost:3000)
### 6. Build
We recommend using Docker for builds.
```bash
# Without proxy
docker build -f ./projects/app/Dockerfile -t fastgpt . --build-arg name=app
# With Taobao proxy
docker build -f ./projects/app/Dockerfile -t fastgpt. --build-arg name=app --build-arg proxy=taobao
```
Without Docker, you'd need to manually execute all the run-stage commands from the `Dockerfile` (not recommended).
## Contributing to the Open Source Repository
1. Make sure your code is forked from the [FastGPT](https://github.com/labring/FastGPT) repository.
2. Keep commits small and focused — each should address one issue.
3. Submit a PR to FastGPT's main branch. The FastGPT team and community will review it with you.
If you run into issues like merge conflicts, check GitHub's [pull request tutorial](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests). Once your PR is merged, you'll be listed in the [contributors table](https://github.com/labring/FastGPT/graphs/contributors).
## QA
### System Time Anomaly
If your default timezone is `Asia/Shanghai`, system time may be incorrect in non-Linux environments. For local development, change your timezone to UTC (+0).
### Can't Connect to Local Database
1. For remote databases, check if the port is open.
2. For local databases, try changing `host` to `localhost` or `127.0.0.1`.
3. For local connections to remote MongoDB, add `directConnection=true` to connect to replica sets.
4. Use `mongocompass` for MongoDB connection testing and visual management.
5. Use `navicat` for PostgreSQL connection and management.
### sh ./scripts/postinstall.sh Permission Denied
FastGPT runs a `postinstall` script after `pnpm i` to auto-generate ChakraUI types. If you get a permission error, run `chmod -R +x ./scripts/` first, then `pnpm i`.
If that doesn't work, manually execute the contents of `./scripts/postinstall.sh`.
*On Windows, use git bash to add execute permissions and run the script.*
### TypeError: Cannot read properties of null (reading 'useMemo')
Delete all `node_modules` and reinstall with Node 18 — newer Node versions may have issues. Local dev workflow:
1. Root directory: `pnpm i`
2. Copy `config.json` -> `config.local.json`
3. Copy `.env.template` -> `.env.local`
4. `cd projects/app`
5. `pnpm dev`
### Error response from daemon: error while creating mount source path 'XXX': mkdir XXX: file exists
This may be caused by leftover files from a previous container stop. Make sure all related containers are stopped, then manually delete the files or restart Docker.
## Join the Community
Having trouble? Join the Lark group to connect with developers and users.
## Code Structure
### Next.js
FastGPT uses Next.js page routing. To separate frontend and backend code, directories are split into global, service, and web subdirectories for shared, backend-only, and frontend-only code respectively.
### Monorepo
FastGPT uses pnpm workspace for its monorepo structure, with two main parts:
* projects/app - FastGPT main project
* packages/ - Submodules
* global - Shared code: functions, type declarations, and constants usable on both frontend and backend
* service - Server-side code
* web - Frontend code
* plugin - Custom workflow plugin code
### Domain-Driven Design (DDD)
FastGPT's code modules follow DDD principles, divided into these domains:
* core - Core features (knowledge base, workflow, app, conversation)
* support - Supporting features (user system, billing, authentication, etc.)
* common - Base features (log management, file I/O, etc.)
Code Structure Details
```
.
├── .github // GitHub config
├── .husky // Formatting config
├── document // Documentation
├── files // External files, e.g., docker-compose, helm
├── packages // Subpackages
│ ├── global // Frontend/backend shared subpackage
│ ├── plugins // Workflow plugins (for custom packages)
│ ├── service // Backend subpackage
│ └── web // Frontend subpackage
├── projects
│ └── app // FastGPT main project
├── python // Model code, unrelated to FastGPT itself
└── scripts // Automation scripts
├── icon // Icon scripts: pnpm initIcon (write SVG to code), pnpm previewIcon (preview icons)
└── postinstall.sh // ChakraUI custom theme TS type initialization
├── package.json // Top-level monorepo
├── pnpm-lock.yaml
├── pnpm-workspace.yaml // Monorepo declaration
├── Dockerfile
├── LICENSE
├── README.md
├── README_en.md
├── README_ja.md
├── dev.md
```
file: ./content/self-host/dev.mdx
meta: {
"title": "本地开发",
"description": "对 FastGPT 进行开发调试"
}
import { Alert } from '@/components/docs/Alert';
import FastGPTLink from '@/components/docs/linkFastGPT';
本文档介绍了如何设置开发环境以构建和测试 FastGPT。
## 前置开发环境
您需要在计算机上安装和配置以下依赖项才能构建 FastGPT:
* [Git](https://git-scm.com/)
* [Docker](https://www.docker.com/)
* [Node.js >=20](https://nodejs.org)(版本尽量一样,可以使用 [nvm](https://github.com/nvm-sh/nvm) 管理 Node.js 版本)
* [pnpm](https://pnpm.io/) 需要使用 10.x
建议在 \*nix 环境进行开发 (Linux, MacOS, Windows WSL)
## 开始本地开发
### 1. Fork FastGPT 存储库
您需要 Fork [FastGPT 存储库](https://github.com/labring/FastGPT)。
### 2. 克隆存储库
克隆您在 GitHub 上 Fork 的存储库:
```
git clone git@github.com:/FastGPT.git
```
### 3. 通过 docker 启动开发环境
若您本地已经通过 docker 启动了 FastGPT,则需要先关闭,否则会有端口冲突。
切换到 `FastGPT/deploy/dev` 目录,执行 `docker compose up -d` 运行 FastGPT 的各种依赖。
```bash
cd FastGPT/deploy/dev
docker compose up -d
```
1. 如果无法获取镜像,可以选择国内镜像版本的 docker-compose.yml 文件:`docker compose -f
docker-compose.cn.yml up -d` 2. Mongo 数据库需要注意,需要注意在连接地址中增加
`directConnection=true` 参数,才能连接上副本集的数据库。
### 4. 初始配置
以下文件均在 `projects/app` 路径下。
```bash
# 确保你现在在 projects/app 下
pwd
# 应当输出 /xxxx/xxxx/xxx/FastGPT/projects/app
```
**1. 环境变量**
复制 `.env.template` 文件,在同级目录下生成一个 `.env.local` 文件,修改 `.env.local` 里内容才是有效的变量。变量说明见 `.env.template`
如果没有修改 docker-compose.yaml 中的变量,`.env.template` 中的默认值就可以,不需要进行修改,否则需要和 `yml` 中的变量一致。
```bash
cp .env.template .env.local
```
**2. config.json 配置文件**
复制 `data/config.json` 文件,生成一个 `data/config.local.json` 配置文件,具体配置参数说明,可参考 [config 配置说明](./config/model/intro.mdx)
```bash
cp data/config.json data/config.local.json
```
这个文件大部分时候不需要修改。只需要关注 `systemEnv` 里的参数:
* `vectorMaxProcess` : 向量生成最大进程,根据数据库和 key 的并发数来决定,通常单个 120 号,2c4g 服务器设置 10\~15。
* `qaMaxProcess` : QA 生成最大进程
* `vlmMaxProcess` : 图片理解模型最大进程
* `hnswEfSearch` : 向量搜索参数,仅对 PG 和 OB 生效,越大搜索精度越高但是速度越慢。
### 5. 运行
可参考项目根目录下的 `dev.md`,第一次编译运行可能会有点慢,需要点耐心哦
```bash
# 代码根目录下执行,会安装根 package、projects 和 packages 内所有依赖
# 如果提示 isolate-vm 安装失败,可以参考:https://github.com/laverdet/isolated-vm?tab=readme-ov-file#requirements
pwd # 应该在代码的根目录
pnpm i
cd projects/app
pnpm dev
```
默认 next 将运行在 3000 端口,访问 [http://localhost:3000](http://localhost:3000)
### 6. 打包
建议直接使用 Docker 进行打包。
```bash
# 没有 Proxy
docker build -f ./projects/app/Dockerfile -t fastgpt . --build-arg name=app
# Taobao Proxy
docker build -f ./projects/app/Dockerfile -t fastgpt. --build-arg name=app --build-arg proxy=taobao
```
如果不使用 `docker` 打包,需要手动把 `Dockerfile` 里 run 阶段的内容全部手动执行一遍(非常不推荐)。
## 提交代码至开源仓库
1. 确保你的代码是 Fork [FastGPT](https://github.com/labring/FastGPT) 仓库
2. 尽可能少量的提交代码,每次提交仅解决一个问题。
3. 向 FastGPT 的 main 分支提交一个 PR,提交请求后,FastGPT 团队/社区的其他人将与您一起审查它。
如果遇到问题,比如合并冲突或不知道如何打开拉取请求,请查看 GitHub 的[拉取请求教程](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests),了解如何解决合并冲突和其他问题。一旦您的 PR 被合并,您将自豪地被列为[贡献者表](https://github.com/labring/FastGPT/graphs/contributors)中的一员。
## QA
### 获取系统时间异常
如果用户默认的时区为 `Asia/Shanghai` , 非 linux 环境时,获取系统时间会异常,本地开发时,可以将用户的时区调整成 UTC(+0)。
### 本地数据库无法连接
1. 如果你是连接远程的数据库,先检查对应的端口是否开放。
2. 如果是本地运行的数据库,可尝试 `host` 改成 `localhost` 或 `127.0.0.1`
3. 本地连接远程的 Mongo,需要增加 `directConnection=true` 参数,才能连接上副本集的数据库。
4. mongo 使用 `mongocompass` 客户端进行连接测试和可视化管理。
5. pg 使用 `navicat` 进行连接和管理。
### sh ./scripts/postinstall.sh 没权限
FastGPT 在 `pnpm i` 后会执行 `postinstall` 脚本,用于自动生成 `ChakraUI` 的 `Type`。如果没有权限,可以先执行 `chmod -R +x ./scripts/`,再执行 `pnpm i`。
仍不可行的话,可以手动执行 `./scripts/postinstall.sh` 里的内容。*如果是 Windows 下的话,可以使用 git bash 给 `postinstall` 脚本添加执行权限并执行 sh 脚本*
### TypeError: Cannot read properties of null (reading 'useMemo' )
删除所有的 `node_modules`,用 Node18 重新 install 试试,可能最新的 Node.js 有问题。本地开发流程:
1. 根目录: `pnpm i`
2. 复制 `config.json` -> `config.local.json`
3. 复制 `.env.template` -> `.env.local`
4. `cd projects/app`
5. `pnpm dev`
### Error response from daemon: error while creating mount source path 'XXX': mkdir XXX: file exists
这个错误可能是之前停止容器时有文件残留导致的,首先需要确认相关镜像都全部关闭,然后手动删除相关文件或者重启 docker 即可
## 加入社区
遇到困难了吗?有任何问题吗? 加入飞书群与开发者和用户保持沟通。
## 代码结构说明
### nextjs
FastGPT 使用了 nextjs 的 page route 作为框架。为了区分好前后端代码,在目录分配上会分成 global, service, web 3 个自目录,分别对应着 `前后端共用`、`后端专用`、`前端专用` 的代码。
### monorepo
FastGPT 采用 pnpm workspace 方式构建 monorepo 项目,主要分为两个部分:
* projects/app - FastGPT 主项目
* packages/ - 子模块
* global - 共用代码,通常是放一些前后端都能执行的函数、类型声明、常量。
* service - 服务端代码
* web - 前端代码
* plugin - 工作流自定义插件的代码
### 领域驱动模式(DDD)
FastGPT 在代码模块划分时,按 DDD 的思想进行划分,主要分为以下几个领域:
* core - 核心功能(知识库,工作流,应用,对话)
* support - 支撑功能(用户体系,计费,鉴权等)
* common - 基础功能(日志管理,文件读写等)
代码结构说明
```
.
├── .github // github 相关配置
├── .husky // 格式化配置
├── document // 文档
├── files // 一些外部文件,例如 docker-compose, helm
├── packages // 子包
│ ├── global // 前后端通用子包
│ ├── plugins // 工作流插件(需要自定义包时候使用到)
│ ├── service // 后端子包
│ └── web // 前端子包
├── projects
│ └── app // FastGPT 主项目
├── python // 存放一些模型代码,和 FastGPT 本身无关
└── scripts // 一些自动化脚本
├── icon // icon预览脚本,可以在顶层 pnpm initIcon(把svg写入到代码中), pnpm previewIcon(预览icon)
└── postinstall.sh // chakraUI自定义theme初始化 ts 类型
├── package.json // 顶层monorepo
├── pnpm-lock.yaml
├── pnpm-workspace.yaml // monorepo 声明
├── Dockerfile
├── LICENSE
├── README.md
├── README_en.md
├── README_ja.md
├── dev.md
```
file: ./content/self-host/index.en.mdx
meta: {
"title": "Self-Host",
"description": "FastGPT Self-Host"
}
import { Redirect } from '@/components/docs/Redirect';
file: ./content/self-host/index.mdx
meta: {
"title": "自部署",
"description": "FastGPT 自部署"
}
import { Redirect } from '@/components/docs/Redirect';
file: ./content/guide/admin/sso.en.mdx
meta: {
"title": "SSO & External Member Sync",
"description": "FastGPT External Member System Integration and Configuration"
}
import { Alert } from '@/components/docs/Alert';
If you don't need SSO or member sync, or only need quick login via GitHub, Google, Microsoft, or WeChat Official Account, you can skip this section. This guide is for users who need to integrate their own member systems or mainstream office IMs.
## Overview
To simplify integration with **external member systems**, FastGPT provides a set of **standard interfaces** for connecting to external systems, along with a FastGPT-SSO-Service image that serves as an **adapter**.
Through these standard interfaces, you can:
1. SSO login. After a callback from an external system, create a user in FastGPT.
2. Member and organizational structure sync (referred to as "member sync" below).
**How It Works**
FastGPT-pro includes a standard set of SSO and member sync interfaces. The system performs SSO and member sync operations based on these interfaces.
FastGPT-SSO-Service aggregates SSO and member sync interfaces from different sources and converts them into the format recognized by fastgpt-pro.

## System Configuration Tutorial
### 1. Deploy the SSO-Service Image
Deploy using docker-compose:
```yaml
fastgpt-sso:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.9.0 # This version must match the FastGPT image version
container_name: fastgpt-sso
restart: always
networks:
- fastgpt
environment:
- SSO_PROVIDER=example
- AUTH_TOKEN=xxxxx # Auth token, used by fastgpt-pro
# Provider-specific environment variables below
```
Depending on the provider, you'll need different environment variables. Below are the built-in protocols/IMs:
Protocol/Feature
SSO
Member Sync Support
Lark
Yes
Yes
WeCom
Yes
Yes
DingTalk
Yes
No
SAML 2.0
Yes
No
OAuth 2.0
Yes
No
### 2. Configure fastgpt-pro
#### 1. Configure Environment Variables
The `EXTERNAL_USER_SYSTEM_BASE_URL` environment variable should be set to the internal network address. For example, with the configuration above:
```yaml
env:
- EXTERNAL_USER_SYSTEM_BASE_URL=http://fastgpt-sso:3000
- EXTERNAL_USER_SYSTEM_AUTH_TOKEN=xxxxx
```
#### 2. Configure button text, icons, etc. in the commercial version admin panel.
WeCom
DingTalk
Lark



#### 3. Enable Member Sync (Optional)
If you need to sync members from an external system, you can enable member sync. For team mode details, see: [Team Mode Documentation](./teamMode.en.mdx)

#### 4. Optional Configuration
1. Automatic scheduled member sync
Set the fastgpt-pro environment variable to enable automatic member sync:
```yaml
env:
- "SYNC_MEMBER_CRON=0 0 * * *" # Cron expression, runs daily at 00:00. Note: uses UTC (timezone 0). For example, to sync at 12:00 Beijing time, set this to "0 4 * * *" (UTC 04:00)
```
## Built-in Protocol/IM Configuration Examples
### Lark
#### 1. Get Parameters
App ID and App Secret
Go to the developer console, click on your enterprise self-built app, and view the app credentials on the Credentials & Basic Info page.

#### 2. Permission Configuration
Go to the developer console, click on your enterprise self-built app, and enable permissions on the Permission Management page under Development Configuration.

You can use the **Batch Import/Export Permissions** feature to import the following permission configuration:
```json
{
"scopes": {
"tenant": [
"contact:user.phone:readonly",
"contact:contact.base:readonly",
"contact:department.base:readonly",
"contact:department.organize:readonly",
"contact:user.base:readonly",
"contact:user.department:readonly",
"contact:user.email:readonly",
"contact:user.employee_id:readonly"
],
"user": []
}
}
```
Note: The accessible data scope must be set to visible to all members.
#### 3. Redirect URL
Go to the developer console, click on your enterprise self-built app, and set the redirect URL in Security Settings under Development Configuration.
The redirect URL should follow the format `https://www.fastgpt.cn/login/provider` — replace the domain with your publicly accessible FastGPT domain.

#### 4. yml Configuration Example
```yaml
fastgpt-sso:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.9.0
container_name: fastgpt-sso
restart: always
networks:
- fastgpt
environment:
- SSO_PROVIDER=feishu
- AUTH_TOKEN=xxxxx
# OAuth endpoint (for private Lark deployments, replace with your private address; same below)
- SSO_TARGET_URL=https://accounts.feishu.cn/open-apis/authen/v1/authorize
# Token endpoint
- FEISHU_TOKEN_URL=https://open.feishu.cn/open-apis/authen/v2/oauth/token
# User info endpoint
- FEISHU_GET_USER_INFO_URL=https://open.feishu.cn/open-apis/authen/v1/user_info
# Redirect address — must match the URL from step 3 exactly
- FEISHU_REDIRECT_URI=https://fastgpt.cn/login/provider
# Lark App ID, usually starts with cli
- FEISHU_APP_ID=xxx
# Lark App Secret
- FEISHU_APP_SECRET=xxx
```
### DingTalk
#### 1. Get Parameters
CLIENT\_ID and CLIENT\_SECRET
Go to the DingTalk Open Platform, click App Development, select your app, and record the Client ID and Client Secret on the Credentials & Basic Info page.

#### 2. Permission Configuration
Go to the DingTalk Open Platform, click App Development, select your app, and manage permissions on the Permission Management page under Development Configuration. Required permissions:
1. ***Personal phone number information***
2. ***Contact personal information read permission***
3. ***Basic permission to obtain DingTalk open interface user access credentials***
#### 3. Redirect URL
Go to the DingTalk Open Platform, click App Development, select your app, and configure on the Security Settings page under Development Configuration.
Two items need to be filled in:
1. Server egress IP (list of server IPs calling DingTalk server-side APIs)
2. Redirect URL (callback domain)
#### 4. yml Configuration Example
```yaml
fastgpt-sso:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.9.0
container_name: fastgpt-sso
restart: always
networks:
- fastgpt
environment:
- SSO_PROVIDER=dingtalk
- AUTH_TOKEN=xxxxx
# OAuth endpoint
- SSO_TARGET_URL=https://login.dingtalk.com/oauth2/auth
# Token endpoint
- DINGTALK_TOKEN_URL=https://api.dingtalk.com/v1.0/oauth2/userAccessToken
# User info endpoint
- DINGTALK_GET_USER_INFO_URL=https://oapi.dingtalk.com/v1.0/contact/users/me
# DingTalk App ID
- DINGTALK_CLIENT_ID=xxx
# DingTalk App Secret
- DINGTALK_CLIENT_SECRET=xxx
```
### WeCom
#### 1. Get Parameters
1. Enterprise CorpID
a. Log in to the WeCom admin console with an admin account: `https://work.weixin.qq.com/wework_admin/loginpage_wx`
b. Go to the "My Enterprise" page and find the Enterprise ID

2. Create an internal app for FastGPT:
a. Get the app's AgentID and Secret
b. Ensure the app's visibility scope is set to all (i.e., root department)


3. A domain name with the following requirements:
a. Resolves to a publicly accessible server
b. Can serve static files at the root path (for domain ownership verification — follow the prompts, you only need to host one static file, which can be removed after verification)
c. Configure web authorization, JS-SDK, and WeCom authorization login
d. You can set "Hide app in workbench" at the bottom of the WeCom Authorization Login page



4. Get the "Contact Sync Assistant" secret
Retrieving contacts and organization member IDs requires the "Contact Sync Assistant" secret
Security & Management -- Management Tools -- Contact Sync

5. Enable interface sync
6. Get the Secret
7. Configure enterprise trusted IPs

#### 2. yml Configuration Example
```yaml
fastgpt-sso:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.9.0
container_name: fastgpt-sso
restart: always
networks:
- fastgpt
environment:
- AUTH_TOKEN=xxxxx
- SSO_PROVIDER=wecom
# OAuth endpoint, used in WeCom client
- WECOM_TARGET_URL_OAUTH=https://open.weixin.qq.com/connect/oauth2/authorize
# SSO endpoint, QR code scan
- WECOM_TARGET_URL_SSO=https://login.work.weixin.qq.com/wwlogin/sso/login
# Get user ID (returns ID only)
- WECOM_GET_USER_ID_URL=https://qyapi.weixin.qq.com/cgi-bin/auth/getuserinfo
# Get detailed user info (everything except name)
- WECOM_GET_USER_INFO_URL=https://qyapi.weixin.qq.com/cgi-bin/auth/getuserdetail
# Get user info (has name, no other info)
- WECOM_GET_USER_NAME_URL=https://qyapi.weixin.qq.com/cgi-bin/user/get
# Get department ID list
- WECOM_GET_DEPARTMENT_LIST_URL=https://qyapi.weixin.qq.com/cgi-bin/department/list
# Get user ID list
- WECOM_GET_USER_LIST_URL=https://qyapi.weixin.qq.com/cgi-bin/user/list_id
# WeCom CorpId
- WECOM_CORPID=
# WeCom App AgentId, usually 1000xxx
- WECOM_AGENTID=
# WeCom App Secret
- WECOM_APP_SECRET=
# Contact Sync Assistant Secret
- WECOM_SYNC_SECRET=
```
### Standard OAuth 2.0
We provide OAuth 2.0 integration support using the authorization code grant from RFC 6749.
References:
* [RFC 6749](https://datatracker.ietf.org/doc/html/rfc6749) documentation
* [Ruan Yifeng's blog post on OAuth 2.0](https://www.ruanyifeng.com/blog/2014/05/oauth_2_0.html)
#### Parameter Requirements
##### Three Endpoints
We provide a standard OAuth 2.0 integration flow requiring three endpoints:
1. Login authorization endpoint (users are redirected here with parameters after clicking the SSO button), e.g., `http://example.com/oauth/authorize`
```bash
curl -X GET\
"http://example.com/oauth/authorize?response_type=code&client_id=s6BhdRkqt3&state=xyz&redirect_uri=https%3A%2F%2Ffastgpt.cn%2Flogin%2Fprovider"
```
After entering credentials, users are redirected to redirect\_uri with a code parameter:
`https://fastgpt.cn/login/provider?code=4/P7qD2qAz4&state=xyz`
2. Access token endpoint. After obtaining the code, make a *server-side request* to this endpoint to get the access\_token, e.g., `http://example.com/oauth/access_token`
```bash
curl -X POST\
-H "Content-Type: application/x-www-form-urlencoded"\
"http://example.com/oauth/access_token?grant_type=authorization_code&client_id=s6BhdRkqt3&client_secret=xxx&code=4/P7qD2qAz4&redirect_uri=https%3A%2F%2Ffastgpt.cn%2Flogin%2Fprovider"
```
Note: Content-Type must be application/x-www-form-urlencoded, not application/json
3. User info endpoint, requires passing the access\_token, e.g., `http://example.com/oauth/user_info`
```bash
curl -X GET\
-H "Authorization: Bearer 4/P7qD2qAz4"\
"http://example.com/oauth/user_info"
```
Note: access\_token is passed as the Authorization header in the format: Bearer xxxx
##### Parameter Configuration
* CLIENT\_ID: Required
* CLIENT\_SECRET: Optional, skip if not needed
* SCOPE: Optional, skip if not needed
> The redirect\_uri parameter is auto-populated based on the runtime environment
>
> Other fixed parameters like grant\_type and response\_type are auto-populated
#### Configuration Example
```yaml
fastgpt-sso:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.9.0
container_name: fastgpt-sso
restart: always
networks:
- fastgpt
environment:
- SSO_PROVIDER=oauth2
- AUTH_TOKEN=xxxxx
# OAuth2.0
# === Request URLs ===
# 1. OAuth2 login authorization URL (required)
- OAUTH2_AUTHORIZE_URL=
# 2. OAuth2 access token URL (required)
- OAUTH2_TOKEN_URL=
# 3. OAuth2 user info URL (required)
- OAUTH2_USER_INFO_URL=
# === Parameters ===
# 1. client_id (required)
- OAUTH2_CLIENT_ID=
# 2. client_secret (optional)
- OAUTH2_CLIENT_SECRET=
# 3. scope (optional)
- OAUTH2_SCOPE=
# === Field Mapping ===
# OAuth2 username field mapping (required)
- OAUTH2_USERNAME_MAP=
# OAuth2 avatar field mapping (optional)
- OAUTH2_AVATAR_MAP=
# OAuth2 member name field mapping (optional)
- OAUTH2_MEMBER_NAME_MAP=
# OAuth2 contact field mapping (optional)
- OAUTH2_CONTACT_MAP=
```
## Standard Interface Documentation
Below is the standard interface documentation for SSO and member sync in FastGPT-pro. If you need to integrate with a non-standard system, refer to this section for development.

FastGPT provides the following standard interfaces:
1. [https://example.com/login/oauth/getAuthURL](https://example.com/login/oauth/getAuthURL) - Get the authorization redirect URL
2. [https://example.com/login/oauth/getUserInfo?code=xxxxx](https://example.com/login/oauth/getUserInfo?code=xxxxx) - Consume the code and exchange it for user info
3. [https://example.com/org/list](https://example.com/org/list) - Get the organization list
4. [https://example.com/user/list](https://example.com/user/list) - Get the member list
### Get SSO Login Redirect URL
Returns a redirect login URL. FastGPT will automatically redirect to this URL. The redirect\_uri is automatically appended to the URL query string.
```bash
curl -X GET "https://redict.example/login/oauth/getAuthURL?redirect_uri=xxx&state=xxxx" \
-H "Authorization: Bearer your_token_here" \
-H "Content-Type: application/json"
```
Success:
```json
{
"success": true,
"message": "",
"authURL": "https://example.com/somepath/login/oauth?redirect_uri=https%3A%2F%2Ffastgpt.cn%2Flogin%2Fprovider%0A"
}
```
Failure:
```json
{
"success": false,
"message": "Error message",
"authURL": ""
}
```
### SSO Get User Info
This interface accepts a code parameter for authentication, consumes the code, and returns user info.
```bash
curl -X GET "https://oauth.example/login/oauth/getUserInfo?code=xxxxxx" \
-H "Authorization: Bearer your_token_here" \
-H "Content-Type: application/json"
```
Success:
```json
{
"success": true,
"message": "",
"username": "fastgpt-123456789",
"avatar": "https://example.webp",
"contact": "+861234567890",
"memberName": "Member name (optional)",
}
```
Failure:
```json
{
"success": false,
"message": "Error message",
"username": "",
"avatar": "",
"contact": ""
}
```
### Get Organizations
```bash
curl -X GET "https://example.com/org/list" \
-H "Authorization: Bearer your_token_here" \
-H "Content-Type: application/json"
```
Warning: Only one root department can exist. If your system has multiple root departments, you need to add a virtual root department first. Return type:
```ts
type OrgListResponseType = {
message?: string; // Error message
success: boolean;
orgList: {
id: string; // Unique department ID
name: string; // Name
parentId: string; // parentId — empty string for root department
}[];
}
```
```json
{
"success": true,
"message": "",
"orgList": [
{
"id": "od-125151515",
"name": "Root Department",
"parentId": ""
},
{
"id": "od-51516152",
"name": "Sub Department",
"parentId": "od-125151515"
}
]
}
```
### Get Members
```bash
curl -X GET "https://example.com/user/list" \
-H "Authorization: Bearer your_token_here" \
-H "Content-Type: application/json"
```
Return type:
```typescript
type UserListResponseListType = {
message?: string; // Error message
success: boolean;
userList: {
username: string; // Unique ID. username must match the username returned by the SSO interface. Must include a prefix, e.g., sync-aaaaa, consistent with the SSO interface prefix
memberName?: string; // Name, used as tmbname
avatar?: string;
contact?: string; // email or phone number
orgs?: string[]; // IDs of organizations the member belongs to. Pass [] if no organization
}[];
}
```
curl example
```json
{
"success": true,
"message": "",
"userList": [
{
"username": "fastgpt-123456789",
"memberName": "John Doe",
"avatar": "https://example.webp",
"contact": "+861234567890",
"orgs": ["od-125151515", "od-51516152"]
},
{
"username": "fastgpt-12345678999",
"memberName": "Jane Smith",
"avatar": "",
"contact": "",
"orgs": ["od-125151515"]
}
]
}
```
## How to Integrate Non-Standard Systems
1. Self-development: Build according to the standard interfaces provided by FastGPT, then enter the deployed service address into fastgpt-pro.
You can use this template repository as a starting point: [fastgpt-sso-template](https://github.com/labring/fastgpt-sso-template)
2. Custom development by the FastGPT team:
a. Provide the system's SSO documentation, member and organization retrieval documentation, and an external test address.
b. In fastgpt-sso-service, add the corresponding provider and environment variables, and write the integration code.
file: ./content/guide/admin/sso.mdx
meta: {
"title": "SSO & 外部成员同步",
"description": "FastGPT 外部成员系统接入设计与配置"
}
import { Alert } from '@/components/docs/Alert';
如果你不需要用到 SSO/成员同步功能,或者是只需要用 Github、google、microsoft、公众号的快速登录,可以跳过本章节。本章适合需要接入自己的成员系统或主流 办公IM 的用户。
## 介绍
为了方便地接入**外部成员系统**,FastGPT 提供一套接入外部系统的**标准接口**,以及一个 FastGPT-SSO-Service 镜像作为**适配器**。
通过这套标准接口,你可以可以实现:
1. SSO 登录。从外部系统回调后,在 FastGPT 中创建一个用户。
2. 成员和组织架构同步(下面都简称成员同步)。
**原理**
FastGPT-pro 中,有一套标准的SSO 和成员同步接口,系统会根据这套接口进行 SSO 和成员同步操作。
FastGPT-SSO-Service 是为了聚合不同来源的 SSO 和成员同步接口,将他们转成 fastgpt-pro 可识别的接口。

## 系统配置教程
### 1. 部署 SSO-service 镜像
使用 docker-compose 部署:
```yaml
fastgpt-sso:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.14.16 # 目前sso最新版本,可直接使用当前版本
container_name: fastgpt-sso
restart: always
networks:
- fastgpt
environment:
- SSO_PROVIDER=example
- AUTH_TOKEN=xxxxx # 鉴权信息,fastgpt-pro 会用到。
# 具体对接提供商的环境变量。
```
根据不同的提供商,你需要配置不同的环境变量,下面是内置的通用协议/IM:
### Multi-team Mode (Default)
In multi-team mode, a default team owned by the user is automatically created when each user is created.
### Single-team Mode
Single-team mode is a new feature introduced in v4.9. To simplify personnel and resource management for enterprises, when single-team mode is enabled, new users no longer get their own default team — instead, they are added to the root user's team.
### Sync Mode
When system configuration is complete and sync mode is enabled, members from external member systems are automatically synced to FastGPT.
For specific sync methods and rules, see [SSO & External Member Sync](./sso.en.mdx).
## Configuration
In `fastgpt-pro`'s System Configuration - Member Configuration, you can configure the team mode.

file: ./content/guide/admin/teamMode.mdx
meta: {
"title": "团队模式说明文档",
"description": "FastGPT 团队模式说明文档"
}
## 介绍
目前支持的团队模式:
1. 多团队模式(默认模式)
2. 单团队模式(全局只有一个团队)
3. 成员同步模式(所有成员自外部同步)
Only one speech recognition model can be active at a time, so you only need to configure one.
The system requires at least one language model and one embedding model to function properly.
### Architecture Diagram

### Model Types
1. Language Models - Text-based conversations; multimodal models also support image recognition.
2. Embedding Models - Index text chunks for semantic text retrieval.
3. Rerank Models - Reorder retrieval results to optimize search ranking.
4. Text-to-Speech (TTS) - Convert text to audio.
5. Speech-to-Text (STT) - Convert audio to text.
### Key Terminology
* Model ID: The value of the `model` field in the API request body. Must be globally unique.
* Model Name: The display name of the model, which can be customized.
* Model Channel: The protocol of different model providers, such as OpenAI, Anthropic, Google, etc. Most self-hosted channels follow the OpenAI protocol. A single model can be configured across multiple channels to enable load balancing.
* Custom Request URL / Key: Allows you to bypass Model Channels and send requests directly to a custom endpoint. You need to provide the full request URL and token. Generally not needed (not recommended as it's harder to manage).
## Adding Channels and Models
You can configure models from the `Account - Model Providers` page in FastGPT.
### 1. Create a Channel
Switch to the `Model Channels` tab. Note that you can only add models that already exist in `Model Configuration`. The system only includes mainstream models by default — if you need additional models, add them in `Model Configuration` first.

Click "Add Channel" in the top-right corner to open the channel configuration page.

Using Alibaba Bailian models as an example:

1. Channel Name: A display label for the channel, used for identification only.
2. Protocol Type: The API protocol for the model. Generally, select the provider that offers the model. Most providers support the OpenAI protocol, so you can also choose OpenAI as the protocol type.
3. Models: The specific models available in this channel. The system includes popular models by default. If the model you need isn't in the dropdown, click "Add Model" to [add a custom model](./intro.en.mdx#add-a-custom-model).
4. Model Mapping: Maps the model name in FastGPT requests to the actual model name at the provider. For example:
```json
{
"gpt-4o-test": "gpt-4o"
}
```
In FastGPT, the model is `gpt-4o-test`, and requests to AI Proxy also use `gpt-4o-test`. When AI Proxy forwards the request upstream, the actual `model` value becomes `gpt-4o`.
5. Proxy URL: Do not enter the full model request URL. Enter the `BaseUrl` instead, and check whether `/v1` needs to be appended.
6. API Key: The API credentials obtained from the model provider. Some providers require multiple keys — follow the on-screen prompts to enter them.
Click "Add" to save. The new channel will appear under "Model Channels".

### 2. Channel Testing
You can test the channel to verify that the configured models are working properly.

Click "Model Test" to see the list of configured models, then click "Start Test".

Once testing completes, you'll see the results and response times for each model.

### 3. Enable Models
The system includes models from major providers by default. If you're not familiar with the configuration, simply click `Enable`. The `Model ID` corresponds to the `Model` in `Model Channels`.
Click "Enable" to activate the model.
| Enable Models | Model ID Mapping |
| ------------------------------------------------- | -------------------------------------------------- |
|  |  |
### 4. Test Models
FastGPT provides simple tests for each model type on the UI to verify that models are working correctly. Each test sends an actual request using a template.

## Model Configuration
### Edit Model Configuration
Click the gear icon next to a model to open its configuration. Different model types have different configuration options.
| | |
| ------------------------------------------------- | ------------------------------------------------- |
|  |  |
### Add a Custom Model
If the built-in models don't meet your needs, you can add custom models. If the `Model ID` matches an existing built-in model ID, it will be treated as a modification rather than a new model.
1. **Add via Form**
| | |
| ------------------------------------------------- | ------------------------------------------------- |
|  |  |
2. **Add via Configuration File**
If you find it tedious to configure models through the UI, you can use a configuration file instead. This is also useful for quickly replicating the configuration from one system to another.
| | |
| ------------------------------------------------- | ------------------------------------------------- |
|  |  |
```json
{
"model": "Model ID",
"metadata": {
"isCustom": true, // Whether this is a custom model
"isActive": true, // Whether the model is enabled
"provider": "OpenAI", // Model provider, used for categorization. Built-in providers: https://github.com/labring/FastGPT/blob/main/packages/global/core/ai/provider.ts. You can submit a PR for new providers, or use "Other"
"model": "gpt-5", // Model ID (corresponds to the model name in the channel)
"name": "gpt-5", // Display name
"maxContext": 125000, // Maximum context length
"maxResponse": 16000, // Maximum response length
"quoteMaxToken": 120000, // Maximum citation content tokens
"maxTemperature": 1.2, // Maximum temperature
"charsPointsPrice": 0, // Credits per 1k tokens (commercial edition)
"censor": false, // Enable content moderation (commercial edition)
"vision": true, // Supports image input
"toolChoice": true, // Supports tool selection (used in classification, extraction, and tool calls)
"functionCall": false, // Supports function calling (used in classification, extraction, and tool calls). toolChoice takes priority; if false, functionCall is used; if also false, prompt mode is used
"customCQPrompt": "", // Custom text classification prompt (for models without tool/function call support)
"customExtractPrompt": "", // Custom content extraction prompt
"defaultSystemChatPrompt": "", // Default system prompt included in conversations
"defaultConfig": {}, // Default config sent with API requests (e.g., GLM4's top_p)
"fieldMap": {} // Field mapping (e.g., o1 models need max_tokens mapped to max_completion_tokens)
}
}
```
```json
{
"model": "Model ID",
"metadata": {
"isCustom": true, // Whether this is a custom model
"isActive": true, // Whether the model is enabled
"provider": "OpenAI", // Model provider
"model": "text-embedding-3-small", // Model ID
"name": "text-embedding-3-small", // Display name
"charsPointsPrice": 0, // Credits per 1k tokens
"defaultToken": 512, // Default token count for text splitting
"maxToken": 3000 // Maximum token count
}
}
```
```json
{
"model": "Model ID",
"metadata": {
"isCustom": true, // Whether this is a custom model
"isActive": true, // Whether the model is enabled
"provider": "BAAI", // Model provider
"model": "bge-reranker-v2-m3", // Model ID
"name": "ReRanker-Base", // Display name
"requestUrl": "", // Custom request URL
"requestAuth": "", // Custom request authentication
"type": "rerank" // Model type
}
}
```
```json
{
"model": "Model ID",
"metadata": {
"isActive": true, // Whether the model is enabled
"isCustom": true, // Whether this is a custom model
"type": "tts", // Model type
"provider": "FishAudio", // Model provider
"model": "fishaudio/fish-speech-1.5", // Model ID
"name": "fish-speech-1.5", // Display name
"voices": [
// Available voices
{
"label": "fish-alex", // Voice name
"value": "fishaudio/fish-speech-1.5:alex" // Voice ID
},
{
"label": "fish-anna", // Voice name
"value": "fishaudio/fish-speech-1.5:anna" // Voice ID
}
],
"charsPointsPrice": 0 // Credits per 1k tokens
}
}
```
```json
{
"model": "whisper-1",
"metadata": {
"isActive": true, // Whether the model is enabled
"isCustom": true, // Whether this is a custom model
"provider": "OpenAI", // Model provider
"model": "whisper-1", // Model ID
"name": "whisper-1", // Display name
"charsPointsPrice": 0, // Credits per 1k tokens
"type": "stt" // Model type
}
}
```
## Other
### Channel Priority
Range: 1–100. Higher values are prioritized.

### Enable / Disable Channels
In the control menu on the right side of each channel, you can enable or disable it. Disabled channels will no longer serve model requests.

### Model Call Logs
Model calls made through channels are logged on the `Call Logs` page. Logs include input/output tokens, request time, latency, request URL, and more. Failed requests show detailed parameters and error messages for debugging, but logs are retained for only 1 hour by default (configurable via environment variables).

### Self-Hosted Models
[See the ReRank model deployment tutorial](../../custom-models/bge-rerank.en.mdx)
### Custom Request URL
If you set a custom request URL, requests will bypass `Model Channels` and be sent directly to the specified endpoint. You must provide the full request URL, for example:
* LLM: \[host]/v1/chat/completions
* Embedding: \[host]/v1/embeddings
* STT: \[host]/v1/audio/transcriptions
* TTS: \[host]/v1/audio/speech
* Rerank: \[host]/v1/rerank
The custom request key is included as the `Authorization: Bearer xxx` header when sending requests to the custom URL.
All endpoints follow the OpenAI model format. Refer to the [OpenAI API documentation](https://platform.openai.com/docs/api-reference/guide) for details.
Since OpenAI does not provide a Rerank model, the Rerank endpoint follows the Cohere format. [See request examples](../../troubleshooting/model-errors.en.mdx)
### Migrating from OneAPI to AI Proxy
If you were using OneAPI in an older version, you can migrate your channel configuration to AI Proxy using a script.
Send the following HTTP request from any terminal. Replace `{{host}}` with the AI Proxy address and `{{admin_key}}` with the `ADMIN_KEY` value in AI Proxy.
The `dsn` parameter in the request body is the MySQL connection string for OneAPI.
```bash
curl --location --request POST '{{host}}/api/channels/import/oneapi' \
--header 'Authorization: Bearer {{admin_key}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"dsn": "mysql://root:s5mfkwst@tcp(dbconn.sealoshzh.site:33123)/mydb"
}'
```
A successful response will return `"success": true`.
Note that the migration script performs a simple data mapping — it primarily transfers `proxy URLs`, `models`, and `API keys`. Manual verification after migration is recommended.
file: ./content/self-host/config/model/intro.mdx
meta: {
"title": "模型配置说明",
"description": "FastGPT 模型配置说明"
}
import { Alert } from '@/components/docs/Alert';
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
## 介绍
FastGPT 借助 `AI Proxy` 服务,可以连接到不同的模型提供商。同时 `AI Proxy` 还提供了负载均衡、模型日志、数据看板等能力,方便检测模型调用情况。
注意事项:
目前语音识别模型仅会生效一个,所以配置时候,只需要配置一个即可。
系统至少需要一个语言模型和一个索引模型才能正常使用。
### 运行流程图

### 模型类型
1. 语言模型 - 进行文本对话,多模态模型支持图片识别。
2. 索引模型 - 对文本块进行索引,用于相关文本检索。
3. 重排模型 - 对检索结果进行重排,用于优化检索排名。
4. 语音合成 - 将文本转换为语音。
5. 语音识别 - 将语音转换为文本。
### 特殊术语介绍
* 模型 ID:接口请求时候,Body 中 `model` 字段的值,全局唯一。
* 模型名: 用于展示的模型名称,可以自定义。
* 模型渠道:不同的模型提供商协议,例如 OpenAI、Anthropic、Google 等。大部分自建渠道都遵守 OpenAI 的协议。一个模型可以在配置在不同渠道中,实现负载均衡。
* 自定义请求地址/Key:如果需要绕过 `模型渠道`,可以设置自定义请求地址和 Token。一般情况下不需要。(不推荐使用,不方便管理)
## 添加渠道/模型
可以 FastGPT 中 `账号-模型提供商` 页面中进行模型配置。
### 1. 创建渠道
切换到 `模型渠道` 标签页。注意,这里只能增加 `模型配置` 里有的模型,系统仅内置了主流的模型,如果需要增加其他模型,需要先在 `模型配置` 中增加。

点击右上角的“新增渠道”,即可进入渠道配置页面

以阿里百炼的模型为例,进行如下配置

1. 渠道名:展示在外部的渠道名称,仅作标识;
2. 协议类型:模型对应的协议类型,一般哪家提供的模型就选对于服务商即可。大多数都提供了 OpenAI 的协议,也可以选择 OpenAI 协议类型。
3. 模型:当前渠道具体可以使用的模型,系统内置了主流的一些模型,如果下拉框中没有想要的选项,可以点击“新增模型”,[增加自定义模型](./intro.mdx#新增自定义模型);
4. 模型映射:将 FastGPT 请求的模型,映射到具体提供的模型上。例如:
```json
{
"gpt-4o-test": "gpt-4o"
}
```
FatGPT 中的模型为 `gpt-4o-test`,向 AI Proxy 发起请求时也是 `gpt-4o-test`。AI proxy 在向上游发送请求时,实际的 `model` 为 `gpt-4o`。
5. 代理地址:不要填完整的模型请求地址,要填写 `BaseUrl`,注意是否需要增加 `/v1`
6. API 密钥:从模型厂商处获取的 API 凭证。注意部分厂商需要提供多个密钥组合,可以根据提示进行输入。
最后点击“新增”,就能在“模型渠道”下看到刚刚配置的渠道

### 2. 渠道测试
然后可以对渠道进行测试,确保配置的模型有效

点击“模型测试”,可以看到配置的模型列表,点击“开始测试”

等待模型测试完成后,会输出每个模型的测试结果以及请求时长

### 3. 启用模型
系统内置了目前主流厂商的模型,如果你不熟悉配置,直接点击 `启用` 即可。`模型 ID` 是和 `模型渠道` 中的 `模型` 一致。
点击启用模型,即可使用。
| 启用模型 | 模型 ID 映射说明 |
| ------------------------------------------------- | -------------------------------------------------- |
|  |  |
### 4. 测试模型
FastGPT 页面上提供了每类模型的简单测试,可以初步检查模型是否正常工作,会实际按模板发送一个请求。

## 模型配置
### 修改模型配置
点击模型右侧的齿轮即可进行模型配置,不同类型模型的配置有区别。
| | |
| ------------------------------------------------- | ------------------------------------------------- |
|  |  |
### 新增自定义模型
如果系统内置的模型无法满足你的需求,你可以添加自定义模型。如果 `模型 ID` 与系统内置的模型 ID 重复,则会被认为是修改系统模型,而不是新增模型。
1. **通过表单添加模型**
| | |
| ------------------------------------------------- | ------------------------------------------------- |
|  |  |
2. **通过配置文件配置**
如果你觉得通过页面配置模型比较麻烦,你也可以通过配置文件来配置模型。或者希望快速将一个系统的配置,复制到另一个系统,也可以通过配置文件来实现。
| | |
| ------------------------------------------------- | ------------------------------------------------- |
|  |  |
```json
{
"model": "模型 ID",
"metadata": {
"isCustom": true, // 是否为自定义模型
"isActive": true, // 是否启用
"provider": "OpenAI", // 模型提供商,主要用于分类展示,目前已经内置提供商包括:https://github.com/labring/FastGPT/blob/main/packages/global/core/ai/provider.ts, 可 pr 提供新的提供商,或直接填写 Other
"model": "gpt-5", // 模型ID(对应OneAPI中渠道的模型名)
"name": "gpt-5", // 模型别名
"maxContext": 125000, // 最大上下文
"maxResponse": 16000, // 最大回复
"quoteMaxToken": 120000, // 最大引用内容
"maxTemperature": 1.2, // 最大温度
"charsPointsPrice": 0, // n积分/1k token(商业版)
"censor": false, // 是否开启敏感校验(商业版)
"vision": true, // 是否支持图片输入
"toolChoice": true, // 是否支持工具选择(分类,内容提取,工具调用会用到。)
"functionCall": false, // 是否支持函数调用(分类,内容提取,工具调用会用到。会优先使用 toolChoice,如果为false,则使用 functionCall,如果仍为 false,则使用提示词模式)
"customCQPrompt": "", // 自定义文本分类提示词(不支持工具和函数调用的模型
"customExtractPrompt": "", // 自定义内容提取提示词
"defaultSystemChatPrompt": "", // 对话默认携带的系统提示词
"defaultConfig": {}, // 请求API时,挟带一些默认配置(比如 GLM4 的 top_p)
"fieldMap": {} // 字段映射(o1 模型需要把 max_tokens 映射为 max_completion_tokens)
}
}
```
```json
{
"model": "模型 ID",
"metadata": {
"isCustom": true, // 是否为自定义模型
"isActive": true, // 是否启用
"provider": "OpenAI", // 模型提供商
"model": "text-embedding-3-small", // 模型ID
"name": "text-embedding-3-small", // 模型别名
"charsPointsPrice": 0, // n积分/1k token
"defaultToken": 512, // 默认文本分割时候的 token
"maxToken": 3000 // 最大 token
}
}
```
```json
{
"model": "模型 ID",
"metadata": {
"isCustom": true, // 是否为自定义模型
"isActive": true, // 是否启用
"provider": "BAAI", // 模型提供商
"model": "bge-reranker-v2-m3", // 模型ID
"name": "ReRanker-Base", // 模型别名
"requestUrl": "", // 自定义请求地址
"requestAuth": "", // 自定义请求认证
"type": "rerank" // 模型类型
}
}
```
```json
{
"model": "模型 ID",
"metadata": {
"isActive": true, // 是否启用
"isCustom": true, // 是否为自定义模型
"type": "tts", // 模型类型
"provider": "FishAudio", // 模型提供商
"model": "fishaudio/fish-speech-1.5", // 模型ID
"name": "fish-speech-1.5", // 模型别名
"voices": [
// 音色
{
"label": "fish-alex", // 音色名称
"value": "fishaudio/fish-speech-1.5:alex" // 音色ID
},
{
"label": "fish-anna", // 音色名称
"value": "fishaudio/fish-speech-1.5:anna" // 音色ID
}
],
"charsPointsPrice": 0 // n积分/1k token
}
}
```
```json
{
"model": "whisper-1",
"metadata": {
"isActive": true, // 是否启用
"isCustom": true, // 是否为自定义模型
"provider": "OpenAI", // 模型提供商
"model": "whisper-1", // 模型ID
"name": "whisper-1", // 模型别名
"charsPointsPrice": 0, // n积分/1k token
"type": "stt" // 模型类型
}
}
```
## 其他
### 渠道优先级
范围 1~100。数值越大,越容易被优先选中。

### 启用/禁用渠道
在渠道右侧的控制菜单中,还可以控制渠道的启用或禁用,被禁用的渠道将无法再提供模型服务

### 模型调用日志
通过渠道调用的模型,可以在 `调用日志` 页面,会展示发送到模型处的请求记录,包括具体的输入输出 tokens、请求时间、请求耗时、请求地址等等。错误的请求,则会详细的入参和错误信息,方便排查,但仅会保留 1 小时(环境变量里可配置)。

### 私有部署模型
[点击查看部署 ReRank 模型教程](../../custom-models/bge-rerank.mdx)
### 自定义请求地址说明
如果填写了该值,则可以允许你绕过 `模型渠道`,直接向自定义请求地址发起请求。需要填写完整的请求地址,例如:
* LLM: \[host]/v1/chat/completions
* Embedding: \[host]/v1/embeddings
* STT: \[host]/v1/audio/transcriptions
* TTS: \[host]/v1/audio/speech
* Rerank: \[host]/v1/rerank
自定义请求 Key,则是向自定义请求地址发起请求时候,携带请求头:Authorization: Bearer xxx 进行请求。
所有接口均遵循 OpenAI 提供的模型格式,可参考 [OpenAI API 文档](https://platform.openai.com/docs/api-reference/guide) 进行配置。
由于 OpenAI 没有提供 ReRank 模型,遵循的是 Cohere 的格式。[点击查看接口请求示例](../../troubleshooting/model-errors.mdx)
### 从 OneAPI 迁移到 AI Proxy
对于旧版使用 OneAPI 的用户,可以通过脚本将 OneAPI 里的渠道配置迁移到 AI Proxy。
可以从任意终端,发起 1 个 HTTP 请求。其中 `{{host}}` 替换成 AI Proxy 地址,`{{admin_key}}` 替换成 AI Proxy 中 `ADMIN_KEY` 的值。
Body 参数 `dsn` 为 OneAPI 的 mysql 连接串。
```bash
curl --location --request POST '{{host}}/api/channels/import/oneapi' \
--header 'Authorization: Bearer {{admin_key}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"dsn": "mysql://root:s5mfkwst@tcp(dbconn.sealoshzh.site:33123)/mydb"
}'
```
执行成功的情况下会返回 "success": true
脚本目前不是完全准,仅是简单的做数据映射,主要是迁移 `代理地址`、`模型` 和 `API 密钥`,建议迁移后再进行手动检查。
file: ./content/self-host/config/model/minimax.en.mdx
meta: {
"title": "MiniMax Integration Example",
"description": "MiniMax integration example for FastGPT"
}
[MiniMax](https://www.minimaxi.com) is an AI technology company that provides high-performance large language model API services. MiniMax's API is compatible with the OpenAI format, making it easy to integrate with FastGPT.
Before reading this guide, make sure you've read the [Model Configuration Guide](./intro.en.mdx).
## 1. Get an API Key
1. Visit [MiniMax Platform](https://platform.minimaxi.com), register and log in.
2. Go to the console and create an API Key.
## 2. Add Models
The system includes built-in MiniMax models. Simply search for `MiniMax` on the `Model Configuration` page and enable the models you need. If you need additional models, you can [add them manually](./intro.en.mdx#add-a-custom-model).
### Built-in Model List
| Model ID | Context | Max Output | Description |
| ------------------------ | ------- | ---------- | ------------------------------------------------------------ |
| `MiniMax-M3` | 512K | 128K | Latest flagship model with image input support (**default**) |
| `MiniMax-M2.7` | 128K | 8K | Previous generation model |
| `MiniMax-M2.7-highspeed` | 128K | 8K | Previous generation low-latency variant |
## 3. Add a Model Channel
On the Model Channels page, add a new MiniMax channel:
* Protocol type: Select **MiniMax**
* Proxy URL: `https://api.minimax.io/v1`
* Enter your MiniMax API Key
* Select the models you just enabled
## 4. Test Models
After configuration, click the test button in the channel list to verify the models are working properly.
file: ./content/self-host/config/model/minimax.mdx
meta: {
"title": "MiniMax 接入示例",
"description": "MiniMax 接入示例"
}
[MiniMax](https://www.minimaxi.com) 是一家通用人工智能科技公司,提供高性能的大语言模型 API 服务。MiniMax 的 API 兼容 OpenAI 格式,可以方便地接入 FastGPT。
在阅读该章之前,请先确保你阅读了[模型配置说明](./intro.mdx)。
## 1. 获取 API Key
1. 访问 [MiniMax 开放平台](https://platform.minimaxi.com),注册并登录账号。
2. 进入控制台,创建 API Key。
## 2. 新增模型
系统内置了 MiniMax 的模型,直接在`模型配置`页面搜索 `MiniMax` 并启用即可。如果需要其他模型,可以[手动添加](./intro.mdx#新增自定义模型)。
### 内置模型列表
| 模型 ID | 上下文 | 最大输出 | 说明 |
| ------------------------ | ---- | ---- | ----------------------- |
| `MiniMax-M3` | 512K | 128K | 最新一代旗舰模型,支持图片输入(**默认**) |
| `MiniMax-M2.7` | 128K | 8K | 上一代模型 |
| `MiniMax-M2.7-highspeed` | 128K | 8K | 上一代低延迟版本 |
## 3. 新增模型渠道
在模型渠道页,新增一个 MiniMax 的渠道:
* 协议类型选择 **MiniMax**
* 代理地址填写:`https://api.minimax.io/v1`
* 填写 MiniMax 的 API Key
* 选择刚刚启用的模型
## 4. 测试模型
配置完成后,可以在渠道列表中点击测试按钮,验证模型是否正常工作。
file: ./content/self-host/config/model/siliconCloud.en.mdx
meta: {
"title": "SiliconCloud Integration Example",
"description": "SiliconCloud integration example for FastGPT"
}
[SiliconCloud](https://cloud.siliconflow.cn/i/TR9Ym0c4) is a platform focused on open source model inference, with its own acceleration engine. It helps users test and use open source models quickly at low cost. In our experience, their models offer solid speed and stability, with a wide variety covering language, embedding, reranking, TTS, STT, image generation, and video generation — meeting all model requirements in FastGPT.
Before reading this guide, make sure you've read the [Model Configuration Guide](./intro.en.mdx).
## 1. Register an Account
1. [Register a SiliconCloud account](https://cloud.siliconflow.cn/i/TR9Ym0c4)
2. Go to the console and get your API key: [https://cloud.siliconflow.cn/account/ak](https://cloud.siliconflow.cn/account/ak)
## 2. Add Models
The system includes a few SiliconCloud models by default for quick testing. If you need additional models, you can [add them manually](./intro.en.mdx#add-a-custom-model).
Here we enable `Qwen2.5 72b` for both text and vision; `bge-m3` as the embedding model; `bge-reranker-v2-m3` as the reranking model; `fish-speech-1.5` as the TTS model; and `SenseVoiceSmall` as the STT model.

## 3. Add a Model Channel
On the Model Channels page, add a new SiliconCloud channel and select the models you just added.

## 4. Test Models
First, verify that all SiliconCloud models are running properly.

## 5. Test in an App
### Test Chat and Image Recognition
Create a simple app, select the corresponding model, enable image upload, and test:
| | |
| ------------------------------------------------- | ------------------------------------------------- |
|  |  |
The 72B model performs quite fast. Without several 4090 GPUs locally, just the output alone would take around 30 seconds — not to mention the environment setup.
### Test Knowledge Base Import and Q\&A
Create a knowledge base (since only one embedding model is configured, the embedding model selector won't appear on the page):
| | |
| ------------------------------------------------- | ------------------------------------------------- |
|  |  |
Import a local file — just select the file and click through the steps. 79 indexes were completed in about 20 seconds. Now let's test knowledge base Q\&A.
Go back to the app we just created, select the knowledge base, adjust the parameters, and start a conversation:
| | | |
| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- |
|  |  |  |
After the conversation, click the citation at the bottom to view citation details, including retrieval and reranking scores:
| | |
| ------------------------------------------------- | ------------------------------------------------- |
|  |  |
### Test Text-to-Speech
In the same app, find "Voice Playback" in the left sidebar configuration. Click to select a voice model from the popup and preview it:

### Test Speech-to-Text
In the same app, find "Voice Input" in the left sidebar configuration. Click to enable voice input from the popup:

Once enabled, a microphone icon appears in the chat input box. Click it to start voice input:
| | |
| ------------------------------------------------- | ------------------------------------------------- |
|  |  |
## Summary
If you want to quickly try open source models or get started with FastGPT without applying for API keys from multiple providers, SiliconCloud is a great option for a fast start.
If you plan to self-host models and FastGPT in the future, you can use SiliconCloud for initial testing and validation, then proceed with hardware procurement later — reducing POC time and cost.
file: ./content/self-host/config/model/siliconCloud.mdx
meta: {
"title": "硅基流动接入示例",
"description": "硅基流动接入示例"
}
[SiliconCloud(硅基流动)](https://cloud.siliconflow.cn/i/TR9Ym0c4) 是一个以提供开源模型调用为主的平台,并拥有自己的加速引擎。帮助用户低成本、快速的进行开源模型的测试和使用。实际体验下来,他们家模型的速度和稳定性都非常不错,并且种类丰富,覆盖语言、向量、重排、TTS、STT、绘图、视频生成模型,可以满足 FastGPT 中所有模型需求。
在阅读该章之前,请先确保你阅读了[模型配置说明](./intro.mdx)。
## 1. 注册账号
1. [点击注册硅基流动账号](https://cloud.siliconflow.cn/i/TR9Ym0c4)
2. 进入控制台,获取 API key: [https://cloud.siliconflow.cn/account/ak](https://cloud.siliconflow.cn/account/ak)
## 2. 新增模型
系统内置了几个硅基流动的模型进行体验,如果需要其他模型,可以[手动添加](./intro.mdx#新增自定义模型)。
这里启动了 `Qwen2.5 72b` 的纯语言和视觉模型;选择 `bge-m3` 作为向量模型;选择 `bge-reranker-v2-m3` 作为重排模型。选择 `fish-speech-1.5` 作为语音模型;选择 `SenseVoiceSmall` 作为语音输入模型。

## 3. 新增模型渠道
在模型渠道页,新增一个硅基流动的渠道,选择刚刚添加的模型即可。

## 4. 测试模型
先测试下硅基流动的模型是否均可正常运行。

## 5. 在应用中测试
### 测试对话和图片识别
随便新建一个简易应用,选择对应模型,并开启图片上传后进行测试:
| | |
| ------------------------------------------------- | ------------------------------------------------- |
|  |  |
可以看到,72B 的模型,性能还是非常快的,这要是本地没几个 4090,不说配置环境,输出怕都要 30s 了。
### 测试知识库导入和知识库问答
新建一个知识库(由于只配置了一个向量模型,页面上不会展示向量模型选择)
| | |
| ------------------------------------------------- | ------------------------------------------------- |
|  |  |
导入本地文件,直接选择文件,然后一路下一步即可。79 个索引,大概花了 20s 的时间就完成了。现在我们去测试一下知识库问答。
首先回到我们刚创建的应用,选择知识库,调整一下参数后即可开始对话:
| | | |
| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- |
|  |  |  |
对话完成后,点击底部的引用,可以查看引用详情,同时可以看到具体的检索和重排得分:
| | |
| ------------------------------------------------- | ------------------------------------------------- |
|  |  |
### 测试语音播放
继续在刚刚的应用中,左侧配置中找到语音播放,点击后可以从弹窗中选择语音模型,并进行试听:

### 测试语言输入
继续在刚刚的应用中,左侧配置中找到语音输入,点击后可以从弹窗中开启语言输入

开启后,对话输入框中,会增加一个话筒的图标,点击可进行语音输入:
| | |
| ------------------------------------------------- | ------------------------------------------------- |
|  |  |
## 总结
如果你想快速的体验开源模型或者快速的使用 FastGPT,不想在不同服务商申请各类 Api Key,那么可以选择 SiliconCloud 的模型先进行快速体验。
如果你决定未来私有化部署模型和 FastGPT,前期可通过 SiliconCloud 进行测试验证,后期再进行硬件采购,减少 POC 时间和成本。
file: ./content/self-host/config/sandbox/common.en.mdx
meta: {
"title": "General Sandbox Configuration",
"description": "General FastGPT Agent Sandbox configuration"
}
This page covers shared Agent Sandbox configuration for both `opensandbox` and `sealosdevbox`. Provider-specific settings are documented on each provider page. Regardless of the provider, you need to deploy `fastgpt-agent-sandbox-proxy` and optionally configure package mirrors for the sandbox runtime.
## Deploy sandbox-proxy
### 1. Add the yml service
Use [agent-sandbox-proxy.yml](/deploy/sandbox_deploy/agent-proxy.yml) as a reference and add the service to your yml file. Expose the external access port and record the `AGENT_SANDBOX_PROXY_SECRET` value, which you will need in the next step.
FastGPT uses this proxy when accessing the sandbox file system.
**Proxy service environment variables**
| Variable | Default | Description |
| ---------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| `PORT` | `1006` | Listening port for `fastgpt-agent-sandbox-proxy`. |
| `AGENT_SANDBOX_PROXY_SECRET` | None | Secret shared with the FastGPT main service. Must be at least 32 characters. |
| `FASTGPT_APP_URL` | `http://fastgpt-app:3000` | Internal URL of the FastGPT main service. The proxy and FastGPT must be able to reach each other on the network. |
| `FASTGPT_APP_REQUEST_TIMEOUT_SECS` | `10` | Timeout, in seconds, for proxy requests back to the FastGPT main service. Increase it if sandbox cold starts take longer. |
| `RUST_LOG` | `info,fastgpt_agent_sandbox_proxy=debug` | Log level for the proxy service. |
### 2. Update FastGPT environment variables
Add the following three environment variables to `fastgpt-app`:
```dotenv
# Must match AGENT_SANDBOX_PROXY_SECRET in fastgpt-agent-sandbox-proxy. Use a random secret longer than 32 characters in production.
AGENT_SANDBOX_PROXY_SECRET=replace_with_32_chars_random_secret
# Browser-accessible WebSocket URL for agent-sandbox-proxy. Use wss:// when proxying through an HTTPS domain.
AGENT_SANDBOX_PROXY_URL=wss://sandbox-proxy.example.com
# Browser-accessible HTTP(S) URL for Sandbox file previews
AGENT_SANDBOX_PREVIEW_PROXY_URL=https://sandbox-proxy.example.com
```
`fastgpt-pro` does not provide the Sandbox Editor or WebSocket proxy path, so it does not require `AGENT_SANDBOX_PROXY_SECRET` or `AGENT_SANDBOX_PROXY_URL`. However, when Agent Sandbox is enabled, you must add `AGENT_SANDBOX_PREVIEW_PROXY_URL` to `fastgpt-pro`. It can use the same value as `fastgpt-app`.
We strongly recommend hosting the preview proxy on an origin separate from the FastGPT application, with a different scheme, host, or port. HTML files in a Sandbox may contain user-generated scripts. If previews share the FastGPT application origin, those scripts run inside the application's same-origin security boundary and may be able to access application credentials or APIs. FastGPT currently validates only that this variable uses `http://` or `https://`; it does not enforce origin isolation.
Preview URLs are temporary, read-only bearer capabilities. Anyone with a URL can change its path to read other files in the same Sandbox Workspace while the URL remains valid. Do not share a preview URL with anyone who should not have access to that Workspace.
### 3. Verify startup
1. Restart `fastgpt-app`, `fastgpt-pro`, and `fastgpt-agent-sandbox-proxy`.
2. Visit `https://agent-proxy-domain/health`. It should return `OK`.
### 4. Deploy a sandbox provider
After deploying the proxy service, connect one of the supported sandbox providers:
* [Sealos Cloud Sandbox](./sealosdevbox)
* [OpenSandbox Deployment](./opensandbox)
## Additional Configuration
### Custom package mirrors
If the sandbox needs to install npm or Python dependencies, configure package mirrors in both `fastgpt-app` and `fastgpt-pro`. During Agent Sandbox initialization, FastGPT writes these settings for npm, yarn, pnpm, bun, pip, and uv.
```dotenv
# npm registry used by npm/yarn/pnpm/bun inside Agent Sandbox
AGENT_SANDBOX_NPM_REGISTRY=https://registry.npmmirror.com
# PyPI index URL used by pip/python -m pip/uv inside Agent Sandbox
AGENT_SANDBOX_PYPI_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
```
### Resource limit variables
Configure the following variables in `fastgpt-app` and `fastgpt-pro` when you need to adjust resource limits:
| Variable | Default | Description |
| ------------------------------------ | ---------- | ------------------------------------------------------------------------------------------------------------------------ |
| `AGENT_SANDBOX_CPU_COUNT` | `1` | Maximum CPU count for each Agent Sandbox instance. |
| `AGENT_SANDBOX_MEMORY_MIB` | `2048` | Maximum memory for each Agent Sandbox instance, in MiB. |
| `AGENT_SANDBOX_STORAGE_SIZE_GI` | `1` | Agent Sandbox storage size in Gi. FastGPT derives its archive, Skill, and single-file limits as storage in MB / 2 - 150. |
| `AGENT_SANDBOX_WS_MAX_MESSAGE_BYTES` | `67108864` | Maximum IDE Agent WebSocket message size in bytes. |
| `AGENT_SANDBOX_WS_MAX_FRAME_BYTES` | `16777216` | Maximum IDE Agent WebSocket frame size in bytes. |
### Lifecycle variables
| Variable | Default | Description |
| ------------------------------------- | ------- | ----------------------------------------------------------------------- |
| `AGENT_SANDBOX_SUSPEND_MINUTES` | `60` | Number of inactive minutes before a running Agent Sandbox is suspended. |
| `AGENT_SANDBOX_ARCHIVE_INACTIVE_DAYS` | `7` | Number of inactive days before a suspended Agent Sandbox is archived. |
## FAQ
### AGENT\_SANDBOX\_PROXY\_URL or AGENT\_SANDBOX\_PREVIEW\_PROXY\_URL is required
After Agent Sandbox is enabled, `fastgpt-app` requires `AGENT_SANDBOX_PROXY_SECRET`, `AGENT_SANDBOX_PROXY_URL`, and `AGENT_SANDBOX_PREVIEW_PROXY_URL`. `fastgpt-pro` requires only `AGENT_SANDBOX_PREVIEW_PROXY_URL`. You must add the preview proxy URL, such as `https://sandbox-proxy.example.com`, to both services.
### Browser WebSocket connection fails
Check that the proxy service is reachable from the browser and that your reverse proxy supports WebSocket Upgrade. If FastGPT is accessed over HTTPS, `AGENT_SANDBOX_PROXY_URL` should use `wss://` to avoid mixed-content blocking.
### proxy validation fails or returns 401
Make sure `AGENT_SANDBOX_PROXY_SECRET` is exactly the same in the FastGPT main service and `fastgpt-agent-sandbox-proxy`, and that it is at least 32 characters long.
file: ./content/self-host/config/sandbox/common.mdx
meta: {
"title": "沙盒通用配置",
"description": "FastGPT Agent Sandbox 通用配置"
}
本文说明 Agent Sandbox 的通用配置,适用于 `opensandbox` 和 `sealosdevbox`。Provider 自身的接入参数请参考对应 Provider 文档;无论选择哪种 Provider,都需要部署 `fastgpt-agent-sandbox-proxy`,并按需配置沙盒内依赖源。
## 部署 sandbox-proxy
### 1. 添加 yml
可以参考 [agent-sandbox-proxy.yml](/deploy/sandbox_deploy/agent-proxy.yml),将 service 加到 yml 文件里。并开放外网访问端口。并记录 `AGENT_SANDBOX_PROXY_SECRET` 环境变量,下一步需要使用。
FastGPT 服务里访问沙盒内部文件系统,会通过 proxy 去代理访问。
**proxy 服务环境变量**
| 变量 | 默认值 | 说明 |
| ---------------------------------- | ---------------------------------------- | ----------------------------------------- |
| `PORT` | `1006` | `fastgpt-agent-sandbox-proxy` 监听端口。 |
| `AGENT_SANDBOX_PROXY_SECRET` | 无 | 与 FastGPT 主服务共用的密钥,至少 32 位。 |
| `FASTGPT_APP_URL` | `http://fastgpt-app:3000` | 代理回源 FastGPT 主服务的内网地址,要求两个服务在一个互通网络。 |
| `FASTGPT_APP_REQUEST_TIMEOUT_SECS` | `10` | 代理回源 FastGPT 主服务的请求超时时间,单位秒。沙盒冷启动较慢时建议调大。 |
| `RUST_LOG` | `info,fastgpt_agent_sandbox_proxy=debug` | 代理服务日志级别。 |
### 2. 修改 FastGPT 环境变量
在 `fastgpt-app` 中增加下面三项环境变量:
```dotenv
# 对应 fastgpt-agent-sandbox-proxy 的变量 AGENT_SANDBOX_PROXY_SECRET。生产环境请改为 32 位以上随机密钥
AGENT_SANDBOX_PROXY_SECRET=replace_with_32_chars_random_secret
# 浏览器可访问的 agent-sandbox-proxy WebSocket 地址;如已通过 HTTPS 域名代理,请使用 wss://
AGENT_SANDBOX_PROXY_URL=wss://sandbox-proxy.example.com
# 浏览器访问 Sandbox 文件预览的 HTTP(S) 地址
AGENT_SANDBOX_PREVIEW_PROXY_URL=https://sandbox-proxy.example.com
```
`fastgpt-pro` 不提供 Sandbox Editor 和 WebSocket proxy 链路,因此不要求 `AGENT_SANDBOX_PROXY_SECRET` 和 `AGENT_SANDBOX_PROXY_URL`,但启用 Agent Sandbox 时必须增加 `AGENT_SANDBOX_PREVIEW_PROXY_URL`。该变量可以与 `fastgpt-app` 使用相同的值。
强烈建议将预览代理部署在与 FastGPT 主站不同的 origin(协议、域名或端口至少一项不同)。Sandbox 中的 HTML 可能包含用户生成的脚本;如果预览地址与 FastGPT 主站同源,这些脚本会处于主站的同源安全边界内,可能访问主站凭证或接口。FastGPT 当前只校验该变量使用 `http://` 或 `https://`,不会强制检查 origin 是否隔离。
预览链接是短期只读 bearer capability。任何获得链接的人都可以在链接有效期内通过修改 URL 路径读取同一 Sandbox Workspace 中的其他文件,因此不要把预览链接分享给不应访问该 Workspace 的用户。
### 3. 启动验证
1. 重启 `fastgpt-app`、`fastgpt-pro` 和 `fastgpt-agent-sandbox-proxy`。
2. 访问 `https://agent-proxy域名/health`,正常返回 `OK`。
### 4. 部署沙盒服务
部署完 proxy 服务后,还需接入沙盒控制服务,目前系统支持以下两种方案:
* [Sealos cloud 沙盒接入](./sealosdevbox)
* [Opensandbox 部署方案](./opensandbox)
## 更多配置
### 自定义源
如果沙盒内需要安装 npm 或 Python 依赖,可以在 `fastgpt-app` 和 `fastgpt-pro` 中配置依赖源。配置后,Agent Sandbox 初始化时会写入 npm、yarn、pnpm、bun、pip 和 uv 的源配置。
```dotenv
# Agent Sandbox 内 npm/yarn/pnpm/bun 使用的 npm registry
AGENT_SANDBOX_NPM_REGISTRY=https://registry.npmmirror.com
# Agent Sandbox 内 pip/python -m pip/uv 使用的 PyPI index URL
AGENT_SANDBOX_PYPI_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
```
### 资源限制变量
`fastpgt-app` 和 `fastgpt-pro` 中你可以通过以下变量控制资源限制:
| 变量 | 默认值 | 说明 |
| ------------------------------------ | ---------- | ------------------------------------------------------------------------------ |
| `AGENT_SANDBOX_CPU_COUNT` | `1` | Agent Sandbox 单实例 CPU 核数上限。 |
| `AGENT_SANDBOX_MEMORY_MIB` | `2048` | Agent Sandbox 单实例内存上限,单位 MiB。 |
| `AGENT_SANDBOX_STORAGE_SIZE_GI` | `1` | Agent Sandbox 存储容量,单位 Gi;同时按“存储容量换算为 MB / 2 - 150”计算 FastGPT 的归档、Skill 和单文件限制。 |
| `AGENT_SANDBOX_WS_MAX_MESSAGE_BYTES` | `67108864` | IDE Agent WebSocket 单消息大小上限,单位字节。 |
| `AGENT_SANDBOX_WS_MAX_FRAME_BYTES` | `16777216` | IDE Agent WebSocket 单帧大小上限,单位字节。 |
### 生命周期变量
| 变量 | 默认值 | 说明 |
| ------------------------------------- | ---- | ---------------------------- |
| `AGENT_SANDBOX_SUSPEND_MINUTES` | `60` | 运行中的 Agent 沙箱持续未活跃多少分钟后自动暂停。 |
| `AGENT_SANDBOX_ARCHIVE_INACTIVE_DAYS` | `7` | 已暂停的 Agent 沙箱持续未活跃多少天后自动归档。 |
## 常见问题
### 提示 AGENT\_SANDBOX\_PROXY\_URL 或 AGENT\_SANDBOX\_PREVIEW\_PROXY\_URL is required
启用 Agent Sandbox 后,`fastgpt-app` 必须配置 `AGENT_SANDBOX_PROXY_SECRET`、`AGENT_SANDBOX_PROXY_URL` 和 `AGENT_SANDBOX_PREVIEW_PROXY_URL`;`fastgpt-pro` 只强制要求 `AGENT_SANDBOX_PREVIEW_PROXY_URL`。两个服务都必须新增预览代理地址,例如 `https://sandbox-proxy.example.com`。
### 浏览器 WebSocket 连接失败
检查代理服务是否能被浏览器访问,并确认反向代理已支持 WebSocket Upgrade。如果 FastGPT 通过 HTTPS 访问,`AGENT_SANDBOX_PROXY_URL` 也应使用 `wss://`,避免浏览器拦截混合内容。
### proxy 校验失败或返回 401
确认 FastGPT 主服务和 `fastgpt-agent-sandbox-proxy` 中的 `AGENT_SANDBOX_PROXY_SECRET` 完全一致,并且长度不少于 32 位。
file: ./content/self-host/config/sandbox/opensandbox.en.mdx
meta: {
"title": "OpenSandbox Deployment",
"description": "Use self-hosted OpenSandbox with FastGPT Agent Sandbox"
}
import { Alert } from '@/components/docs/Alert';
Note: The OpenSandbox setup does not provide network isolation by default. Add your own network
isolation policy if your deployment requires it.
OpenSandbox is suitable when you want to self-host the Agent/Skill sandbox runtime. Before starting, complete [General Sandbox Configuration](./common) and make sure `fastgpt-agent-sandbox-proxy` is deployed. Configure the proxy secret, WebSocket URL, and preview URL in `fastgpt-app`; you must configure the preview URL in `fastgpt-pro`.
The OpenSandbox setup flow is below.
## 1. Add yml services
Use [opensandbox.yml](/deploy/sandbox_deploy/opensandbox.yml) as a reference. Add `fastgpt-opensandbox-server`, `fastgpt-volume-manager`, the image pre-pull services, and `opensandbox-config` to your current FastGPT `docker-compose.yml`. Place them on the same `app` network as the FastGPT App service. You do not need to expose OpenSandbox or Volume Manager ports publicly. Deploy Agent Sandbox Proxy separately as described in [General Sandbox Configuration](./common).
The sample uses China Mainland image registries. For deployments outside China Mainland, replace them with:
* `opensandbox/server:v0.2.1`
* `ghcr.io/labring/fastgpt-agent-sandbox:v0.2.0`
* `opensandbox/execd:v1.0.21`
* `opensandbox/egress:v1.1.4`
* `ghcr.io/labring/fastgpt-agent-volume-manager:v0.2.0`
## 2. Update OpenSandbox variables
Only the following values usually need to be changed:
| Setting | Description |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `x-volume-manager-auth-token` | Authentication token for `fastgpt-volume-manager`. It must match `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN` in FastGPT. |
| `[server].api_key` | OpenSandbox Server API key. It must match `AGENT_SANDBOX_OPENSANDBOX_API_KEY` in FastGPT. |
Docker runtime requires mounting the host Docker socket. The default Docker path is usually `/var/run/docker.sock`; environments such as OrbStack may require replacing it with the actual socket path.
If the server has `HTTP_PROXY` / `HTTPS_PROXY` configured, set `NO_PROXY` / `no_proxy` for OpenSandbox Server and Volume Manager. Include at least `localhost,127.0.0.1,127.0.0.0/8,fastgpt-opensandbox-server,fastgpt-volume-manager,host.docker.internal` to prevent internal service calls from being routed through the proxy. OrbStack/Docker may inject IPv6 CIDR entries into `NO_PROXY`; httpx used by OpenSandbox may parse unbracketed IPv6 CIDR values as invalid URL ports. Explicitly override `NO_PROXY` if you hit that startup issue.
## 3. Update FastGPT variables
Add or update the following environment variables in both `fastgpt-app` and `fastgpt-pro`:
```dotenv
# Enable OpenSandbox as the Agent Sandbox provider
AGENT_SANDBOX_PROVIDER=opensandbox
# Internal URL for FastGPT to access OpenSandbox Server
AGENT_SANDBOX_OPENSANDBOX_BASEURL=http://fastgpt-opensandbox-server:8090
# OpenSandbox API key. Must match [server].api_key in opensandbox-config.
AGENT_SANDBOX_OPENSANDBOX_API_KEY=replace_with_opensandbox_api_key
# Docker compose deployments use docker runtime
AGENT_SANDBOX_OPENSANDBOX_RUNTIME=docker
# Runtime image used when OpenSandbox creates Agent Sandbox instances
AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO=registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox
AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG=v0.2.0
AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY=true
# Persistent volume manager URL and token. The token must match x-volume-manager-auth-token.
AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_URL=http://fastgpt-volume-manager:3000
AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN=replace_with_volume_manager_token
# Per-instance Agent Sandbox CPU count and memory limit (MiB)
AGENT_SANDBOX_CPU_COUNT=1
AGENT_SANDBOX_MEMORY_MIB=2048
# OpenSandbox persistent volume size. Effective only when creating new PVCs in Kubernetes mode.
AGENT_SANDBOX_STORAGE_SIZE_GI=1
```
If your `docker-compose.yml` already uses `x-agent-sandbox-config` to inject Agent Sandbox variables, fill these values in that anchor so both `fastgpt-app` and `fastgpt-pro` inherit the same configuration.
## 4. Start and verify
1. Pre-pull the sandbox runtime images:
```bash
docker compose --profile prepull pull opensandbox-agent-sandbox-image opensandbox-execd-image opensandbox-egress-image
```
2. Start or restart the related services:
```bash
docker compose up -d fastgpt-opensandbox-server fastgpt-volume-manager fastgpt-app fastgpt-pro
```
3. Check service health inside the container network:
```bash
docker compose exec fastgpt-opensandbox-server python -c "import urllib.request; print(urllib.request.urlopen('http://localhost:8090/health', timeout=5).read().decode())"
docker compose exec fastgpt-volume-manager node -e "fetch('http://localhost:3000/health').then(async r => { console.log(await r.text()); if (!r.ok) process.exit(1); })"
```
OpenSandbox should return `{"status":"healthy"}`, and `fastgpt-volume-manager` should return a health JSON response. See [General Sandbox Configuration](./common) for Agent Sandbox Proxy verification.
4. Log in to FastGPT and open a scenario that supports Agent Sandbox, such as Agent V2 VM, Skill editing, or Skill debugging. Confirm that the sandbox can be created and that the file tree and terminal open normally.
## FAQ
### Sandbox provider apiKey is required for opensandbox
Check that both `fastgpt-app` and `fastgpt-pro` have `AGENT_SANDBOX_OPENSANDBOX_API_KEY` configured, and make sure it matches `[server].api_key` in `opensandbox-config`.
### AGENT\_SANDBOX\_OPENSANDBOX\_VOLUME\_MANAGER\_URL is required
OpenSandbox mode requires deploying `fastgpt-volume-manager` and configuring `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_URL` and `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN` in FastGPT.
### The sandbox is created, but the file tree or terminal fails to connect
Check that `AGENT_SANDBOX_PROXY_URL` is a browser-accessible `ws://` or `wss://` URL and that your reverse proxy supports WebSocket Upgrade. If the FastGPT main site uses HTTPS, the proxy URL should use `wss://`.
### proxy cannot connect to the sandbox endpoint
Check `[docker].host_ip` in `opensandbox-config` first. When OpenSandbox Server runs in a container, sandbox endpoints using `localhost` or `127.0.0.1` are not reachable from the proxy container. Use the host's internal IP or `host.docker.internal`.
file: ./content/self-host/config/sandbox/opensandbox.mdx
meta: {
"title": "OpenSandbox 部署",
"description": "FastGPT 使用 OpenSandbox 自托管 Agent Sandbox"
}
import { Alert } from '@/components/docs/Alert';
注意:OpenSandbox 方案默认未做网络隔离。如需网络隔离,请自行补充对应的网络隔离策略。
OpenSandbox 适合需要自托管 Agent/Skill 沙盒运行环境的场景。开始前,请先完成[沙盒通用配置](./common),确保 `fastgpt-agent-sandbox-proxy` 已部署;`fastgpt-app` 需配置 Proxy Secret、WebSocket URL 和预览 URL,`fastgpt-pro` 必须配置预览 URL。
下面是 OpenSandbox 部署和配置流程。
## 1. 添加 yml service
参考 [opensandbox.yml](/deploy/sandbox_deploy/opensandbox.yml),将 `fastgpt-opensandbox-server`、`fastgpt-volume-manager`、预拉取镜像和 `opensandbox-config` 加入当前 FastGPT 部署的 `docker-compose.yml`,并放到 FastGPT App 所在的 `app` network 中;不需要对外暴露 OpenSandbox 或 Volume Manager 端口。Agent Sandbox Proxy 请按[沙盒通用配置](./common)单独部署。
下面示例使用国内镜像源。海外部署可将镜像替换为:
* `opensandbox/server:v0.2.1`
* `ghcr.io/labring/fastgpt-agent-sandbox:v0.2.0`
* `opensandbox/execd:v1.0.21`
* `opensandbox/egress:v1.1.4`
* `ghcr.io/labring/fastgpt-agent-volume-manager:v0.2.0`
## 2. 修改 OpenSandbox 变量
根据实际部署环境修改下面变量:
| 配置 | 说明 |
| ----------------------------- | ------------------------------------------------------------------------------------------------------ |
| `x-volume-manager-auth-token` | `fastgpt-volume-manager` 的认证 Token,需要与 FastGPT 里的 `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN` 一致。 |
| `[server].api_key` | OpenSandbox Server API Key,需要与 FastGPT 里的 `AGENT_SANDBOX_OPENSANDBOX_API_KEY` 一致。 |
Docker runtime 必须挂载宿主机 Docker socket。Docker 默认路径通常是 `/var/run/docker.sock`;OrbStack 等环境需要替换为实际 socket 路径。
如果服务器配置了 `HTTP_PROXY` / `HTTPS_PROXY`,建议给 OpenSandbox Server 和 Volume Manager 补充 `NO_PROXY` / `no_proxy`,至少包含 `localhost,127.0.0.1,127.0.0.0/8,fastgpt-opensandbox-server,fastgpt-volume-manager,host.docker.internal`,避免内部服务调用被代理劫持。OrbStack/Docker 可能自动注入包含 IPv6 CIDR 的 `NO_PROXY`,OpenSandbox 依赖的 httpx 可能把未加方括号的 IPv6 CIDR 误解析成 URL 端口,导致启动失败;遇到该问题时应显式覆盖 `NO_PROXY`。
## 3. 修改 FastGPT 相关变量
在 `fastgpt-app` 和 `fastgpt-pro` 中增加或修改下面环境变量:
```dotenv
# 启用 OpenSandbox 作为 Agent Sandbox provider
AGENT_SANDBOX_PROVIDER=opensandbox
# FastGPT 主服务访问 OpenSandbox Server 的内网地址
AGENT_SANDBOX_OPENSANDBOX_BASEURL=http://fastgpt-opensandbox-server:8090
# OpenSandbox 访问密钥,需要与 opensandbox-config 里的 [server].api_key 一致
AGENT_SANDBOX_OPENSANDBOX_API_KEY=replace_with_opensandbox_api_key
# Docker compose 部署使用 docker runtime
AGENT_SANDBOX_OPENSANDBOX_RUNTIME=docker
# OpenSandbox 创建 Agent Sandbox 时使用的运行态镜像
AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO=registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox
AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG=v0.2.0
AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY=true
# 持久卷管理服务地址和 Token,需要与 x-volume-manager-auth-token 一致。
AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_URL=http://fastgpt-volume-manager:3000
AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN=replace_with_volume_manager_token
# Agent Sandbox 单实例 CPU 核数和内存上限(MiB)
AGENT_SANDBOX_CPU_COUNT=1
AGENT_SANDBOX_MEMORY_MIB=2048
# OpenSandbox 持久卷容量,仅 K8s 模式下创建新 PVC 时有效
AGENT_SANDBOX_STORAGE_SIZE_GI=1
```
如果你的 `docker-compose.yml` 已经使用 `x-agent-sandbox-config` 统一注入 Agent Sandbox 变量,可直接在该 anchor 中填入上述值,确保 `fastgpt-app` 和 `fastgpt-pro` 都继承该配置。
## 4. 启动验证
1. 预拉取沙盒运行时镜像:
```bash
docker compose --profile prepull pull opensandbox-agent-sandbox-image opensandbox-execd-image opensandbox-egress-image
```
2. 启动或重启相关服务:
```bash
docker compose up -d fastgpt-opensandbox-server fastgpt-volume-manager fastgpt-app fastgpt-pro
```
3. 在容器网络内检查服务健康状态:
```bash
docker compose exec fastgpt-opensandbox-server python -c "import urllib.request; print(urllib.request.urlopen('http://localhost:8090/health', timeout=5).read().decode())"
docker compose exec fastgpt-volume-manager node -e "fetch('http://localhost:3000/health').then(async r => { console.log(await r.text()); if (!r.ok) process.exit(1); })"
```
正常情况下,OpenSandbox 的健康检查会返回 `{"status":"healthy"}`,`fastgpt-volume-manager` 会返回健康状态 JSON。Agent Sandbox Proxy 的验证方式见[沙盒通用配置](./common)。
4. 登录 FastGPT,打开支持 Agent Sandbox 的场景,例如 Agent V2 虚拟机、Skill 编辑或 Skill 调试,确认可以正常创建沙盒、打开文件树和终端。
## 常见问题
### 提示 Sandbox provider apiKey is required for opensandbox
检查 `fastgpt-app` 和 `fastgpt-pro` 是否配置了 `AGENT_SANDBOX_OPENSANDBOX_API_KEY`,并确认它与 `opensandbox-config` 中的 `[server].api_key` 一致。
### 提示 AGENT\_SANDBOX\_OPENSANDBOX\_VOLUME\_MANAGER\_URL is required
OpenSandbox 模式需要部署 `fastgpt-volume-manager`,并在 FastGPT 中配置 `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_URL` 和 `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN`。
### 沙盒创建成功,但文件树或终端连接失败
检查 `AGENT_SANDBOX_PROXY_URL` 是否是浏览器可访问的 `ws://` 或 `wss://` 地址,并确认反向代理支持 WebSocket Upgrade。如果 FastGPT 主站使用 HTTPS,proxy 地址也应使用 `wss://`。
### proxy 无法连接沙盒 endpoint
优先检查 `opensandbox-config` 的 `[docker].host_ip`。当 OpenSandbox Server 运行在容器内时,沙盒 endpoint 里的 `localhost` 或 `127.0.0.1` 对 proxy 容器不可达,通常需要改成宿主机内网 IP 或 `host.docker.internal`。
file: ./content/self-host/config/sandbox/sealosdevbox.en.mdx
meta: {
"title": "Sealos Devbox Sandbox Configuration",
"description": "Use Sealos Devbox as the FastGPT sandbox"
}
import { Alert } from '@/components/docs/Alert';
This feature is available only to commercial edition users. Contact support to request a key.
Billing is usage-based and deducted from your Sealos balance.
## Prerequisites
1. FastGPT commercial edition is deployed, and the team has Agent Sandbox access.
2. Request Sealos Devbox connection details from support: Devbox service URL, access token, and runtime image.
## Configure FastGPT Environment Variables
Add the following environment variables to `fastgpt-app` and `fastgpt-pro` .
```dotenv
# Use Sealos Devbox as the Agent Sandbox provider
AGENT_SANDBOX_PROVIDER=sealosdevbox
# Sealos Devbox Server API URL provided by support. The FastGPT main service must be able to access it.
AGENT_SANDBOX_SEALOS_BASEURL=https://devbox-server.example.com
# Access token provided by support
AGENT_SANDBOX_SEALOS_TOKEN=replace_with_sealos_devbox_token
# Sandbox image version
AGENT_SANDBOX_SEALOS_IMAGE=hub.hzh.sealos.run/labring/devbox-sandbox:v0.2.0
# Per-instance Devbox resource limits. Storage size is in Gi.
AGENT_SANDBOX_CPU_COUNT=1
AGENT_SANDBOX_MEMORY_MIB=2048
AGENT_SANDBOX_STORAGE_SIZE_GI=1
```
## FAQ
### AGENT\_SANDBOX\_PROXY\_URL or AGENT\_SANDBOX\_PREVIEW\_PROXY\_URL is required
After `AGENT_SANDBOX_PROVIDER=sealosdevbox` is enabled, `fastgpt-app` requires both `AGENT_SANDBOX_PROXY_URL` and `AGENT_SANDBOX_PREVIEW_PROXY_URL`, while `fastgpt-pro` requires `AGENT_SANDBOX_PREVIEW_PROXY_URL`. See [General Sandbox Configuration](./common) for details.
### AGENT\_SANDBOX\_SEALOS\_IMAGE is required
The `sealosdevbox` provider requires `AGENT_SANDBOX_SEALOS_IMAGE` . Use the Agent Sandbox runtime image provided by support or the image that matches your current FastGPT version.
### Browser WebSocket connection fails
Check that the proxy service is reachable from the browser and that your reverse proxy supports WebSocket Upgrade. If FastGPT is accessed over HTTPS, `AGENT_SANDBOX_PROXY_URL` should use `wss://` to avoid mixed-content blocking.
### proxy validation fails or returns 401
Make sure `AGENT_SANDBOX_PROXY_SECRET` is exactly the same in the FastGPT main service and `fastgpt-agent-sandbox-proxy` , and that it is at least 32 characters long.
file: ./content/self-host/config/sandbox/sealosdevbox.mdx
meta: {
"title": "Sealos Devbox 沙盒配置",
"description": "FastGPT 使用 Sealos Devbox 沙盒"
}
import { Alert } from '@/components/docs/Alert';
仅商业版用户支持,可联系客服申请密钥,计费方式为按量计费,扣除 sealos 余额。
## 前置准备
1. 已部署 FastGPT 商业版,并确认团队拥有 Agent Sandbox 使用权限。
2. 向客服申请 Sealos Devbox 接入信息:Devbox 服务地址、访问 Token、运行态镜像。
## 配置 FastGPT 环境变量
在 `fastgpt-app` 和 `fastgpt-pro` 中增加下面环境变量。
```dotenv
# 启用 Sealos Devbox 作为 Agent Sandbox provider
AGENT_SANDBOX_PROVIDER=sealosdevbox
# 客服提供的 Sealos Devbox Server API 地址,FastGPT 主服务需要能访问
AGENT_SANDBOX_SEALOS_BASEURL=https://devbox-server.example.com
# 客服提供的访问密钥
AGENT_SANDBOX_SEALOS_TOKEN=replace_with_sealos_devbox_token
# 沙盒镜像版本
AGENT_SANDBOX_SEALOS_IMAGE=hub.hzh.sealos.run/labring/devbox-sandbox:v0.2.0
# Devbox 单实例资源上限;存储容量单位为 GB
AGENT_SANDBOX_CPU_COUNT=1
AGENT_SANDBOX_MEMORY_MIB=2048
AGENT_SANDBOX_STORAGE_SIZE_GI=1
```
## 常见问题
### 提示 AGENT\_SANDBOX\_PROXY\_URL 或 AGENT\_SANDBOX\_PREVIEW\_PROXY\_URL is required
启用 `AGENT_SANDBOX_PROVIDER=sealosdevbox` 后,`fastgpt-app` 必须配置 `AGENT_SANDBOX_PROXY_URL` 和 `AGENT_SANDBOX_PREVIEW_PROXY_URL`,`fastgpt-pro` 必须配置 `AGENT_SANDBOX_PREVIEW_PROXY_URL`。具体要求见[沙盒通用配置](./common)。
### 提示 AGENT\_SANDBOX\_SEALOS\_IMAGE is required
`sealosdevbox` provider 启用后必须配置 `AGENT_SANDBOX_SEALOS_IMAGE`。请使用客服提供或与当前 FastGPT 版本匹配的 Agent Sandbox 运行态镜像。
### 浏览器 WebSocket 连接失败
检查代理服务是否能被浏览器访问,并确认反向代理已支持 WebSocket Upgrade。如果 FastGPT 通过 HTTPS 访问,`AGENT_SANDBOX_PROXY_URL` 也应使用 `wss://`,避免浏览器拦截混合内容。
### proxy 校验失败或返回 401
确认 FastGPT 主服务和 `fastgpt-agent-sandbox-proxy` 中的 `AGENT_SANDBOX_PROXY_SECRET` 完全一致,并且长度不少于 32 位。
file: ./content/guide/workspace/team/invitation_link.en.mdx
meta: {
"title": "Invitation Links",
"description": "How to use invitation links to invite team members"
}
Starting from v4.9.1, team member invitations use the **invitation link** method, replacing the previous username-based approach.
After upgrading, any pending invitations that haven't been accepted will be automatically cleared. Please use invitation links to re-invite members.
## How to Use
1. **On the team management page, admins can click the "Invite Members" button to open the invitation dialog**

2. **In the invitation dialog, click "Create Invitation Link" to generate a new link**

3. **Fill in the details**

Link description: We recommend describing the intended use case or purpose. The description cannot be changed after creation.
Expiration: 30 minutes, 7 days, or 1 year
Usage limit: 1 person or unlimited
4. **Click "Copy Link" and send it to the people you want to invite**

5. **When a user visits the link, they will be redirected to the login page if not logged in or registered. After logging in, they will be taken to the team page to handle the invitation.**
> Invitation links look like: fastgpt.cn/account/team?invitelinkid=xxxx

Click "Accept" to join the team.
Click "Ignore" to close the dialog. The user can still accept the invitation by visiting the link again later.
## Link Expiration and Auto-Cleanup
### Why Links Expire
Links are manually disabled by an admin.
The invitation link reaches its expiration date and is automatically disabled.
A single-use link (1 person limit) has already been used.
Expired links cannot be accessed or re-enabled.
### Link Limits
Each user can have up to 10 **active** invitation links at a time.
### Auto-Cleanup
Expired links are automatically deleted after 30 days.
file: ./content/guide/workspace/team/invitation_link.mdx
meta: {
"title": "邀请链接说明文档",
"description": "如何使用邀请链接来邀请团队成员"
}
v4.9.1 团队邀请成员将开始使用「邀请链接」的模式,弃用之前输入用户名进行添加的形式。
在版本升级后,原收到邀请还未加入团队的成员,将自动清除邀请。请使用邀请链接重新邀请成员。
## 如何使用
1. **在团队管理页面,管理员可点击「邀请成员」按钮打开邀请成员弹窗**

2. **在邀请成员弹窗中,点击「创建邀请链接」按钮,创建邀请链接。**

3. **输入对应内容**

链接描述:建议将链接描述为使用场景或用途。链接创建后不支持修改噢。
有效期:30分钟,7天,1年
有效人数:1人,无限制
4. **点击复制链接,并将其发送给想要邀请的人。**

5. **用户访问链接后,如果未登录/未注册,则先跳转到登录页面进行登录。在登录后将进入团队页面,处理邀请。**
> 邀请链接形如:fastgpt.cn/account/team?invitelinkid=xxxx

点击接受,则用户将加入团队
点击忽略,则关闭弹窗,用户下次访问该邀请链接则还可以选择加入。
## 链接失效和自动清理
### 链接失效原因
手动停用链接
邀请链接到达有效期,自动停用
有效人数为1人的链接,已有1人通过邀请链接加入团队。
停用的链接无法访问,也无法再次启用。
### 链接上限
一个用户最多可以同时存在 10 个**有效的**邀请链接。
### 链接自动清理
失效的链接将在 30 天后自动清理。
file: ./content/guide/workspace/team/team_roles_permissions.en.mdx
meta: {
"title": "Teams, Groups & Permissions",
"description": "How to manage FastGPT teams, member groups, and permission settings"
}
# Teams, Groups & Permissions
## Permission System Overview
FastGPT's permission system combines **attribute-based** and **role-based** access control, providing fine-grained permission management for team collaboration. Through **members, departments, and groups**, you can flexibly configure access to teams, apps, and knowledge bases.
## Teams
Each user can belong to multiple teams. The system automatically creates an initial team for every user. Manual creation of additional teams is not currently supported.
## Permission Management
FastGPT offers three permission management levels:
**Member Permissions**: Highest priority, directly assigned to individuals
**Department & Group Permissions**: Use union logic, lower priority than member permissions
Permission evaluation follows this logic:
First, check the user's individual member permissions
Then, check permissions from the user's departments and groups (union)
Final permissions are the combination of the above
Authorization logic:

### Resource Permissions
Different **resources** have different permissions.
Resources refer to concepts like apps, knowledge bases, teams, etc.
The table below shows the manageable permissions for different resources.
Resource
Manageable Permissions
Description
Team
Create Apps
Create, delete, and other basic operations
Create Knowledge Bases
Create, delete, and other basic operations
Create Team APIKey
Create, delete, and other basic operations
Manage Members
Invite/remove users, create groups, etc.
App
Can Use
Allows conversation interaction
Can Edit
Modify basic info, workflow orchestration, etc.
Can Manage
Add or remove collaborators
Knowledge Base
Can Use
Can call this knowledge base in apps
Can Edit
Modify knowledge base content
Can Manage
Add or remove collaborators
### Collaborators
You must add **collaborators** before managing their permissions:

When managing team permissions, first select members/organizations/groups, then configure permissions.

For resources like apps and knowledge bases, you can directly modify member permissions.

Team permissions are set on a dedicated permissions page.

## Special Permissions
### Admin Permissions
Admins primarily manage resource collaboration relationships, with these limitations:
* Cannot modify or remove their own permissions
* Cannot modify or remove other admins' permissions
* Cannot grant admin permissions to other collaborators
### Owner Permissions
Each resource has a unique Owner with the highest permissions for that resource. Owners can transfer ownership, but will lose all permissions to the resource after transfer.
### Root Permissions
Root is the system's only super admin account, with complete access and management rights to all resources across all teams.
## Tips
### 1. Set Default Team Permissions
Use the "All Members Group" to quickly set baseline permissions for the entire team. For example, grant everyone access to an app.
**Note**: Individual member permissions override all-member group permissions. For example, if App A has all-member edit permissions, but User M is individually set to use-only, User M can only use the app, not edit it.
### 2. Batch Permission Management
Create groups or organizations to efficiently manage permissions for multiple users. Add users to a group, then grant permissions to the entire group.
### Developer Reference
> The following content is for developers. Skip if you're not doing custom development.
#### Permission Design Principles
FastGPT's permission system is inspired by Linux permissions, using binary storage for permission bits. A permission bit of 1 means the permission is granted, 0 means no permission. Owner permissions are specially marked as all 1s.
#### Permission Table
Permission information is stored in MongoDB's resource\_permissions collection, with these main fields:
* teamId: Team identifier
* tmbId/groupId/orgId: Permission subject (one of three)
* resourceType: Resource type (team/app/dataset)
* permission: Permission value (number)
* resourceId: Resource ID (null for team resources)
The system implements flexible and precise permission control through this data structure.
The schema for this table is defined in packages/service/support/permission/schema.ts:
```typescript
export const ResourcePermissionSchema = new Schema({
teamId: {
type: Schema.Types.ObjectId,
ref: TeamCollectionName
},
tmbId: {
type: Schema.Types.ObjectId,
ref: TeamMemberCollectionName
},
groupId: {
type: Schema.Types.ObjectId,
ref: MemberGroupCollectionName
},
orgId: {
type: Schema.Types.ObjectId,
ref: OrgCollectionName
},
resourceType: {
type: String,
enum: Object.values(PerResourceTypeEnum),
required: true
},
permission: {
type: Number,
required: true
},
// Resrouce ID: App or DataSet or any other resource type.
// It is null if the resourceType is team.
resourceId: {
type: Schema.Types.ObjectId
}
});
```
file: ./content/guide/workspace/team/team_roles_permissions.mdx
meta: {
"title": "团队&成员组&权限",
"description": "如何管理 FastGPT 团队、成员组及权限设置"
}
# 团队 & 成员组 & 权限
## 权限系统简介
FastGPT
权限系统融合了基于**属性**和基于**角色**的权限管理范式,为团队协作提供精细化的权限控制方案。通过**成员、部门和群组**三种管理模式,您可以灵活配置对团队、应用和知识库等资源的访问权限。
## 团队
每位用户可以同时归属于多个团队,系统默认为每位用户创建一个初始团队。目前暂不支持用户手动创建额外团队。
## 权限管理
FastGPT 提供三种权限管理维度:
**成员权限**:最高优先级,直接赋予个人的权限
**部门与群组权限**:采用权限并集原则,优先级低于成员权限
权限判定遵循以下逻辑:
首先检查用户的个人成员权限
其次检查用户所属部门和群组的权限(取并集)
最终权限为上述结果的组合
鉴权逻辑如下:

### 资源权限
对于不同的**资源**,有不同的权限。
这里说的资源,是指应用、知识库、团队等等概念。
下表为不同资源,可以进行管理的权限。
资源
可管理权限
说明
团队
创建应用
创建,删除等基础操作
创建知识库
创建,删除等基础操作
创建团队 APIKey
创建,删除等基础操作
管理成员
邀请、移除用户,创建群组等
应用
可使用
允许进行对话交互
可编辑
修改基本信息,进行流程编排等
可管理
添加或删除协作者
知识库
可使用
可以在应用中调用该知识库
可编辑
修改知识库的内容
可管理
添加或删除协作者
### 协作者
必须先添加**协作者**,才能对其进行权限管理:

管理团队权限时,需先选择成员/组织/群组,再进行权限配置。

对于应用和知识库等资源,可直接修改成员权限。

团队权限在专门的权限页面进行设置

## 特殊权限说明
### 管理员权限
管理员主要负责管理资源的协作关系,但有以下限制:
* 不能修改或移除自身权限
* 不能修改或移除其他管理员权限
-不能将管理员权限赋予其他协作者
### Owner 权限
每个资源都有唯一的 Owner,拥有该资源的最高权限。Owner
可以转移所有权,但转移后原 Owner 将失去对资源的权限。
### Root 权限
Root
作为系统唯一的超级管理员账号,对所有团队的所有资源拥有完全访问和管理权限。
## 使用技巧
### 1. 设置团队默认权限
利用"全员群组"可快速为整个团队设置基础权限。例如,为应用设置全员可访问权限。
**注意**:个人成员权限会覆盖全员组权限。例如,应用 A
设置了全员编辑权限,而用户 M 被单独设置为使用权限,则用户 M
只能使用而无法编辑该应用。
### 2. 批量权限管理
通过创建群组或组织,可以高效管理多用户的权限配置。先将用户添加到群组,再对群组整体授权。
### 开发者参考
> 以下内容面向开发者,如不涉及二次开发可跳过。
#### 权限设计原理
FastGPT 权限系统参考 Linux 权限设计,采用二进制方式存储权限位。权限位为
1 表示拥有该权限,为 0 表示无权限。Owner 权限特殊标记为全 1。
#### 权限表
权限信息存储在 MongoDB 的 resource\_permissions 集合中,其主要字段包括:
* teamId: 团队标识
* tmbId/groupId/orgId: 权限主体(三选一)
* resourceType: 资源类型(team/app/dataset)
* permission: 权限值(数字)
* resourceId: 资源ID(团队资源为null)
系统通过这一数据结构实现了灵活而精确的权限控制。
对于这个表的 Schema 定义在 packages/service/support/permission/schema.ts
文件中。定义如下:
```typescript
export const ResourcePermissionSchema = new Schema({
teamId: {
type: Schema.Types.ObjectId,
ref: TeamCollectionName
},
tmbId: {
type: Schema.Types.ObjectId,
ref: TeamMemberCollectionName
},
groupId: {
type: Schema.Types.ObjectId,
ref: MemberGroupCollectionName
},
orgId: {
type: Schema.Types.ObjectId,
ref: OrgCollectionName
},
resourceType: {
type: String,
enum: Object.values(PerResourceTypeEnum),
required: true
},
permission: {
type: Number,
required: true
},
// Resrouce ID: App or DataSet or any other resource type.
// It is null if the resourceType is team.
resourceId: {
type: Schema.Types.ObjectId
}
});
```
file: ./content/self-host/upgrading/4-13/4130.en.mdx
meta: {
"title": "V4.13.0 (Environment Changes)",
"description": "FastGPT V4.13.0 Release Notes"
}
## Upgrade Guide
### 1. Update Images:
* Update FastGPT image tag: v4.13.0-fix
* Update FastGPT commercial edition image tag: v4.13.0-fix
* Update fastgpt-plugin image tag: v0.2.0-fix2
* mcp\_server: no update needed
* Sandbox: no update needed
* AIProxy: no update needed
### 2. Update Environment Variables
1. Update `fastgpt-plugin` environment variable names, and add `S3_PLUGIN_BUCKET`, `MONGODB_URI`, and `REDIS_URL` values.
```
S3_EXTERNAL_BASE_URL=https://xxx.com # S3 external URL
S3_ENDPOINT=localhost
S3_PORT=9000
S3_USE_SSL=false
S3_ACCESS_KEY=minioadmin
S3_SECRET_KEY=minioadmin
S3_TOOL_BUCKET=fastgpt-tool # Bucket for temporary files created by system tools. Requires public read, private write.
S3_PLUGIN_BUCKET=fastgpt-plugin # Bucket for system plugin hot-install files. Private read/write.
RETENTION_DAYS=15 # Number of days to retain system tool temporary files
MONGODB_URI=mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin # MongoDB connection string
REDIS_URL=redis://default:mypassword@redis:6379 # Redis connection string
```
2. Add S3-related environment variables for `fastgpt` and `fastgpt-pro (commercial edition)`.
```
# S3 external URL
S3_EXTERNAL_BASE_URL=
S3_ENDPOINT=localhost
S3_PORT=9000
S3_USE_SSL=false
S3_ACCESS_KEY=minioadmin
S3_SECRET_KEY=minioadmin
S3_PLUGIN_BUCKET=fastgpt-plugin # Bucket for system plugin hot-install files. Private read/write.
```
## New Features
1. New HTTP Toolset type for apps, replacing the previous HTTP Plugin.
2. System administrators can now quickly install system tools via file upload.
3. Team administrators can assign model permissions.
4. Code execution node supports AI-assisted code generation.
5. Knowledge base file parsing now supports configuring maximum concurrency. (Open-source edition: configure via `systemEnv.datasetParseMaxProcess` in config.json. Commercial edition: configure via the admin dashboard.)
## Improvements
1. System tools now display the corresponding author name, with safe i18n translations.
2. Metered billing push and merge logic.
3. Node details in chat history are now stored in a separate table.
4. Removed invalid `dataId` index from `chat_items`.
5. Workflow UI performance improvements to reduce unnecessary re-renders.
6. Knowledge base citation authentication in chats now applies to the entire conversation instead of individual messages.
7. Improved UX for dynamic input/output variables in workflows.
## Bug Fixes
1. Global variables not passed in debug mode.
2. Parameters from upstream nodes not passed to downstream nodes in debug mode.
3. In debug mode, enabling "Auto Execute" would skip external variable input.
4. Auto voice reply not working.
5. Error capture configuration lost when copying nodes.
6. "Suggested Questions" custom prompt: previous values were cleared on save.
7. Knowledge base image URLs assembled incorrectly when a secondary route was configured.
8. Prompt editor cleared Markdown formatting during keyboard input.
9. Knowledge base collection page did not auto-refresh when training data was present.
10. Workflow quick-add node popup showed empty toolbox on second open.
11. PPTX file parsing order was incorrect.
## Plugin Updates
1. Added Volcengine Fusion Information Search tool.
file: ./content/self-host/upgrading/4-13/4130.mdx
meta: {
"title": "V4.13.0(环境变量变更)",
"description": "FastGPT V4.13.0 更新说明"
}
## 更新指南
### 1. 更新镜像:
* 更新 FastGPT 镜像tag: v4.13.0-fix
* 更新 FastGPT 商业版镜像tag: v4.13.0-fix
* 更新 fastgpt-plugin 镜像 tag: v0.2.0-fix2
* mcp\_server 无需更新
* Sandbox 无需更新
* AIProxy 无需更新
### 2. 更新环境变量
1. 更新 `fastgpt-plugin` 环境变量名字,并新增`S3_PLUGIN_BUCKET`、`MONGODB_URI`、`REDIS_URL`值。
```
S3_EXTERNAL_BASE_URL=https://xxx.com # S3 外网地址
S3_ENDPOINT=localhost
S3_PORT=9000
S3_USE_SSL=false
S3_ACCESS_KEY=minioadmin
S3_SECRET_KEY=minioadmin
S3_TOOL_BUCKET=fastgpt-tool # 系统工具,创建的临时文件,存储的桶,要求公开读私有写。
S3_PLUGIN_BUCKET=fastgpt-plugin # 系统插件热安装文件的桶,私有读写。
RETENTION_DAYS=15 # 系统工具临时文件保存天数
MONGODB_URI=mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin # MongoDB 链接参数
REDIS_URL=redis://default:mypassword@redis:6379 # Redis 链接参数
```
2. 增加`fastgpt`和`fastgpt-pro(商业版)` s3 相关环境变量。
```
# S3 外网地址
S3_EXTERNAL_BASE_URL=
S3_ENDPOINT=localhost
S3_PORT=9000
S3_USE_SSL=false
S3_ACCESS_KEY=minioadmin
S3_SECRET_KEY=minioadmin
S3_PLUGIN_BUCKET=fastgpt-plugin # 系统插件热安装文件的桶,私有读写。
```
## 🚀 新增内容
1. 应用新增 HTTP 工具集类型,取代原 HTTP 插件。
2. 支持系统管理员通过文件形式快速安装系统工具。
3. 团队管理员支持分配模型权限。
4. 代码运行节点支持 AI 辅助生成。
5. 知识库文件解析支持配置最大并发数。(开源版通过 config.json 文件中`systemEnv.datasetParseMaxProcess`属性配置,商业版通过 admin 后台配置。)
## ⚙️ 优化
1. 系统工具增加对应 author 名字显示。同时使用安全的 I18n 翻译。
2. 计量计费账单推送和合并逻辑。
3. 对话记录中,节点详情单独分表存储。
4. 删除 chat\_items 中无效的 dataId 索引。
5. 工作流UI性能优化,减少 UI 重绘。
6. 对话中,知识库引用鉴权采用整个对话框鉴权,而不是单条记录。
7. 工作流动态输入输出变量交互优化。
## 🐛 修复
1. debug 模式下,全局变量未传递。
2. debug 模式下,前方节点参数无法传递至后方节点。
3. 调试模式下,开启“自动执行”,会跳过外部变量的填写。
4. 自动语音回复未生效。
5. 节点复制,报错捕获配置丢失。
6. “猜你想问”的自定义提示词,保存时,上一次的值会被置空。
7. 配置了二级路由的情况下,知识库检索出来的图片地址拼接异常。
8. Prompt 编辑器,键盘输入时会清除掉 Markdown 标记。
9. 知识库集合页面,有训练数据时候无法自动刷新页面。
10. 工作流快速添加节点弹窗,工具箱页面二次打开时为空。
11. PPTX 文件解析顺序错误。
## 🔨 插件更新
1. 新增火山引擎融合信息搜索工具。
file: ./content/self-host/upgrading/4-13/4131.en.mdx
meta: {
"title": "V4.13.1",
"description": "FastGPT V4.13.1 Release Notes"
}
## Upgrade Guide
### 1. Update Images:
* Update FastGPT image tag: v4.13.1
* Update FastGPT commercial edition image tag: v4.13.1
* Update fastgpt-plugin image tag: v0.2.2
* mcp\_server: no update needed
* Sandbox: no update needed
* AIProxy: no update needed
## New Features
1. Added response size limit for HTTP requests.
## Improvements
1. When copying an app, the avatar is now duplicated to avoid sharing the same image link, which previously caused one app's avatar to disappear when the other's was updated.
2. Markdown parser now handles Windows paths correctly, preventing `\` from being treated as an escape character.
## Bug Fixes
1. In loop nodes, the previous round's interactive response value was not cleared at the end of each iteration.
2. After an interactive node responded, chat record statistics were not updated.
3. Prompt editor displayed incorrect default values in popups.
4. Form input fields with `.` in the variable name could not accept values properly.
5. When calling a sub-workflow, auto-flow knowledge base citations were not displayed in share links.
## Plugin Updates
1. Base64 decode tool now supports conversion to both text and images.
2. Moji Weather tool.
3. Biyou PPT generation tool.
4. Configurable maximum request body size and internal network request maximum response size to prevent memory overflow from oversized responses.
5. Added model presets for Claude 4.5, Qwen3, Kimi2, and DeepSeek 3.2.
file: ./content/self-host/upgrading/4-13/4131.mdx
meta: {
"title": "V4.13.1",
"description": "FastGPT V4.13.1 更新说明"
}
## 更新指南
### 1. 更新镜像:
* 更新 FastGPT 镜像tag: v4.13.1
* 更新 FastGPT 商业版镜像tag: v4.13.1
* 更新 fastgpt-plugin 镜像 tag: v0.2.2
* mcp\_server 无需更新
* Sandbox 无需更新
* AIProxy 无需更新
## 🚀 新增内容
1. 增加对 HTTP 请求响应大小限制。
## ⚙️ 优化
1. 复制应用时,将头像复制一份,避免使用相同的图片链接,导致其中一个应用头像更新后,另一个应用头像丢失。
2. Markdown 解析器适配 windows 路径,避免 \ 被认为转义符。
## 🐛 修复
1. 循环节点中,每轮结束,未清除上一轮交互响应值。
2. 交互节点响应后,未更新对话记录统计数据。
3. prompt 编辑器,弹窗中的默认值存在显示异常。
4. 表单输入,变量名包含.符号时,无法正常输入值。
5. 调用子工作流,自动流知识库引用无法在分享链接中显示。
## 🔨 插件更新
1. base64 解码工具,可以转化成文本和图片。
2. 墨迹天气工具。
3. 必优 PPT 生成工具。
4. 可配置最大请求体大小,以及内部网络请求最大响应大小,避免响应体过大,导致内存溢出。
5. 新增 Claude4.5, qwen3, kimi2, deepseek3.2 模型预设。
file: ./content/self-host/upgrading/4-13/4132.en.mdx
meta: {
"title": "V4.13.2 (Environment Changes, Upgrade Script)",
"description": "FastGPT V4.13.2 Release Notes"
}
## Upgrade Guide
### 1. Update Images:
* Update FastGPT image tag: v4.13.2
* Update FastGPT commercial edition image tag: v4.13.2
* Update fastgpt-plugin image tag: v0.2.4
* mcp\_server: no update needed
* Sandbox: no update needed
* AIProxy: no update needed
### 2. Add FastGPT/FastGPT-pro Environment Variables
```
S3_PUBLIC_BUCKET=fastgpt-public # (Public read bucket name, corresponds to the previous S3_TOOL_BUCKET in the plugin project)
S3_PRIVATE_BUCKET=fastgpt-private # (Private read/write bucket name, corresponds to the previous S3_PLUGIN_BUCKET in the plugin project)
```
### 3. Fix fastgpt-plugin Environment Variables
* Rename S3\_TOOL\_BUCKET to S3\_PUBLIC\_BUCKET
* Rename S3\_PLUGIN\_BUCKET to S3\_PRIVATE\_BUCKET
### 4. Run the Upgrade Script
From any terminal, send an HTTP request. Replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your **FastGPT domain**.
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv4132' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
This will remove the previous S3 circleLife policy. If you are using an external S3 service that does not support circleLife operations, this script may fail -- you can safely ignore the error (since setting the policy would have also failed).
## New Features
1. HTTP Toolset now supports manual creation mode.
2. Introduced the project OpenAPI framework.
3. API key validity check endpoint.
4. Exported chat logs now include the current version's global variables at the end.
## Improvements
1. Non-administrators can no longer view team audit logs.
2. Introduced S3 for storing app avatars.
3. Workflow canvas performance improvements.
## Bug Fixes
1. LLM models defaulting to image support caused request errors.
2. Mongo watch was not re-triggered during multi-replica failover.
3. Text chunking did not process the remaining `LastText` data after all strategies were exhausted.
4. Variable input field failed validation when number value was 0.
5. Incorrect parallel execution detection in complex workflow loops.
## Plugin Updates
1. Added: Perplexity Search tool.
2. Added: Base64-to-file conversion tool.
3. Added: MiniMax TTS file generation tool.
4. Added: Openrouter Nano Banana image generation tool.
5. Added: Redis cache operation tool.
6. Added: Tavily Search tool.
7. Added: SiliconFlow qwen-image and qwen-image-edit tools.
8. Added: Lark Multidimensional Table operation suite.
9. Added: YouTube subtitle extraction.
10. Added: Alibaba Cloud Bailian qwen image edit.
11. Added: Markdown-to-PPT tool.
12. Added: Whisper speech-to-text tool.
13. System tools now support configuring whether to run in a Worker.
file: ./content/self-host/upgrading/4-13/4132.mdx
meta: {
"title": "V4.13.2(环境变量变更、升级脚本)",
"description": "FastGPT V4.13.2 更新说明"
}
## 更新指南
### 1. 更新镜像:
* 更新 FastGPT 镜像tag: v4.13.2
* 更新 FastGPT 商业版镜像tag: v4.13.2
* 更新 fastgpt-plugin 镜像 tag: v0.2.4
* mcp\_server 无需更新
* Sandbox 无需更新
* AIProxy 无需更新
### 2. 增加 FastGPT/FastGPT-pro 环境变量
```
S3_PUBLIC_BUCKET=fastgpt-public #(公开读公开桶名称,对应原来 plugin 项目的S3_TOOL_BUCKET)
S3_PRIVATE_BUCKET=fastgpt-private #(私有读私有写桶名称,对应原来 plugin 项目的S3_PLUGIN_BUCKET)
```
### 3. 修复 fastgpt-plugin 环境变量
* S3\_TOOL\_BUCKET 改名成 S3\_PUBLIC\_BUCKET
* S3\_PLUGIN\_BUCKET 改名成 S3\_PRIVATE\_BUCKET
### 4. 执行升级脚本
从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv4132' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
会删除原先 S3 的 circleLife 策略。如果使用的是外部 S3,可能会因为不支持 circleLife 操作导致该脚本错误,可以忽略(因为设置策略也会失败)。
## 🚀 新增内容
1. HTTP 工具集支持手动创建模式。
2. 项目 OpenAPI 框架引入。
3. APIKey 有效性检测接口。
4. 导出对话日志,末尾跟随当前版本全局变量。
## ⚙️ 优化
1. 非管理员无法看到团队审计日志。
2. 引入 S3 用于存储应用头像。
3. 工作流画布性能。
## 🐛 修复
1. LLM 模型默认支持图片,导致请求错误。
2. Mongo 多副本切换时候,watch 未重新触发。
3. 文本分块,所有策略用完后,未处理 LastText 数据。
4. 变量输入框,number=0 时,无法通过校验。
5. 工作流复杂循环并行判断异常。
## 🔨 插件更新
1. 新增:Perplexity search 工具。
2. 新增:Base64转文件工具。
3. 新增:MiniMax TTS 文件生成工具。
4. 新增:Openrouter nano banana 绘图工具。
5. 新增:Redis 缓存操作工具。
6. 新增:Tavily search 工具。
7. 新增:硅基流动 qwen-image 和 qwen-image-edit 工具。
8. 新增:飞书多维表格操作套件。
9. 新增:Youtube 字幕提取。
10. 新增:阿里百炼 qwen image edit。
11. 新增:Markdown 转 PPT 工具。
12. 新增:whisper 语音转文字工具。
13. 系统工具支持配置是否需要在 Worker 中运行。
file: ./content/self-host/upgrading/4-16/41601.en.mdx
meta: {
"title": "V4.16.0-beta1 (In Progress)",
"description": "FastGPT V4.16.0-beta1 release notes"
}
## 📦 Upgrade Guide
### 1. Update the Agent Sandbox configuration
Environments that enable Agent Sandbox must add a browser-accessible preview proxy URL to both `fastgpt-app` and `fastgpt-pro`:
```dotenv
# HTTP(S) URL used by browsers to preview Sandbox files
AGENT_SANDBOX_PREVIEW_PROXY_URL=https://sandbox-proxy.example.com
```
The URL must start with `http://` or `https://`. With a default single-port deployment, it can point to the same host and port as `AGENT_SANDBOX_PROXY_URL`, while the protocols remain HTTP(S) and WebSocket(S), respectively.
We strongly recommend using a different origin for the preview URL and the main FastGPT site. Sandbox HTML may contain user-generated scripts; serving it from the same origin would place those scripts inside the main site's same-origin security boundary, where they could access site credentials or APIs. FastGPT does not currently enforce origin isolation.
The preview URL is a short-lived, read-only bearer capability. It authorizes access to the entire Sandbox Workspace, not just the individual file in the URL. Anyone with the link can change the URL path during its validity period and read other files in the same Sandbox Workspace. Do not share it with users who should not access that Workspace.
The following optional settings are also available:
| Variable | Default | Description |
| ------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `AGENT_SANDBOX_CPU_COUNT` | `1` | Maximum CPU cores per Agent Sandbox instance. |
| `AGENT_SANDBOX_MEMORY_MIB` | `2048` | Memory limit per Agent Sandbox instance, in MiB. |
| `AGENT_SANDBOX_STORAGE_SIZE_GI` | `1` | Agent Sandbox storage capacity, in Gi. Used as the Sealos Devbox storage limit and to create new PVCs in OpenSandbox Kubernetes mode. |
| `AGENT_SANDBOX_SUSPEND_MINUTES` | `60` | Number of minutes an active Sandbox can remain idle before it is automatically suspended. |
| `AGENT_SANDBOX_ARCHIVE_INACTIVE_DAYS` | `7` | Number of days a suspended Sandbox can remain inactive before it is automatically archived. |
The E2B Sandbox Provider has been removed. Environments previously configured for E2B must switch to `opensandbox` or `sealosdevbox` and remove `AGENT_SANDBOX_E2B_API_KEY`.
> The preview protocol has changed for FastGPT, `fastgpt-agent-sandbox-proxy`, and `fastgpt-agent-sandbox`. When Agent Sandbox is enabled, use the images released with this version. Mixing old and new versions is not supported.
### 2. Update the Agent Sandbox Proxy environment variables
Version 4.16.0 requires the proxy for static resource access. If your gateway supports WebSocket and HTTP traffic on the same port, you only need to expose one port. Otherwise, set `PREVIEW_PORT` to configure the HTTP port.
```dotenv
# Port for the WebSocket and HTTP services
PORT=1006
# HTTP service port; overrides PORT when set
PREVIEW_PORT=1007
```
### 3. Migrate Agent Sandbox data
This release changes App Chat's Agent Sandbox from “one instance per conversation” to “one shared instance per App and user.” Files from different conversations remain isolated under `sessions/`. Published Skills are stored in the shared `projects` directory.
If Agent Sandbox was previously enabled, migrate the existing Workspaces in the following order. You can skip this section if Agent Sandbox has never been enabled.
Run a dry run first to see how many beta6 Sandbox fields require normalization and how many legacy Skill Debug Chats require cleanup. The dry run does not create resources, access object storage, or modify data:
```bash
curl -X POST 'https://你的域名/api/admin/4160/initUserSandbox' \
-H 'Content-Type: application/json' \
-H 'rootkey: 你的ROOT_KEY' \
-d '{"dryRun":true}'
```
After reviewing the dry-run result, run the migration:
```bash
curl -X POST 'https://你的域名/api/admin/4160/initUserSandbox' \
-H 'Content-Type: application/json' \
-H 'rootkey: 你的ROOT_KEY' \
-d '{"dryRun":false}'
```
If every item in `failures` reports `Sandbox source is missing or deleted`, and you have confirmed that the corresponding Apps or Skills no longer exist, you can explicitly skip those stale Sandboxes:
```bash
curl -X POST 'https://your-domain/api/admin/4160/initUserSandbox' \
-H 'Content-Type: application/json' \
-H 'rootkey: YOUR_ROOT_KEY' \
-d '{"dryRun":false,"skipError":true}'
```
`skipError` defaults to `false`, so omitting it preserves strict migration behavior. The switch only skips an entire source group when that source is missing or soft-deleted. Sandboxes in the group are not archived, deleted, or migrated, and are reported through `skippedCount` and `skipped`. Archive, object storage, provider, concurrency-control, and all other errors remain blocking.
The migration first runs all V4.15.0-beta6 normalization steps. It fills in `sourceType/sourceId` for legacy Sandboxes, removes obsolete fields, deletes orphaned resources that cannot be associated, and cleans up the three legacy Skill Debug Chat collections and old private/public Bucket prefixes when `sourceType` is missing. After recounting, the two categories are combined into `normalization.pendingCount`; Workspace archiving does not begin while the count is non-zero. Once normalization is complete, all legacy Workspaces are archived, old compute resources are cleaned up, Skills are migrated, and records are aggregated into user-level Sandboxes by App and user. Installation does not start if any archive operation fails. New Sandboxes are suspended after Workspace installation and start normally on first use. The script is safe to retry: completed archive and migration operations are not repeated. Old archives and MongoDB records are retained as backups after migration.
Check `normalization.pendingCount`, `normalizationBlocked`, `failedCount`, `failures`, `skippedCount`, and `skipped` in the response. When both `normalization.pendingCount` and `failedCount` are `0` and `normalizationBlocked` is `false`, every non-skipped Sandbox has been migrated. Legacy records listed in `skipped` remain in place and are not migrated.
### 4. Migrate manual HTTP tool data
This release changes array parameters in manually configured HTTP tools to standard JSON Schema. Environments with manual HTTP tools created before the upgrade must run this migration. OpenAPI-mode HTTP tools do not require migration and are skipped automatically.
Run a dry run first to inspect pending data in current Apps and historical versions. The dry run does not modify data:
```bash
curl -X POST 'https://你的域名/api/admin/4160/initHttpToolSchema' \
-H 'Content-Type: application/json' \
-H 'rootkey: 你的ROOT_KEY' \
-d '{"dryRun":true}'
```
After confirming the result, run the migration:
```bash
curl -X POST 'https://你的域名/api/admin/4160/initHttpToolSchema' \
-H 'Content-Type: application/json' \
-H 'rootkey: 你的ROOT_KEY' \
-d '{"dryRun":false}'
```
The script first filters Apps by HTTP tool type, then migrates historical versions associated with those `appId` values. Only manual-mode tools without `apiSchemaStr` are processed; other Apps and OpenAPI-mode tools are left unchanged. The migration runs in batches and is safe to retry. `total.changedDocumentCount` in the response shows how many documents require processing. Run another dry run after the migration and confirm that this value is `0`.
## 🚀 New
1. Agent Sandbox now runs at the App-user level. Multiple conversations from the same user and App share a Sandbox while keeping files isolated in separate session directories.
2. Sandbox HTML and files can be previewed directly through short-lived, read-only links without being uploaded to object storage again.
3. App Workflow automatically archives and restores Workspaces when the Sandbox Provider or runtime image changes. The upgrade completes silently during the current run.
4. Workflow tool nodes can delegate selected input parameters to the Agent for generation while preserving fixed values, references, and user inputs.
5. ChatAgent tool selection supports explicitly choosing whether parameters should be generated by AI.
6. Knowledge Base data supports custom `metadata`, which can be imported as JSON through the API, CSV templates, or Excel templates. Search results and backup exports preserve this field. Template and backup imports accept both `.csv` and `.xlsx` files with `q`, `a`, `index`, and `metadata` headers. `q`, `a`, and `metadata` each use one column, while `index` may use multiple columns in any order. Excel files must contain a single worksheet with no merged cells. FastGPT reports an invalid file format when it cannot parse a CSV or Excel file correctly.
7. Large-file chunked uploads.
8. System tool keys configured by administrators are now encrypted, with backward compatibility for existing keys.
## ⚙️ Improvements
1. Refactored the Agent Sandbox lifecycle and migration flow with concurrency protection, resumable execution, and idempotent retries for creation, suspension, archiving, restoration, deletion, and Provider changes.
2. When Agent Sandbox is unavailable or unsupported by the current team plan, App Chat disables Sandbox automatically. Other models, tools, Knowledge Bases, and Workflow nodes remain available.
3. OpenSandbox can retain persistent volumes after stopping and reuse them on later runs. Suspension and archive thresholds can be configured through environment variables.
4. App and Skill now share runtime image upgrade status, and the Skill editor can continuously poll for upgrade results.
5. Sandbox file writes now create parent directories automatically, preventing failures when writing to nested paths.
6. Improved compatibility handling for legacy Workflow data and tool parameters.
7. Updated the Agent Ask UI.
## 🐛 Fixes
1. Fixed OpenSandbox resources not being released or reused correctly after stopping.
2. Fixed state races and duplicate operations during Agent Sandbox creation, restoration, and runtime upgrades.
3. Fixed Sandbox writes to nested directories failing when the parent directory did not exist.
4. Fixed number inputs becoming regular text fields after switching between Agent-generated and manual input.
5. Fixed string inputs being rendered incorrectly as dropdowns.
6. Fixed JSON Editor being incorrectly included in Workflow tool configuration.
7. Fixed tool execution errors being displayed incorrectly in Agent and Workflow tool interfaces.
8. Fixed uninstalled tools still appearing in the system tool list.
9. Fixed the default Agent/Agent V2 version selection so it chooses the latest version by default.
10. Fixed images embedded in S3-hosted files with spaces failing to parse because of malformed keys and returning 404 errors.
11. Fixed duplicate headers in MCP SSE mode.
12. Fixed unencrypted Agent V2 system tool keys.
## 🛠️ Code Improvements
1. Split Sandbox Adapter by lifecycle, filesystem, command execution, and Provider contracts, and removed the E2B Adapter.
2. Added direct Workspace preview, Range requests, path traversal protection, and session authentication to Agent Sandbox Proxy and IDE Agent.
3. Optimized Workflow schemas and unified tool calls with form rendering.
4. Extended tool JSON Schema support for additional data types.
5. Unified service file-read timeouts.
6. Hardened system tool permissions in multi-process deployments.
file: ./content/self-host/upgrading/4-16/41601.mdx
meta: {
"title": "V4.16.0-beta1(进行中)",
"description": "FastGPT V4.16.0-beta1 更新说明"
}
## 📦 升级指南
### 1. 更新 Agent Sandbox 配置
启用 Agent Sandbox 的环境必须在 `fastgpt-app` 和 `fastgpt-pro` 中新增浏览器可访问的预览代理地址:
```dotenv
# 浏览器访问 Sandbox 文件预览的 HTTP(S) 地址
AGENT_SANDBOX_PREVIEW_PROXY_URL=https://sandbox-proxy.example.com
```
该地址必须以 `http://` 或 `https://` 开头。默认单端口部署时,它可以与 `AGENT_SANDBOX_PROXY_URL` 指向同一域名和端口,但协议分别使用 HTTP(S) 和 WebSocket(S)。
强烈建议预览地址与 FastGPT 主站使用不同的 origin。Sandbox HTML 可能包含用户生成的脚本;同源部署会让这些脚本进入主站的同源安全边界,可能访问主站凭证或接口。系统当前不会强制检查 origin 是否隔离。
预览 URL 是短期只读 bearer capability,不只授权 URL 中的单个文件。获得链接的人可以在有效期内修改 URL 路径,读取同一 Sandbox Workspace 中的其他文件,请勿将链接分享给不应访问该 Workspace 的用户。
本版本还新增以下可选配置:
| 变量 | 默认值 | 说明 |
| ------------------------------------- | ------ | ------------------------------------------------------------------------------------ |
| `AGENT_SANDBOX_CPU_COUNT` | `1` | Agent Sandbox 单实例 CPU 核数上限。 |
| `AGENT_SANDBOX_MEMORY_MIB` | `2048` | Agent Sandbox 单实例内存上限,单位 MiB。 |
| `AGENT_SANDBOX_STORAGE_SIZE_GI` | `1` | Agent Sandbox 存储容量,单位 Gi;用于 Sealos Devbox 存储上限,以及 OpenSandbox Kubernetes 模式下创建新 PVC。 |
| `AGENT_SANDBOX_SUSPEND_MINUTES` | `60` | 运行中的 Sandbox 未活跃多久后自动暂停,单位分钟。 |
| `AGENT_SANDBOX_ARCHIVE_INACTIVE_DAYS` | `7` | 已暂停 Sandbox 未活跃多久后自动归档,单位天。 |
E2B Sandbox Provider 已移除。此前配置过 E2B 的环境需要切换为 `opensandbox` 或 `sealosdevbox`,并删除 `AGENT_SANDBOX_E2B_API_KEY`。
> FastGPT、`fastgpt-agent-sandbox-proxy` 和 `fastgpt-agent-sandbox` 的预览协议已同步变更。启用 Agent Sandbox 时必须使用本版本配套镜像,不支持新旧版本混合部署。
### 2. 更新 Agent-sandbox-proxy 环境变量
4.16.0 需要依赖 proxy 进行静态资源代理访问,如果网关支持 ws 和 http 在同一个端口,则可以只开放一个端口。如果不支持,可以通过设置 `PREVIEW_PORT` 来设置 http 访问端口。
```dotenv
# ws和http服务的端口
PORT=1006
# http服务的端口,可以覆盖 PORT
PREVIEW_PORT=1007
```
### 3. 迁移 Agent Sandbox 数据
本版本将 App Chat 的 Agent Sandbox 从“每个对话一个实例”调整为“同一 App、同一用户共享一个实例”。不同对话的文件仍分别保存在 `sessions/` 目录中,已发布 Skill 则统一保存在共享的 `projects` 目录中。
如果此前启用过 Agent Sandbox,必须按以下顺序完成旧 Workspace 迁移。未启用过 Agent Sandbox 的环境可以跳过本节。
先执行 dry-run,查看 beta6 Sandbox 字段归一化和旧 Skill Debug Chat 清理的待处理数。dry-run 不会创建资源、访问对象存储或修改数据:
```bash
curl -X POST 'https://你的域名/api/admin/4160/initUserSandbox' \
-H 'Content-Type: application/json' \
-H 'rootkey: 你的ROOT_KEY' \
-d '{"dryRun":true}'
```
查看 dry-run 结果后执行正式迁移。正式迁移会先执行 beta6 归一化,并且只在剩余待处理数归零时,才在同一请求中继续 Workspace 归档:
```bash
curl -X POST 'https://你的域名/api/admin/4160/initUserSandbox' \
-H 'Content-Type: application/json' \
-H 'rootkey: 你的ROOT_KEY' \
-d '{"dryRun":false}'
```
如果 `failures` 中仅包含 `Sandbox source is missing or deleted`,并且已确认对应 App 或 Skill 确实不再存在,可以显式跳过这些残留 Sandbox:
```bash
curl -X POST 'https://你的域名/api/admin/4160/initUserSandbox' \
-H 'Content-Type: application/json' \
-H 'rootkey: 你的ROOT_KEY' \
-d '{"dryRun":false,"skipError":true}'
```
`skipError` 默认为 `false`,省略时保持严格迁移。该开关只跳过 source 已缺失或已软删除的整个分组,不会归档、删除或迁移其中的 Sandbox;跳过明细通过 `skippedCount` 和 `skipped` 返回。归档、对象存储、Provider 和并发控制等其他错误仍会阻断迁移。
迁移会先执行 V4.15.0-beta6 的完整前置逻辑:补齐旧 Sandbox 的 `sourceType/sourceId`、清理遗留字段、删除无法归属的孤立资源,并清理缺失 `sourceType` 的旧 Skill Debug Chat 三表数据及私有、公开 Bucket 旧前缀。与 App 同 ID 的 Skill 会跳过 Chat 清理。两类数据重新统计后合计为 `normalization.pendingCount`;数量不为 `0` 时不会进入 Workspace 归档。归零后直接归档全部旧 Workspace 并清理旧计算资源,再迁移 Skill,最后按 App、用户聚合到用户级 Sandbox。只要归档阶段存在失败,安装阶段就不会开始。新的 Sandbox 会在 Workspace 安装完成后暂停,首次使用时再按正常流程启动。脚本可安全重试,已完成的归档和迁移不会重复执行;迁移完成后会保留旧归档和旧 MongoDB 记录作为备份。
请检查返回结果中的 `normalization.pendingCount`、`normalizationBlocked`、`failedCount`、`failures`、`skippedCount` 和 `skipped`。只有 `normalization.pendingCount` 和 `failedCount` 均为 `0`,且 `normalizationBlocked` 为 `false` 时,才表示所有未跳过的 Sandbox 迁移完成;`skipped` 中的 Legacy 记录会保留且不会迁移。
### 4. 迁移手动 HTTP 工具数据
本版本将手动模式 HTTP 工具的数组参数改为标准 JSON Schema。升级前创建过手动 HTTP 工具的环境需要执行此迁移;OpenAPI 模式的 HTTP 工具无需迁移,脚本会自动跳过。
先执行 dry-run,查看当前应用及历史版本中的待处理数据。dry-run 不会修改数据:
```bash
curl -X POST 'https://你的域名/api/admin/4160/initHttpToolSchema' \
-H 'Content-Type: application/json' \
-H 'rootkey: 你的ROOT_KEY' \
-d '{"dryRun":true}'
```
确认结果后执行正式迁移:
```bash
curl -X POST 'https://你的域名/api/admin/4160/initHttpToolSchema' \
-H 'Content-Type: application/json' \
-H 'rootkey: 你的ROOT_KEY' \
-d '{"dryRun":false}'
```
脚本会先按 HTTP 工具类型筛选应用,再根据这些应用的 `appId` 迁移对应的历史版本。仅 `apiSchemaStr` 不存在的手动模式会被处理,其他应用及 OpenAPI 模式不会修改。迁移按批次执行且可安全重试;返回结果中 `total.changedDocumentCount` 表示发现的待处理文档数,正式执行后可再次 dry-run,确认该值为 `0`。
## 🚀 新增内容
1. Agent Sandbox 改为 App 用户级实例,同一 App、同一用户的多个对话复用 Sandbox,并通过独立 session 目录隔离各对话文件。
2. Sandbox HTML 和文件支持通过短期只读链接直接预览,不再为预览重复上传到对象存储。
3. App Workflow 在 Sandbox Provider 或运行时镜像变化时自动归档并恢复 Workspace,升级过程在当前运行中静默完成。
4. 工作流工具节点支持将指定输入参数交由 Agent 自动生成,并保留固定值、引用和用户输入等既有配置。
5. ChatAgent 选择工具时,支持手动指定是否为 AI 生成参数。
6. 知识库数据支持自定义 `metadata`,可通过 API、CSV 或 Excel 模板导入 JSON 元数据;检索结果和备份导出会保留该字段。模板导入和备份导入均支持 `.csv` 和 `.xlsx` 文件,使用 `q`、`a`、`index`、`metadata` 表头;`q`、`a`、`metadata` 各一列,`index` 可多列且顺序任意。Excel 文件仅支持单个工作表且不能包含合并单元格,无法正确解析的 CSV 或 Excel 文件会提示文件格式异常。
7. 大文件分块上传。
8. 管理员配置系统工具密钥时,加密(兼容已配置的密钥)。
## ⚙️ 优化
1. 重构 Agent Sandbox 生命周期和迁移流程,创建、暂停、归档、恢复、删除及 Provider 切换支持并发保护、断点续跑和幂等重试。
2. Agent Sandbox 不可用或当前团队套餐不支持时,App Chat 自动禁用 Sandbox 能力,其他模型、工具、知识库和 Workflow 节点仍可继续运行。
3. OpenSandbox 停止后可保留持久卷并在后续运行时复用;暂停和归档阈值支持通过环境变量配置。
4. App 与 Skill 统一运行时镜像升级状态,Skill 编辑页可持续轮询升级结果。
5. Sandbox 文件写入前自动创建父目录,避免写入嵌套路径失败。
6. 优化工作流旧数据、工具参数等兼容问题。
7. Agent Ask UI。
## 🐛 修复
1. 修复 OpenSandbox 资源停止后未正确释放或复用的问题。
2. 修复 Agent Sandbox 创建、恢复或运行时升级期间的状态竞争和重复操作问题。
3. 修复 Sandbox 向嵌套目录写入文件时因父目录不存在而失败的问题。
4. 修复 number 输入在 Agent 生成和手动输入之间切换后变成普通文本框的问题。
5. 修复字符串文本输入被错误渲染为下拉选择的问题。
6. 修复 JSON Editor 被错误加入工作流工具配置的问题。
7. 修复工具运行错误在 Agent/工作流工具界面中被错误展示的问题。
8. 修复系统工具列表中已卸载工具的展示问题。
9. 修复 Agent/Agent V2 默认版本选择逻辑,使其默认选择最新版本。
10. S3 文件如果有空格时,解析其文件内的图片,会因 key 异常 404。
11. MCP SSE 模式,header 重复。
12. Agent V2 系统工具密钥未加密。
## 🛠️ 代码优化
1. Sandbox Adapter 按生命周期、文件系统、命令执行和 Provider 契约重新拆分,并移除 E2B Adapter。
2. Agent Sandbox Proxy 和 IDE Agent 增加 Workspace 直连预览、Range 请求、路径逃逸防护及会话鉴权。
3. 工作流 schema 优化,统一工具调用和表单渲染。
4. 扩展工具 JSON Schema,支持更多数据类型。
5. 统一服务文件读取超时时间。
6. 优化系统工具多进程权限安全问题。
file: ./content/self-host/upgrading/4-15/41500.en.mdx
meta: {
"title": "V4.15.0 (Environment Changes, Upgrade Script)",
"description": "FastGPT V4.15.0 Release Notes"
}
import { Alert } from '@/components/docs/Alert';
## 📦 Upgrade Guide
### 1. Environment Variable Changes
#### 1.1 fastgpt-app and fastgpt-pro
##### Check required variables
v4.15.0 introduces stricter environment variable validation. After upgrading, make sure the following variables are configured correctly.
```dotenv
# Encryption key. Must be the same in both services.
AES256_SECRET_KEY=
# File token key. Must be the same in both services.
FILE_TOKEN_KEY=
# JWT secret for invoke callbacks. Must be at least 32 characters and the same in both services.
INVOKE_TOKEN_SECRET=
```
##### New environment variables
**Required**
```dotenv
# SSE MCP Server address. Leave empty if you do not use SSE.
SSE_MCP_SERVER_PROXY_ENDPOINT=
```
**Optional**
The following variables have defaults or can be left unset without affecting normal usage.
```dotenv
# File parsing worker concurrency (optional)
PARSE_FILE_WORKERS=10
# File parsing timeout in seconds (optional)
PARSE_FILE_TIMEOUT_SECONDS=600
# HTML-to-Markdown worker concurrency (optional)
HTML_TO_MARKDOWN_WORKERS=10
# Text chunking worker concurrency (optional)
TEXT_TO_CHUNKS_WORKERS=10
# Automatically sync MongoDB indexes. Use boolean strings instead of 0 or 1. (optional)
SYNC_INDEX=true
# Whether to enable trusted reverse proxy client IP verification (optional)
TRUSTED_PROXY_ENABLE=false
# Trusted reverse proxy IP/CIDR list, separated by commas or whitespace. Only takes effect when TRUSTED_PROXY_ENABLE=true.
# Only X-Forwarded-For/X-Real-IP from explicitly trusted proxies will be used for client IP resolution. (optional)
TRUSTED_PROXY_IPS=
# Maximum string length for synchronous system variable replacement, in M. Range: 1-100.
SYSTEM_MAX_STRING_LENGTH_M=100
# Maximum folder depth. Default: 4. Range: 2-20.
MAX_FOLDER_DEPTH=4
# Maximum input array length for Loop/Parallel nodes
WORKFLOW_MAX_LOOP_TIMES=100
# Parallel node concurrency limit. The final value is clamped to [5, 100].
WORKFLOW_PARALLEL_MAX_CONCURRENCY=10
```
##### Open-source edition variable changes
The open-source edition no longer uses the `config.json` configuration file. These settings have moved to environment variables. After removing the volume mount, add the following variables as needed:
```dotenv
# Custom PDF parsing service URL
CUSTOM_PDF_PARSE_URL=
# Custom PDF parsing service key
CUSTOM_PDF_PARSE_KEY=
# Doc2x PDF parsing service key
DOC2X_KEY=
# TextIn service App ID
TEXTIN_APP_ID=
# TextIn service Secret Code
TEXTIN_SECRET_CODE=
# hnsw ef_search parameter for vector search. Only applies to PG / OB / OpenGauss.
HNSW_EF_SEARCH=100
# Maximum vector scan tuple count. Only applies to PG.
HNSW_MAX_SCAN_TUPLES=100000
# Maximum Knowledge Base file parsing queue concurrency
DATASET_PARSE_MAX_PROCESS=10
# Maximum vector training queue concurrency
VECTOR_MAX_PROCESS=10
# Maximum Q&A split queue concurrency
QA_MAX_PROCESS=10
# Maximum vision-language model processing queue concurrency
VLM_MAX_PROCESS=10
```
#### 1.2 code-sandbox
Code Sandbox adds security-related environment variables such as `SANDBOX_API_MAX_BODY_MB` and `SANDBOX_MAX_OUTPUT_MB`, and supports grouped run queueing through `queueId`. Full defaults:
| Variable | Default | Description |
| --------------------------------- | ------- | ----------------------------------------------------------------------------------------------------- |
| `SANDBOX_API_MAX_BODY_MB` | `8` | Maximum `/sandbox` API JSON body size, including `variables`, in MB. |
| `SANDBOX_MAX_OUTPUT_MB` | `10` | Maximum output JSON size for one code execution, including return values and logs, in MB. |
| `CHECK_INTERNAL_IP` | `true` | Enables internal IP checks for sandbox network requests by default to reduce SSRF risk. |
| `SANDBOX_MAX_TIMEOUT` | `60000` | Timeout for one code execution, in milliseconds. |
| `SANDBOX_MAX_MEMORY_MB` | `256` | Memory limit for one sandbox, in MB. The runtime reserves an extra `50` MB for overhead. |
| `SANDBOX_POOL_SIZE` | `20` | Number of pre-warmed JS/Python workers. |
| `SANDBOX_REQUEST_MAX_COUNT` | `30` | Maximum number of network requests allowed during one code execution. |
| `SANDBOX_REQUEST_TIMEOUT` | `60000` | Timeout for one network request from inside the sandbox, in milliseconds. |
| `SANDBOX_REQUEST_MAX_RESPONSE_MB` | `10` | Maximum response body size for one sandbox network request, in MB. |
| `SANDBOX_REQUEST_MAX_BODY_MB` | `5` | Maximum request body size for one sandbox network request, in MB. |
| `SANDBOX_QUEUE_ID_CONCURRENCY` | Empty | Number of requests with the same `queueId` that may enter execution at once. Empty disables queueing. |
#### 1.3 fastgpt-plugin
The plugin service has been reworked. You must add `AUTH_TOKEN` and `FASTGPT_BASE_URL`, and update the `MONGODB_URI` variable:
1. Set `AUTH_TOKEN` for `fastgpt-plugin`. It must be at least 32 characters long.
2. Set `PLUGIN_TOKEN` in both `fastgpt` and `fastgpt-pro` to the same value as `fastgpt-plugin`'s `AUTH_TOKEN`.
3. Change the database name in `fastgpt-plugin`'s `MONGODB_URI` so it does not conflict with FastGPT's MongoDB database name. Example: `mongodb://myusername:mypassword@fastgpt-mongo:27017/fastgpt-plugin?authSource=admin`.
**Additional variables you may adjust**
```dotenv
# ================ System =====================
# Auth token
AUTH_TOKEN=
# Maximum API request body size (MB)
MAX_API_SIZE=10
# FastGPT service URL. It can be an internal address and is used for callbacks to FastGPT APIs.
FASTGPT_BASE_URL=http://fastgpt-app:3000
# ================ Plugin runtime =====================
# Supported value: localPool
PLUGIN_RUNTIME_MODE=localPool
# Temporary file storage directory. Can be empty.
LOCAL_FILE_BASE_PATH=
# ================ Process pool =====================
# Health check interval (ms)
POOL_HEALTH_CHECK_INTERVAL=30000
# Maximum total process count
POOL_MAX_TOTAL_PODS=100
# Minimum process count for one Service
POOL_SERVICE_MIN_PODS=0
# Maximum process count for one Service
POOL_SERVICE_MAX_PODS=5
# Global idle timeout (ms)
POOL_SERVICE_IDLE_TIMEOUT=60000
# Process runtime timeout (ms)
POOL_SERVICE_POD_TIMEOUT=120000
# Maximum concurrent requests per process
POOL_SERVICE_MAX_CONCURRENT_REQUESTS_PER_POD=10
# Global maximum requests per process before automatic rotation
POOL_SERVICE_MAX_REQUESTS_PER_POD=100
# Global maximum process queue length
POOL_SERVICE_MAX_QUEUE_SIZE=500
# Global process queue timeout (ms)
POOL_SERVICE_QUEUE_TIMEOUT=60000
# Startup retry backoff base delay (ms)
POOL_SERVICE_STARTUP_RETRY_BASE_DELAY=1000
# Startup retry backoff maximum delay (ms)
POOL_SERVICE_STARTUP_RETRY_MAX_DELAY=10000
# ================ Database =====================
MONGODB_URI=mongodb://username:password@localhost:27017/fastgpt?authSource=admin&directConnection=true
MONGO_MAX_LINK=20
SYNC_INDEX=true
REDIS_URL=redis://default:password@localhost:6379/0
# ================ Object storage =====================
# S3 file prefix. Do not change it casually after use.
S3_FILE_BASE_PATH=system/plugin
STORAGE_VENDOR=minio
STORAGE_REGION=us-east-1
STORAGE_ACCESS_KEY_ID=minioadmin
STORAGE_SECRET_ACCESS_KEY=minioadmin
STORAGE_PUBLIC_BUCKET=fastgpt-public
STORAGE_PRIVATE_BUCKET=fastgpt-private
STORAGE_EXTERNAL_ENDPOINT=http://localhost:9000
STORAGE_S3_ENDPOINT=http://localhost:9000
STORAGE_S3_FORCE_PATH_STYLE=true
STORAGE_S3_MAX_RETRIES=3
STORAGE_PUBLIC_ACCESS_EXTRA_SUB_PATH=
# ================ Logs =====================
LOG_ENABLE_CONSOLE=true
# Console log level: "trace" | "debug" | "info" | "warning" | "error" | "fatal"
LOG_CONSOLE_LEVEL=info
LOG_ENABLE_OTEL=false
# Minimum log level stored in OTEL
LOG_OTEL_LEVEL=info
LOG_OTEL_SERVICE_NAME=fastgpt-plugin
LOG_OTEL_URL=http://localhost:4318/v1/logs
# ================ Metrics =====================
METRICS_ENABLE_OTEL=false
METRICS_OTEL_SERVICE_NAME=fastgpt-plugin
METRICS_OTEL_URL=http://localhost:4318/v1/metrics
METRICS_EXPORT_INTERVAL_MS=30000
METRICS_EXPORT_TIMEOUT_MS=10000
METRICS_INCLUDE_PLUGIN_VERSION=true
METRICS_INCLUDE_PLUGIN_ETAG=false
METRICS_INCLUDE_HOSTNAME=true
# For multi-node deployments, use Pod UID / container id / instance id. Empty generates an opaque id.
SERVICE_INSTANCE_ID=
DEPLOYMENT_ENVIRONMENT=
```
### 2. OpenSandbox Changes (as needed)
OpenSandbox and other sandbox provider settings have moved to [Sandbox Configuration](../../config/sandbox/common) and are no longer built into the deployment yml.
For this upgrade, focus on:
1. Deploying the `agent-sandbox-proxy` service.
2. Updating OpenSandbox-related image versions.
3. Updating related environment variables in `fastgpt-app` and `fastgpt-pro`.
You can overwrite your deployment directly with the new OpenSandbox template.
### 3. Image Changes
* Update fastgpt-app (FastGPT main service) image tag: v4.15.0
* Update fastgpt-pro (FastGPT commercial edition) image tag: v4.15.0
* Update fastgpt-code-sandbox image tag: v4.15.0
* Update fastgpt-plugin image tag: v1.0.0
* Update aiproxy image tag: v0.6.5
If `opensandbox` is enabled, also update:
* fastgpt-agent-sandbox-proxy image tag: v0.2.0
* fastgpt-agent-sandbox image tag: v0.2.0
### 4. Start Services
Run `docker compose up -d` to restart services.
### 5. Reinstall System Tools
After upgrading the plugin service, reinstall all legacy system tools:
1. Download the [zip package](https://github.com/labring/fastgpt-img/raw/refs/heads/main/fastgpt-official-plugins\(1\).zip) that contains all system tools.
2. Open the `fastgpt` web app, click `Admin` in the navbar, click Add Plugin, click `Import/Update Plugin`, upload the zip package, and confirm.
You can also install them one by one from the plugin marketplace: [https://v2.marketplace.fastgpt.cn](https://v2.marketplace.fastgpt.cn). The environment variable default now points to this address, so no marketplace-related variables are required.
### 6. Run Migration Scripts
Before running scripts:
1. Back up MongoDB, object storage, and your current deployment configuration.
2. Upgrade `fastgpt-app` / `fastgpt-pro` to image versions that include these root-admin APIs.
3. Prepare a reachable FastGPT `{{host}}` and `{{rootkey}}`. All APIs below require `rootkey`.
#### 6.1 Clean Duplicate appId-chatId Records (optional, but recommended)
The stable release syncs two unique indexes: `{ appId, chatId }` and `{ sourceType, appId, chatId }`. Before the indexes sync successfully, check and clean duplicate `appId + chatId` records in the `chats` collection. Otherwise, when `SYNC_INDEX=true`, index sync may fail with `E11000 duplicate key error`, and the unique constraint will not take effect.
This API depends on the upgraded `fastgpt-app` image. If the first stable-release startup already reports a unique index conflict but the service is still reachable, run the dry-run and cleanup commands below, then restart the service so it can sync indexes again.
Run the dry-run first. This does not delete data, and every deployment should run it at least once:
```bash
curl -X POST 'https://{{host}}/api/admin/dataClean/cleanupDuplicateChats' \
-H 'Content-Type: application/json' \
-H 'rootkey: {{rootkey}}' \
-d '{"dryRun":true,"sampleLimit":20}'
```
Check these response fields:
* `duplicateDocumentCount`: expected number of duplicate `chats` headers to delete.
* `samples`: duplicate samples, including the retained `keepId` and candidate `deleteIds`.
* `deletedDocumentCount`: number actually deleted during apply. It is always `0` in dry-run mode.
If `duplicateDocumentCount=0`, no apply step is needed. If it is greater than 0, confirm the samples and then apply the cleanup:
```bash
curl -X POST 'https://{{host}}/api/admin/dataClean/cleanupDuplicateChats' \
-H 'Content-Type: application/json' \
-H 'rootkey: {{rootkey}}' \
-d '{"dryRun":false,"sampleLimit":20}'
```
Cleanup policy: for each duplicate `appId + chatId` group, the API keeps the record with the latest `updateTime`. If timestamps are equal, it uses `_id` descending as a stable tie-breaker. The API only deletes duplicate `chats` headers. It does not delete message content in `chatitems` or `chat_item_responses`.
After cleanup, keep `SYNC_INDEX=true` and restart `fastgpt-app` / `fastgpt-pro` so the service can sync indexes again. You can enter MongoDB and confirm both indexes are `unique: true`:
```js
db.chats
.getIndexes()
.filter((idx) => ['appId_1_chatId_1', 'sourceType_1_appId_1_chatId_1'].includes(idx.name));
```
#### 6.2 Workflow V1 -> V2 Migration (optional)
Run this only when upgrading directly from a version earlier than `<4.8`, or when your deployment still contains historical V1 Workflow data. The API defaults to dry-run mode. It scans, converts, and validates the saved structure without writing to the database.
```bash
curl -X POST 'https://{{host}}/api/admin/dataClean/v1WorkflowToV2' \
-H 'Content-Type: application/json' \
-H 'rootkey: {{rootkey}}' \
-d '{"dryRun":true}'
```
After confirming the returned statistics, apply the migration:
```bash
curl -X POST 'https://{{host}}/api/admin/dataClean/v1WorkflowToV2' \
-H 'Content-Type: application/json' \
-H 'rootkey: {{rootkey}}' \
-d '{"dryRun":false}'
```
Skip this step if you already completed the V1 -> V2 migration in an earlier version, or if you are upgrading from v4.8 or later.
#### 6.3 Workflow Dirty-Data Cleanup (required)
This script scans and fixes historical enum-expression strings, nullish values, and legacy-structure compatibility issues in `apps.modules` and `app_versions.nodes`. All self-hosted deployments should run the dry-run first. If the returned statistics show fixable data, apply the write step.
If 6.2 applies to your deployment, run this script after 6.2 completes.
```bash
curl -X POST 'https://{{host}}/api/admin/dataClean/initWorkflowData' \
-H 'Content-Type: application/json' \
-H 'rootkey: {{rootkey}}' \
-d '{"dryRun":true,"batchSize":1000,"writeBatchSize":10}'
```
After confirming the dry-run result, apply the cleanup:
```bash
curl -X POST 'https://{{host}}/api/admin/dataClean/initWorkflowData' \
-H 'Content-Type: application/json' \
-H 'rootkey: {{rootkey}}' \
-d '{"dryRun":false,"batchSize":1000,"writeBatchSize":10}'
```
Lower `writeBatchSize` if production write pressure is high. Documents that fail Zod validation are reported in the response and are not written back to the database.
#### 6.4 Archive Legacy Sandboxes (optional)
If you used legacy sandbox workspaces, this API can fix historical sandbox status fields and optionally archive inactive workspaces to S3. This step does not affect newly generated sandboxes. Skipping it does not block the v4.15 stable upgrade; old workspaces simply will not be archived automatically. You can also delete old sandboxes manually.
Check only, without triggering archive:
```bash
curl -X POST 'https://{{host}}/api/admin/dataClean/initSandboxArchive' \
-H 'Content-Type: application/json' \
-H 'rootkey: {{rootkey}}' \
-d '{"runArchive":false,"inactiveDays":0}'
```
If you want to immediately archive inactive workspaces that match the condition:
```bash
curl -X POST 'https://{{host}}/api/admin/dataClean/initSandboxArchive' \
-H 'Content-Type: application/json' \
-H 'rootkey: {{rootkey}}' \
-d '{"runArchive":true,"inactiveDays":0}'
```
## Major Impacts
1. API Key behavior has changed. FastGPT no longer distinguishes between app keys and system keys; only system keys are kept. For OpenAI SDK compatibility, pass the token as `apikey-appId`. Existing API keys remain compatible and continue to work. For details, see the [FastGPT API documentation](../../../openapi/intro).
2. Some APIs now enforce stricter data format validation. If you see a `zod parse error`, please submit an issue. It may be caused by legacy data or custom data structures that do not match the declared schema.
3. LLM request traces now enforce team isolation. `llm_request_records` stores `teamId`, `GET /api/core/ai/record/getRecord` queries by `{ requestId, teamId }`, and the unique index changes to `{ teamId, requestId }`. Trace records written before this upgrade do not contain `teamId` and can no longer be queried; the UI will treat them as expired. Export relevant logs or keep original request details before upgrading if you need to investigate historical calls. If your self-hosted deployment has `SYNC_INDEX` disabled, run an index sync after upgrading so the old `requestId_1` unique index is removed.
## 🚀 New Features
1. Added the Skill module. Agent V2 can bind and run static Skills.
2. Reworked the Agent V2 loop logic to improve stability for multi-step tool calls and orchestration.
3. Sandbox now supports custom npm and pip sources.
4. Reworked the plugin system architecture, added plugin-level runtime config, and moved system tool execution to local-pool.
5. The commercial edition now supports local direct-connect debugging for FastGPT plugins.
6. Reworked the chatbox UI with quick scroll-to-bottom, model-generated chat titles, and smoother streaming output.
7. Added LLM-generated chat titles.
8. Added the Loop node and deprecated the legacy batch execution node.
9. Knowledge Base search now supports native multimodal embedding models, image-to-image search, and permission filtering in Agent mode.
10. Multimodal models now support audio and video input.
11. API Key logic is optimized. API Key management is unified, and requests now explicitly pass app context.
12. Generated separate DevAPI and System OpenAPI documentation.
13. Added quick-reply output syntax.
14. Added DingTalk Knowledge Base integration for third-party Knowledge Bases.
15. Added model reasoning configuration.
16. Workflow template export now includes the template name and description.
17. Global variable inputs now support object-type data.
18. In tool call mode, when the virtual machine feature is enabled, files uploaded in the user chat input are injected directly into the VM.
19. Added worker pools for file parsing, HTML-to-Markdown conversion, and text chunking to prevent resource exhaustion under high concurrency.
20. Added a directory depth environment variable to avoid infinitely nested directories. Configure it with `MAX_FOLDER_DEPTH`.
21. S3 now supports CDN configuration.
22. Rerank now supports `defaultConfig`.
23. Share links and portal pages now support language switching and no longer force language detection from the browser.
24. Chat API now validates duplicate `dataId` values to prevent invalid data from entering Workflow execution and stream-resume merge logic.
25. The HTTP node now supports ignoring TLS certificate verification and returning the complete error object.
## ⚙️ Improvements
1. Plugin execution entries can now be fetched from object storage and cached in a local directory.
2. Optimized the OTEL log collection format.
3. Disabled invalid connection mode in Workflows.
4. Added mutually exclusive parent-child node selection to prevent jitter when moving selected parent and child nodes together.
5. Improved Workflow node name, description input, and long-name adaptation.
6. When the user is redirected from the Workflow editor because the login session expires, the draft is automatically saved for recovery.
7. In Workflow run details, file fields from form input nodes are displayed as file lists.
8. Strengthened validation for Workflow array reference types to avoid conflicts with two-dimensional data.
9. Image processing workers now support configuring whether images are converted to base64 before being sent to the model through `MULTIPLE_DATA_TO_BASE64=true`.
10. HTML output now automatically switches to preview mode after generation, reducing the need to open the preview manually.
11. Improved stream-resume pause and abnormal interruption recovery to reduce chats getting stuck in inaccurate generating or stopping states.
12. The most recent chat is remembered per app when switching apps, and local chat cache is cleared when switching teams.
13. Improved the Knowledge Base search test interaction and Knowledge Base data editing modal.
14. When a Knowledge Base is deleted, app orchestration now shows a graceful prompt.
15. Improved error prompts during Knowledge Base training and added one-click retry for all failed items.
16. Invalid Knowledge Base reference markers are now filtered out.
17. PDF parsing now uses `liteparse` instead of PDFJs, improving speed by 3x.
18. xlsx parsing now automatically removes empty rows and columns and supports merged cells.
19. Added validation for input guide configuration to prevent incorrect custom dictionary URL configuration.
20. Strengthened security protection for third-party Knowledge Base requests, HTTP tool parsing, IP detection, and Code Sandbox AST checks.
21. File injection in messages moved from system messages to user messages to improve cache hit rates.
22. Improved the reason hide toggle so reasoning can be hidden in the UI while still being preserved when requesting the LLM.
23. Optimized `chat2messages` adaptation to avoid standalone reason output.
24. Empty tool responses are now automatically filled with `none` to avoid errors in some models.
25. Improved the insufficient-balance prompt for non-admin users and visitors.
26. Template features are hidden when the user does not have creation permission.
27. Improved long-name display for apps, Knowledge Bases, files, and folders: names are truncated when they exceed the available width, and the full name is shown on hover.
28. Improved Skill-related modals, editing interactions, and list API performance.
29. Improved the login page UI.
30. Deduplicated site sync rate-limit error prompts.
31. Added virtual list rendering for apps and Knowledge Bases to improve large-list performance.
32. LLM request traces now use team-isolated queries to prevent request IDs from exposing request bodies, retrieved Knowledge Base chunks, and model responses across teams.
## 🐛 Bug Fixes
1. Fixed an issue where a model response error in Agent V2 mode caused steps to execute repeatedly.
2. Fixed missing charset in text responses when previewing or downloading Knowledge Base source files.
3. Fixed abnormal default values in Workflow single-node debugging.
4. Fixed abnormal `defaultConfig` override behavior in model configuration.
5. Fixed TTS playback errors when adapting to the latest OpenAI SDK.
6. Fixed oversized chunks that could occur when Knowledge Base data chunks contained code blocks.
7. Fixed abnormal multimodal file link retrieval from models.
8. Fixed potential security risks related to the training API, HTTP tool parsing, and private S3 object keys.
9. Fixed abnormal MCP tool expansion for tool calls after interactive nodes.
10. Fixed abnormal tool call parameter schemas for array and object types in Workflow tools.
11. Fixed UI offset in publish channel portals.
12. Fixed the v1/completions API where `quoteList` in `nodeResponse` did not return `q` and `a`.
13. Fixed conversation stream resume issues, including form restoration, file list restoration, node response preservation, duplicate interaction appending, temporary history titles, and cross-app chat leakage.
14. Stop conversation prompts are now synchronized with the backend generation state, and the warning toast shown during stop has been removed.
15. The v1/chat/completions API previously filtered out `q`/`a`/`index` when returning `nodeResponse`; this version restores those fields.
## 🛠️ Code Improvements
1. Reorganized the overall code structure, upgraded Next.js, switched to Turbopack builds, and upgraded the default container Node.js version to 24.
2. Unified Agent tool declaration and execution behavior.
3. The plugin service moved from the legacy `runtime` structure to a pnpm workspace monorepo, split into HTTP service entry, domain model, use cases, API adapter, infrastructure, SDK, and CLI.
4. Application-related API interfaces now use zod schemas consistently and generate documentation.
5. Split AI request, Workflow run detail, and chatbox code to reduce module coupling.
6. Optimized user-defined API key billing logic and token calculation dependencies.
7. Server-side environment loading now uses `@t3-oss/env-core` with stronger type checks. Other services also use centralized environment exports.
8. Upgraded project tooling, including ESLint, Prettier, textlint, lint-staged, and TS6.
9. Improved unit test performance, reducing full test runtime from 10 minutes to 5 minutes.
10. Strengthened GitHub Actions security.
11. Added design documentation and unit tests for stream-resume-related modules.
12. Changed the volume manager runtime from Bun to Node.js.
13. Images are now processed promptly inside workers instead of retaining base64 data, reducing memory usage.
14. Added string length protection for system string processing. When strings are too large, synchronized replacement stops to avoid high CPU load.
15. Workflow `nodeResponse` is now stored in a flattened structure to avoid save failures in large nested Workflows.
16. Removed `temperature` and `max_tokens` from all built-in LLM requests to avoid incompatibility with some models.
17. Fixed dirty enum-expression strings such as `FlowNodeInputTypeEnum.*`, `FlowNodeOutputTypeEnum.*`, and `WorkflowIOValueTypeEnum.*` in Workflow node configuration that caused input rendering and IO type checks to behave incorrectly.
18. In Workflow text boxes, `Ctrl+C` for copying text could be intercepted by node copy behavior, preventing text copy.
19. The chat API has been abstracted from app-specific handling into a platform-level capability.
file: ./content/self-host/upgrading/4-15/41500.mdx
meta: {
"title": "V4.15.0(环境变量变更、升级脚本)",
"description": "FastGPT V4.15.0 更新说明"
}
import { Alert } from '@/components/docs/Alert';
## 📦 升级指南
### 1. 环境变量变更
#### 1.1 fastgpt-app 与 fastgpt-pro
##### 检查是否缺少变量
4.15.0 版本引入了更为严格的环境变量检查,升级后需确保以下环境变量正确配置.
```dotenv
# 密钥加密密钥,两个服务需一致
AES256_SECRET_KEY=
# 文件 token 密钥,两个服务需一致
FILE_TOKEN_KEY=
# Invoke 反向调用 JWT 密钥,至少 32 位,两个服务需一致
INVOKE_TOKEN_SECRET=
```
##### 新增环境变量
**必须新增的变量**
```dotenv
# SSE mcp server 服务地址,如果不需要 SSE 的话,可以不配置
SSE_MCP_SERVER_PROXY_ENDPOINT=
```
**可选的变量**
以下变量均有默认值,或者不配置不影响使用。
```dotenv
# 文件解析 worker 并发数(可选)
PARSE_FILE_WORKERS=10
# 文件解析超时时间(秒)(可选)
PARSE_FILE_TIMEOUT_SECONDS=600
# HTML 转 Markdown worker 并发数(可选)
HTML_TO_MARKDOWN_WORKERS=10
# 文本切块 worker 并发数(可选)
TEXT_TO_CHUNKS_WORKERS=10
# 自动同步 mongo 数据库索引, 改成 boolean 字符串值,而不是 0 和 1(可选)
SYNC_INDEX=true
# 是否启用可信反向代理客户端 IP 校验(可选)
TRUSTED_PROXY_ENABLE=false
# 可信反向代理 IP/CIDR 列表,逗号或空白分隔。仅 TRUSTED_PROXY_ENABLE=true 时生效;仅显式可信代理传入的 X-Forwarded-For/X-Real-IP 会用于客户端 IP 解析(可选)
TRUSTED_PROXY_IPS=
# 系统变量替换等同步字符串处理的最大字符数,单位 M,范围 1~100
SYSTEM_MAX_STRING_LENGTH_M=100
# 允许的最深文件夹层级,默认 4,范围 2~20
MAX_FOLDER_DEPTH=4
# 循环/并行节点最大输入数组长度
WORKFLOW_MAX_LOOP_TIMES=100
# 并行节点并发上限,最终会 clamp 到 [5, 100]
WORKFLOW_PARALLEL_MAX_CONCURRENCY=10
```
##### 开源版环境变量变更
开源版移除 config.json 配置文件,改成环境变量,可新增这些变量来替代。移除 volumn 挂载后加入以下变量:
```dotenv
# 自定义 PDF 解析服务地址
CUSTOM_PDF_PARSE_URL=
# 自定义 PDF 解析服务密钥
CUSTOM_PDF_PARSE_KEY=
# Doc2x PDF 解析服务密钥
DOC2X_KEY=
# 合合信息 Textin 服务 App ID
TEXTIN_APP_ID=
# 合合信息 Textin 服务 Secret Code
TEXTIN_SECRET_CODE=
# 向量检索 hnsw ef_search 参数,仅对 PG / OB / OpenGauss 生效
HNSW_EF_SEARCH=100
# 向量检索最大扫描数据量,仅对 PG 生效
HNSW_MAX_SCAN_TUPLES=100000
# 知识库文件解析队列最大并发数
DATASET_PARSE_MAX_PROCESS=10
# 向量训练队列最大并发数
VECTOR_MAX_PROCESS=10
# 问答拆分队列最大并发数
QA_MAX_PROCESS=10
# 图片理解模型处理队列最大并发数
VLM_MAX_PROCESS=10
```
#### 1.2 code-sandbox
Code Sandbox 新增 `SANDBOX_API_MAX_BODY_MB`、`SANDBOX_MAX_OUTPUT_MB` 等安全相关环境变量,并支持通过 `queueId` 对运行接口做分组排队;完整默认值如下:
| 变量 | 默认值 | 说明 |
| --------------------------------- | ------- | -------------------------------------------------- |
| `SANDBOX_API_MAX_BODY_MB` | `8` | `/sandbox` API JSON 请求体总大小上限,包含 `variables`,单位 MB。 |
| `SANDBOX_MAX_OUTPUT_MB` | `10` | 单次代码执行输出 JSON 大小上限,包含返回值和日志,单位 MB。 |
| `CHECK_INTERNAL_IP` | `true` | 沙箱网络请求默认开启内网 IP 检查,降低 SSRF 风险。 |
| `SANDBOX_MAX_TIMEOUT` | `60000` | 单次代码执行超时时间,单位毫秒。 |
| `SANDBOX_MAX_MEMORY_MB` | `256` | 单个沙箱内存上限,单位 MB;运行时会额外预留 `50` MB 开销。 |
| `SANDBOX_POOL_SIZE` | `20` | JS/Python 预热 worker 数量。 |
| `SANDBOX_REQUEST_MAX_COUNT` | `30` | 单次代码执行允许发起的最大网络请求数。 |
| `SANDBOX_REQUEST_TIMEOUT` | `60000` | 沙箱内单次网络请求超时时间,单位毫秒。 |
| `SANDBOX_REQUEST_MAX_RESPONSE_MB` | `10` | 沙箱内单次网络响应体最大大小,单位 MB。 |
| `SANDBOX_REQUEST_MAX_BODY_MB` | `5` | 沙箱内单次网络请求体最大大小,单位 MB。 |
| `SANDBOX_QUEUE_ID_CONCURRENCY` | 空 | 同一个 `queueId` 同时可进入执行流程的请求数;为空时不启用排队。 |
#### 1.3 fastgpt-plugin
插件服务进行了重构,必须增加 `AUTH_TOKEN` 和 `FASTGPT_BASE_URL` 两个环境变量,并且需要修改 `MONGODB_URI` 变量:
1. 修改 `fastgpt-plugin` 的环境变量 `AUTH_TOKEN`,要求 32 位以上。
2. 同时修改 `fastgpt` 和 `fastgpt-pro` 的环境变量 `PLUGIN_TOKEN`,与 `fastgpt-plugin` 的 `AUTH_TOKEN` 一致。
3. 修改 `fastgpt-plugin` 的环境变量 `MONGODB_URI` 中的数据库名,不与 `fastgpt` 的 Mongo 数据库名重名即可,例如:`mongodb://myusername:mypassword@fastgpt-mongo:27017/fastgpt-plugin?authSource=admin`
**更多变量,可按需修改**
```dotenv
# ================ 系统 =====================
# 鉴权 token
AUTH_TOKEN=
# 最大 API 请求体大小(MB)
MAX_API_SIZE=10
# FastGPT 服务的地址,可以为内网连接串,用于反向调用 fastgpt 接口。
FASTGPT_BASE_URL=http://fastgpt-app:3000
# ================ 插件运行 =====================
# 可选值: localPool
PLUGIN_RUNTIME_MODE=localPool
# 临时文件存储目录,可以为空
LOCAL_FILE_BASE_PATH=
# ================ 进程池 =====================
# 健康检查时间(ms)
POOL_HEALTH_CHECK_INTERVAL=30000
# 最大总进程数
POOL_MAX_TOTAL_PODS=100
# 某个 Service 的最小进程数
POOL_SERVICE_MIN_PODS=0
# 某个 Service 的最大进程数
POOL_SERVICE_MAX_PODS=5
# 全局空闲超时时间(ms)
POOL_SERVICE_IDLE_TIMEOUT=60000
# 进程运行超时时间(ms)
POOL_SERVICE_POD_TIMEOUT=120000
# 单个进程最大并发请求数
POOL_SERVICE_MAX_CONCURRENT_REQUESTS_PER_POD=10
# 全局单个进程最大请求数,超出后自动轮换
POOL_SERVICE_MAX_REQUESTS_PER_POD=100
# 全局进程队列最大长度
POOL_SERVICE_MAX_QUEUE_SIZE=500
# 全局进程队列超时时间(ms)
POOL_SERVICE_QUEUE_TIMEOUT=60000
# 启动超时退避基础时间(ms)
POOL_SERVICE_STARTUP_RETRY_BASE_DELAY=1000
# 启动超时退避最大时间(ms)
POOL_SERVICE_STARTUP_RETRY_MAX_DELAY=10000
# ================ 数据库 =====================
MONGODB_URI=mongodb://username:password@localhost:27017/fastgpt?authSource=admin&directConnection=true
MONGO_MAX_LINK=20
SYNC_INDEX=true
REDIS_URL=redis://default:password@localhost:6379/0
# ================ 对象存储 =====================
# S3 文件前缀,使用后不可随意修改
S3_FILE_BASE_PATH=system/plugin
STORAGE_VENDOR=minio
STORAGE_REGION=us-east-1
STORAGE_ACCESS_KEY_ID=minioadmin
STORAGE_SECRET_ACCESS_KEY=minioadmin
STORAGE_PUBLIC_BUCKET=fastgpt-public
STORAGE_PRIVATE_BUCKET=fastgpt-private
STORAGE_EXTERNAL_ENDPOINT=http://localhost:9000
STORAGE_S3_ENDPOINT=http://localhost:9000
STORAGE_S3_FORCE_PATH_STYLE=true
STORAGE_S3_MAX_RETRIES=3
STORAGE_PUBLIC_ACCESS_EXTRA_SUB_PATH=
# ================ 日志 =====================
LOG_ENABLE_CONSOLE=true
# 控制台日志等级: "trace" | "debug" | "info" | "warning" | "error" | "fatal"
LOG_CONSOLE_LEVEL=info
LOG_ENABLE_OTEL=false
# OTEL 存储的最低日志等级
LOG_OTEL_LEVEL=info
LOG_OTEL_SERVICE_NAME=fastgpt-plugin
LOG_OTEL_URL=http://localhost:4318/v1/logs
# ================ 指标 =====================
METRICS_ENABLE_OTEL=false
METRICS_OTEL_SERVICE_NAME=fastgpt-plugin
METRICS_OTEL_URL=http://localhost:4318/v1/metrics
METRICS_EXPORT_INTERVAL_MS=30000
METRICS_EXPORT_TIMEOUT_MS=10000
METRICS_INCLUDE_PLUGIN_VERSION=true
METRICS_INCLUDE_PLUGIN_ETAG=false
METRICS_INCLUDE_HOSTNAME=true
# 多节点部署建议使用 Pod UID / container id / instance id;为空时进程会生成 opaque id。
SERVICE_INSTANCE_ID=
DEPLOYMENT_ENVIRONMENT=
```
### 2. OpenSandbox 调整(按需)
Opensandbox 和其他沙盒提供商的配置单独移动到[沙盒配置](../../config/sandbox/common)内,并不再内置到部署 yml 中。
本次升级主要需修改以下内容:
1. 新部署 `agent-sandbox-proxy` 服务。
2. 更新 `opensandbox` 相关镜像版本。
3. 修改 `fastgpt-app` 和 `fastgpt-pro` 里部分环境变量。
可以直接按新的 OpenSandbox 模板进行覆盖部署即可。
### 3. 镜像变更
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.15.0
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.15.0
* 更新 fastgpt-code-sandbox 镜像 tag: v4.15.0
* 更新 fastgpt-plugin 镜像 tag: v1.0.0
* 更新 aiproxy 镜像 tag: v0.6.5
如果启用 `opensandbox`,需同步更新下面镜像:
更新 fastgpt-agent-sandbox-proxy 镜像 tag: v0.2.0
更新 fastgpt-agent-sandbox 镜像 tag: v0.2.0
### 4. 启动服务
`docker compose up -d` 重启服务。
### 5. 重装系统工具
插件服务升级后,需要重装旧的所有系统工具:
1. 下载所有系统工具的 [zip 包](https://github.com/labring/fastgpt-img/raw/refs/heads/main/fastgpt-official-plugins\(1\).zip)。
2. 打开 `fastgpt` 网页 - 点击 `管理员` navbar - 点击添加插件 - 点击 `导入/更新插件` - 上传 zip - 确认。
也可以打开插件市场逐个下载安装,插件市场地址为: [https://v2.marketplace.fastgpt.cn](https://v2.marketplace.fastgpt.cn),环境变量默认值已变成该地址,不设置相关环境变量即可。
### 6. 执行迁移脚本
执行前先完成三件事:
1. 备份 MongoDB、对象存储和当前部署配置。
2. 将 `fastgpt-app` / `fastgpt-pro` 升级到包含这些 Root 管理员接口的镜像版本。
3. 准备可访问 FastGPT 的 `{{host}}` 和 `{{rootkey}}`。下面所有接口都需要 `rootkey`。
#### 6.1 清理重复的 appId-chatId(可选,但建议执行)
正式版会同步 `{ appId, chatId }` 和 `{ sourceType, appId, chatId }` 两个唯一索引。正式版索引最终同步成功前,必须检查并清理 `chats` 集合中重复的 `appId + chatId`;否则开启 `SYNC_INDEX=true` 后,索引同步可能报 `E11000 duplicate key error`,唯一约束不会生效。
该接口依赖升级后的 `fastgpt-app` 镜像。如果首次启动正式版时已经出现唯一索引冲突,但服务仍可访问,可直接执行下面的 dry-run 和清理命令,完成后重启服务重新同步索引。
先执行 dry-run。该步骤不会删除数据,所有环境都应至少执行一次:
```bash
curl -X POST 'https://{{host}}/api/admin/dataClean/cleanupDuplicateChats' \
-H 'Content-Type: application/json' \
-H 'rootkey: {{rootkey}}' \
-d '{"dryRun":true,"sampleLimit":20}'
```
重点查看返回值:
* `duplicateDocumentCount`:预计需要删除的重复 `chats` 会话头数量。
* `samples`:重复样本,包含保留的 `keepId` 和候选删除的 `deleteIds`。
* `deletedDocumentCount`:正式执行时实际删除数量,dry-run 时固定为 `0`。
如果 `duplicateDocumentCount=0`,无需执行正式清理。如果大于 0,确认样本无误后执行:
```bash
curl -X POST 'https://{{host}}/api/admin/dataClean/cleanupDuplicateChats' \
-H 'Content-Type: application/json' \
-H 'rootkey: {{rootkey}}' \
-d '{"dryRun":false,"sampleLimit":20}'
```
清理策略:每组重复的 `appId + chatId` 会保留 `updateTime` 最新的一条;如果时间相同,用 `_id` 倒序作为稳定兜底。接口只删除重复的 `chats` 会话头,不删除 `chatitems`、`chat_item_responses` 中的消息内容。
清理完成后,保持 `SYNC_INDEX=true` 并重启 `fastgpt-app` / `fastgpt-pro`,让服务重新同步索引。可进入 MongoDB 后确认两个索引都已经是 `unique: true`:
```js
db.chats
.getIndexes()
.filter((idx) => ['appId_1_chatId_1', 'sourceType_1_appId_1_chatId_1'].includes(idx.name));
```
#### 6.2 Workflow V1 -> V2 迁移(可选)
只有从 `<4.8` 的旧版本直接升级,或历史上仍保留 V1 Workflow 数据的环境需要执行。该接口默认 dry-run,会扫描、转换并校验保存结构,但不写库。
```bash
curl -X POST 'https://{{host}}/api/admin/dataClean/v1WorkflowToV2' \
-H 'Content-Type: application/json' \
-H 'rootkey: {{rootkey}}' \
-d '{"dryRun":true}'
```
确认返回统计后,执行正式迁移:
```bash
curl -X POST 'https://{{host}}/api/admin/dataClean/v1WorkflowToV2' \
-H 'Content-Type: application/json' \
-H 'rootkey: {{rootkey}}' \
-d '{"dryRun":false}'
```
如果你已经在较早版本完成过 V1 -> V2 迁移,或从 v4.8 及以上版本升级,可跳过本步骤。
#### 6.3 Workflow 脏数据清理(必须)
该脚本会扫描并修复 `apps.modules` 和 `app_versions.nodes` 中历史枚举表达式字符串、空值和旧结构兼容问题。所有自托管环境都应先执行 dry-run;如果返回统计显示存在可修复数据,再执行正式写入。
如果满足 6.2 条件,该脚本必须在 6.2 之后执行。
```bash
curl -X POST 'https://{{host}}/api/admin/dataClean/initWorkflowData' \
-H 'Content-Type: application/json' \
-H 'rootkey: {{rootkey}}' \
-d '{"dryRun":true,"batchSize":1000,"writeBatchSize":10}'
```
确认 dry-run 结果后执行:
```bash
curl -X POST 'https://{{host}}/api/admin/dataClean/initWorkflowData' \
-H 'Content-Type: application/json' \
-H 'rootkey: {{rootkey}}' \
-d '{"dryRun":false,"batchSize":1000,"writeBatchSize":10}'
```
生产写入压力较高时,可以降低 `writeBatchSize`。未通过 Zod 校验的文档只会在响应中报告,不会被写回数据库。
#### 6.4 归档旧沙盒(可选)
如果使用过旧版 sandbox workspace,可通过该接口修正历史 sandbox 状态字段,并按需把不活跃 workspace 归档到 S3。该步骤不影响新生成的 sandbox;不执行也不影响 v4.15 正式版升级,只是不会自动归档旧 workspace。可以手动删除旧的沙盒。
只检查、不触发归档:
```bash
curl -X POST 'https://{{host}}/api/admin/dataClean/initSandboxArchive' \
-H 'Content-Type: application/json' \
-H 'rootkey: {{rootkey}}' \
-d '{"runArchive":false,"inactiveDays":0}'
```
如果确认需要立即归档满足条件的不活跃 workspace:
```bash
curl -X POST 'https://{{host}}/api/admin/dataClean/initSandboxArchive' \
-H 'Content-Type: application/json' \
-H 'rootkey: {{rootkey}}' \
-d '{"runArchive":true,"inactiveDays":0}'
```
## 一些大的影响
1. ApiKey 功能调整,不再区分应用 key 和系统 key,只保留系统 key,如需兼容 openai sdk 用法,可使用 `apikey-appId` 的方式传递 Token。已有的 apikey 保持兼容,不影响使用。具体和查阅 [FastGPT API 文档说明](../../../openapi/intro)
2. 部分 API 增加了更为严格的数据格式校验,如过遇到报错: `zod parse error` 可提交 issue 反馈,可能因一些旧数据或者自定义数据结构与声明不一致。
3. LLM 请求追踪记录新增团队隔离:`llm_request_records` 写入 `teamId`,`GET /api/core/ai/record/getRecord` 按 `{ requestId, teamId }` 查询,唯一索引调整为 `{ teamId, requestId }`。升级前没有 `teamId` 的旧追踪记录将无法继续查询,页面会提示追踪记录已过期;如需排查历史调用详情,请在升级前导出相关日志或保留原始请求信息。自托管环境如关闭了 `SYNC_INDEX`,升级后需要执行一次索引同步,确保旧的 `requestId_1` 唯一索引被移除。
## 🚀 新增内容
1. 新增技能模块,Agent V2 可绑定静态 Skill 来运行。
2. 重写 Agent V2 loop 逻辑,提升多轮工具调用和流程编排的稳定性。
3. 沙盒支持自定义 npm 和 pip 源。
4. 插件系统架构重写,支持插件级 runtime config,系统工具运行迁移到 local-pool。
5. 商业版支持本地直连 FastGPT 调试插件。
6. 重写 chatbox UI,支持快速滚动到底部、模型生成对话标题和更流畅的流式输出动效。
7. 支持通过 LLM 生成对话标题。
8. 新增循环节点,弃用旧的批量执行。
9. 知识库搜索支持原生多模态 embedding 模型、图搜图和 Agent 模式权限过滤。
10. 多模态模型支持音视频输入。
11. API 密钥逻辑优化,统一 APIKey 管理并由请求显式传入应用上下文。
12. 生成 DevAPI 和 System OpenAPI 两套 API 文档。
13. 支持快速回复的输出语法。
14. 第三方知识库新增钉钉知识库接入。
15. 增加模型思考配置。
16. 工作流模板导出支持同时导出名称和介绍。
17. 全局变量输入框支持输入 object 类型数据。
18. 工具调用模式下,如果开启虚拟机功能,用户对话框上传的文件会直接注入到虚拟机中。
19. 增加文件解析、HTML 转 Markdown、文本切块 worker pool,避免并发太高导致资源耗尽。
20. 支持目录深度环境变量,避免无限嵌套目录。可配置环境变量 `MAX_FOLDER_DEPTH`。
21. S3 支持配置 CDN。
22. Rerank 支持配置 defaultConfig。
23. 分享链接/门户页支持语言切换,不再强制自动识别浏览器语言。
24. Chat API 增加 `dataId` 重复校验,避免脏数据进入工作流与流恢复合并逻辑。
25. HTTP 节点支持配置忽略 TLS 证书校验,并支持返回完整错误对象。
## ⚙️ 优化
1. 插件运行入口支持从对象存储拉取,并缓存到本地文件目录。
2. 优化 OTEL 日志采集格式。
3. 禁用工作流无效连接模式。
4. 增加父子节点选中互斥功能,解决同时选中父子节点时移动节点抖动的问题。
5. 优化工作流节点名称、介绍输入和超长名称适配。
6. 工作流编辑页因登录失效跳出后,自动保存草稿用于恢复。
7. 工作流运行详情中,表单输入节点的文件字段以文件列表形式展示。
8. 工作流数组引用类型增强校验,避免与二维数据冲突。
9. 图片处理线程支持配置是否转化成 base64 发送给模型,`MULTIPLE_DATA_TO_BASE64=true` 变量。
10. HTML 输出后自动切换为预览,减少手动打开预览的操作。
11. 流恢复暂停和异常中断恢复体验优化,减少会话卡在「生成中」或停止态不准确的问题。
12. 切换应用时按应用恢复最近会话,切换团队时清除本地 chat 缓存。
13. 优化知识库搜索测试交互和知识库数据编辑弹窗。
14. 知识库被删除后,应用编排时优雅提示。
15. 知识库训练出现错误时优化提示,并支持一键全部重试。
16. 过滤掉无效的知识库引用角标。
17. PDF 解析将 PDFJs 替换为 `liteparse`,速度提高 3 倍。
18. xlsx 解析自动去除空行空列,并补充合并单元格。
19. 输入引导配置增加校验,避免错误配置自定义词库地址。
20. 加强第三方知识库请求、HTTP tool parse、IP 检测和 Code Sandbox AST 检查等安全防护。
21. 文件注入 messages 位置从 system 调整至 user,便于命中缓存。
22. reason hide 开关完善,确保 UI 不显示时,请求 LLM 仍可保留 reason。
23. chat2messages adapt 优化,避免出现独立的 reason。
24. 工具运行空响应时自动补充 `none`,避免部分模型报错。
25. 非管理员/访客触发余额不足时,优化提示。
26. 无创建权限时隐藏模板功能。
27. 应用、知识库、文件和文件夹等长名称展示优化:超出宽度时自动省略,hover 名称时展示完整内容。
28. 技能模块相关弹窗、编辑交互和列表接口性能优化。
29. 登录页 UI 优化。
30. 站点同步限流错误提示去重。
31. 应用/知识库增加虚拟列表渲染,优化大列表加载性能。
32. LLM 请求追踪记录增加团队隔离,避免 `requestId` 被跨团队用于读取请求体、知识库召回片段和模型响应。
## 🐛 修复
1. 修复 Agent V2 模式下,模型响应报错会导致 step 重复执行。
2. 修复知识库源文件预览和下载时文本类型响应缺少 charset 的问题。
3. 修复工作流单节点调试存在异常默认值的问题。
4. 修复模型配置 `defaultConfig` 覆盖异常。
5. 修复 TTS 语音播放适配最新 OpenAI SDK 时的报错。
6. 修复知识库数据分块遇到代码块时可能出现超大分块的问题。
7. 修复模型获取多模态文件链接异常。
8. 修复 training 接口、HTTP tool parse 和 S3 私有对象 key 相关的潜在安全风险。
9. 修复交互节点后的工具调用展开 MCP 工具异常。
10. 修复工作流工具 array 和 object 类型工具调用参数 schema 异常。
11. 修复发布渠道 - 门户 UI 偏移。
12. 修复 v1/completions 接口 `nodeResponse` 中 `quoteList` 未返回 `q`、`a` 的问题。
13. 修复对话流恢复过程中的表单回填、文件列表恢复、节点响应保留、重复交互追加、临时历史标题和跨应用会话串显问题。
14. 停止会话提示改为与后端生成态同步,移除停止时的 warning toast。
15. v1/chat/completions 接口,返回 nodeResponse 时候,过滤掉了 q/a/index,该版本恢复返回。
## 🛠️ 代码优化
1. 调整整体代码结构,升级 Next.js 并切换至 Turbopack 构建;容器默认 Node.js 升级至 24。
2. 统一 Agent tool 的声明和运行方式。
3. 插件服务从旧 `runtime` 结构调整为 pnpm workspace monorepo,拆分为 HTTP 服务入口、领域模型、用例、API adapter、基础设施、SDK 和 CLI。
4. app API 接口统一使用 zod schema 编写并生成文档。
5. 拆分 AI request、工作流运行详情和对话框相关代码,降低模块耦合。
6. 优化用户自定义密钥计费逻辑和 token 计算依赖。
7. 服务端 env 加载统一使用 `@t3-oss/env-core`,增加类型检查;其余服务也采用集中导出 env 的方式使用环境变量。
8. 升级工程化工具链,包括 ESLint、Prettier、textlint、lint-staged 和 TS6。
9. 优化单测性能,全量测试从 10 分钟降至 5 分钟。
10. GitHub Action 增强安全性。
11. 流恢复相关模块补充设计文档与单元测试。
12. volume manager 从 Bun 改为 Node.js 运行。
13. 及时处理 worker 内图片,不再存留 base64,降低内存消耗。
14. 增加系统处理字符串时的长度保护,如果长度过大会停止继续同步替换,避免高 CPU 负载。
15. 工作流运行的 nodeResponse 改为扁平化存储,避免大的嵌套工作流保存失败。
16. 移除所有内置 LLM 请求中的 `temperature` 和 `max_tokens`,避免部分模型不兼容。
17. 修复工作流节点配置中 `FlowNodeInputTypeEnum.*`、`FlowNodeOutputTypeEnum.*` 和 `WorkflowIOValueTypeEnum.*` 枚举表达式字符串脏数据导致输入渲染和 IO 类型判断异常的问题。
18. 工作流文本框,ctrl+c 复制文本内容时,会被节点复制抢占,导致无法复制文本。
19. chat 接口抽象,不再绑定 app, 改成平台级别通用。
file: ./content/self-host/upgrading/4-15/41501.en.mdx
meta: {
"title": "V4.15.0-beta1 (Environment Changes)",
"description": "FastGPT V4.15.0-beta1 Release Notes"
}
## Upgrade Guide
### Image Changes
* Update the fastgpt-app (FastGPT main service) image tag to v4.15.0-beta1.
* Update the fastgpt-pro (FastGPT commercial edition) image tag to v4.15.0-beta1.
* Update the fastgpt-plugin image tag to v0.6.2.
* Update the AIProxy image tag to v0.5.6.
### Environment Changes
You can add the following file parsing concurrency settings to `fastgpt-app` and `fastgpt-pro`:
```dotenv
# File parsing worker concurrency (optional)
PARSE_FILE_WORKERS=10
# File parsing timeout in seconds (optional)
PARSE_FILE_TIMEOUT_SECONDS=600
# HTML-to-Markdown worker concurrency (optional)
HTML_TO_MARKDOWN_WORKERS=10
# Text chunking worker concurrency (optional)
TEXT_TO_CHUNKS_WORKERS=10
# Automatically synchronize MongoDB indexes. Use a boolean string instead of 0 or 1. (optional)
SYNC_INDEX=true
# Enable trusted reverse proxy client IP validation (optional)
TRUSTED_PROXY_ENABLE=false
# Comma- or whitespace-separated trusted reverse proxy IP/CIDR list. Used only when TRUSTED_PROXY_ENABLE=true. Only X-Forwarded-For/X-Real-IP values from explicitly trusted proxies are used for client IP resolution. (optional)
TRUSTED_PROXY_IPS=
```
### Check Required Environment Variables
This release adds stricter environment variable validation. Verify that `fastgpt-app` and `fastgpt-pro` include:
```dotenv
# Encryption key. Must match across both services.
AES256_SECRET_KEY=
# File token key. Must match across both services.
FILE_TOKEN_KEY=
# JWT secret for reverse invocation. Must be at least 32 characters and match across both services.
INVOKE_TOKEN_SECRET=
```
## 🚀 New Features
1. Added a Loop node and deprecated the legacy Batch Execution node.
2. Global variable inputs now support object values.
3. When the virtual machine feature is enabled in tool-calling mode, files uploaded in the chat input are injected directly into the virtual machine.
4. Added DingTalk Knowledge Base integration for third-party Knowledge Bases (beta; rich-text retrieval has known issues).
5. Added worker pools for file parsing, HTML-to-Markdown conversion, and text chunking to prevent excessive concurrency. Pool sizes are configurable through environment variables.
6. Added model reasoning configuration.
7. Added S3 CDN support.
8. Added `defaultConfig` support for rerank models.
## ⚙️ Improvements
1. Made parent and child node selection mutually exclusive to prevent jitter when moving selected parent and child nodes together.
2. Moved file injection in messages from the system message to the user message to improve cache hits.
3. Improved insufficient-balance messages for non-admin users and visitors.
4. Hid templates when the user does not have create permission.
5. Strengthened SSRF protection for third-party Knowledge Base requests.
6. Strengthened AST checks in codex-sandbox to prevent bypasses.
7. Prevented duplicate site synchronization rate-limit messages.
8. Strengthened IP validation to prevent spoofing bypasses.
9. Added an option to convert images to base64 before sending them to models.
## 🐛 Fixes
1. Fixed an issue where Agent V2 could repeat a step after a model response error.
2. Fixed missing charset information when previewing or downloading Knowledge Base source files with text responses.
## 🛠️ Code Improvements
1. Reorganized the codebase, upgraded to the latest Next.js, switched builds to Turbopack, and upgraded the default container Node.js version to 24.
2. Unified Agent tool declarations and execution.
3. Moved uploaded file content from the system prompt to the user message to improve cache hits.
4. Migrated server-side environment loading to `@t3-oss/env-core` for stronger type validation and centralized environment variable access across services.
5. Upgraded engineering tools including ESLint, Prettier, textlint, and lint-staged.
file: ./content/self-host/upgrading/4-15/41501.mdx
meta: {
"title": "V4.15.0-beta1(环境变量变更)",
"description": "FastGPT V4.15.0-beta1 更新说明"
}
## 升级指南
### 镜像变更
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.15.0-beta1
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.15.0-beta1
* 更新 fastgpt-plugin 镜像 tag: v0.6.2
* 更新 aiproxy 镜像 tag: v0.5.6
### 环境变量变更
`fastgpt-app` , `fastgpt-pro` 可增加文件解析并发线程数
```dotenv
# 文件解析 worker 并发数(可选)
PARSE_FILE_WORKERS=10
# 文件解析超时时间(秒)(可选)
PARSE_FILE_TIMEOUT_SECONDS=600
# HTML 转 Markdown worker 并发数(可选)
HTML_TO_MARKDOWN_WORKERS=10
# 文本切块 worker 并发数(可选)
TEXT_TO_CHUNKS_WORKERS=10
# 自动同步 mongo 数据库索引, 改成 boolean 字符串值,而不是 0 和 1(可选)
SYNC_INDEX=true
# 是否启用可信反向代理客户端 IP 校验(可选)
TRUSTED_PROXY_ENABLE=false
# 可信反向代理 IP/CIDR 列表,逗号或空白分隔。仅 TRUSTED_PROXY_ENABLE=true 时生效;仅显式可信代理传入的 X-Forwarded-For/X-Real-IP 会用于客户端 IP 解析(可选)
TRUSTED_PROXY_IPS=
```
### 确认是否遗漏环境变量
本次升级,增加了对于环境变量的检测,避免漏填必须的环境变量,需重点检查 `fastgpt-app` 和 `fastgpt-pro` 是否包含:
```dotenv
# 密钥加密密钥,两个服务需一致
AES256_SECRET_KEY=
# 文件 token 密钥,两个服务需一致
FILE_TOKEN_KEY=
# Invoke 反向调用 JWT 密钥,至少 32 位,两个服务需一致
INVOKE_TOKEN_SECRET=
```
## 🚀 新增内容
1. 新增循环节点,弃用旧的批量执行。
2. 全局变量输入框支持输入 object 类型数据。
3. 工具调用模式下,如果开启了虚拟机功能,用户对话框上传的文件会直接注入到虚拟机中。
4. 第三方知识库接入钉钉知识库(beta 版,目前存在富文本获取异常问题)。
5. 增加文件解析/HTML 转 Markdown/文本切块 worker pool,避免并发太高导致资源耗尽,可通过环境变量调整其 pool 数量。
6. 模型思考配置。
7. S3 支持配置 CDN。
8. Rerank 支持配置 defaultConfig。
## ⚙️ 优化
1. 增加父子节点选中互斥功能,解决:同时选中父子节点时,移动节点会出现抖动。
2. 调整文件注入 messages 位置,从 system 调整至 user,便于命中缓存。
3. 非管理员/访客,触发余额不足时候,提示优化。
4. 无创建权限时,隐藏模板功能。
5. 加强第三方知识库请求的 SSRF 防护。
6. codex-sandbox 加强 AST 检查,防止绕过安全检查。
7. 站点同步限流错误提示,重复提示。
8. 加强 IP 检测,避免伪造绕过。
9. 图片处理线程,支持配置是否转化成 base64 发送给模型。
## 🐛 修复
1. 修复 Agent v2 模式下,模型响应报错会导致 step 重复执行
2. 修复知识库源文件预览和下载时文本类型响应缺少 charset 的问题。
## 🛠️ 代码优化
1. 重新调整代码结构,升级 Next.js 最新版,切换至 Turbopack 构建,提高构建速度;升级容器默认 Node.js 至 24。
2. 优化 Agent tool 声明和运行,统一所有 tool 的声明和运行方式。
3. 文件上传内容从 system prompt 中放到 user message 中,提高 cache 命中率。
4. 服务端 env 加载全部使用 `@t3-oss/env-core`,增加更多类型检查。其余服务,也采用集中导出 env 的方式进行环境变量使用。
5. 升级了项目工程化工具链版本,包括 ESLint、Prettier、textlint 和 lint-staged 工具。
file: ./content/self-host/upgrading/4-15/41502.en.mdx
meta: {
"title": "V4.15.0-beta2 (Environment Changes)",
"description": "FastGPT V4.15.0-beta2 Release Notes"
}
## 📦 Upgrade Guide
### Image Changes
* Update the fastgpt-app (FastGPT main service) image tag to v4.15.0-beta2
* Update the fastgpt-pro (FastGPT commercial edition) image tag to v4.15.0-beta2
If you use OpenSandbox, update the following images:
* Update the fastgpt-agent-sandbox image tag to v0.2.0
* Update the fastgpt-agent-volume-manager image tag to v0.2.0
### Environment Variable Updates
1. If you use OpenSandbox, `AGENT_SANDBOX_VOLUME_MANAGER_MOUNT_PATH` is no longer effective and can be removed. OpenSandbox now always mounts persistent data to `/workspace`, which affects the old sandbox persistence behavior.
## 🚀 New Features
1. Added Skill editing. Agents can now use Skills. Currently, only static Skills are supported, and reverse calls to system tools are not supported.
2. Reworked the agentV2 loop logic.
3. Knowledge Base search now supports native multimodal embedding models and image-to-image search.
4. Chat API `dataId` validation: `/v1/chat/completions`, `/v2/chat/completions`, and `chatTest` now validate whether the current `dataId` duplicates one in the request or existing records in the current session before running the Workflow. Duplicate values return a business error immediately, preventing invalid data from entering Workflow execution and stream-resume merge logic.
## ⚙️ Improvements
1. Optimized the OTEL log collection format.
2. Disabled invalid connection mode in Workflows.
3. Improved layout adaptation for Workflow nodes with very long names.
4. Improved the Knowledge Base search test interaction.
5. Improved the Knowledge Base data editing modal.
6. Improved the reason hide toggle so reasoning can be hidden in the UI while still being preserved when requesting the LLM.
7. Stream-resume pause experience: after pausing, the client waits for the backend to return the real generation state. If the Workflow has not finished, the input area remains disabled and shows "Stopping", preventing the next round from being sent before the previous one ends.
8. Faster recovery for abnormally interrupted sessions: after a service crash or restart, Redis stream activity detection (about two minutes without a heartbeat) is used to correct stuck "generating" sessions to completed sooner. The 30-minute MongoDB fallback is still retained, and short Redis outages will not incorrectly update sessions that are still generating.
9. Remember the most recent chat when switching apps: when switching apps in the same browser, the last opened `chatId` is restored per app instead of sharing a single global session id.
10. Optimized response detail display: in the full response modal, file fields from form input nodes are displayed as file lists instead of raw JSON text.
11. Optimized `chat2messages` adaptation to avoid standalone reason output.
## 🐛 Bug Fixes
1. Fixed abnormal default values in Workflow single-node debugging.
2. Fixed abnormal `defaultConfig` override behavior in model configuration.
3. Clear the local chat cache when switching teams.
4. Conversation stream resume:
* Submitted form input values, including `fileSelect` file lists, are correctly restored into interactive nodes after refresh or reconnect resume. Empty forms and disappearing files no longer occur.
* Loaded AI output and node responses are preserved when automatic resume starts. When completed records overwrite local state, restored interactive form values and flow node responses are no longer lost.
* Expired unsubmitted interactions are no longer appended again after a form is submitted. During resume, form default values now stay in sync with `formInputResult`.
* After starting a new conversation, the temporary sidebar history item prioritizes the title generated from user input. The server-side title overwrites it after being persisted, avoiding a long-running "New Chat" display.
* Fixed an issue where the sidebar or conversation content briefly showed chat records from another app when switching apps.
5. Stop conversation prompt: removed the warning toast shown during stop and replaced it with a status prompt synchronized with the backend generation state.
6. Fixed the v1/completions API where `quoteList` in `nodeResponse` did not return `q` and `a`.
## 🛠️ Code Improvements
1. Split AI request logic and Workflow run detail code.
2. Updated billing logic for user-defined API keys.
3. Added design documentation and unit tests for stream-resume-related modules, including stop state, stale cleanup, history title, `dataId` validation, and form restoration.
4. Changed the volume manager runtime from Bun to Node.js.
file: ./content/self-host/upgrading/4-15/41502.mdx
meta: {
"title": "V4.15.0-beta2(环境变量变更)",
"description": "FastGPT V4.15.0-beta2 更新说明"
}
## 📦 升级指南
### 镜像变更
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.15.0-beta2
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.15.0-beta2
如果使用 Opensandbox,更新下面镜像
* 更新 fastgpt-agent-sandbox 镜像 tag: v0.2.0
* 更新 fastgpt-agent-volume-manager 镜像 tag: v0.2.0
### 环境变量更新
1. 如使用 opensandbox,则 AGENT\_SANDBOX\_VOLUME\_MANAGER\_MOUNT\_PATH 不再生效,可移除。opensandbox 固定挂载持久化数据到 `/workspace`,旧的沙盒持久化会受到影响。
## 🚀 新增内容
1. 支持 Skill 编辑,Agent 支持 Skill 使用,目前仅支持静态 Skill,无法反向调用系统工具。
2. 重写 agentV2 loop 逻辑。
3. 知识库搜索支持原生多模态 embedding 模型以及图搜图。
4. Chat API dataId 校验:`/v1/chat/completions`、`/v2/chat/completions` 与 `chatTest` 在工作流执行前校验本轮 `dataId` 是否与请求内或当前会话已有记录重复;重复时直接返回业务错误,避免脏数据进入工作流与流恢复合并逻辑。
## ⚙️ 优化
1. 优化 OTEL 日志采集格式。
2. 禁用工作流无效连接模式。
3. 增加工作流节点,名字超长适配。
4. 知识库搜索测试交互。
5. 知识库数据编辑弹窗。
6. reason hide 开关完善,确保只是 UI 不显示,但是 request llm 时候依然可以保留。
7. 流恢复暂停体验:暂停后会等待后端返回真实生成态;若工作流尚未收尾,输入区保持禁发并提示「停止中」,避免上一轮未结束就发送下一轮。
8. 异常中断会话更快恢复:服务崩溃或重启后,结合 Redis stream 活动检测(约 2 分钟无心跳)更快将卡住的「生成中」会话纠正为已完成;仍保留 30 分钟 Mongo 兜底,Redis 短暂异常时不会误改正在生成的会话。
9. 切换应用记住最近会话:同一浏览器内切换应用时,会按应用恢复上次打开的 chatId,不再共用单一全局会话 id。
10. 响应详情展示优化:完整响应弹窗中,表单输入节点的文件字段以文件列表形式展示,而不仅是 JSON 文本。
11. chat2messages adapt 优化,避免出现独立的 reason
## 🐛 修复
1. 工作流,单节点调试,存在异常默认值。
2. 模型配置,defaultConfig 覆盖异常。
3. 切换团队时,清除本地 chat 缓存。
4. 对话流恢复:
* 刷新或断线续传后,已提交的表单输入值(含 `fileSelect` 文件列表)能正确回填到交互节点内,不再出现空表单或文件消失。
* 自动续传开始时保留已加载的 AI 输出与节点响应;completed 记录覆盖时不再丢失已恢复的交互表单值与 flow 节点响应。
* 已提交表单后不再重复追加过期未提交交互;恢复过程中表单默认值能随 `formInputResult` 同步更新。
* 新对话发起后,侧栏临时历史项优先展示用户输入生成的标题,服务端标题落库后再覆盖,避免长时间显示「新对话」。
* 切换不同应用时,侧栏或会话内容短暂展示其他应用聊天记录的问题。
5. 停止会话提示:移除停止时的 warning toast,改为与后端生成态同步的状态提示。
6. v1/completions 接口,nodeResponse 中,quoteList 未返回 `q` , `a`。
## 🛠️ 代码优化
1. 拆分 AI request、工作流运行详情代码。
2. 用户自定义密钥计费逻辑。
3. 流恢复相关模块补充设计文档与单元测试(stop 状态、stale 清理、历史标题、dataId 校验、表单回填等)。
4. volumn manager 将 bun 改成 Node.js 运行。
file: ./content/self-host/upgrading/4-15/41503.en.mdx
meta: {
"title": "V4.15.0-beta3 (Environment Changes)",
"description": "FastGPT V4.15.0-beta3 Release Notes"
}
## 📦 Upgrade Guide
### Image Changes
* Update the fastgpt-app (FastGPT main service) image tag to v4.15.0-beta3.
* Update the fastgpt-pro (FastGPT commercial edition) image tag to v4.15.0-beta3.
* Update the fastgpt-code-sandbox image tag to v4.15.0-beta3.
### Environment Variable Changes
Code Sandbox adds security-related environment variables such as `SANDBOX_API_MAX_BODY_MB` and `SANDBOX_MAX_OUTPUT_MB`, and now supports grouped request queuing for run APIs through `queueId`. The full defaults are listed below:
| Variable | Default | Description |
| --------------------------------- | ------- | ----------------------------------------------------------------------------------------------------- |
| `SANDBOX_API_MAX_BODY_MB` | `8` | Maximum `/sandbox` API JSON body size, including `variables`, in MB. |
| `SANDBOX_MAX_OUTPUT_MB` | `10` | Maximum output JSON size for one code execution, including return values and logs, in MB. |
| `CHECK_INTERNAL_IP` | `true` | Enables internal IP checks for sandbox network requests by default to reduce SSRF risk. |
| `SANDBOX_MAX_TIMEOUT` | `60000` | Timeout for one code execution, in milliseconds. |
| `SANDBOX_MAX_MEMORY_MB` | `256` | Memory limit for one sandbox, in MB. The runtime reserves an extra `50` MB for overhead. |
| `SANDBOX_POOL_SIZE` | `20` | Number of pre-warmed JS/Python workers. |
| `SANDBOX_REQUEST_MAX_COUNT` | `30` | Maximum number of network requests allowed during one code execution. |
| `SANDBOX_REQUEST_TIMEOUT` | `60000` | Timeout for one network request from inside the sandbox, in milliseconds. |
| `SANDBOX_REQUEST_MAX_RESPONSE_MB` | `10` | Maximum response body size for one sandbox network request, in MB. |
| `SANDBOX_REQUEST_MAX_BODY_MB` | `5` | Maximum request body size for one sandbox network request, in MB. |
| `SANDBOX_QUEUE_ID_CONCURRENCY` | Empty | Number of requests with the same `queueId` that may enter execution at once. Empty disables queueing. |
## 🚀 New Features
1. Multimodal models now support audio and video input.
2. Shared links and portal pages now support language switching, and no longer force browser-language auto switching.
## ⚙️ Improvements
1. Improved styles for Skill module dialogs.
2. Improved Skill list API performance.
3. Improved workflow node name and description inputs.
4. Workflow editor drafts are now saved automatically for recovery when the session expires and the user is redirected.
5. Improved the login page UI.
## 🐛 Bug Fixes
1. Adapted TTS audio playback to the latest OpenAI SDK to avoid errors.
2. Fixed cases where Knowledge Base data chunking could produce oversized chunks when code blocks were present.
## 🛠️ Code Improvements
1. Updated the token calculation dependency to improve performance.
2. Rewrote dialog-related code with more modular structure.
3. Improved unit test performance, reducing full runs from about 10 minutes to 5 minutes.
4. Upgraded to TypeScript 6.
5. Improved GitHub Actions security.
file: ./content/self-host/upgrading/4-15/41503.mdx
meta: {
"title": "V4.15.0-beta3(环境变量变更)",
"description": "FastGPT V4.15.0-beta3 更新说明"
}
## 📦 升级指南
### 镜像变更
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.15.0-beta3
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.15.0-beta3
* 更新 fastgpt-code-sandbox 镜像 tag: v4.15.0-beta3
### 环境变量变更
Code Sandbox 新增 `SANDBOX_API_MAX_BODY_MB`、`SANDBOX_MAX_OUTPUT_MB` 等安全相关环境变量,并支持通过 `queueId` 对运行接口做分组排队;完整默认值如下:
| 变量 | 默认值 | 说明 |
| --------------------------------- | ------- | -------------------------------------------------- |
| `SANDBOX_API_MAX_BODY_MB` | `8` | `/sandbox` API JSON 请求体总大小上限,包含 `variables`,单位 MB。 |
| `SANDBOX_MAX_OUTPUT_MB` | `10` | 单次代码执行输出 JSON 大小上限,包含返回值和日志,单位 MB。 |
| `CHECK_INTERNAL_IP` | `true` | 沙箱网络请求默认开启内网 IP 检查,降低 SSRF 风险。 |
| `SANDBOX_MAX_TIMEOUT` | `60000` | 单次代码执行超时时间,单位毫秒。 |
| `SANDBOX_MAX_MEMORY_MB` | `256` | 单个沙箱内存上限,单位 MB;运行时会额外预留 `50` MB 开销。 |
| `SANDBOX_POOL_SIZE` | `20` | JS/Python 预热 worker 数量。 |
| `SANDBOX_REQUEST_MAX_COUNT` | `30` | 单次代码执行允许发起的最大网络请求数。 |
| `SANDBOX_REQUEST_TIMEOUT` | `60000` | 沙箱内单次网络请求超时时间,单位毫秒。 |
| `SANDBOX_REQUEST_MAX_RESPONSE_MB` | `10` | 沙箱内单次网络响应体最大大小,单位 MB。 |
| `SANDBOX_REQUEST_MAX_BODY_MB` | `5` | 沙箱内单次网络请求体最大大小,单位 MB。 |
| `SANDBOX_QUEUE_ID_CONCURRENCY` | 空 | 同一个 `queueId` 同时可进入执行流程的请求数;为空时不启用排队。 |
## 🚀 新增内容
1. 多模态模型支持音视频输入。
2. 分享链接/门户页,支持语言切换,不再强制自动识别浏览器语言切换。
## ⚙️ 优化
1. Skill 模块相关弹窗样式。
2. Skill list 接口性能。
3. 工作流节点名称和介绍输入。
4. 工作流编辑页,因登录失效,跳出后自动保存草稿用于恢复。
5. 登录页 UI。
## 🐛 修复
1. TTS 语音播放适配最新 OpenAI SDK,避免报错。
2. 知识库数据分块,遇到代码块时,可能出现超大分块。
## 🛠️ 代码优化
1. 调整 token 计算依赖,提高性能。
2. 重写了对话框相关代码,进行模块化细分。
3. 优化单测性能,全量从 10 分支将至 5 分钟。
4. 升级 ts6。
5. GitHub action 增强安全性。
file: ./content/self-host/upgrading/4-15/41504.en.mdx
meta: {
"title": "V4.15.0-beta4 (Environment Changes)",
"description": "FastGPT V4.15.0-beta4 Release Notes"
}
## 📦 Upgrade Guide
‼️ Important update: the plugin service has been upgraded to v1.0.0-beta1, and system tool execution has changed significantly.
### 1. Update Environment Variables
1. Update the `AUTH_TOKEN` environment variable for `fastgpt-plugin`. It must be at least 32 characters long.
2. Update the `PLUGIN_TOKEN` environment variable for `fastgpt` to match the `AUTH_TOKEN` value used by `fastgpt-plugin`.
3. Update the database name in the `MONGODB_URI` environment variable for `fastgpt-plugin` so it does not conflict with the MongoDB database name used by `fastgpt`. For example: `mongodb://myusername:mypassword@fastgpt-mongo:27017/fastgpt-plugin?authSource=admin`
### 2. Image Changes
* Update the fastgpt-app (FastGPT main service) image tag to v4.15.0-beta4.
* Update the fastgpt-pro (FastGPT commercial edition) image tag to v4.15.0-beta4.
* Update the fastgpt-plugin image tag to v1.0.0-beta2.
* Update the aiproxy image tag to v0.6.1.
### 3. Reinstall System Tools
1. Download the [zip package](https://github.com/labring/fastgpt-img/raw/refs/heads/main/fastgpt-official-plugins\(1\).zip) for all system tools.
2. Open the `fastgpt` web app, click `Admin` in the navbar, click add plugin, click `Import/Update Plugin`, upload the zip package, and confirm. This reinstalls all legacy system tools.
You can also download tools one by one from the plugin marketplace. Before the stable release, the marketplace URL is: [https://v2.marketplace.fastgpt.cn](https://v2.marketplace.fastgpt.cn)
## 🚀 New Features
1. Reworked the plugin system architecture.
2. Reworked the chatbox UI.
3. Added virtual list rendering for apps and Knowledge Bases.
4. Added separate OpenAPI documentation to distinguish it from the dev API documentation.
5. Workflow template export now includes the name and description.
## ⚙️ Improvements
1. Migrated system tool execution to local-pool, with support for process pools, queues, timeouts, retry backoff, and runtime metrics.
2. Added plugin-level runtime config support.
3. Plugin entry files can now be pulled from object storage and cached in the local file directory.
4. Added validation to input guide configuration to avoid invalid custom lexicon URLs.
5. Enhanced validation for Workflow array reference types to avoid conflicts with two-dimensional data.
6. Apps now show a graceful prompt during orchestration when a Knowledge Base has been deleted.
7. Replaced PDFJs with `liteparse` for PDF parsing, improving parsing speed by 3x.
8. Optimized Workflow execution by storing nodeResponse in a flattened format, avoiding failures when saving large nested Workflows.
9. XLSX parsing now automatically removes empty rows and columns and supplements merged cells.
## 🐛 Bug Fixes
1. Fixed abnormal multimodal file link retrieval for models.
2. Fixed a potential unauthorized access risk in training APIs.
3. Fixed an SSRF risk in HTTP tool parsing.
4. Fixed abnormal MCP tool expansion after tool calls following an interaction node.
## 🛠️ Code Improvements
1. Restructured the plugin service from the legacy `runtime` structure into a pnpm workspace monorepo, split into the HTTP service entry, domain models, use cases, API adapters, infrastructure, SDK, and CLI.
2. Rewrote all app API endpoints with zod schemas and generated documentation from them.
3. Process images in workers promptly instead of retaining base64 data, reducing memory usage.
file: ./content/self-host/upgrading/4-15/41504.mdx
meta: {
"title": "V4.15.0-beta4(环境变量变更)",
"description": "FastGPT V4.15.0-beta4 更新说明"
}
## 📦 升级指南
‼️重要更新,插件服务更新到 v1.0.0-beta1 版本,系统工具运行方式有较大调整。
### 1. 修改环境变量
1. 修改 `fastgpt-plugin` 的环境变量 `AUTH_TOKEN`,要求 32 位以上。
2. 同时修改 `fastgpt` 的环境变量 `PLUGIN_TOKEN`,与 `fastgpt-plugin` 的 `AUTH_TOKEN` 一致。
3. 修改 `fastgpt-plugin` 的环境变量 `MONGODB_URI` 中的数据库名,不与 `fastgpt` 的 Mongo 数据库名重名即可,例如:`mongodb://myusername:mypassword@fastgpt-mongo:27017/fastgpt-plugin?authSource=admin`
### 2. 镜像变更
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.15.0-beta4
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.15.0-beta4
* 更新 fastgpt-plugin 镜像 tag: v1.0.0-beta2
* 更新 aiproxy 镜像 tag: v0.6.1
### 3. 重装系统工具
1. 下载所有系统工具的 [zip 包](https://github.com/labring/fastgpt-img/raw/refs/heads/main/fastgpt-official-plugins\(1\).zip)
2. 打开 `fastgpt` 网页 - 点击 `管理员` navbar - 点击添加插件 - 点击 `导入/更新插件` - 上传 zip - 确认。即可重装旧的所有系统工具。
也可以打开插件市场逐个下载,正式版之前,插件市场地址为: [https://v2.marketplace.fastgpt.cn](https://v2.marketplace.fastgpt.cn)
## 🚀 新增内容
1. 重写插件系统架构。
2. 重写 chatbox ui。
3. 应用/知识库增加虚拟列表渲染。
4. 增加单独的 openapi 文档,区分 devapi 文档。
5. 导出工作流模板,同时导出名字和介绍。
6. HTML 输出自动切换预览。
## ⚙️ 优化
1. 系统工具运行迁移到 local-pool,支持进程池、队列、超时、重试退避和运行指标。
2. 支持插件级 runtime config。
3. 插件运行入口支持从对象存储拉取,并缓存到本地文件目录。
4. 输入引导配置增加校验,避免错误配置了自定义词库地址。
5. 工作流数组引用类型增强校验,避免刚好与二维数据冲突。
6. 知识库被删除后,应用编排时优雅提示。
7. PDF 解析,将 PDFJs 替换成 `liteparse`,速度提高 3 倍。
8. 工作流运行,nodeResponse 扁平化存储优化,避免大的嵌套工作流保存失败。
9. xlsx 解析,自动去除空行空列,补充合并单元格。
## 🐛 修复
1. 模型获取多模态文件链接异常。
2. 修复 training 接口存在的潜在越权风险。
3. HTTP tool parse 的 SSRF 风险。
4. 交互节点后的工具调用,展开 MCP 工具异常。
## 🛠️ 代码优化
1. 插件服务从旧 `runtime` 结构调整为 pnpm workspace monorepo,拆分为 HTTP 服务入口、领域模型、用例、API adapter、基础设施、SDK 和 CLI。
2. 将 app API 接口全部用 zod schema 编写并生成文档。
3. 及时处理 worker 内图片,不再存留 base64,降低内存消耗。
file: ./content/self-host/upgrading/4-15/41505.en.mdx
meta: {
"title": "V4.15.0-beta5 (Environment Changes, Upgrade Script)",
"description": "FastGPT V4.15.0-beta5 Release Notes"
}
## 📦 Upgrade Guide
### 1. Update Environment Variables
Add the `CHAT_TITLE_MODEL` environment variable to `fastgpt` and `fastgpt-pro`. It is used to automatically generate chat titles. For example:
```shell
CHAT_TITLE_MODEL=deepseek-v4-flash
INVOKE_TOKEN_SECRET=For keys with more than 32 bits, reverse call the interface jwt key
```
If Agent Sandbox is enabled, also add the following environment variables to `fastgpt`:
```shell
# Shared with fastgpt-agent-sandbox-proxy. In production, replace it with a random secret longer than 32 characters.
AGENT_SANDBOX_PROXY_SECRET=replace_with_32_chars_random_secret
# Browser-accessible WebSocket URL for agent-sandbox-proxy. Use wss:// if it is proxied through an HTTPS domain.
AGENT_SANDBOX_PROXY_URL=ws://{{host}}:3006
```
### 2. Image Changes
* Update the fastgpt-app (FastGPT main service) image tag to v4.15.0-beta5.
* Update the fastgpt-pro (FastGPT commercial edition) image tag to v4.15.0-beta5.
* Update the fastgpt-plugin image tag to v1.0.0-beta5.
* Update the aiproxy image tag to v0.6.2.
If Agent Sandbox is enabled, also update the following images:
* Add the fastgpt-agent-sandbox-proxy image with tag v0.2.0-beta2.
* Update the fastgpt-agent-sandbox image tag to v0.2.0-beta2.
Also add the `fastgpt-agent-sandbox-proxy` service to `docker-compose.yml`. The example below uses the China Mainland image registry. For global deployments, change the image to `ghcr.io/labring/fastgpt-agent-sandbox-proxy:v0.2.0-beta2`:
```yml
fastgpt-agent-sandbox-proxy:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox-proxy:v0.2.0-beta2
container_name: fastgpt-agent-sandbox-proxy
restart: always
ports:
- 3006:1006
networks:
- fastgpt
environment:
PORT: 1006
# Must exactly match AGENT_SANDBOX_PROXY_SECRET in fastgpt.
AGENT_SANDBOX_PROXY_SECRET: replace_with_32_chars_random_secret
# Internal URL of the main app container. If your service name is not fastgpt, update it accordingly.
FASTGPT_APP_URL: http://fastgpt:3000
FASTGPT_APP_REQUEST_TIMEOUT_SECS: 10
RUST_LOG: info,fastgpt_agent_sandbox_proxy=debug
# Configure this only when the upstream sandbox endpoint returns localhost/127.0.0.1 and the proxy container cannot reach it.
# AGENT_SANDBOX_PROXY_REWRITE_HOST: host.docker.internal
```
### 3. Upgrade Script
Archive all old sandbox workspaces to S3 to more thoroughly release inactive sandboxes. Some old sandboxes may fail to install zip packages because of timeouts. Because most old sandboxes are tied to old chats, you may also remove all old sandboxes directly instead of running this script. This script only affects old sandboxes and does not affect newly created sandboxes.
```shell
curl --location --request POST 'https://{{host}}/api/admin/initSandboxArchive' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json' \
-d '{"runArchive":true,"inactiveDays":0}'
```
## Breaking Changes
1. API Key behavior has changed. FastGPT no longer distinguishes between app keys and system keys; only system keys are kept. For OpenAI SDK compatibility, pass the token as `apikey-appId`. Existing API keys remain compatible and continue to work. For details, see the [FastGPT API documentation](../../../openapi/intro).
## 🚀 New Features
1. The HTTP node now supports ignoring TLS certificate verification, which is useful when calling HTTPS services that use self-signed or internal certificates.
2. Added an environment variable for maximum folder depth to prevent unlimited nested folders.
3. Chat windows now support a quick scroll-to-bottom button.
4. Optimized streaming output animations based on Lobe UI.
5. Added model-generated chat titles. Configure the `CHAT_TITLE_MODEL` variable to enable this feature.
6. Adjusted the Skill Edit editing experience.
7. The HTTP node now supports returning the complete error object.
8. Knowledge Base search in agent mode now supports permission filtering.
9. Optimized API key logic by unifying APIKey management and requiring requests to explicitly pass the app context.
10. Optimized agent context compression.
11. Added output syntax for quick replies.
## ⚙️ Improvements
1. HTML output now automatically switches to preview mode after generation, reducing the need to open the preview manually.
2. Improved long-name display for apps, Knowledge Bases, files, and folders: names are truncated when they exceed the available width, and the full name is shown on hover.
3. Removed `temperature` and `max_tokens` from all built-in LLM requests to avoid incompatibility with some models.
4. Improved error prompts for Knowledge Base training failures, including one-click retry for all failed items.
5. Filtered out invalid Knowledge Base citation markers.
6. When a tool returns an empty response, FastGPT now automatically fills in `"none"` to avoid errors from some models.
7. Added a second permission check before system tools run.
8. Optimized SSRF checks after redirects.
## 🐛 Bug Fixes
1. Fixed a potential cross-resource file access risk when private S3 object keys were not bound to the already-authorized resource.
2. Fixed abnormal tool call parameter schemas for `array` and `object` types in Workflow tools.
3. Fixed a UI offset issue in the portal publish channel.
## Code Improvements
1. Added a length guard for system string processing. When the string is too long, synchronous replacement stops to avoid high CPU load. You can adjust the limit with the `SYSTEM_MAX_STRING_LENGTH_M` environment variable.
file: ./content/self-host/upgrading/4-15/41505.mdx
meta: {
"title": "V4.15.0-beta5(环境变量变更、升级脚本)",
"description": "FastGPT V4.15.0-beta5 更新说明"
}
## 📦 升级指南
### 1. 修改环境变量
`fastgpt` 和 `fastgpt-pro` 增加环境变量 `CHAT_TITLE_MODEL`,用于自动生成对话的标题,例如:
```shell
CHAT_TITLE_MODEL=deepseek-v4-flash
INVOKE_TOKEN_SECRET=32 位以上密钥,反向调用接口 jwt 密钥
```
如果启用 Agent Sandbox,`fastgpt` 还需要增加下面环境变量:
```shell
# 与 fastgpt-agent-sandbox-proxy 共用,生产环境请改为 32 位以上随机密钥
AGENT_SANDBOX_PROXY_SECRET=replace_with_32_chars_random_secret
# 浏览器可访问的 agent-sandbox-proxy WebSocket 地址;如已通过 HTTPS 域名代理,请使用 wss://
AGENT_SANDBOX_PROXY_URL=ws://{{host}}:3006
```
### 2. 镜像变更
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.15.0-beta5
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.15.0-beta5
* 更新 fastgpt-plugin 镜像 tag: v1.0.0-beta5
* 更新 aiproxy 镜像 tag: v0.6.2
如果启用 Agent Sandbox,需同步更新下面镜像:
* 新增 fastgpt-agent-sandbox-proxy 镜像 tag: v0.2.0-beta2
* 更新 fastgpt-agent-sandbox 镜像 tag: v0.2.0-beta2
同时在 `docker-compose.yml` 中新增 `fastgpt-agent-sandbox-proxy` 服务。下面示例使用国内镜像源,海外部署可将镜像改为 `ghcr.io/labring/fastgpt-agent-sandbox-proxy:v0.2.0-beta2`:
```yml
fastgpt-agent-sandbox-proxy:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox-proxy:v0.2.0-beta2
container_name: fastgpt-agent-sandbox-proxy
restart: always
ports:
- 3006:1006
networks:
- fastgpt
environment:
PORT: 1006
# 必须与 fastgpt 中的 AGENT_SANDBOX_PROXY_SECRET 完全一致
AGENT_SANDBOX_PROXY_SECRET: replace_with_32_chars_random_secret
# 主站容器内网地址;如果服务名不是 fastgpt,请按实际 docker-compose 服务名调整
FASTGPT_APP_URL: http://fastgpt:3000
FASTGPT_APP_REQUEST_TIMEOUT_SECS: 10
RUST_LOG: info,fastgpt_agent_sandbox_proxy=debug
# 当上游 sandbox endpoint 返回 localhost/127.0.0.1 且 proxy 容器无法访问时再配置
# AGENT_SANDBOX_PROXY_REWRITE_HOST: host.docker.internal
```
### 3. 升级脚本
将所有旧的沙盒 workspace 归档到 s3 里,从而更彻底的释放不活跃的沙盒,旧的沙盒可能因为超时安装 zip 失败。因为旧的沙盒大部分关联的是旧的对话,不执行该脚本,直接把旧的沙盒全部移除也可以。该脚本仅影响旧的沙盒,不影响新生成沙盒。
```shell
curl --location --request POST 'https://{{host}}/api/admin/initSandboxArchive' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json' \
-d '{"runArchive":true,"inactiveDays":0}'
```
## 功能重大变化
1. ApiKey 功能调整,不再区分应用 key 和系统 key,只保留系统 key,如需兼容 openai sdk 用法,可使用 `apikey-appId` 的方式传递 Token。已有的 apikey 保持兼容,不影响使用。具体和查阅 [FastGPT API 文档说明](../../../openapi/intro)
## 🚀 新增内容
1. HTTP 节点支持配置忽略 TLS 证书校验,适用于调用使用自签名证书或内部证书的 HTTPS 服务。
2. 支持目录深度环境变量,避免无限嵌套目录。
3. 对话框支持快速滚动到底部按键。
4. 参考 Lobe UI 优化流输出动效。
5. 支持通过模型生成对话标题,需配置 `CHAT_TITLE_MODEL` 变量。
6. 调整 Skill Edit 编辑交互。
7. HTTP 节点支持返回完整错误对象。
8. agent 模式知识库搜索,支持权限过滤。
9. API 密钥逻辑优化,统一 APIKey 管理并由请求显式传入应用上下文。
10. 优化 agent 上下文压缩逻辑。
11. 支持快速回复的输出语法。
## ⚙️ 优化
1. HTML 输出后自动切换为预览,减少手动打开预览的操作。
2. 优化应用、知识库、文件和文件夹等长名称展示:超出宽度时自动省略,并在 hover 名称时展示完整内容。
3. 移除所有内置 LLM 请求中的 `temperature` 和 `max_tokens`,避免部分模型不兼容。
4. 知识库训练出现错误时的提示,同时支持一键全部重试。
5. 过滤掉无效的知识库引用角标。
6. 工具运行空响应时候,自动补充 "none",避免部分模型报错。
7. 系统工具运行前,再次进行二次权限校验。
8. 优化重定向后 SSRF 校验。
## 🐛 修复
1. 修复 S3 私有对象 key 未绑定已鉴权资源时可能导致的跨资源文件访问风险。
2. 工作流工具,array 和 object 类型,工具调用参数 schema 异常。
3. 发布渠道 - 门户,UI 偏移。
## 🛠️ 代码优化
1. 增加系统处理字符串时的长度保护,如果长度过大会停止继续同步替换,避免高 CPU 负载,可通过环境变量 `SYSTEM_MAX_STRING_LENGTH_M` 调整上限。
file: ./content/self-host/upgrading/4-15/41506.en.mdx
meta: {
"title": "V4.15.0-beta6 (Environment Changes, Upgrade Script)",
"description": "FastGPT V4.15.0-beta6 Release Notes"
}
## 📦 Upgrade Guide
### 1. Update the default model configuration
The chat title generation model is no longer configured through the `CHAT_TITLE_MODEL` environment variable. After upgrading, select the Chat Title Model in Model Configuration > Default Model Configuration. This setting can be left unset. When unset, FastGPT does not call a model to generate the title and uses a truncated user question instead.
If you previously configured `CHAT_TITLE_MODEL`, remove it from the `fastgpt` and `fastgpt-pro` environment variables, then select the corresponding model in the UI.
### 2. Clean up legacy Skill Debug chat data
This version migrates Skill Edit chats to the standard Chat storage model. Historical Skill Debug data wrote `skillId` into the physical `appId` field in the three Chat collections and did not include `sourceType`. Historical sandbox instance records also need `sourceType/sourceId` backfilled. After the upgrade, new Skill Edit chats will not read those legacy records, but we recommend running the root-only initialization API once to migrate sandbox instance ownership fields and clean up legacy Skill Debug chats. This endpoint is only for this upgrade migration and is not exposed as an OpenAPI endpoint.
Before running it, make sure the new Chat source indexes have been created. The initialization API defaults to dry-run mode and only reports matched records:
```bash
curl -X POST 'https://your-domain/api/admin/4150/init4150-beta6' \
-H 'Content-Type: application/json' \
-H 'rootkey: YOUR_ROOT_KEY' \
-d '{"dryRun":true}'
```
After confirming the dry-run result, set `dryRun` to `false` to run the migration and cleanup:
```bash
curl -X POST 'https://your-domain/api/admin/4150/init4150-beta6' \
-H 'Content-Type: application/json' \
-H 'rootkey: YOUR_ROOT_KEY' \
-d '{"dryRun":false}'
```
Parameters:
| Parameter | Type | Default | Description |
| --------- | ------- | ------- | -------------------------------------------------------------- |
| `dryRun` | boolean | `true` | Whether to only report matched data without executing changes. |
This endpoint always scans the full `skills` collection and does not support passing a partial Skill list. Sandbox instance migration must identify all Skills first, then treat the remaining records with `appId` as App sandboxes. Scanning only part of the Skill list could incorrectly mark unscanned Skill sandboxes as App sandboxes.
Migration logic:
1. Read all `_id` values from the `skills` collection.
2. For `agent_sandbox_instances` missing `sourceType` or `sourceId`, records matching `appId=skillId` or `metadata.skillId=skillId` are updated with `sourceType=skillEdit` and `sourceId=skillId`, and the legacy `appId` / `metadata.skillId` fields are unset.
3. Remaining sandbox instances that are still missing `sourceType` or `sourceId`, do not match a Skill, and have a non-empty `appId` are updated with `sourceType=app` and `sourceId=appId`, and the legacy `appId` / `metadata.skillId` fields are unset.
4. Sandbox instances that already have `sourceType/sourceId` but still retain legacy `appId` or `metadata.skillId` only have the legacy fields unset. Their existing standard ownership is not overwritten.
5. Orphan sandboxes with no `appId`, `appId=null`, or `appId=""`, and that cannot be associated with a Skill through `metadata.skillId`, are deleted in non-dry-run mode. This removes the remote sandbox, OpenSandbox volume, S3 archive, and Mongo record. Dry-run only reports them through `orphanMatchedCount`.
6. Legacy Skill Debug chat cleanup first removes Skill IDs that also exist in the `apps` collection, then deletes legacy `chats`, `chatitems`, `chat_item_responses`, and legacy-format Chat S3 prefixes for the remaining Skill IDs.
This endpoint does not backfill `sourceType` for existing App Chat records.
### 3. Update environment variables (optional)
Agent Sandbox now supports package registry mirror configuration. When configured, FastGPT writes mirror configuration files for npm, yarn, bun, pip, and uv under the sandbox HOME directory during sandbox initialization. This improves dependency installation stability in private networks or cross-region network environments.
```dotenv
# npm registry used by npm/yarn/pnpm/bun inside Agent Sandbox
AGENT_SANDBOX_NPM_REGISTRY=
# PyPI index URL used by pip/python -m pip/uv inside Agent Sandbox
AGENT_SANDBOX_PYPI_INDEX_URL=
```
The configuration is cached by content hash in the sandbox runtime state, so the same sandbox only rewrites these files when the configuration changes.
### 4. Update images
* Update the fastgpt-app (FastGPT main service) image tag to v4.15.0-beta6.
* Update the fastgpt-pro (FastGPT commercial edition) image tag to v4.15.0-beta6.
* Update the fastgpt-plugin image tag to v1.0.0-beta6.
* Update the aiproxy image tag to v0.6.2.
If Agent Sandbox is enabled, also update the following images:
* Update the fastgpt-agent-sandbox-proxy image tag to v0.2.0-beta3.
* Update the fastgpt-agent-sandbox image tag to v0.2.0.-beta3.
## Risks
### 1. Team isolation added to LLM request traces
LLM request traces (`llm_request_records`) now include a `teamId` field. `GET /api/core/ai/record/getRecord` queries records by `{ requestId, teamId }` for the current team, preventing a `requestId` from being used to read another team's request body, retrieved Knowledge Base chunks, or model response.
The unique index on `llm_request_records` has also changed from the single `requestId` field to the compound unique index `{ teamId: 1, requestId: 1 }`. If your self-hosted deployment has `SYNC_INDEX` disabled, run an index sync after upgrading so the old `requestId_1` unique index is removed.
Risk: trace records written before this upgrade do not have `teamId`, so they can no longer be queried by `requestId` after the upgrade. The UI will treat them as expired. These records already have a TTL and are intended only for temporary debugging. Export the relevant logs or keep the original request details before upgrading if you need to investigate historical calls.
## 🚀 New Features
1. The commercial edition now supports local direct-connect debugging for FastGPT plugins.
## ⚙️ Improvements
1. Chat title generation now uses the system default model configuration, making it easier to switch at runtime and manage consistently.
2. LLM request traces are now queried with team isolation, and the unique index is now `{ teamId, requestId }` to prevent request IDs from exposing sensitive traces across teams.
3. Skill Edit chats now use the standard Chat storage and cleanup flow, and legacy Skill Debug chats can be cleaned through the initialization API.
4. Agent Sandbox now supports npm and PyPI mirror configuration. During initialization, it writes common package manager configuration files to reduce dependency installation failures inside the sandbox.
## Code Improvements
1. The chat API has been abstracted from app-specific handling into a platform-level capability.
file: ./content/self-host/upgrading/4-15/41506.mdx
meta: {
"title": "V4.15.0-beta6(环境变量变更、升级脚本)",
"description": "FastGPT V4.15.0-beta6 更新说明"
}
## 📦 升级指南
### 1. 修改默认模型配置
对话标题生成模型不再通过环境变量 `CHAT_TITLE_MODEL` 配置,升级后可在「模型配置」的「默认模型配置」中选择「对话标题模型」。该配置可以不设置,不设置时不会调用模型生成标题,仅使用用户问题截断作为标题。
如此前配置过 `CHAT_TITLE_MODEL`,升级后可从 `fastgpt` 和 `fastgpt-pro` 的环境变量中移除,并在页面中重新选择对应模型。
### 2. 清理旧 Skill Debug 对话数据
本版本将 Skill Edit 对话迁移到标准 Chat 存储模型。历史 Skill Debug 数据曾把 `skillId` 写入 Chat 三表的物理 `appId` 字段,且没有 `sourceType`;历史 sandbox 实例也需要补齐 `sourceType/sourceId`。升级后旧 Skill Debug 对话不会被新 Skill Edit 对话读取,但建议执行一次 root-only 初始化接口完成 sandbox 实例字段迁移并清理旧 Skill Debug 对话。该接口仅用于本次升级迁移,不作为 OpenAPI 对外接口。
执行前请先确认新的 Chat source 索引已经创建完成。该初始化接口默认 dry-run,只统计不删除:
```bash
curl -X POST 'https://你的域名/api/admin/4150/init4150-beta6' \
-H 'Content-Type: application/json' \
-H 'rootkey: 你的ROOT_KEY' \
-d '{"dryRun":true}'
```
返回结果确认无误后,将 `dryRun` 改为 `false` 执行迁移和删除:
```bash
curl -X POST 'https://你的域名/api/admin/4150/init4150-beta6' \
-H 'Content-Type: application/json' \
-H 'rootkey: 你的ROOT_KEY' \
-d '{"dryRun":false}'
```
接口参数:
| 参数 | 类型 | 默认值 | 说明 |
| -------- | ------- | ------ | --------- |
| `dryRun` | boolean | `true` | 是否只统计不执行。 |
该接口会全量读取 `skills` 表,不支持只传部分 Skill ID。原因是 sandbox 实例迁移需要先识别所有 Skill,再把剩余未命中 Skill 且带 `appId` 的实例统一视为 App sandbox;如果只扫描部分 Skill,会把未扫描到的 Skill sandbox 误标成 App。
迁移逻辑:
1. 查询 `skills` 表拿到全部 `_id`。
2. 对缺少 `sourceType` 或 `sourceId` 的 `agent_sandbox_instances`,如果匹配 `appId=skillId` 或 `metadata.skillId=skillId`,写入 `sourceType=skillEdit` 和 `sourceId=skillId`,并清理旧 `appId` / `metadata.skillId` 字段。
3. 对剩余缺少 `sourceType` 或 `sourceId`、未命中 Skill 且存在非空 `appId` 的 sandbox 实例,写入 `sourceType=app` 和 `sourceId=appId`,并清理旧 `appId` / `metadata.skillId` 字段。
4. 对已经具备 `sourceType/sourceId` 但残留旧 `appId` 或 `metadata.skillId` 的 sandbox 实例,只清理旧字段,不覆盖现有标准归属。
5. 没有 `appId`、`appId=null` 或 `appId=""` 且无法通过 `metadata.skillId` 归属到 Skill 的 orphan sandbox,会在非 dry-run 模式下删除远端 sandbox、OpenSandbox volume、S3 归档和 Mongo 记录;dry-run 只通过 `orphanMatchedCount` 统计。
6. 清理旧 Skill Debug chat:先用 `apps` 表去掉与 App `_id` 重复的 Skill ID,再删除剩余 Skill ID 下匹配到的旧 `chats`、`chatitems`、`chat_item_responses` 和旧格式 Chat S3 文件前缀。
该接口不会回填几亿条历史 App Chat 的 `sourceType`。
### 3. 更新环境变量(可选)
Agent Sandbox 新增包管理镜像源配置。配置后,Agent Sandbox 初始化时会在 sandbox HOME 下写入 npm、yarn、bun、pip 和 uv 的镜像配置文件,提升在私有网络或跨境网络环境中安装依赖的稳定性。
```dotenv
# Agent Sandbox 内 npm/yarn/pnpm/bun 使用的 npm registry
AGENT_SANDBOX_NPM_REGISTRY=
# Agent Sandbox 内 pip/python -m pip/uv 使用的 PyPI index URL
AGENT_SANDBOX_PYPI_INDEX_URL=
```
该配置会按内容 hash 缓存在 sandbox runtime state 中,同一个 sandbox 仅在配置变化时重新写入。
### 4. 更新镜像
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.15.0-beta6
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.15.0-beta6
* 更新 fastgpt-plugin 镜像 tag: v1.0.0-beta6
* 更新 aiproxy 镜像 tag: v0.6.2
如果启用 Agent Sandbox,需同步更新下面镜像:
* 更新 fastgpt-agent-sandbox-proxy 镜像 tag: v0.2.0-beta3
* 更新 fastgpt-agent-sandbox 镜像 tag: v0.2.0-beta3
## 风险点
### 1. LLM 请求追踪记录增加团队隔离
LLM 请求追踪记录(`llm_request_records`)新增 `teamId` 字段,`GET /api/core/ai/record/getRecord` 会按当前登录团队查询 `{ requestId, teamId }`,避免仅凭 `requestId` 读取其他团队的请求体、知识库召回片段和模型响应。
同时,`llm_request_records` 的唯一索引从单字段 `requestId` 调整为复合唯一索引 `{ teamId: 1, requestId: 1 }`。如自托管环境关闭了 `SYNC_INDEX`,升级后需要执行一次索引同步,确保旧的 `requestId_1` 唯一索引被移除。
风险点:升级前已写入的旧追踪记录没有 `teamId`,升级后将无法再通过 `requestId` 查询,页面会按追踪记录已过期处理。该记录本身有 TTL,仅用于临时排查模型调用详情;如需排查历史问题,请在升级前导出相关日志或保留原始请求信息。
## 🚀 新增内容
1. 商业版支持本地直连 FastGPT 调试插件。
2. 沙盒支持自定义 npm 和 pip 源。
## ⚙️ 优化
1. 对话标题生成模型改为使用系统默认模型配置管理,便于运行时切换和统一维护。
2. LLM 请求追踪记录按团队隔离查询,唯一索引调整为 `{ teamId, requestId }`,避免 `requestId` 被其他团队复用读取敏感 trace。
3. Skill Edit 对话统一使用标准 Chat 存储和清理链路,历史 Skill Debug 对话可通过初始化接口清理。
4. Agent Sandbox 支持配置 npm 和 PyPI 镜像源,初始化时自动写入常见包管理器配置,减少 sandbox 内依赖安装失败。
5. PDF 解析兼容 `linux/arm64 + Alpine/musl` 架构,回退到 `pdfjs` 解析方案。
## 🐛 修复
1. chat/completions 接口,返回 nodeResponse 时候,过滤掉了 q/a/index,该版本恢复返回。
## 🛠️ 代码优化
1. chat 接口抽象,不再绑定 app, 改成平台级别通用。
file: ./content/self-host/upgrading/4-15/41507.en.mdx
meta: {
"title": "V4.15.0-beta7 (Environment Changes, Upgrade Script)",
"description": "FastGPT V4.15.0-beta7 Release Notes"
}
## 📦 Upgrade Guide
### 1. Open-source config.json Configuration Removed
The `config.json` configuration file has been removed. All configuration is now provided through environment variables:
```dotenv
# MCP Server proxy endpoint, used on the MCP usage page to build the SSE URL (do not include a trailing /)
SSE_MCP_SERVER_PROXY_ENDPOINT=http://localhost:3003
# ==================== Enhanced PDF Parsing (Optional) ====================
# Custom PDF parsing service endpoint
# CUSTOM_PDF_PARSE_URL=
# Custom PDF parsing service key
# CUSTOM_PDF_PARSE_KEY=
# Doc2x PDF parsing service key
# DOC2X_KEY=
# TextIn service App ID
# TEXTIN_APP_ID=
# TextIn service Secret Code
# TEXTIN_SECRET_CODE=
# hnsw ef_search parameter for vector retrieval. Only applies to PG / OB / OpenGauss.
HNSW_EF_SEARCH=100
# Maximum scanned rows for vector retrieval. Only applies to PG.
HNSW_MAX_SCAN_TUPLES=100000
# ==================== Knowledge Base Processing Concurrency Control ====================
# Maximum concurrency for the Knowledge Base file parsing queue
DATASET_PARSE_MAX_PROCESS=10
# Maximum concurrency for the vector training queue
VECTOR_MAX_PROCESS=10
# Maximum concurrency for the Q&A splitting queue
QA_MAX_PROCESS=10
# Maximum concurrency for the image understanding model processing queue
VLM_MAX_PROCESS=10
```
### 2. Commercial Edition: Add the SSE MCP Endpoint
This setting has been removed from admin and must now be added as an environment variable to the `fastgpt` service:
```dotenv
SSE_MCP_SERVER_PROXY_ENDPOINT=http://localhost:3003
```
### 3. OpenSandbox Variable Updates
The OpenSandbox Volume Manager configuration is now required, and the environment variables have been renamed to:
```dotenv
AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_URL=http://localhost:3005
AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN=vmtoken
```
### 4. Update Images
See the [4.15.0 stable image tags](./41500.mdx) and update all images to the stable release.
### 5. Run the Workflow V1 to V2 Migration (Optional)
Only users who have deployed a FastGPT version earlier than `<4.8` need to run this step.
Starting from V4.15.0-beta7, workflow save payloads use the V2 structure consistently. Historical `apps.modules` and `app_versions.nodes` records may still use the V1 structure. After upgrading, run the V1 -> V2 migration first, then run the V2 dirty-data cleanup in the next step.
Migration script path: `projects/app/src/pages/api/admin/dataClean/v1WorkflowToV2.ts`. This endpoint is only for this upgrade migration and is not a public OpenAPI endpoint.
The endpoint uses dry-run mode by default. It scans, converts in memory, and validates with `PublishAppBodySchema` without writing to MongoDB:
```bash
curl -X POST 'https://your-domain/api/admin/dataClean/v1WorkflowToV2' \
-H 'Content-Type: application/json' \
-H 'rootkey: YOUR_ROOT_KEY' \
-d '{"dryRun":true}'
```
After confirming the returned statistics, set `dryRun` to `false` to write the converted data:
```bash
curl -X POST 'https://your-domain/api/admin/dataClean/v1WorkflowToV2' \
-H 'Content-Type: application/json' \
-H 'rootkey: YOUR_ROOT_KEY' \
-d '{"dryRun":false}'
```
Request parameters:
| Parameter | Type | Default | Description |
| --------- | ------- | ------- | ---------------------------------------------------------- |
| `dryRun` | boolean | `true` | Whether to scan and validate only without writing changes. |
Migration behavior:
1. Scans apps where `apps.version != 'v2'` and `type` is not `folder`, `httpPlugin`, or `toolFolder`.
2. For each batch of `apps`, converts and writes related `app_versions` first, then converts and writes `apps`, so historical versions will not be missed if the migration is interrupted.
3. Converts V1 node fields to V2 node fields, such as `moduleId` -> `nodeId` and `flowType` -> `flowNodeType`.
4. Unknown node types fall back to `emptyNode`, and invalid `valueType` values are converted to `any`.
5. Missing `node.name` falls back to `flowType`, and missing `input.label` falls back to `input.key`.
6. Before writing, the script validates `nodes`, `edges`, and `chatConfig` with `PublishAppBodySchema`. Documents that fail validation are not written and are included in the endpoint response.
### 6. Run the Workflow V2 Enum and Structure Cleanup
Some historical workflow nodes may have stored TypeScript enum expression strings directly in MongoDB, for example:
```json
{
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"valueType": "WorkflowIOValueTypeEnum.any"
}
```
The correct stored values are:
```json
{
"renderTypeList": ["hidden"],
"valueType": "any"
}
```
This dirty data can affect workflow node input rendering and IO type checks. After running the V1 -> V2 migration, continue with the V2 cleanup script to scan and fix `apps.modules` and `app_versions.nodes`.
The endpoint uses dry-run mode by default. It formats data in memory and validates with `PublishAppBodySchema` without writing to MongoDB:
```bash
curl -X POST 'https://your-domain/api/admin/dataClean/initWorkflowData' \
-H 'Content-Type: application/json' \
-H 'rootkey: YOUR_ROOT_KEY' \
-d '{"dryRun":true,"batchSize":1000,"writeBatchSize":10}'
```
After confirming the returned statistics, set `dryRun` to `false` to write the cleanup:
```bash
curl -X POST 'https://your-domain/api/admin/dataClean/initWorkflowData' \
-H 'Content-Type: application/json' \
-H 'rootkey: YOUR_ROOT_KEY' \
-d '{"dryRun":false,"batchSize":1000,"writeBatchSize":10}'
```
Request parameters:
| Parameter | Type | Default | Description |
| ---------------- | ------- | ------- | ------------------------------------------------------------------------------- |
| `dryRun` | boolean | `true` | Whether to scan and validate only without writing changes. |
| `batchSize` | number | `1000` | Documents fetched per batch. |
| `writeBatchSize` | number | `10` | Documents written per `bulkWrite`. Lower it when online write pressure is high. |
Cleanup behavior:
1. Scans workflow data in `apps` and `app_versions` in batches to reduce read and write pressure.
2. Formats each workflow document once, covering historical dirty fields, null values, enum expressions, and legacy structure compatibility.
3. After formatting, validates the save payload fields `nodes`, `edges`, and `chatConfig` with `PublishAppBodySchema`.
4. Documents that fail Zod validation are only recorded in the response and are not written to MongoDB.
5. In non-dry-run mode, only documents that changed during formatting and passed Zod validation are written. Unchanged documents are not written again.
The response includes separate statistics for `apps`, `appVersions`, and `total`, including scanned documents, fixable documents, Zod error count, successful writes, failed writes, enum expression statistics, change samples, and error samples.
### 7. Clean Up Duplicate Chat Headers
Some historical data may contain duplicate `chats` records with the same `appId + chatId`, which can prevent the new unique index from being created. After upgrading, run the duplicate chat header cleanup script to keep the record with the latest `updateTime`. If multiple records have the same `updateTime`, the record with the largest `_id` is kept.
Migration script path: `projects/app/src/pages/api/admin/dataClean/cleanupDuplicateChats.ts`. This endpoint is only for this upgrade migration and is not a public OpenAPI endpoint.
The endpoint uses dry-run mode by default. It scans duplicate groups and returns samples without deleting data:
```bash
curl -X POST 'https://your-domain/api/admin/dataClean/cleanupDuplicateChats' \
-H 'Content-Type: application/json' \
-H 'rootkey: YOUR_ROOT_KEY' \
-d '{"dryRun":true,"sampleLimit":20}'
```
After confirming the returned statistics, set `dryRun` to `false` to delete duplicates:
```bash
curl -X POST 'https://your-domain/api/admin/dataClean/cleanupDuplicateChats' \
-H 'Content-Type: application/json' \
-H 'rootkey: YOUR_ROOT_KEY' \
-d '{"dryRun":false,"sampleLimit":20}'
```
Request parameters:
| Parameter | Type | Default | Description |
| ------------- | ------- | ------- | ------------------------------------------------------------ |
| `dryRun` | boolean | `true` | Whether to scan and report statistics without deleting. |
| `sampleLimit` | number | `20` | Number of duplicate group samples to return. Range: `0~100`. |
Cleanup behavior:
1. Scans duplicate chat headers in the `chats` collection by `appId + chatId`.
2. Keeps the record with the latest `updateTime`; if timestamps are equal, `_id` descending order is used as a stable fallback.
3. In non-dry-run mode, deletes only duplicate `chats` headers. Messages in `chatitems` and `chat_item_responses` are not deleted.
4. The response includes duplicate group count, estimated delete count, actual delete count, and duplicate group samples.
## 🐛 Fixes
1. Fixed historical V1 workflow data that could fail validation under the new save payload structure.
2. Fixed dirty `FlowNodeInputTypeEnum.*`, `FlowNodeOutputTypeEnum.*`, and `WorkflowIOValueTypeEnum.*` expression strings in workflow node configuration that could break input rendering and IO type checks.
3. Fixed AgentV2 MCP not being able to retrieve schemas.
4. Fixed workflow text boxes where pressing Ctrl+C while selecting text could be intercepted by node copy handling, preventing text from being copied.
file: ./content/self-host/upgrading/4-15/41507.mdx
meta: {
"title": "V4.15.0-beta7(环境变量变更、升级脚本)",
"description": "FastGPT V4.15.0-beta7 更新说明"
}
## 📦 升级指南
该版本为 4.15.0 正式版最后一个版本,如果有部署过 4.15.0-beta 版本的,需要先升级到该版本,执行完所有 beta 期间的升级操作后,再将所有镜像更新至正式版,正式版镜像可看 [4.15.0](./41500.mdx)
### 1. 开源版 config.json 配置移除
`config.json` 配置文件移除,全部改成环境变量,环境变量为:
```dotenv
# MCP Server 代理地址,用于 MCP 使用方式页拼接 SSE 地址(末尾不要带 /)
SSE_MCP_SERVER_PROXY_ENDPOINT=http://localhost:3003
# ==================== PDF 增强解析(可选) ====================
# 自定义 PDF 解析服务地址
# CUSTOM_PDF_PARSE_URL=
# 自定义 PDF 解析服务密钥
# CUSTOM_PDF_PARSE_KEY=
# Doc2x PDF 解析服务密钥
# DOC2X_KEY=
# 合合信息 Textin 服务 App ID
# TEXTIN_APP_ID=
# 合合信息 Textin 服务 Secret Code
# TEXTIN_SECRET_CODE=
# 向量检索 hnsw ef_search 参数,仅对 PG / OB / OpenGauss 生效
HNSW_EF_SEARCH=100
# 向量检索最大扫描数据量,仅对 PG 生效
HNSW_MAX_SCAN_TUPLES=100000
# ==================== 知识库处理并发控制 ====================
# 知识库文件解析队列最大并发数
DATASET_PARSE_MAX_PROCESS=10
# 向量训练队列最大并发数
VECTOR_MAX_PROCESS=10
# 问答拆分队列最大并发数
QA_MAX_PROCESS=10
# 图片理解模型处理队列最大并发数
VLM_MAX_PROCESS=10
```
### 2. 商业版补充 SSE Mcp Endpoint
该配置从 admin 里移除,需要在 `fastgpt` 服务里增加环境变量:
```dotenv
SSE_MCP_SERVER_PROXY_ENDPOINT=http://localhost:3003
```
### 3. OpenSandbox 变量更新
OpenSandbox Volume Manager 配置变为必填,并且环境变量改名为:
```dotenv
AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_URL=http://localhost:3005
AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN=vmtoken
```
### 4. 更新镜像
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.15.0-beta7
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.15.0-beta7
### 5. 执行工作流 V1 升级 V2 迁移(可选)
该步骤仅需部署过 `<4.8` 版本 FastGPT 的用户执行。
V4.15.0-beta7 后工作流保存结构统一使用 V2。历史 `apps.modules` 与 `app_versions.nodes` 中可能仍存在 V1 结构,升级后建议先执行 V1 -> V2 迁移,再执行后续 V2 脏数据清洗。
迁移脚本位置:`projects/app/src/pages/api/admin/dataClean/v1WorkflowToV2.ts`。该接口仅用于本次升级迁移,不作为 OpenAPI 对外接口。
接口默认 dry-run,只扫描、转换和执行 `PublishAppBodySchema` 校验,不写库:
```bash
curl -X POST 'https://你的域名/api/admin/dataClean/v1WorkflowToV2' \
-H 'Content-Type: application/json' \
-H 'rootkey: 你的ROOT_KEY' \
-d '{"dryRun":true}'
```
确认返回统计无误后,将 `dryRun` 改为 `false` 执行写入:
```bash
curl -X POST 'https://你的域名/api/admin/dataClean/v1WorkflowToV2' \
-H 'Content-Type: application/json' \
-H 'rootkey: 你的ROOT_KEY' \
-d '{"dryRun":false}'
```
接口参数:
| 参数 | 类型 | 默认值 | 说明 |
| -------- | ------- | ------ | ----------- |
| `dryRun` | boolean | `true` | 是否只扫描验证不写库。 |
迁移逻辑:
1. 按 `apps.version != 'v2'` 且 `type` 非 `folder`、`httpPlugin`、`toolFolder` 扫描应用。
2. 对每批 `apps`,先转换并写入对应 `app_versions`,再转换并写入 `apps`,避免中断后遗漏历史版本。
3. 将 V1 节点字段升级为 V2 节点字段,例如 `moduleId` -> `nodeId`、`flowType` -> `flowNodeType`。
4. 未知节点类型会兜底为 `emptyNode`,非法 `valueType` 会转为 `any`。
5. 缺失 `node.name` 时用 `flowType` 兜底,缺失 `input.label` 时用 `input.key` 兜底。
6. 写库前使用 `PublishAppBodySchema` 校验 `nodes`、`edges`、`chatConfig`,校验失败的文档不会写入,并会记录到接口返回结果。
### 6. 执行工作流 V2 枚举与结构脏数据清洗
部分历史工作流节点可能把 TypeScript 枚举表达式字符串直接写入 MongoDB,例如:
```json
{
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"valueType": "WorkflowIOValueTypeEnum.any"
}
```
正确落库值应为:
```json
{
"renderTypeList": ["hidden"],
"valueType": "any"
}
```
该脏数据会影响工作流节点输入渲染和 IO 类型判断。执行 V1 -> V2 迁移后,继续执行 V2 清洗脚本,扫描并修复 `apps.modules` 与 `app_versions.nodes`。
接口默认 dry-run,只格式化内存数据并执行 `PublishAppBodySchema` 校验,不写库:
```bash
curl -X POST 'https://你的域名/api/admin/dataClean/initWorkflowData' \
-H 'Content-Type: application/json' \
-H 'rootkey: 你的ROOT_KEY' \
-d '{"dryRun":true,"batchSize":1000,"writeBatchSize":10}'
```
确认返回统计无误后,将 `dryRun` 改为 `false` 执行写入:
```bash
curl -X POST 'https://你的域名/api/admin/dataClean/initWorkflowData' \
-H 'Content-Type: application/json' \
-H 'rootkey: 你的ROOT_KEY' \
-d '{"dryRun":false,"batchSize":1000,"writeBatchSize":10}'
```
接口参数:
| 参数 | 类型 | 默认值 | 说明 |
| ---------------- | ------- | ------ | --------------------------------- |
| `dryRun` | boolean | `true` | 是否只扫描验证不写库。 |
| `batchSize` | number | `1000` | 每批读取文档数量。 |
| `writeBatchSize` | number | `10` | 每次 `bulkWrite` 的文档数量。线上写入压力大时可调小。 |
清洗逻辑:
1. 按批扫描 `apps` 和 `app_versions` 中的工作流数据,降低单次读取和写入压力。
2. 对每条工作流数据执行一次格式化,统一修复历史脏字段、空值、枚举表达式和旧结构兼容问题。
3. 格式化后使用 `PublishAppBodySchema` 校验保存接口实际关心的 `nodes`、`edges`、`chatConfig`。
4. Zod 校验失败的文档只记录在返回结果中,不会写入数据库。
5. 非 dry-run 时,只写入“发生过格式化变更,且 Zod 校验通过”的文档;未变化文档不会重复写库。
返回结果会分别展示 `apps`、`appVersions` 和 `total` 的统计,包括扫描文档数、可修复文档数、Zod 错误数量、写入成功数量、写入失败数量、枚举表达式统计、变更样本和错误样本。
### 7. 清理重复 Chat 会话头
部分历史数据可能存在相同 `appId + chatId` 的重复 `chats` 会话头,导致新版本创建唯一索引失败。升级后可执行重复会话头清理脚本,保留 `updateTime` 最新的一条记录;如果 `updateTime` 相同,则保留 `_id` 最大的一条。
迁移脚本位置:`projects/app/src/pages/api/admin/dataClean/cleanupDuplicateChats.ts`。该接口仅用于本次升级迁移,不作为 OpenAPI 对外接口。
接口默认 dry-run,只扫描重复组并返回样本,不删除数据:
```bash
curl -X POST 'https://你的域名/api/admin/dataClean/cleanupDuplicateChats' \
-H 'Content-Type: application/json' \
-H 'rootkey: 你的ROOT_KEY' \
-d '{"dryRun":true,"sampleLimit":20}'
```
确认返回统计无误后,将 `dryRun` 改为 `false` 执行删除:
```bash
curl -X POST 'https://你的域名/api/admin/dataClean/cleanupDuplicateChats' \
-H 'Content-Type: application/json' \
-H 'rootkey: 你的ROOT_KEY' \
-d '{"dryRun":false,"sampleLimit":20}'
```
接口参数:
| 参数 | 类型 | 默认值 | 说明 |
| ------------- | ------- | ------ | ------------------------ |
| `dryRun` | boolean | `true` | 是否只扫描统计不删除。 |
| `sampleLimit` | number | `20` | 返回重复组样本数量,取值范围为 `0~100`。 |
清理逻辑:
1. 按 `appId + chatId` 扫描 `chats` 集合中的重复会话头。
2. 每组保留 `updateTime` 最新的一条;若时间相同,用 `_id` 倒序作为稳定兜底。
3. 非 dry-run 时只删除重复的 `chats` 会话头,不删除 `chatitems` 和 `chat_item_responses` 中的消息内容。
4. 返回结果包含重复组数量、预计删除数量、实际删除数量和重复组样本。
## ⚙️ 优化
1. 虚拟机文件地址使用新 API。
## 🐛 修复
1. 修复历史 V1 工作流数据在新版保存结构下无法通过校验的问题。
2. 修复工作流节点配置中 `FlowNodeInputTypeEnum.*`、`FlowNodeOutputTypeEnum.*` 和 `WorkflowIOValueTypeEnum.*` 枚举表达式字符串脏数据导致输入渲染和 IO 类型判断异常的问题。
3. AgentV2 mcp 拿不到 schema。
4. 批量执行节点最后未回写变量更新。
5. 工作流文本框,ctrl+c 复制文本内容时,会被节点复制抢占,导致无法复制文本。
file: ./content/self-host/upgrading/4-15/4151.en.mdx
meta: {
"title": "V4.15.1 (Environment Changes, Upgrade Script)",
"description": "FastGPT V4.15.1 Release Notes"
}
## 📦 Upgrade Guide
### 1. fastgpt-pro Environment Variable Updates
Starting from v4.15.1, the FastGPT main app no longer uses `rootkey` when calling Pro/Admin internal APIs. These internal service-to-service calls now use a dedicated `PRO_TOKEN`. `FE_DOMAIN` is also required. If you deploy the Pro edition, configure the same `PRO_TOKEN` in both the FastGPT main app and the Pro/Admin service:
```bash
PRO_TOKEN=your_pro_token_at_least_32_chars
FE_DOMAIN=fastgpt_domain
```
Notes:
1. `PRO_TOKEN` must be at least 32 characters long, and the value must be identical in the FastGPT main app and Pro/Admin.
2. If the FastGPT main app is configured with `PRO_URL`, `PRO_TOKEN` is also required. Otherwise, the service fails to start.
3. The Pro/Admin service must configure `PRO_TOKEN`; otherwise, internal API authentication fails.
4. `rootkey` is no longer used as the credential for FastGPT main app calls to Pro/Admin internal APIs. It is only the admin secret for the current system and is used to call `/api/admin/**` APIs, such as the initialization script below.
5. Open-source deployment files do not include `PRO_TOKEN`. For Pro deployments, add it manually in your private deployment environment variables.
### 2. WECOM\_LOGIN\_AUTO\_REDIRECT Environment Variable
Older versions always redirected WeCom terminals to the login page, equivalent to `WECOM_LOGIN_AUTO_REDIRECT=true`. Starting from v4.15.1, this behavior is disabled by default. To keep the previous automatic redirect behavior, add the following environment variable to the FastGPT main app:
```bash
WECOM_LOGIN_AUTO_REDIRECT=true
```
If automatic redirects are not needed, leave this variable unset or set it to `false`. Restart the FastGPT main app after changing the environment variable for the configuration to take effect.
### 3. Docker Image Changes
* Update the fastgpt-app (FastGPT main service) image tag to v4.15.1.
* Update the fastgpt-pro (FastGPT commercial edition) image tag to v4.15.1.
* Update the fastgpt-plugin image tag to v1.0.1.
### 4. API Key App Name Initialization
To keep older API keys compatible and make it easier to find keys previously associated with apps, v4.15.1 adds global API Key tag management and an `appName` display snapshot for historical app-level API Keys. After upgrading, run the initialization script once to backfill app names for existing API Keys whose `appId` field is still present.
From any terminal, send an HTTP request. Replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your FastGPT domain.
```bash
curl -X POST "{{host}}/api/admin/initv4151" \
-H "rootkey: {{rootkey}}"
```
The script only fills missing `appName` values. It does not overwrite existing values, does not change the `appId` field, and does not create or bind tags. It is safe to run multiple times.
## 🚀 New Features
1. Added global API Key tag management and an `appName` display snapshot for historical app-level API Keys, making older API keys compatible and easier to find when they were previously associated with apps.
2. Pre-extract the skill name and description when publishing a skill to help with generation.
3. Added the `WECOM_LOGIN_AUTO_REDIRECT` environment variable to control whether WeCom terminals automatically redirect to login. It is disabled by default.
4. The Plugin Marketplace now supports official/community source filters, and the system tool list supports status and tag filters.
## ⚙️ Improvements
1. Removed system field parameters when AgentV2 calls nested workflows.
2. System tools now support uninstall and reinstall. Uninstalling changes the tool status to Uninstalled and requires entering the tool name for confirmation. Uninstalled tools show only basic information and can be reinstalled.
## 🐛 Fixes
1. Workflow tool debugging did not show run details.
2. The chat page did not automatically show the login component after credentials expired.
3. Fixed an issue where workflow tools did not initialize variables from the tool app's global variable configuration when running a sub-workflow, causing runtime variables such as default variables and system variables to be read incorrectly.
4. Fixed an issue where updates to global variables or outputs from nodes outside the container through **Variable Update** inside loop nodes and parallel execution nodes were not synchronized back to the main workflow by round or task completion. Successful rounds or tasks now write back their changes, while failed rounds or tasks do not commit their changes.
5. The component did not refresh immediately when retrying all Knowledge Base collections.
6. Fixed repeated shallow route updates in the embedded FastGPT Marketplace when filters did not change, which could keep the top progress bar loading.
## 🛠️ Code Improvements
1. Fixed file paths that contain colons to avoid Windows compatibility issues.
file: ./content/self-host/upgrading/4-15/4151.mdx
meta: {
"title": "V4.15.1(环境变量变更、升级脚本)",
"description": "FastGPT V4.15.1 更新说明"
}
## 📦 升级指南
### 1. fastgpt-pro 环境变量更新
社区版跳过。
v4.15.1 起,FastGPT 主应用访问 Pro/Admin 内部接口不再使用 `rootkey`,改为使用独立的服务间凭证 `PRO_TOKEN`。同时要求 `FE_DOMAIN` 变量必填,如果你部署了 Pro 版本,需要同时在 FastGPT 主应用和 Pro/Admin 服务中配置相同的 `PRO_TOKEN`:
```bash
PRO_TOKEN=your_pro_token_at_least_32_chars
FE_DOMAIN=fastgpt_domain
```
注意事项:
1. `PRO_TOKEN` 长度必须不少于 32 位,并且主应用与 Pro/Admin 必须保持一致。
2. 如果 FastGPT 主应用配置了 `PRO_URL`,则必须同时配置 `PRO_TOKEN`,否则服务会启动失败。
3. Pro/Admin 服务必须配置 `PRO_TOKEN`,否则内部接口鉴权会失败。
4. `rootkey` 不再作为 FastGPT 主应用访问 Pro/Admin 内部接口的凭证,仅作为当前系统的管理员密钥,用于调用 `/api/admin/**` 接口,例如下方初始化脚本。
5. 开源版部署配置文件不会内置 `PRO_TOKEN`。Pro 部署请在私有部署环境变量中手动增加该配置。
### 2. WECOM\_LOGIN\_AUTO\_REDIRECT 环境变量更新
旧版本在企微终端会固定自动跳转登录,行为等同于 `WECOM_LOGIN_AUTO_REDIRECT=true`。v4.15.1 起,该行为默认关闭。如果需要保持旧版本的自动跳转行为,请在 FastGPT 主应用的环境变量中增加:
```bash
WECOM_LOGIN_AUTO_REDIRECT=true
```
如果不需要自动跳转,可以不配置该变量,或将其设置为 `false`。修改环境变量后请重启 FastGPT 主应用使配置生效。
### 3. 镜像变更
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.15.1
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.15.1
* 更新 fastgpt-plugin 镜像 tag: v1.0.1
### 4. API Key 应用名初始化
为了兼容旧版 API 密钥,便于找到以前应用关联的密钥,v4.15.1 增加了全局 API Key 标签管理,并为历史应用级 API Key 增加 `appName` 展示快照。升级后建议执行一次初始化脚本,为已有 `appId` 的历史 API Key 自动回填应用名。
从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成 FastGPT 域名。
```bash
curl -X POST "{{host}}/api/admin/initv4151" \
-H "rootkey: {{rootkey}}"
```
脚本只会回填缺失的 `appName`,不会覆盖已有值,不会修改 `appId`,也不会创建或绑定标签。脚本可重复执行。
## 🚀 新增内容
1. 增加全局 API Key 标签管理,并为历史应用级 API Key 增加 `appName` 展示快照,便于兼容旧版 API 密钥并查找以前应用关联的密钥。
2. 发布技能时,预提取技能名称和描述,便于辅助生成。
3. 新增 `WECOM_LOGIN_AUTO_REDIRECT` 环境变量,可控制企微终端是否自动跳转登录,默认关闭。
4. 插件市场支持官方/社区来源筛选,系统工具列表的状态列和标签列支持筛选。
## ⚙️ 优化
1. AgentV2 调用嵌套工作流时候,去除系统字段参数。
2. 系统工具支持卸载和重新安装。卸载会将工具状态改为“已卸载”,需要输入工具名称确认;已卸载工具只展示基础信息,并可重新安装恢复。
## 🐛 修复
1. 工作流工具调试时,运行详情看不到。
2. 对话页,凭证到期不会自动跳出登录组件。
3. 修复工作流工具运行子工作流时未按工具应用的全局变量配置初始化变量,导致默认变量、系统变量等运行态变量读取异常的问题。
4. 修复循环节点和并行执行节点中通过【变量更新】修改全局变量或容器外节点输出时,主流程未按轮次/任务结束同步更新的问题。成功轮次或成功任务会回写本轮变更,失败轮次或失败任务不提交本轮变更。
5. 重试全部知识库集合时,未立即刷新组件。
6. 修复 FastGPT 内嵌插件市场在筛选条件没有变化时重复更新浅路由,导致顶部进度条持续 loading 的问题。
## 🛠️ 代码优化
1. 修复冒号的文件路径,避免 window 系统不兼容。
file: ./content/self-host/upgrading/4-15/4152.en.mdx
meta: {
"title": "V4.15.2 (Environment Changes)",
"description": "FastGPT V4.15.2 Release Notes"
}
## 📦 Upgrade Guide
### Upgrade OpenSandbox Images
If OpenSandbox is enabled in your deployment, update the following images:
* `opensandbox/server:v0.2.1`
* `opensandbox/execd:v1.0.21`
* `opensandbox/egress:v1.1.4`
This upgrade fixes an issue that prevented files with Chinese filenames from being downloaded. See [OpenSandbox Configuration](../../config/sandbox/opensandbox) for the complete configuration.
### Update the AGENT\_ENGINE Environment Variable
Starting with V4.15.2, `AGENT_ENGINE` uses new enum values. Update the environment variable before upgrading:
| Previous value | New value |
| -------------- | ----------- |
| `default` | `fastAgent` |
| `pi` | `piAgent` |
The previous values are no longer supported. Using `default` or `pi` will fail environment variable validation and prevent FastGPT from starting. If `AGENT_ENGINE` is not set, FastGPT uses `fastAgent` by default.
### Configure the File Download URL Mode
V4.15.2 introduces the `STORAGE_DOWNLOAD_URL_MODE` environment variable, which defaults to `short-proxy`.
* `short-proxy`: Returns a FastGPT short URL and proxies file downloads through the FastGPT App.
* `short-redirect`: Returns a FastGPT short URL that redirects to a temporary S3/CDN URL after validation.
To use short URLs without routing file traffic through the FastGPT App, set:
`STORAGE_DOWNLOAD_URL_MODE=short-redirect`
When using `short-redirect`, you must configure `STORAGE_EXTERNAL_ENDPOINT`.
## 🚀 New Features
1. Enterprise verification / company verification.
2. The portal page now supports selecting Agent V2 apps for conversations.
3. File upload and download URLs now use short access URLs, reducing the context consumed by long URLs and the risk of malformed model output. Previously issued URLs remain supported.
4. For file URLs without a recognizable extension, FastGPT now infers the file type from the buffer to improve parsing success rates.
5. The Custom Tool Parameters node now supports manually entering a JSON Schema and marking parameters as required.
## ⚙️ Improvements
### General Improvements
1. Updated the delete confirmation copy when a Skill is not associated with an app.
2. Adapted to the latest WeChat publishing channel SDK.
3. Renamed the plugin status from Offline to Uninstalled.
4. Judge nodes now use a unique ID as the identifier instead of the index, so target branches remain stable when branches are deleted or reordered.
5. Files generated by system tools no longer expire after 1 hour. They are now long-lived and deleted together with the conversation.
6. The registration button is now hidden in Sync Mode.
7. Improved the performance of the fade-in effect for streaming output in chat dialogs.
8. Upgraded `LiteParse` to fix PDF parsing errors under concurrent workloads. The default file parsing worker count is now 5 instead of 10 and remains configurable through `PARSE_FILE_WORKERS`.
9. Added in-flight request deduplication for the model list and sandbox package endpoints. Identical concurrent requests now share the same result, reducing duplicate requests triggered by workflow nodes and selectors.
10. Workflow node responses are now included in SSE streams.
### Streaming Markdown Rendering Improvements
1. Reduced streaming render updates to 20 frames per second. Completed Markdown blocks are cached, while active blocks reuse their parser and animation runtime, reducing repeated parsing, DOM updates, and frame drops during long responses.
2. Moved fade-in effects to a stable character timeline. Characters that are already visible no longer restart their animation when later Markdown is parsed; only newly appended characters fade in.
3. Temporarily completes streaming tails for bold, italic, bold italic, strikethrough, nested emphasis, inline code, and block math so delimiter characters arriving one at a time do not change the DOM structure of existing content.
4. Defers lists, task items, blockquotes, headings, code fences, tables, links, images, and citation markers until their structure is known. This prevents control markers from flashing and avoids previously rendered content disappearing and then reappearing.
## 🐛 Fixes
### General Fixes
1. Optimized the CI workflow by pinning action step versions to commit hashes to reduce the risk of CI supply-chain attacks.
2. Removed the high-risk archive extraction library used for PPTX parsing and replaced it with a streaming decompression and parsing flow to reduce the risk of malicious code execution.
3. Custom chunk delimiters now reject a single `|` or consecutive `||` to prevent incorrect parsing of large numbers of chunks.
4. Improved automatic license purchase logic for WeCom edition customers after payment to prevent duplicate or missing license purchases.
5. Fixed empty Tag labels in the Plugin Marketplace.
6. Fixed runtime calculations for LoopRun iterations and ParallelRun tasks so each item reports its own elapsed time instead of summing the runtimes of its child steps.
7. Deleting a chat file while it is uploading now also aborts the presign and upload requests, preventing deleted files from reappearing or incorrectly updating other files.
8. Fixed cases where file persistence, type, or metadata could be lost during uploads, draft uploads, and first-turn media messages.
### Agent Loop Fixes
1. Fixed unfinished interactive sessions failing to resume when `history=0`. Regular requests still exclude history. When the latest round contains an unfinished interaction, FastGPT retains the nearest Human/AI pair long enough to detect and restore the interaction, then filters the history as configured.
2. Fixed ask answers in nested workflows not being restored as the matching tool response. New interaction records use `askId` to associate the ask call with the user's answer, while legacy `planId` records remain readable.
3. Fixed duplicate tool responses and plan snapshots after resuming a child interaction. Tool results are updated in place by `toolCallId`, and plans are updated by `planId`, preventing duplicate tool cards or plans after a refresh.
4. Fixed Agent Knowledge Base search not reading the split dataset parameters from the main workflow, adding compatibility with the latest Knowledge Base search parameter structure.
5. Fixed later tools continuing to run after an ask in the same model response had already paused the loop, preventing additional tool side effects before the user answers.
6. Fixed parent-node errors being hidden when a workflow node also produced child execution details. Parent errors are now preserved in SSE events, workflow results, and traces.
7. Fixed `workflowDispatchDeep` not being restored when the workflow observer failed before dispatch started, preventing subsequent workflows from inheriting an incorrect nesting depth.
## 🛠️ Code Improvements
### General Code Improvements
1. Refactored Agent V2 assisted generation / ChatAgentHelper to reuse the dialog.
2. AI request records that contain very long base64/data URLs are truncated before saving to prevent possible stack overflows.
3. Unified SSE event wrapping for stronger type hints.
4. Added the `AUTH_COOKIE_SECURE` environment variable. When enabled, login cookies use the `Secure` attribute and are sent only over HTTPS.
### Agent Loop Refactor
1. Workflow Agent and ToolCall now use the same Agent Loop execution core. ToolCall disables plan and ask capabilities while sharing the same loop execution, context handling, tool events, interactive recovery, and billing rules as Workflow Agent.
2. Standardized the Provider interface for `fastAgent` and `piAgent`. The execution engine can be selected with `AGENT_ENGINE`, and both providers now use the same input, runtime, and result contracts.
3. Standardized the event lifecycle for plan, ask, sandbox, file reading, Knowledge Base search, and runtime tools so SSE events, execution details, and errors are handled consistently.
4. Unified the generation and persistence of `assistantResponses`, node responses, Provider state, and context-compression checkpoints, and removed duplicate adapters from the legacy execution paths.
5. Unified usage collection for model calls, context compression, and tool execution to prevent duplicate billing or usage aggregation.
6. Improved tool scheduling by allowing safe tools to run in parallel while writing tool responses back in model-call order. Stateful tools such as plan and ask continue to run sequentially.
file: ./content/self-host/upgrading/4-15/4152.mdx
meta: {
"title": "V4.15.2(环境变量变更)",
"description": "FastGPT V4.15.2 更新说明"
}
## 📦 升级指南
### 1. OpenSandbox 镜像升级
如果部署中启用了 OpenSandbox,请同步更新以下镜像:
* `opensandbox/server:v0.2.1`
* `opensandbox/execd:v1.0.21`
* `opensandbox/egress:v1.1.4`
升级后可修复中文文件名的文件无法下载的问题。完整配置请参考 [OpenSandbox 配置](../../config/sandbox/opensandbox)。
### 2. AGENT\_ENGINE 环境变量值调整
V4.15.2 起,`AGENT_ENGINE` 使用新的枚举值。升级前,请按下表修改部署环境变量:
| 旧值 | 新值 |
| --------- | ----------- |
| `default` | `fastAgent` |
| `pi` | `piAgent` |
旧值不再兼容。继续使用 `default` 或 `pi` 会导致环境变量校验失败,FastGPT 无法启动。未配置 `AGENT_ENGINE` 时,可正常启动,系统默认使用 `fastAgent`。
### 3. 修改文件下载模式变量
V4.15.2 新增 `STORAGE_DOWNLOAD_URL_MODE` 环境变量,默认值为 `short-proxy`。
* `short-proxy`:返回 FastGPT 短链,由 FastGPT App 代理文件下载。
* `short-redirect`:返回 FastGPT 短链,校验后跳转到临时 S3/CDN 地址。
如需使用短链但不希望文件流量经过 FastGPT App,可配置:
`STORAGE_DOWNLOAD_URL_MODE=short-redirect`
使用 `short-redirect` 时,必须配置 `STORAGE_EXTERNAL_ENDPOINT`。
### 4. 镜像变更
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.15.2
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.15.2
* 更新 fastgpt-plugin 镜像 tag: v1.0.2
## 🚀 新增内容
1. 工作流节点增加实时错误提示。
2. 自定义工具参数节点,支持手动输入 jsonschema,同时支持必填选项。
3. 文件上传、下载链接改用短访问链接,减少长链接占用上下文及模型输出异常;已签发的旧版链接仍保持兼容。
4. 针对无明确后缀的文件链接,进行 buffer 推测后缀,提高文件解析成功率。
5. 企业认证/公司认证能力。
6. 门户页支持选择 AgentV2 应用进行对话。
## ⚙️ 优化
1. Skill 未关联应用时的删除弹窗文案。
2. 适配最新微信发布渠道 sdk。
3. 将插件的已下线命名改成已卸载。
4. 判断器节点采用唯一 ID 作为标识,而不是 index,实现删除、排序时,目标分支保持不变。
5. 系统工具生成的文件不会 1 小时过期,改成长期,跟随会话一起删除。
6. 同步模式下不显示注册用户按钮。
7. 对话框流输出,淡入效果性能优化。
8. 升级 `LiteParse` 版本,解决并发解析 PDF 报错问题;文件解析 worker 默认数量由 10 调整为 5,仍可通过 `PARSE_FILE_WORKERS` 配置。
9. 前端请求增加并发去重能力,模型列表和沙盒依赖接口的相同请求会复用进行中的结果,减少工作流节点和选择器重复触发的请求。
10. 工作流 SSE 返回 nodeResponse。
## 🐛 修复
1. 优化 CI 流程,通过 hashtag 固定 step 版本,规避 CI 供应链投毒攻击风险。
2. 移除 PPTX 解析依赖的高风险解压库,改为流式解压解析流程,规避恶意代码执行风险。
3. 自定义分块标识符拒绝传入单一"|"或连续"||"符号,避免错误解析大量 chunks。
4. 企微版本客户付款后自动购买 license 判断逻辑优化,避免重复购买/少购买的情况
5. 插件市场空 Tag 标签问题
6. 修复循环运行节点的迭代项和并行运行节点的任务项耗时计算错误,改为分别记录每个子项的实际运行时间,不再累加子节点耗时。
7. Agent Loop 部分边界情况优化。
8. 删除正在上传的对话文件时,会同步中止预签名和上传请求,避免已删除文件重新出现或错误更新其他文件。
9. 修复调用上传、草稿上传及首轮媒体消息场景下,文件持久化、类型或元数据可能丢失的问题。
## 🛠️ 代码优化
### 常规代码优化
1. Agent V2 辅助生成/ChatAgentHelper 重构,复用对话框。
2. 保存包含超长 base64/data URL 的 AI 请求记录时可能触发栈溢出,提前进行截断。
3. SSE 事件统一封装,强化类型提示。
4. packages/service 和 packages/global 移除 next 依赖。
5. 新增 `AUTH_COOKIE_SECURE` 环境变量,启用后登录 Cookie 将添加 `Secure` 属性,仅通过 HTTPS 传输。
### Agent Loop 重构
1. Workflow Agent 与 ToolCall 统一接入共享的 Agent Loop 执行内核。ToolCall 关闭 plan 和 ask 能力,其他循环执行、上下文处理、工具事件、交互恢复及计费规则与 Workflow Agent 保持一致。
2. 统一 `fastAgent` 和 `piAgent` 的 Provider 接口,可通过 `AGENT_ENGINE` 切换执行引擎,并共用标准化的输入、运行时和返回结果协议。
3. 统一 plan、ask、sandbox、文件读取、知识库搜索和业务工具的事件生命周期,使 SSE、运行详情和错误信息保持一致。
4. 统一 `assistantResponses`、节点响应、Provider 状态和上下文压缩快照的生成及持久化流程,移除旧执行链路中的重复适配层。
5. 统一模型调用、上下文压缩和工具执行的 usage 收集入口,避免同一笔用量被重复计费或统计。
6. 优化工具调度:允许安全工具批量并行执行,并保持工具响应按模型调用顺序写回;plan、ask 等有状态工具继续串行执行。
file: ./content/self-host/upgrading/4-15/4153.en.mdx
meta: {
"title": "V4.15.3",
"description": "FastGPT V4.15.3 Release Notes"
}
## 📦 Upgrade Guide
### Image Updates
* Update the fastgpt-app (FastGPT main service) image tag to v4.15.3.
* Update the fastgpt-pro (FastGPT commercial edition) image tag to v4.15.3.
## 🐛 Fixes
1. Fixed rapid polling in the WeChat publishing channel when the WeChat API returns certain errors.
2. Restored the legacy `type` field for `/v1/chat/completions` responses when `stream=false` and `detail=true`.
file: ./content/self-host/upgrading/4-15/4153.mdx
meta: {
"title": "V4.15.3",
"description": "FastGPT V4.15.3 更新说明"
}
## 📦 升级指南
### 镜像变更
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.15.3
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.15.3
## 🐛 修复
1. 微信发布渠道,微信接口特殊异常时,会导致快速轮询。
2. v1 接口 stream=false,detail=true,补回 type 兼容。
file: ./content/self-host/upgrading/4-15/4154.en.mdx
meta: {
"title": "V4.15.4 (Environment Changes)",
"description": "FastGPT V4.15.4 Release Notes"
}
## 📦 Upgrade Guide
### Configure the required FE\_DOMAIN
FastGPT services now validate `FE_DOMAIN` at startup. Set it to the origin clients use to access
FastGPT, including the scheme, host, and optional port. Use the public client-facing origin in
production; local development can use `http://localhost:3000`.
```bash
FE_DOMAIN=https://fastgpt.example.com
```
### MongoDB Index Synchronization Changes
Starting with V4.15.4, `SYNC_INDEX` is deprecated and replaced by `MONGO_DEPRECATE_INDEX`. The new variable controls whether indexes explicitly marked as deprecated by a schema are removed and defaults to `true`. Setting it to `false` skips only deprecated-index cleanup; missing current schema indexes are still created.
FastGPT now performs safe index synchronization automatically at startup:
* Creates indexes that are missing from the current FastGPT schemas.
* Removes only built-in historical FastGPT indexes explicitly marked as deprecated by the corresponding schema and whose name, key, and relevant options match exactly.
* Preserves custom indexes and any other indexes that are not explicitly declared as deprecated.
This process does not call Mongoose's full `syncIndexes()` operation, so indexes are never removed simply because they are absent from a FastGPT schema.
> **Default and deletion boundary: `MONGO_DEPRECATE_INDEX` defaults to `true`. It removes only built-in indexes that a FastGPT schema explicitly marks as deprecated and whose definitions match exactly; customer-created indexes are not removed. Give every custom index an explicit name instead of relying on MongoDB's key-derived default name to prevent collisions with built-in FastGPT index names.**
> **Legacy index cleanup: V4.15.4 does not mark any existing historical indexes as deprecated, so upgrading to this version does not automatically remove old indexes. Future releases will explicitly mark verified obsolete indexes in their schemas and remove them incrementally.**
To fully remove obsolete indexes before upgrading to V4.15.4:
1. Upgrade to and start V4.15.3 once.
2. Set `SYNC_INDEX=true`, restart the services, and wait for index synchronization to finish.
3. After confirming that index synchronization succeeded, upgrade to V4.15.4.
V4.15.3 removes every index that is not declared in its schemas, which may include custom indexes. Back up your database and review the existing indexes before following this procedure. If custom indexes must be preserved, record their definitions and recreate them after synchronization, or do not use V4.15.3 for full cleanup.
Setting `MONGO_DEPRECATE_INDEX=false` skips deprecated-index cleanup that may be introduced in future releases, but does not skip creation of missing indexes.
### Image Changes
* Update the `fastgpt-app` (FastGPT core service) image tag to `v4.15.4`.
* Update the `fastgpt-pro` (FastGPT commercial edition) image tag to `v4.15.4`.
## 🚀 New Features
## ⚙️ Improvements
1. Added Workflow file context management to reduce duplicate URL signing and address potential security issues.
2. Improved the thinking icon animation.
## 🐛 Fixes
1. Fixed an issue where Chatbox displayed system tool errors during streaming responses.
2. Fixed an issue where plain-text tool responses in full run details could be incorrectly parsed as Markdown, causing formatting issues.
3. Fixed an issue where switching the embedding model triggered training but did not rebuild vectors for existing data.
4. Fixed MinIO prefix-based bulk deletion failures caused by the XML entity expansion limit and added request timeout protection.
5. Fixed bank account validation for enterprise verification.
6. Fixed inconsistencies between the Agent V2 tool list and its prompt.
7. Fixed syntax errors in deployment script `.yaml` files.
file: ./content/self-host/upgrading/4-15/4154.mdx
meta: {
"title": "V4.15.4(环境变量变更)",
"description": "FastGPT V4.15.4 更新说明"
}
## 📦 升级指南
### 配置必填的 FE\_DOMAIN
FastGPT 服务启动时会校验 `FE_DOMAIN`。请将它配置为客户端访问 FastGPT 时使用的地址,该地址由协议、主机和可选端口组成。公网部署应填写客户端实际使用的公网访问地址;本地开发可使用 `http://localhost:3000`。
```bash
FE_DOMAIN=https://fastgpt.example.com
```
### MongoDB 索引同步调整
V4.15.4 起,`SYNC_INDEX` 弃用,新增 `MONGO_DEPRECATE_INDEX` 环境变量,用于控制是否清理 Schema 显式标记的废弃索引,默认值为 `true`。设置为 `false` 时只跳过废弃索引清理,不影响当前 Schema 缺失索引的创建。
FastGPT 启动时会自动执行安全的主动同步:
* 创建当前 FastGPT Schema 中缺失的索引。
* 仅删除对应 Schema 明确标记为废弃、且 name、key 和关键 options 完全匹配的 FastGPT 系统内置历史索引。
* 保留客户自建索引及其他未声明的索引。
该同步不会调用 Mongoose 的全量 `syncIndexes()`,因此不会按“未在 Schema 中声明”这一条件批量删除索引。
> **默认开启与删除边界:`MONGO_DEPRECATE_INDEX` 默认为 `true`,仅删除 FastGPT Schema 显式声明为废弃、且索引定义精确匹配的系统内置索引,不会删除客户自建索引。建议为自建索引显式设置自定义名称,不要使用 MongoDB 按 key 生成的默认名称,避免与 FastGPT 系统内置索引重名。**
> **旧索引清理说明:V4.15.4 不会把任何已有历史索引标记为废弃,因此升级到该版本时不会自动删除旧索引。后续版本会在确认安全后,通过 Schema 中的显式废弃标记逐步清理对应索引。**
如需在升级 V4.15.4 前完整删除历史过期索引,请按以下顺序操作:
1. 先升级并启动一次 V4.15.3。
2. 设置 `SYNC_INDEX=true`,重启服务并等待索引同步完成。
3. 确认索引同步成功后,再升级至 V4.15.4。
V4.15.3 的索引同步会删除所有未在当时 Schema 中声明的索引,其中可能包含客户自建索引。执行上述步骤前,请先备份数据库并检查现有索引;如需保留自建索引,请记录其定义并在同步后重新创建,或不要使用 V4.15.3 进行全量清理。
`MONGO_DEPRECATE_INDEX=false` 会跳过未来版本可能声明的废弃索引清理,但不会跳过缺失索引的创建。
### 镜像变更
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.15.4
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.15.4
## 🚀 新增内容
## ⚙️ 优化
1. 工作流文件上下文管理,减少重复签发以及避免潜在安全问题。
2. 优化思考 Icon 动画。
## 🐛 修复
1. chatbox 流输出时候,不应该展示系统工具的错误。
2. 完整运行详情,纯文本的工具响应 UI 可能会被 Markdown 错误解析,格式错乱。
3. 切换向量模型后,训练任务会触发但已有数据的向量未重建。
4. 修复 MinIO 按前缀批量删除大量对象时,可能因 XML 实体展开限制失败的问题,并增加请求超时保护。
5. 修复企业认证银行账号校验问题。
6. 修复 Agent V2 中工具列表和提示词矛盾的问题。
7. 修复部署脚本 `.yaml` 中的语法问题
file: ./content/self-host/upgrading/4-15/4155.en.mdx
meta: {
"title": "V4.15.5",
"description": "FastGPT V4.15.5 Release Notes"
}
## 📦 Upgrade Guide
### Image Changes
* Update the `fastgpt-app` (FastGPT core service) image tag to `v4.15.5`.
* Update the `fastgpt-pro` (FastGPT commercial edition) image tag to `v4.15.5`.
* Update the `fastgpt-plugin` image tag to `v1.0.3`.
## 🚀 New Features
1. Added Cloudflare R2 object storage support, including the R2 S3 API, presigned access, and custom domains for public buckets.
2. Added the SoMark PDF enhanced parsing provider. Configure it with `SOMARK_API_KEY`; when multiple PDF providers are configured, FastGPT uses this priority order: custom PDF parsing service, SoMark, TextIn, then Doc2x. See the [environment variable configuration](../../config/env) for details.
## ⚙️ Improvements
1. Centralized more workspace dependency versions in the pnpm catalog and refreshed the lockfile.
2. Added Chinese and English runtime fonts to the Agent Sandbox image to improve font availability for text and image-related tasks.
3. Updated the OSS adapter to support string uploads required by the `IStorage` contract and to preserve the stored `Content-Type` when OSS does not support response-header overrides.
4. Added a missing-object preflight to the COS adapter so downloads follow the shared error contract.
## 🐛 Fixes
1. Fixed Alibaba Cloud OSS metadata reads that looked for ETags in the wrong response field, causing missing ETags and downstream metadata validation failures.
2. Fixed missing S3/MinIO source files being surfaced as `Unknown`; they now return a translated file-not-found error with HTTP 404.
3. Fixed input fields disappearing from older plugin nodes after an upgrade.
4. Fixed avatar URLs being encoded twice.
## 🛠️ Code Improvements
1. Added cross-provider S3 SDK integration tests for MinIO, AWS S3, Cloudflare R2, Alibaba Cloud OSS, and Tencent Cloud COS, covering private/public buckets, public URLs, and real presigned URL access.
file: ./content/self-host/upgrading/4-15/4155.mdx
meta: {
"title": "V4.15.5",
"description": "FastGPT V4.15.5 更新说明"
}
## 📦 升级指南
### 镜像变更
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.15.5
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.15.5
* 更新 fastgpt-plugin 镜像 tag: v1.0.3
## 🚀 新增内容
1. 新增 Cloudflare R2 对象存储支持,兼容 R2 S3 API、预签名访问和公开 bucket 自定义域名。
2. 新增 SoMark PDF 增强解析提供商,支持通过 `SOMARK_API_KEY` 配置;多个 PDF 服务同时配置时,调用优先级为自定义 PDF 解析服务、SoMark、TextIn、Doc2x。具体配置见[环境变量配置](../../config/env)。
## ⚙️ 优化
1. 统一工作区依赖版本管理,将更多子项目依赖迁移到 pnpm catalog,并刷新锁定文件。
2. Agent Sandbox 镜像补充中英文运行时字体,改善文本和图像相关任务的字体可用性。
3. OSS 适配器支持 `IStorage` 契约中的字符串上传,并在无法覆盖响应 `Content-Type` 的 OSS 场景下沿用对象原始类型。
4. COS 适配器对缺失对象下载进行预检,确保符合统一下载错误契约。
## 🐛 修复
1. 修复阿里云 OSS `getObjectMetadata` 从错误字段读取 ETag,导致 ETag 缺失并触发下游元数据校验失败的问题。
2. 修复 S3/MinIO 源文件不存在时 API 返回 `Unknown` 的问题,改为返回文件找不到并使用 HTTP 404。
3. 修复旧插件节点升级后输入框消失的问题。
4. 修复头像 URL 被重复编码的问题。
## 🛠️ 代码优化
1. S3 SDK 增加跨 MinIO、AWS S3、Cloudflare R2、OSS 和 COS 的通用集成测试,覆盖 private/public bucket、公开 URL 和预签名 URL 的真实访问。
file: ./content/self-host/upgrading/4-15/4156.en.mdx
meta: {
"title": "V4.15.6",
"description": "FastGPT V4.15.6 Release Notes"
}
## 📦 Upgrade Guide
### Image Changes
* Update the `fastgpt-app` (FastGPT core service) image tag to `v4.15.6`.
* Update the `fastgpt-pro` (FastGPT commercial edition) image tag to `v4.15.6`.
## 🐛 Fixes
1. Fixed chat history failing to load when opening a conversation page directly from a link for the first time.
file: ./content/self-host/upgrading/4-15/4156.mdx
meta: {
"title": "V4.15.6",
"description": "FastGPT V4.15.6 更新说明"
}
## 📦 升级指南
### 镜像变更
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.15.6
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.15.6
## 🐛 修复
1. 对话页面,首次直接打开链接时,无法加载历史对话。
file: ./content/self-host/upgrading/4-14/4140.en.mdx
meta: {
"title": "V4.14.0 (Upgrade Script)",
"description": "FastGPT V4.14.0 Release Notes"
}
## Upgrade Guide
### 1. Update Images:
* Update FastGPT image tag: v4.14.0
* Update FastGPT commercial edition image tag: v4.14.0
* Update fastgpt-plugin image tag: v0.3.0
* mcp\_server: no update needed
* Sandbox: no update needed
* AIProxy: no update needed
### 2. Run the Upgrade Script
Only required for commercial edition users who have used custom system tools.
From any terminal, send an HTTP request. Replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your **FastGPT domain**.
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv4140' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
This will migrate existing system tools to the latest data table.
### 3. Install System Plugins
Starting from V4.14.0, the fastgpt-plugin image only provides the runtime environment and no longer comes with pre-installed system plugins. All FastGPT systems must manually install system plugins.
**Important Notes**
* Previously manually installed JS plugin packages will become invalid and need to be repackaged and reinstalled.
* Installing via the Plugin Marketplace will fetch data from the public FastGPT Marketplace by default.
* If your FastGPT instance cannot access the Plugin Marketplace, you can manually visit the [FastGPT Plugin Marketplace](https://marketplace.fastgpt.cn/), download the .pkg file, and import it into your system.
* In addition to installation, you can also sort tools, set default installations, manage tags, and more.
* Currently, the plugin system only includes tools. Triggers, document parsers, data chunking strategies, and index enhancement strategies will be added in future releases.
* After system plugins are installed, in multi-tenant systems, team administrators can activate the corresponding tools in the plugin library to use them in apps. For the open-source edition, the root team will have all system tools activated by default.
In addition to installation, you can also sort tools, set default installations, manage tags, and more.

## New Features
1. Added Plugin Marketplace, and removed custom plugin groups (only custom tags are retained). This release supports system tools that can be installed from the FastGPT Marketplace. Future releases will support more plugin types: workflow triggers, data source parsers, data chunking strategies, index enhancement strategies, and more.
2. Files uploaded in the chat dialog are now stored in S3 and will not auto-expire -- they are deleted only when the chat record is deleted. Security is improved with signed preview links that expire after 1 hour instead of being long-lived.
3. Global variables now support time point / time range / chat model selection types.
4. Plugin input now supports password type.
## Improvements
1. Improved regex performance for matching Base64 images in Markdown.
2. After a team member accepts an invitation, the default member name is now set to the member's account name.
## Bug Fixes
1. Prompt editor could not parse content correctly when special syntax was present.
2. Claude tool calls failed when indices started from 1, causing parameter errors.
3. S3 avatar deletion threw an error when the key was empty, blocking the process.
4. Workflow dependencies were not refreshed promptly when upstream I/O changed.
5. Exported chat logs were missing feedback records.
6. Cursor jumped to the end of the input when typing in the workflow welcome message field.
7. Interactive nodes combined with consecutive batch execution caused workflow logic errors.
8. After a workflow Redo operation, edit history could no longer push snapshots.
9. HTTP custom input was lost.
file: ./content/self-host/upgrading/4-14/4140.mdx
meta: {
"title": "V4.14.0(升级脚本)",
"description": "FastGPT V4.14.0 更新说明"
}
## 更新指南
### 1. 更新镜像:
* 更新 FastGPT 镜像tag: v4.14.0
* 更新 FastGPT 商业版镜像tag: v4.14.0
* 更新 fastgpt-plugin 镜像 tag: v0.3.0
* mcp\_server 无需更新
* Sandbox 无需更新
* AIProxy 无需更新
### 2. 执行升级脚本
仅需使用过自定义系统工具的商业版用户操作。
从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv4140' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
会将原系统工具迁移到最新数据表中。
### 3. 安装系统插件至系统
从 V4.14.0 版本开始,fastgpt-plugin 镜像仅提供运行环境,不再预装系统插件,所有 FastGPT 系统需手动安装系统插件。
**注意事项**
* 原先手动安装的 js 插件包将会失效,需重新打包安装。
* 通过插件市场安装,默认会向公开的 FastGPT Marketplace 获取数据进行安装。
* 如果你的 FastGPT 无法访问插件市场,则可以手动访问[FastGPT 插件市场](https://marketplace.fastgpt.cn/),先下载 .pkg 文件,再通过文件导入的方式安装到系统里。
* 除了安装外,还可对工具进行排序、默认安装、标签管理等。
* 目前插件里仅包含工具,后续将增加触发器,文档解析器,数据分块策略,索引增强策略等。
* 系统安装完插件后,对于多租户的系统,团队管理员可以在插件库中激活对应工具,从而在应用中使用。对于开源版,root 团队会默认激活所有系统工具。
除了安装外,还可对工具进行排序、默认安装、标签管理等。

## 🚀 新增内容
1. 增加插件市场,同时移除自定义插件分组,仅保留自定义标签。本期支持系统工具,可以从 FastGPT Marketplace 统一安装系统工具。后续将支持更多插件类型:工作流触发器,数据源解析方式,数据分块,索引增强策略等。
2. 对话框上传文件移动存储至 S3,并且不会自动过期,完全跟随对话记录删除。安全性更高,签发预览连接仅 1 小时生效,而不是长期。
3. 全局变量支持时间点/时间范围/对话模型选择类型。
4. 插件输入支持密码类型。
## ⚙️ 优化
1. 匹配 Markdown 中 Base64 图片正则性能。
2. 团队成员接受邀请后,默认成员名改为成员账户名。
## 🐛 修复
1. Prompt 编辑器存在特殊语法时候,无法解析正确内容。
2. Claude 工具调用,如果下标从 1 开始会导致参数异常。
3. S3 删除头像,如果 key 为空时,会抛错,导致流程阻塞。
4. 工作流前置IO 变更时,依赖未及时刷新。
5. 导出对话日志,缺少反馈记录。
6. 工作流欢迎语输入框输入时,光标会偏移到最后一位。
7. 存在交互节点和连续批量执行时,会导致工作流运行逻辑错误。
8. 工作流 Redo 操作后,编辑记录无法再继续推送快照。
9. HTTP 自定义输入丢失。
file: ./content/self-host/upgrading/4-14/4141.en.mdx
meta: {
"title": "V4.14.1 (Upgrade Script)",
"description": "FastGPT V4.14.1 Release Notes"
}
## Upgrade Guide
### 1. Update Images:
* Update FastGPT image tag: v4.14.1
* Update FastGPT commercial edition image tag: v4.14.1
* Update fastgpt-plugin image tag: v0.3.1
* mcp\_server: no update needed
* Sandbox: no update needed
* AIProxy: no update needed
### 2. Run the Upgrade Script
From any terminal, send an HTTP request. Replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your **FastGPT domain**.
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv4141' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
This will create a copy of the original app directory for tool usage.
## New Features
1. New workbench interaction. The original "Plugin" has been renamed to "Workflow Tool" and moved under the My Tools category.
2. Workflows now provide a "Continue" button after running out of credits, so you don't have to start over.
## Improvements
1. MCP Client instances are now persisted within the same conversation turn and will not be destroyed.
2. When reloading models, the global model configuration is no longer cleared and re-added, which previously caused model call errors during the reload phase.
3. Auto-save now creates a team cloud save record.
## Bug Fixes
1. Interactive nodes did not work properly in debug mode.
2. Tab spacing was misaligned in the rich text editor.
3. When running nested Agents, the skip-node queue was not initialized, preventing normal execution.
4. Condition node threw an error when the right-side value was a number reference.
5. File selection input did not show the selection dialog when used as a workflow tool parameter.
6. HTTP plugin could not correctly handle HTTP (non-HTTPS) protocol requests.
7. UI issue with the default value editor for text-type global variables.
8. Code node content overlapped when exceeding 100 lines.
9. Deleting an app did not delete items inside its directory.
10. Browser did not pass the real-time date to the server.
file: ./content/self-host/upgrading/4-14/4141.mdx
meta: {
"title": "V4.14.1(升级脚本)",
"description": "FastGPT V4.14.1 更新说明"
}
## 更新指南
### 1. 更新镜像:
* 更新 FastGPT 镜像tag: v4.14.1
* 更新 FastGPT 商业版镜像tag: v4.14.1
* 更新 fastgpt-plugin 镜像 tag: v0.3.1
* mcp\_server 无需更新
* Sandbox 无需更新
* AIProxy 无需更新
### 2. 执行升级脚本
从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv4141' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
复制一份原应用目录给工具使用。
## 🚀 新增内容
1. 新工作台交互。原插件,改名"工作流工具",并移动到我的工具分类下。
2. 工作流运行欠费后提供继续运行按键,无需从头开始。
## ⚙️ 优化
1. 在同一轮对话中,MCP Client 会持久化实例,不会销毁。
2. 模型重载时候,不会把全局模型配置清空再添加,从而导致重载阶段模型调用错误。
3. 自动保存,增加一条团队云端保存记录。
## 🐛 修复
1. Debug 模式下,交互节点无法正常使用。
2. 富文本编辑器 tab 空格未对齐。
3. 嵌套运行 Agent 时候,跳过节点队列未初始化,导致无法正常运行。
4. 判断器右侧是 number 引用时,会出现报错。
5. 工作流工具入参为文件选择时,未出现选择框。
6. HTTP 插件无法正确处理 http 协议(非 https)接口请求。
7. 文本类型的全局变量,默认值编辑框 UI。
8. 代码节点行数超过 100 行时显示重叠。
9. 删除应用,未把目录内的删除。
10. 浏览器未传递实时日期至服务器。
file: ./content/self-host/upgrading/4-14/41410.en.mdx
meta: {
"title": "V4.14.10 (Environment Changes)",
"description": "FastGPT V4.14.10 Release Notes"
}
## Upgrade Guide
### 1. Add agent-sandbox related configurations
The following configuration adjustments are for `docker compose` deployments. `sealos` commercial users can contact support for an online sandbox service solution.
Open the [latest yml deployment file](https://github.com/labring/FastGPT/blob/main/document/public/deploy/docker/v4.14/global/docker-compose.pg.yml) and add the following:
1. Add the `x-volume-manager-auth-token: &x-volume-manager-auth-token 'vmtoken'` variable configuration at the top of the file.
2. Add 3 new services: `opensandbox-server`, `volume-manager`, and `agent-sandbox-image`.
3. Add `configs` (you can find this content at the bottom of the file, just copy and append it directly).
4. Modify the `fastgpt` environment variables to include the following:
```bash
# ==================== Agent sandbox config ====================
AGENT_SANDBOX_PROVIDER: opensandbox
# OpenSandbox config (effective when PROVIDER: opensandbox)
AGENT_SANDBOX_OPENSANDBOX_BASEURL: http://opensandbox-server:8090
AGENT_SANDBOX_OPENSANDBOX_API_KEY:
AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker
AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: ghcr.io/labring/fastgpt/fastgpt-agent-sandbox
AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.0.2
# Volume persistence config (optional under opensandbox provider)
AGENT_SANDBOX_ENABLE_VOLUME: true
AGENT_SANDBOX_VOLUME_MANAGER_URL: http://volume-manager:3000
AGENT_SANDBOX_VOLUME_MANAGER_TOKEN: *x-volume-manager-auth-token
```
### 2. Modify the sandbox image name
The image name under the original `sandbox` services needs to be changed from `fastgpt-sandbox` to `fastgpt-code-sandbox`.
### 3. Update image tags
* Update FastGPT image tag to: `v4.14.10`
* Update FastGPT commercial image tag to: `v4.14.10`
* Update fastgpt-plugin image tag to: `v0.5.6`
* Update code-sandbox image tag to: `v4.14.10`
Restart the service after updating.
### 4. Update system tools and refresh icons
Some system tool icons have been removed and replaced with image links, so some tool icons will be lost. You can update the system tools again (uninstall and reinstall, or directly import the pkg to overwrite).
## 🚀 Features
1. Added OpenSandbox docker deployment and adaptation, with support for data persistence via mounted volumes.
2. Added sandbox file link reading tool, allowing AI to directly return file access links.
3. Added WeChat Personal Account publishing channel.
4. Added streaming output support for Lark publishing channel.
5. The maximum directory limit can now be configured via environment variables.
6. Added max limit configuration for rerank models to prevent rerank failures caused by exceeding the single document limit.
7. Added tiered billing mode for LLMs and unified the billing push method.
## ⚙️ Optimizations
1. Optimized workflow runtime to reduce computational complexity.
2. Added calculation limits for large variables to prevent thread blocking caused by high computational complexity.
3. Removed configurations like "Used for knowledge base file processing" and "Used for question classification" from model settings, and unified them with a "Test Model" flag. Test models will have a special identifier and can only be used in AI chat; they will be filtered out in other scenarios.
## 🐛 Bug Fixes
1. Fixed an issue where the default values of global variables in sub-workflows were not taking effect.
2. Fixed an issue where the configured rerank model was not displaying in agent mode.
3. Fixed an issue where the output of the bge-m3 embedding vector model was always 0.
4. Fixed a call failure caused by connection exceptions during concurrent MCP calls.
5. Fixed security vulnerabilities in the login API.
6. Fixed MCP SSRF security vulnerabilities.
7. Fixed an issue where workflow tool errors were not properly caught.
8. Fixed an issue where the default values of global variables in sub-workflows were not taking effect.
file: ./content/self-host/upgrading/4-14/41410.mdx
meta: {
"title": "V4.14.10(环境变量变更)",
"description": "FastGPT V4.14.10 更新说明"
}
## 升级指南
### 1. 增加 agent-sandbox 相关配置
以下针对的是 `docker compose` 部署方案的配置调整,使用 `sealos` 的商业版用户,可私信支持人员,提供在线的沙盒服务方案。
参考[最新 yml 部署文件](https://github.com/labring/FastGPT/blob/main/document/public/deploy/docker/v4.14/cn/docker-compose.pg.yml),调整本地 yml 文件,加入以下内容:
1. 在文件顶部增加 `x-volume-manager-auth-token: &x-volume-manager-auth-token 'vmtoken'` 变量配置。
2. 增加 5 组 services: `opensandbox-server` , `opensandbox-agent-sandbox-image` , `opensandbox-execd-image` , `opensandbox-egress-image` , `fastgpt-volume-manager`
3. 调整 `networks`,可参考最新的 yml 完全修改。
4. 增加 `configs` 配置, 文件底部可找到该内容,直接复制添加。
5. 修改 `fastgpt-app` / `fastgpt-pro` 环境变量,增加以下变量:
```bash
# ==================== Agent sandbox 配置 ====================
AGENT_SANDBOX_PROVIDER: opensandbox
# OpenSandbox 配置(PROVIDER: opensandbox 时生效)
AGENT_SANDBOX_OPENSANDBOX_BASEURL: http://opensandbox-server:8090
AGENT_SANDBOX_OPENSANDBOX_API_KEY:
AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker
AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox
AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1
AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY: true
# Volume 持久化配置(opensandbox provider 下可选)
AGENT_SANDBOX_ENABLE_VOLUME: true
AGENT_SANDBOX_VOLUME_MANAGER_URL: http://volume-manager:3000
AGENT_SANDBOX_VOLUME_MANAGER_TOKEN: *x-volume-manager-auth-token
```
### 2. 修改 sandbox 镜像名
原先的 `sandbox` 服务的镜像名,需要从 `fastgpt-sandbox` 改成 `fastgpt-code-sandbox`。
目的是为了区分 agent-sandbox 和 code-sandbox。
### 3. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.10.4
* 更新 fastpgt-pro(商业版) 镜像 tag: v4.14.10
* 更新 code-sandbox 镜像 tag: v4.14.10
* 更新 fastgpt-plugin 镜像 tag: v0.5.6
更新完后即可重启服务。
### 4. 更新系统工具,刷新头像
系统工具部分头像,移除了 icon,都转用图片链接,所以会丢失一部分工具的头像。可以重新更新一次系统工具(卸载再安装,或者直接导入 pkg 覆盖)。
## 🚀 新增内容
1. 增加 OpenSandbox docker 部署方案及适配,并支持通过挂载 volume 进行数据持久化。
2. 新增沙盒读取文件链接工具,可以直接让 AI 返回文件的访问链接。
3. 新增微信个人号发布渠道
4. 飞书发布渠道,支持流输出。
5. 目录最大上限,可通过环境变量配置。
6. rerank 模型上限配置,避免超出单条 document 上限导致 rerank 失败。
7. 增加 LLM 梯度计量计费模式,同时统一计费推送方式。
## ⚙️ 优化
1. 工作流 runtime,减少计算复杂。
2. 增加一些对于大变量的计算限制,避免计算复杂度过高导致线程阻塞。
3. 移除模型配置里“用于知识库文件处理”、“用于问题分类”等配置,统一增加“测试模型“标志。测试模型会有特殊标识,并且仅可在 ai chat 中使用,其余场景将会过滤。
## 🐛 修复
1. 子工作流的全局变量默认值未生效。
2. agent 模式下已配的 rerank 模型不显示。
3. bge-m3 embedding 向量模型输出都为 0 的问题。
4. MCP 并发调用时,连接异常导致调用失败。
5. 修复登录接口安全问题
6. 修复 MCP SSRF 安全问题
7. 修复工作流工具错误未成功捕获问题
8. 修复子工作流全局变量默认值未生效
file: ./content/self-host/upgrading/4-14/41411.en.mdx
meta: {
"title": "V4.14.11 (Environment Changes)",
"description": "FastGPT V4.14.11 Release Notes"
}
## Upgrade Guide
### 1. Update image tags
* Update fastgpt-app (FastGPT main service) image tag to: v4.14.11
* Update fastgpt-pro (commercial edition) image tag to: v4.14.11
* Update code-sandbox image tag to: v4.14.11
* Update fastgpt-plugin image tag to: v0.6.0
* Update Aiproxy image tag to: v0.5.3
### 2. Update environment variables
> All variables below have default values — you can leave them unset.
```dotenv
STREAM_RESUME_TTL_SECONDS=300 # TTL for Redis stream resume snapshots while generating (seconds)
STREAM_RESUME_POST_COMPLETE_TTL_SECONDS=30 # Shortened TTL after stream completes, for faster reclamation (seconds)
STREAM_RESUME_REDIS_MAXMEMORY_RATIO=0.5 # Stop creating resume snapshots for new requests when Redis used memory / maxmemory reaches this threshold
STREAM_RESUME_REDIS_MEMORY_CHECK_INTERVAL_MS=5000 # Cache duration for Redis memory checks (ms), avoids calling INFO MEMORY on every stream request
WORKFLOW_PARALLEL_MAX_CONCURRENCY=10 # Upper bound for max concurrency; cannot exceed WORKFLOW_MAX_LOOP_TIMES
```
## 🚀 Features
1. Chat stream response resume support.
2. Parallel execution node.
3. Reworked the variable update node UX, with more numeric and array operations.
4. Unified S3 file uploads, with support for proxying S3 uploads and access through FastGPT to reduce pre-signed URL configuration issues.
5. Added direct preview for some sandbox file types, and optimized large file downloads.
## ⚙️ Optimizations
1. Added zod parameter validation to many APIs to reduce attack surface and parameter type errors.
2. Refactored model channel management code.
3. Added a default VLM model to the knowledge base creation API.
## 🐛 Bug Fixes
1. Fixed an issue where the model in chat Agent mode was reset after refresh.
2. Fixed missing permission checks on several APIs.
3. Fixed a billing error in the API for pushing data to the knowledge base.
4. Fixed garbled Chinese characters when uploading Markdown documents to the knowledge base, caused by the leading English content being misdetected as `ascii`.
5. Fixed Python code execution ignoring parameters when the input was empty.
6. Fixed the workflow global variable multi-select field not clearing default values when an enum entry was removed.
7. Fixed sub-workflow global variable default values not being displayed when adding a sub-workflow.
8. Fixed the workflow code-run node replacing the IDs of all output values after AI code generation; now IDs with the same key are preserved.
9. Fixed child node positions shifting when a parent node was auto-aligned by guides in the workflow.
10. Fixed the evaluation list permission filter not covering inherited permissions.
11. Fixed raw schema not being saved for MCP tools and HTTP tools, causing inaccurate schemas during tool calls.
file: ./content/self-host/upgrading/4-14/41411.mdx
meta: {
"title": "V4.14.11(环境变量变更)",
"description": "FastGPT V4.14.11 更新说明"
}
## 版本命名调整
从 4.14.11 开始,为了区分稳定版和快速迭代版,对版本命名进行了调整,未来将按以下方式进行版本命名:
1. 维护 2 个稳定版本。例如当前迭代功能处于 4.16.x 版本,则会维护 4.14.x 和 4.15.x 两个文档版本。
2. 稳定版本命名不带后缀,例如:4.14.11, 4.14.12, 4.15.0, 4.15.1。如果 4.14.11 有问题,会修复后发布 4.14.12,并同步修复到 4.15.x 的稳定版,以确保修复问题同时不引入新的功能。
3. 快速迭代版本命名带后缀,例如:4.16.0-beta.1, 4.16.0-beta.2, 4.16.0-beta.3。
4. 迭代版本约 2 个月发布一次稳定版,并且会提供一个聚合的升级脚本,用户只需要执行一次请求,即可完成所有迭代版本的升级。
总结来说,后续用户可以直接升级不带 beta 后缀的稳定版本,以确保稳定性,官方会单独发布修复版本并确保不会引入新功能。
## 升级指南
4.14.11 以后的版本均可直接升级,不会引入新功能或数据变动。
### 1. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.11
* 更新 fastpgt-pro(商业版) 镜像 tag: v4.14.11
* 更新 code-sandbox 镜像 tag: v4.14.11
* 更新 fastgpt-plugin 镜像 tag: v0.6.0
* 更新 Aiproxy 镜像 tag: v0.5.3
### 2. 更新环境变量
> 以下环境变量均设置了默认值,可不填或不改
```dotenv
STREAM_RESUME_TTL_SECONDS=300 # Redis 流式镜像续期:生成中(秒)
STREAM_RESUME_POST_COMPLETE_TTL_SECONDS=30 # 流结束后缩短 TTL,便于回收(秒)
STREAM_RESUME_REDIS_MAXMEMORY_RATIO=0.5 # 当 Redis 已用内存 / maxmemory 达到该阈值时,停止为新请求创建流恢复镜像
STREAM_RESUME_REDIS_MEMORY_CHECK_INTERVAL_MS=5000 # Redis 内存水位检测缓存时长(毫秒),避免每个流请求都调用 INFO MEMORY
WORKFLOW_PARALLEL_MAX_CONCURRENCY=10 # 最大并发数的上限值,不能超过 WORKFLOW_MAX_LOOP_TIMES 变量
```
## 🚀 新增内容
1. 对话流响应恢复功能。
2. 并行执行节点。
3. 调整变量更新节点交互,以及增加更多数字操作和数组操作。
4. S3 上传统一文件,支持通过 fastgpt 代理传入 s3 以及代理访问 s3,减少预签名配置问题。
5. 支持部分沙盒文件类型直接预览。并优化大文件下载。
## ⚙️ 优化
1. 对大量接口增加了 zod 参数校验,减少攻击和错误参数类型风险。
2. 优化模型渠道管理代码。
3. 知识库创建接口,增加默认 vlm 模型。
## 🐛 修复
1. 对话 Agent 模式,模型存在刷新后被重置问题。
2. 部分接口未正确进行权限校验。
3. API 推送知识库数据接口,计费异常。
4. 修复知识库上传 Markdown 文档时,因文件前部英文较多被误判为 `ascii`,导致中文乱码问题。
5. python 代码执行,如果入参为空,会导致该参数被忽略。
6. 工作流,全局变量多选框,删除 enum 时候未清理默认值。
7. 工作流添加子工作流时,子工作流全局变量默认值未显示。
8. 工作流代码运行节点,AI 生成代码后,会讲输出值的 id 全部替换,优化成相同 key 的 id 不替换。
9. 工作流中,父级节点受到辅助线自动对齐时候,其子节点位置会偏移。
10. 评估列表权限过滤未覆盖继承权限。
11. MCP 工具和 Http 工具 raw schema 未成功保存,导致工具调用时候,schema 不准确。
file: ./content/self-host/upgrading/4-14/41412.en.mdx
meta: {
"title": "V4.14.12",
"description": "FastGPT V4.14.12 Release Notes"
}
## Upgrade Guide
### 1. Update image tags
* Update fastgpt-app (FastGPT main service) image tag to: v4.14.12
* Update fastgpt-pro (commercial edition) image tag to: v4.14.12
## 🐛 Bug Fixes
1. Fixed a zod validation error on the third-level knowledge base directory `path` API.
2. Fixed a `dataId` issue in the `v1/completions` API that prevented run details from showing up in chat logs during API calls.
3. Fixed the sensitive information filter checkbox in chat Agent apps that could not be unchecked.
## 🚀 Features
1. Response values can now set a custom HTTP status code.
2. Agent scheduler supports PI Agent mode (beta).
## ⚙️ Optimizations
1. Improved error handling in the skill API.
file: ./content/self-host/upgrading/4-14/41412.mdx
meta: {
"title": "V4.14.12",
"description": "FastGPT V4.14.12 更新说明"
}
## 升级指南
### 1. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.12
* 更新 fastpgt-pro(商业版) 镜像 tag: v4.14.12
## 🐛 修复
1. 知识库三级目录 path 接口报 zod 校验出错。
2. v1/completions 接口 dataId 异常,导致 api 调用时候,对话日志里无法获取到运行详情。
3. 对话 Agent 应用敏感信息过滤勾选框无法取消。
## 🚀 新增内容
1. 响应值允许自定义 HttpStatus 状态码。
2. Agent 调度器支持 PI Agent 模式(beta功能)。
## ⚙️ 优化
1. skill 接口错误处理。
file: ./content/self-host/upgrading/4-14/41413.en.mdx
meta: {
"title": "V4.14.13",
"description": "FastGPT V4.14.13 Release Notes"
}
## Upgrade Guide
### 1. Update image tags
* Update fastgpt-app (FastGPT main service) image tag to: v4.14.13
## 🐛 Bug Fixes
1. Fixed auth failure on the single-quote fetch API when accessed via share link.
2. Fixed an auth bypass risk in opensandbox.
## ⚙️ Optimizations
1. The `completions` API `chatId` now accepts `null`.
file: ./content/self-host/upgrading/4-14/41413.mdx
meta: {
"title": "V4.14.13",
"description": "FastGPT V4.14.13 更新说明"
}
## 升级指南
### 1. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.13
## 🐛 修复
1. 分享链接获取单条引用接口鉴权失败。
2. opensandbox 鉴权绕过风险。
## ⚙️ 优化
1. completions 接口 chatId 支持 null 类型。
file: ./content/self-host/upgrading/4-14/41414.en.mdx
meta: {
"title": "V4.14.14",
"description": "FastGPT V4.14.14 Release Notes"
}
## Upgrade Guide
### 1. Update image tags
* Update fastgpt-app (FastGPT main service) image tag to: v4.14.14
* Update fastgpt-pro (FastGPT commercial) image tag to: v4.14.14
## 🐛 Bug Fixes
## ⚙️ Optimizations
1. Personal WeChat publishing channel: optimized polling strategy by decoupling pull from reply, preventing blocking under high message volume.
2. Added environment variable `WECHAT_CHANNEL_CONCURRENCY` (default 1000) to control the WeChat channel poll worker concurrency. Recommended to set ≥ peak online channel count.
3. Improved internal network address detection.
4. Added compatibility for DeepSeek tool calling combined with thinking mode to avoid 400 errors from the API.
file: ./content/self-host/upgrading/4-14/41414.mdx
meta: {
"title": "V4.14.14",
"description": "FastGPT V4.14.14 更新说明"
}
## 升级指南
### 1. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.14
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.14.14
## 🐛 修复
## ⚙️ 优化
1. 个人微信发布渠道,优化轮询策略(拉取与回复解耦),避免数据量超大时出现阻塞。
2. 新增环境变量 `WECHAT_CHANNEL_CONCURRENCY`(默认 1000)用于控制微信渠道 poll worker 并发数,建议 ≥ online channel 峰值。
3. 完善内网地址检测。
4. 兼容 deepseek 工具调用+思考模式,避免接口出现 400 错误。
file: ./content/self-host/upgrading/4-14/41415.en.mdx
meta: {
"title": "V4.14.14",
"description": "FastGPT V4.14.14 Release Notes"
}
## Upgrade Guide
### 1. Update image tags
* Update fastgpt-app (FastGPT main service) image tag to: v4.14.15
* Update fastgpt-pro (FastGPT commercial) image tag to: v4.14.15
## 🐛 Bug Fixes
1. Fixed compatibility for legacy system tools.
2. Fixed an issue where selecting a system component as a system tool caused errors.
## ⚙️ Optimizations
file: ./content/self-host/upgrading/4-14/41415.mdx
meta: {
"title": "V4.14.15",
"description": "FastGPT V4.14.15 更新说明"
}
## 升级指南
### 1. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.15
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.14.15
## 🐛 修复
1. 修复兼容旧版的系统工具。
2. 修复选中系统组件为系统工具异常。
## ⚙️ 优化
file: ./content/self-host/upgrading/4-14/41416.en.mdx
meta: {
"title": "V4.14.16",
"description": "FastGPT V4.14.16 Release Notes"
}
## Upgrade Guide
### 1. Update image tags
* Update fastgpt-app (FastGPT main service) image tag to: v4.14.16
* Update fastgpt-pro (FastGPT commercial) image tag to: v4.14.16
## ⚙️ Optimizations
1. Embeddings now support base64-encoded response values.
## 🐛 Bug Fixes
1. Fixed helper-bot prepending an `Error~` prefix to its output.
2. Fixed the Alibaba Cloud OSS copy API.
file: ./content/self-host/upgrading/4-14/41416.mdx
meta: {
"title": "V4.14.16",
"description": "FastGPT V4.14.16 更新说明"
}
## 升级指南
### 1. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.16
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.14.16
## ⚙️ 优化
1. embedding 适配 base64 字符串返回值。
## 🐛 修复
1. helper-bot 前缀输出 Error~ 信息
2. 阿里云 oss copy 接口。
3. 工作流节点弹窗高度过高,导致底部一行节点无法显示。
4. 临时解决评估列表权限问题,只能看到自己创建的评估。
file: ./content/self-host/upgrading/4-14/41417.mdx
meta: {
"title": "V4.14.17",
"description": "FastGPT V4.14.17 更新说明"
}
## 升级指南
### 1. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.17
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.14.17
## 🐛 修复
1. API 知识库 parentId 类型校验错误。
2. 门户页对话无法上传文件。
3. 商业版未包含内部文件解析接口,如果未配置 S3 External Endpoint,会导致文件解析失败。
file: ./content/self-host/upgrading/4-14/41418.mdx
meta: {
"title": "V4.14.18",
"description": "FastGPT V4.14.18 更新说明"
}
## 升级指南
### 1. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.18
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.14.18
## 🚀 新增内容
1. 支持管理员后台关闭个人微信发布渠道。
## 🐛 修复
1. 修复了部分`工作流工具`、`用户表单节点`无法正确根据文件类型过滤并上传文件的问题。
2. 修复在对话页频繁切换未结束对话,导致流恢复顺序异常。
file: ./content/self-host/upgrading/4-14/41419.en.mdx
meta: {
"title": "V4.14.19",
"description": "FastGPT V4.14.19 release notes"
}
## Upgrade Guide
### 1. Update image tags
* Update the fastgpt-app image tag (FastGPT main service): v4.14.19
* Update the fastgpt-pro image tag (FastGPT commercial edition): v4.14.19
## ⚙️ Improvements
1. Improved browser compatibility for lower kernel versions.
## 🐛 Fixes
1. Fixed an issue where form inputs did not filter out icons for file-type fields, causing oversized request bodies.
2. Fixed an issue where shared links did not correctly show the sandbox file entry.
file: ./content/self-host/upgrading/4-14/41419.mdx
meta: {
"title": "V4.14.19",
"description": "FastGPT V4.14.19 更新说明"
}
## 升级指南
### 1. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.19
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.14.19
## ⚙️ 优化
1. 兼容更低版本内核的浏览器。
## 🐛 修复
1. 表单输入,文件类型时,未过滤掉 icon,导致请求体过大。
2. 分享链接,未正确展示虚拟机文件入口。
file: ./content/self-host/upgrading/4-14/4142.en.mdx
meta: {
"title": "V4.14.2",
"description": "FastGPT V4.14.2 Release Notes"
}
## Upgrade Guide
### 1. Update Images:
* Update FastGPT image tag: v4.14.2
* Update FastGPT commercial edition image tag: v4.14.2
* Update fastgpt-plugin image tag: v0.3.2
* mcp\_server: no update needed
* Sandbox: no update needed
* AIProxy: no update needed
## New Features
1. Refactored the underlying Agent Call mechanism with support for context compression during consecutive tool calls.
2. New Template Marketplace UI.
3. Quick knowledge base creation from the Agent editor page.
## Improvements
1. Template Marketplace cache duration set to 30 minutes.
2. Custom separator chunk size now uses the maximum chunk size.
3. Prevented logging from triggering recursive log storms; excluded log model from performance monitoring middleware.
## Bug Fixes
1. Simple app templates were not converted correctly.
2. When tool calls contained two or more consecutive user selections, the second user selection behaved abnormally.
3. Incorrect team app type in the portal.
4. When an app was exported as MCP and used by other apps, global variables no longer need to be filled in.
## Plugin Updates
1. Fix: Sub-tool avatars were missing.
2. Fix: Model avatars were missing.
3. Fix: Incorrect mongoose dependency reference in Worker caused errors for tools running longer than 10 seconds.
4. Improvement: Static files are no longer re-uploaded during hot reload in development mode.
5. Added: 5118 SEO keyword mining tool.
6. Added: Tavily content extraction advanced configuration; website sitemap tool.
7. Added: WeChat Official Account toolset.
8. Added: Document comparison tool.
9. Added: Model presets for Kimi V2 and GPT 5.1.
file: ./content/self-host/upgrading/4-14/4142.mdx
meta: {
"title": "V4.14.2",
"description": "FastGPT V4.14.2 更新说明"
}
## 更新指南
### 1. 更新镜像:
* 更新 FastGPT 镜像tag: v4.14.2
* 更新 FastGPT 商业版镜像tag: v4.14.2
* 更新 fastgpt-plugin 镜像 tag: v0.3.2
* mcp\_server 无需更新
* Sandbox 无需更新
* AIProxy 无需更新
## 🚀 新增内容
1. 封装底层 Agent Call 方式,支持工具连续调用时上下文的压缩。
2. 模板市场新 UI。
3. 支持 Agent 编辑页快速创建知识库。
## ⚙️ 优化
1. 30 分钟模板市场缓存时长。
2. 自定义分隔符块大小采用最大块大小。
3. 避免日志记录触发递归日志风暴,排除日志模型的性能监控中间件。
## 🐛 修复
1. 简易应用模板未正常转化。
2. 工具调用中,包含两个以上连续用户选择时候,第二个用户选择异常。
3. 门户中,团队应用类型错误。
4. 应用作为 MCP 导出,被其他应用使用时,全局变量不需要填写。
## 插件
1. 修复:子工具头像丢失。
2. 修复:模型头像丢失。
3. 修复:Worker 中错误引用 mongoose 依赖,导致超过 10s 的工具运行报错。
4. 优化:开发环境热更新时,不重复上传静态文件。
5. 新增:5118 SEO 关键词挖掘工具。
6. 新增:Tavity 内容提取高级配置。网页站点地图工具。
7. 新增:微信公众号工具集。
8. 新增:文档对比工具。
9. 新增:kimiV2 和 GPT5.1 模型预设。
file: ./content/self-host/upgrading/4-14/41420.en.mdx
meta: {
"title": "V4.14.20",
"description": "FastGPT V4.14.20 release notes"
}
## Upgrade Guide
### 1. Update image tags
* Update the fastgpt-app image tag (FastGPT main service): v4.14.20
* Update the fastgpt-pro image tag (FastGPT commercial edition): v4.14.20
## 🐛 Fixes
1. Improved workflow Zod data type compatibility.
2. Fixed an issue where model configuration could not fully override `defaultConfig`.
file: ./content/self-host/upgrading/4-14/41420.mdx
meta: {
"title": "V4.14.20",
"description": "FastGPT V4.14.20 更新说明"
}
## 升级指南
### 1. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.20
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.14.20
* 更新 fastgpt-plugin 镜像 tag: v0.6.2
## 🐛 修复
1. 增强工作流 zod 数据类型适配性。
2. 模型配置,无法完全覆盖 defaultConfig。
file: ./content/self-host/upgrading/4-14/41421.en.mdx
meta: {
"title": "V4.14.21",
"description": "FastGPT V4.14.21 release notes"
}
## Upgrade Guide
### 1. Update image tags
* Update the fastgpt-app image tag (FastGPT main service): v4.14.21
* Update the fastgpt-pro image tag (FastGPT commercial edition): v4.14.21
## 🐛 Fixes
1. Made `name` optional for file types in the completions API.
2. Fixed an OSS initialization error.
file: ./content/self-host/upgrading/4-14/41421.mdx
meta: {
"title": "V4.14.21",
"description": "FastGPT V4.14.21 更新说明"
}
## 升级指南
### 1. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.21
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.14.21
## 变更说明
1. completions API 文件类型,name 变成可选
2. 修复 OSS 初始化异常
file: ./content/self-host/upgrading/4-14/41422.en.mdx
meta: {
"title": "V4.14.22",
"description": "FastGPT V4.14.22 release notes"
}
## Upgrade Guide
### 1. Update image tags
* Update the fastgpt-app image tag (FastGPT main service): v4.14.22
* Update the fastgpt-pro image tag (FastGPT commercial edition): v4.14.22
## 🐛 Fixes
1. Fixed an issue where the workflow's default selected model was not synced back to the form value, causing the displayed model to differ from the model used at runtime.
2. Fixed a risk where edges could be lost during workflow autosave.
3. Fixed an error that occurred when admins edited the system notification modal.
file: ./content/self-host/upgrading/4-14/41422.mdx
meta: {
"title": "V4.14.22",
"description": "FastGPT V4.14.22 更新说明"
}
## 升级指南
### 1. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.22
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.14.22
## 🐛 修复
1. 工作流默认选中模型未回传表单值,导致看到的模型和实际运行模型不一致。
2. 工作流自动保存时,存在边丢失风险。
3. admin 修改系统通知弹窗时候报错。
4. 工作流混用思考/非思考模型,可能出现独立 reason 字段上下文,导致模型调用报错。
file: ./content/self-host/upgrading/4-14/41424.en.mdx
meta: {
"title": "V4.14.24",
"description": "FastGPT V4.14.24 release notes"
}
## Upgrade Guide
### 1. Update image tags
* Update the fastgpt-app image tag (FastGPT main service): v4.14.24
* Update the fastgpt-pro image tag (FastGPT commercial edition): v4.14.24
## Changes
1. Improved the `v1/completions` abort condition to reduce false aborts caused by socket reconnections, which could occasionally terminate workflow API calls.
2. Added an upload API for admin deployments without an S3 external URL configured.
file: ./content/self-host/upgrading/4-14/41424.mdx
meta: {
"title": "V4.14.24",
"description": "FastGPT V4.14.24 更新说明"
}
## 升级指南
### 1. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.24
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.14.24
## 变更说明
1. 优化 v1/completions abort 条件判断,减少 socket 重连导致误判中断,导致 API 调用工作流时不时终止。
2. 补充 admin 无 s3 external URL 时的上传接口
file: ./content/self-host/upgrading/4-14/41425.en.mdx
meta: {
"title": "V4.14.25(Deprecated)",
"description": "FastGPT V4.14.25 release notes"
}
## Upgrade Guide
### 1. Update image tags
* Update the fastgpt-app image tag (FastGPT main service): v4.14.25
* Update the fastgpt-pro image tag (FastGPT commercial edition): v4.14.25
## Changes
1. Fixed permission issues for the portal page and chat logs.
file: ./content/self-host/upgrading/4-14/41425.mdx
meta: {
"title": "V4.14.25(弃)",
"description": "FastGPT V4.14.25 更新说明"
}
## 升级指南
### 1. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.25
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.14.25
## 变更说明
1. 修复门户页,日志权限问题。
file: ./content/self-host/upgrading/4-14/41426.en.mdx
meta: {
"title": "V4.14.26",
"description": "FastGPT V4.14.26 release notes"
}
## Upgrade Guide
### 1. Update image tags
* Update the fastgpt-app image tag (FastGPT main service): v4.14.26
* Update the fastgpt-pro image tag (FastGPT commercial edition): v4.14.26
## Changes
1. Pinned the Node.js version to avoid streaming response issues caused by automatically using the latest Node.js.
file: ./content/self-host/upgrading/4-14/41426.mdx
meta: {
"title": "V4.14.26",
"description": "FastGPT V4.14.26 更新说明"
}
## 升级指南
### 1. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.26
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.14.26
## 变更说明
1. 锁定 Node.js 版本,避免使用最新 Node.js 导致流式响应接收异常。
file: ./content/self-host/upgrading/4-14/41427.en.mdx
meta: {
"title": "V4.14.27",
"description": "FastGPT V4.14.27 release notes"
}
## Upgrade Guide
### 1. Update image tags
* Update the fastgpt-app image tag (FastGPT main service): v4.14.27
* Update the fastgpt-pro image tag (FastGPT commercial edition): v4.14.27
## Changes
1. Fixed an issue where the V4.13.2 upgrade script could skip S3 lifecycle cleanup. The script no longer depends on `instanceof MinioStorageAdapter` to detect MinIO clients, avoiding false negatives when workspace packages are loaded as separate module instances in Next.js dev or bundled runtimes.
2. Fixed the image migration log resource type in the V4.14.3 upgrade script by changing `data_image` to `dataset_image`, so completed image migrations can be recognized correctly.
3. Fixed the completed-image migration filter in the V4.14.4 upgrade script to also use `dataset_image`, preventing already migrated images from being migrated again when the script is rerun.
file: ./content/self-host/upgrading/4-14/41427.mdx
meta: {
"title": "V4.14.27",
"description": "FastGPT V4.14.27 更新说明"
}
## 升级指南
### 1. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.27
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.14.27
## 变更说明
该版本修复一些历史升级脚本问题,由于近期变更导致旧的升级脚本无法正常使用。
1. 修复 V4.13.2 升级脚本中 S3 lifecycle 清理可能被跳过的问题。该脚本不再依赖 `instanceof MinioStorageAdapter` 判断 MinIO 客户端,避免 Next.js dev 或 bundle 场景下 workspace package 被加载为不同模块实例导致误判。
2. 修复 V4.14.3 升级脚本中图片迁移日志的资源类型,将 `data_image` 修正为 `dataset_image`,避免已完成的图片迁移记录无法被正确识别。
3. 修复 V4.14.4 升级脚本中图片迁移已完成记录的过滤条件,同样使用 `dataset_image`,避免重复执行脚本时再次迁移已完成的图片。
file: ./content/self-host/upgrading/4-14/41428.en.mdx
meta: {
"title": "V4.14.28",
"description": "FastGPT V4.14.28 release notes"
}
## Upgrade Guide
### 1. Update image tags
* Update the fastgpt-app image tag (FastGPT main service): v4.14.28
* Update the fastgpt-pro image tag (FastGPT commercial edition): v4.14.28
## Changes
1. Fixed a Node.js version compatibility issue in the admin service to prevent service errors caused by mismatched Node.js runtime versions.
file: ./content/self-host/upgrading/4-14/41428.mdx
meta: {
"title": "V4.14.28",
"description": "FastGPT V4.14.28 更新说明"
}
## 升级指南
### 1. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.28
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.14.28
## 变更说明
1. 修复 admin 服务 Node.js 版本兼容问题,避免因运行环境 Node.js 版本不匹配导致服务异常。
file: ./content/self-host/upgrading/4-14/41429.en.mdx
meta: {
"title": "V4.14.29",
"description": "FastGPT V4.14.29 release notes"
}
## Upgrade Guide
### 1. Update image tags
* Update the fastgpt-app image tag (FastGPT main service): v4.14.29
* Update the fastgpt-pro image tag (FastGPT commercial edition): v4.14.29
## Changes
1. Fixed permission checks for the WeChat publish channel login, logout, and QR code status APIs. These APIs now authorize by publish channel ID and verify the channel type to avoid accidentally operating on non-WeChat publish channels.
2. Adapted to the latest WeChat publish channel SDK.
file: ./content/self-host/upgrading/4-14/41429.mdx
meta: {
"title": "V4.14.29",
"description": "FastGPT V4.14.29 更新说明"
}
## 升级指南
### 1. 更新镜像 tag
* 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.29
* 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.14.29
## 变更说明
1. 修复微信发布渠道登录、登出和二维码状态接口的权限校验,改为使用发布渠道 ID 鉴权,并校验渠道类型,避免非微信发布渠道被误操作。
2. 适配最新微信发布渠道 sdk。
file: ./content/self-host/upgrading/4-14/4143.en.mdx
meta: {
"title": "V4.14.3 (Upgrade Script)",
"description": "FastGPT V4.14.3 Release Notes"
}
## Upgrade Guide
### 1. Update Images:
* Update FastGPT image tag: v4.14.3
* Update FastGPT commercial edition image tag: v4.14.3
* Update fastgpt-plugin image tag: v0.3.3
* mcp\_server: no update needed
* Sandbox: no update needed
* AIProxy: no update needed
### 2. Run the Upgrade Script
From any terminal, send an HTTP request. Replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your **FastGPT domain**.
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv4143' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
This will migrate all knowledge base files from MongoDB GridFS to S3, including text datasets and image datasets, but not images extracted from documents (e.g., .docx files).
## New Features
1. Knowledge base files migrated to S3 (all file-related functionality has been migrated).
2. Global variables now support file upload.
3. Form input node now supports password, toggle, time point, time range, file upload, and chat model selection.
4. Plugin input now supports multi-select, time point, time range, and internal variables.
5. System plugins in the Plugin Marketplace now show whether a new version is available, with an update button.
6. Workflow execution QPM (queries per minute) rate limiting.
## Improvements
1. Improved UX for file upload input in workflow tools.
2. Added permission table validation middleware to improve permission system robustness.
## Bug Fixes
1. Workflow debug preview window lost input values due to re-rendering.
2. When the S3 service shared the same origin as the main service, file request URLs to S3 were incorrectly rewritten, causing 404 errors.
## Plugin Updates
1. Updated tool versioning logic with a computed version value for update detection.
2. WeChat Official Account toolset: now allows uploading multiple documents to the draft box at once.
3. Fixed tool cache not being refreshed correctly.
4. Fixed static files being re-uploaded when refreshing cache in development mode.
5. Fixed images not being uploaded correctly after uploading a .pkg file.
file: ./content/self-host/upgrading/4-14/4143.mdx
meta: {
"title": "V4.14.3(升级脚本)",
"description": "FastGPT V4.14.3 更新说明"
}
## 更新指南
### 1. 更新镜像:
* 更新 FastGPT 镜像tag: v4.14.3
* 更新 FastGPT 商业版镜像tag: v4.14.3
* 更新 fastgpt-plugin 镜像 tag: v0.3.3
* mcp\_server 无需更新
* Sandbox 无需更新
* AIProxy 无需更新
### 2. 执行升级脚本
从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv4143' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
会将原系统 MongoDB 的 GridFS 中的所有知识库文件迁移到 S3 中,包含文本数据集和图片数据集,但不包括文档(如 .docx)里解析出来的图片。
## 🚀 新增内容
1. 知识库文件迁移至 S3(全部使用文件的地方均已迁移)。
2. 全局变量支持文件上传。
3. 表单输入节点支持密码、开关、时间点、时间范围、文件上传、对话模型选择。
4. 插件输入支持多选、时间点、时间范围、内部变量。
5. 系统插件,插件市场中会提示是否有新版本,并提供更新按键。
6. 工作流运行 QPM 限制。
## ⚙️ 优化
1. 工作流工具,文件上传输入 UX 优化。
2. 添加权限表校验中间件,增强权限表鲁棒性。
## 🐛 修复
1. 工作流调试预览窗口,重新渲染导致输入丢失。
2. S3 服务与主服务相同 Origin 的域名会导致对 S3 的文件请求 URL 被错误替换,产生 404 报错。
## 插件
1. 工具更新逻辑,提供一个计算的 version 值来判断更新
2. 微信公众号工具集:允许同时上传多篇文档到草稿箱
3. 修复工具缓存没有被正确刷新
4. 修复开发模式下刷新缓存导致静态文件重新上传
5. 修复修复上传 pkg 后图片没有被正确上传的问题
file: ./content/self-host/upgrading/4-14/4144.en.mdx
meta: {
"title": "V4.14.4 (Upgrade Script)",
"description": "FastGPT V4.14.4 Release Notes"
}
## Upgrade Guide
### 1. Update Images:
* Update FastGPT image tag: v4.14.4
* Update FastGPT commercial edition image tag: v4.14.4
* Update fastgpt-plugin image tag: v0.3.4
* mcp\_server: no update needed
* Sandbox: no update needed
* AIProxy: no update needed
### 2. Run the Upgrade Script
From any terminal, send an HTTP request. Replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your **FastGPT domain**.
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv4144' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
1. Migrates files uploaded via the Dataset/local API (left over from 4.14.3) to S3.
2. Recalculates feedback for all existing chats and adds flags for filtering. This function runs slowly and is executed asynchronously -- the API will not return a result. Check the logs for the message: `Migration feedback completed!`
## New Features
1. Tool calls now support configurable streaming output.
2. AI credit alert notifications.
3. Chat logs now display IP geolocation.
4. Chat logs now display the app version name (if the version is updated mid-conversation, it will reflect the latest version).
5. Chat logs support filtering by thumbs up/down, with quick navigation to liked/disliked records in the chat details.
6. Upload local files to knowledge base via API, now saved to S3. All legacy GridFS code has been removed.
7. New subscription plan logic.
8. Configurable file whitelist for chat file uploads.
9. S3 now supports pathStyle and region configuration.
10. Support for multi-tenant custom domain configuration via Sealos.
11. File input in workflow tool references now supports manual entry (previously only variable references were supported).
12. Network proxy support (HTTP\_PROXY, HTTPS\_PROXY).
## Improvements
1. Increased S3 file upload timeout to 5 minutes.
2. Question optimization now uses JinaAI's marginal utility formula to find the search term with the highest marginal gain.
3. User notifications now support both Chinese and English, with improved templates.
4. Knowledge base deletion now uses an asynchronous queue-based approach.
5. Improved error messages for invalid images in LLM requests.
6. Completions API in non-stream mode with detail=false now includes `reason_content` in the response.
7. Added detection for invalid S3 keys.
8. Deleting apps and knowledge bases now requires entering the name for confirmation.
9. Mongo slow operation logs now accurately print the collection name and operation details.
10. Share link custom authentication: the returned uid is now limited to 200 characters max (longer values affected file uploads).
## Bug Fixes
1. Loop node arrays no longer filter out empty content.
2. Workflow tools did not pass custom DataId, causing "no permission" errors when viewing knowledge base during test runs.
3. In Chat Agent tool configuration, non-required boolean and number types could not be confirmed directly.
4. Workbench cards were misaligned when names were too long.
5. Global variables passed via URL query parameters in share links were not loaded in the frontend UI.
6. CSV file detection failed on Windows.
7. Models that were not started could not be tested during model testing.
8. MCP headers with special content caused errors.
9. When referencing another Agent in a workflow, the UI was not updated after switching versions.
10. HTTP node used null instead of empty string for global variables with empty string values.
11. Condition node connections broke when the node was collapsed.
12. Single-select and multi-select variable options were not displayed during node debugging.
13. Publish channel documentation links pointed to incorrect locations.
14. Checkbox hover style was incorrect in disabled state.
15. Default huggingface.svg icon displayed incorrectly when model avatar was missing.
16. Log export end date was off by one day.
17. Form input frontend default values were not passed to the actual values.
18. max\_tokens parameter was not passed during tool calls.
19. Workflow condition node value type was not determined by combining the condition with the value.
20. Knowledge base data not using direct chunking mode had incorrect citation reader navigation order. The citation reader only loaded the same page.
## Plugin Updates
1. Added: GLM 4.6 and DeepSeek 3.2 series model presets.
2. Fixed: MinerU SaaS plugin could not select the VLM model version.
3. Fixed: WeChat Official Account plugin batch Markdown upload parameter passing issue.
4. Added: Tool to retrieve WeChat Official Account draft box list.
5. Improvement: Markdown-to-file now supports custom file names.
6. Fixed: Import cache issue preventing plugins from being updated.
file: ./content/self-host/upgrading/4-14/4144.mdx
meta: {
"title": "V4.14.4(升级脚本)",
"description": "FastGPT V4.14.4 更新说明"
}
## 更新指南
### 1. 更新镜像:
* 更新 FastGPT 镜像tag: v4.14.4
* 更新 FastGPT 商业版镜像tag: v4.14.4
* 更新 fastgpt-plugin 镜像 tag: v0.3.4
* mcp\_server 无需更新
* Sandbox 无需更新
* AIProxy 无需更新
### 2. 执行升级脚本
从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv4144' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
1. 将 4.14.3 中,遗留的 Dataset/local 接口上传的文件,也迁移到 S3 中。
2. 全量计算旧的 chat 中的反馈,增加 flags 值便于筛选。该函数执行较慢,所以放到异步执行,接口不会返回结果,请关注日志中是否打印:Migration feedback completed!
## 🚀 新增内容
1. 工具调用支持配置流输出
2. AI 积分告警通知。
3. 对话日志支持展示 IP 地址归属地。
4. 对话日志支持展示应用版本名(如果对话中途修改成最新版本,则会被修改成最新版本)
5. 对话日志支持按点赞点踩过滤,并在对话详情里可以快速定位到赞/踩的记录。
6. 通过 API 上传本地文件至知识库,保存至 S3。同时将旧版 Gridfs 代码全部移除。
7. 新版订阅套餐逻辑。
8. 支持配置对话文件白名单。
9. S3 支持 pathStyle 和 region 配置。
10. 支持通过 Sealos 来进行多租户自定义域名配置。
11. 工作流中引用工具时,文件输入支持手动填写(原本只支持变量引用)。
12. 支持网络代理(HTTP\_PROXY,HTTPS\_PROXY)
## ⚙️ 优化
1. 增加 S3 上传文件超时时长为 5 分钟。
2. 问题优化采用 JinaAI 的边际收益公式,获取最大边际收益的检索词。
3. 用户通知,支持中英文,以及优化模板。
4. 删除知识库采用队列异步删除模式。
5. LLM 请求时,图片无效报错提示。
6. completions 接口,非 stream 模式, detail=false 时,增加返回 reason\_content。
7. 增加对于无效的 S3 key 检测。
8. 删除应用和知识库时,强制要求输入名称校验。
9. Mongo 慢操作日志,可以准确打印集合名和操作内容。
10. 分享链接,自定义鉴权返回的 uid,强制要求长度小于 200(太长会影响文件上传)。
## 🐛 修复
1. 循环节点数组,取消过滤空内容。
2. 工作流工具,未传递自定义 DataId,导致测试运行时,查看知识库提示无权限。
3. 对话 Agent 工具配置中,非必填的布尔和数字类型无法直接确认。
4. 工作台卡片在名字过长时错位。
5. 分享链接中url query 中携带全局变量时,前端 UI 不会加载该值。
6. window 下判断 CSV 文件异常。
7. 模型测试时,如果模型未启动,会导致无法被测试。
8. MCP header 中带特殊内容时,会抛错。
9. 工作流引用其他 Agent 时,切换版本号后未及时更新 UI。
10. http 节点使用值为空字符串的全局变量时,值会被替换为 null。
11. 判断器节点折叠时,连线断开。
12. 节点调试时,单选和多选类型的变量无法展示选项。
13. 发布渠道文档链接定位错误。
14. Checkbox 在禁用状态时,hover 样式错误。
15. 模型头像缺失情况下,默认 huggingface.svg 图标显示错误。
16. 日志导出时,结束时间会多出一天。
17. 表单输入,前端默认值未传递到实体值。
18. 工具调用时,未传递 max\_tokens 参数。
19. 工作流判断器 value 值,未结合 condition 来综合获取数据类型。
20. 非直接分块模式的知识库数据,引用阅读器导航顺序异常。引用阅读器只会加载同一页。
## 插件
1. 新增 - GLM4.6 与 DS3.2 系列模型预设。
2. 修复 - MinerU SaaS 插件模型版本不能选择 vlm 的问题
3. 修复 - 微信公众号插件批量上传 markdown 参数传递问题
4. 新增 - 获取微信公众号草稿箱列表工具
5. 优化 - markdown 转文件支持自定义文件名
6. 修复 - import cache 导致的插件无法被更新的问题
file: ./content/self-host/upgrading/4-14/4145.en.mdx
meta: {
"title": "V4.14.5 (Environment Changes, Upgrade Script)",
"description": "FastGPT V4.14.5 Release Notes"
}
## Upgrade Guide
### 1. Update Storage Bucket Environment Variables
This version adds native support for OSS and COS in addition to MinIO, so the related environment variables need to be renamed. Below is the configuration for MinIO. For other providers, refer to [Object Storage Configuration](../../config/object-storage.en.mdx).
**New Variables**
```
STORAGE_VENDOR=minio
STORAGE_REGION=us-east-1
STORAGE_ACCESS_KEY_ID=minioadmin
STORAGE_SECRET_ACCESS_KEY=minioadmin
STORAGE_PUBLIC_BUCKET=fastgpt-public
STORAGE_PRIVATE_BUCKET=fastgpt-private
STORAGE_EXTERNAL_ENDPOINT=http://192.168.0.2:9000 # An address accessible by both the server and client. Can be a static host IP or domain name. Do not use 127.0.0.1 or localhost (containers cannot access loopback addresses).
STORAGE_S3_ENDPOINT=http://fastgpt-minio:9000 # protocol://domain(IP):port
```
**Remove Old Variables**
* S3\_EXTERNAL\_BASE\_URL
* S3\_ENDPOINT
* S3\_PORT
* S3\_USE\_SSL
* S3\_ACCESS\_KEY
* S3\_SECRET\_KEY
* S3\_PUBLIC\_BUCKET
* S3\_PRIVATE\_BUCKET
### 2. Update Images:
* Update FastGPT image tag: v4.14.5-fix
* Update FastGPT commercial edition image tag: v4.14.5
* Update fastgpt-plugin image tag: v0.4.0
* mcp\_server: no update needed
* Sandbox: no update needed
* AIProxy: no update needed
* Update mongo 5.x to version 5.0.32 to fix CVE-2025-14847. Simply change the image tag to `5.0.32`.
### 3. Run the Upgrade Script
From any terminal, send an HTTP request. Replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your **FastGPT domain**.
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv4145' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
1. Retries all failed S3 deletion tasks.
2. Adds the `showFullText` field to all share-type OutLink records.
3. Renames fields:
* showNodeStatus -> showRunningStatus
* responseDetail -> showCite
* showRawSource -> canDownloadSource
## New Features
1. Workflow canvas now includes a demo mode, with improved collapsed mode styling and reduced edge overlap.
2. Workflow now has a quick-jump button for nested apps.
3. Workflow export now supports choosing whether to filter sensitive information.
4. Chat record deletion is now soft-delete, with the ability to delete chat records from the log management page.
5. When updating an Agent/tool, the update timestamp is propagated to all parent directories so they appear at the top of the list.
6. Portal page now supports configuring visibility for individual app execution.
7. API endpoint to export chunks from a single knowledge base collection.
8. Upgraded Mongo 5.x to 5.0.32 to fix CVE-2025-14847.
9. Email configuration now supports configuring security mode and port number.
## Improvements
1. Optimized Redis key retrieval logic to prevent blocking when fetching a large number of keys.
2. Improved reconnection logic for MongoDB, Redis, and MQ.
3. Variable input fields can now be copied in disabled state.
4. LLM empty response detection now excludes content filter errors from being misidentified as no response.
5. Improved error messages for AI chat and tool calls with more raw data.
6. Increased file parsing API request size limit to 10MB.
7. Citation list below chat responses now only shows knowledge base content actually cited by the AI.
8. Updated MCP SDK version.
9. Optimized Chats table indexes: reduced redundancy and added conditional indexes.
## Bug Fixes
1. Critical: Workflow parallel merge could cause duplicate execution.
2. MCP tool creation with custom auth headers threw an error.
3. Fetching chat log list threw an error when user avatar was empty.
4. chatAgent showed question optimization as enabled in the frontend UI when it was actually disabled.
5. maxTokens field was not assigned when loading default models, causing empty model max response configuration.
6. S3 file cleanup queue was blocked due to network instability, preventing deletion tasks from executing.
7. Chat log API adapted for mongo 4.x syntax.
8. Variable update node incorrectly converted file URL string arrays to object arrays.
9. Multiple form input nodes sharing sessionStorage caused default values not to display.
10. Code execution node still used the old language for AI code generation after switching languages.
11. Multiple custom feedback nodes writing concurrently triggered database write conflicts.
12. Custom feedback nodes following interactive nodes failed to write.
## Plugin Updates
file: ./content/self-host/upgrading/4-14/4145.mdx
meta: {
"title": "V4.14.5(环境变量变更、升级脚本)",
"description": "FastGPT V4.14.5 更新说明"
}
## 更新指南
### 1. 修改存储桶环境变量
该版本除了支持 minio 以外,还增加支持了原生 OSS 和 COS, 所以需要修改相关环境变量修改成新的命名。下面是 Minio 的配置参数,其他厂商配置,可参考[对象存储配置问题](../../config/object-storage.mdx)
**新增变量**
```
STORAGE_VENDOR=minio
STORAGE_REGION=us-east-1
STORAGE_ACCESS_KEY_ID=minioadmin
STORAGE_SECRET_ACCESS_KEY=minioadmin
STORAGE_PUBLIC_BUCKET=fastgpt-public
STORAGE_PRIVATE_BUCKET=fastgpt-private
STORAGE_EXTERNAL_ENDPOINT=http://192.168.0.2:9000 # 一个服务器和客户端均可访问到存储桶的地址,可以是固定的宿主机 IP 或者域名,注意不要填写成 127.0.0.1 或者 localhost 等本地回环地址(因为容器里无法使用)
STORAGE_S3_ENDPOINT=http://fastgpt-minio:9000 # 协议://域名(IP):端口
```
**移除旧的变量**
* S3\_EXTERNAL\_BASE\_URL
* S3\_ENDPOINT
* S3\_PORT
* S3\_USE\_SSL
* S3\_ACCESS\_KEY
* S3\_SECRET\_KEY
* S3\_PUBLIC\_BUCKET
* S3\_PRIVATE\_BUCKET
### 2. 更新镜像:
* 更新 FastGPT 镜像tag: v4.14.5-fix
* 更新 FastGPT 商业版镜像tag: v4.14.5
* 更新 fastgpt-plugin 镜像 tag: v0.4.0
* mcp\_server 无需更新
* Sandbox 无需更新
* AIProxy 无需更新
* mongo 5.x 版本修改成 5.0.32 版本,解决 CVE-2025-14847 漏洞。直接修改镜像 tag 成 `5.0.32`。
### 3. 执行升级脚本
从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv4145' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
1. 重试所有失败的 S3 删除任务
2. 为所有 share 类型的 OutLink 记录添加 showFullText 字段
3. 重命名字段:
* showNodeStatus -> showRunningStatus
* responseDetail -> showCite
* showRawSource -> canDownloadSource
## 🚀 新增内容
1. 工作流画布增加演示模式,同时优化折叠模式样式,优化工作流线重叠问题。
2. 工作流增加嵌套应用快速跳转按钮。
3. 工作流导出支持选择过滤/不过滤敏感信息。
4. 对话记录使用侧改成软删除,增加从日志管理里删除对话记录。
5. 更新Agent/工具时,会更新其上层所有目录的更新时间,以便其会排在列表前面。
6. 门户页支持配置单个应用运行可见度。
7. 导出单个知识库集合分块接口。
8. 升级 Mongo5.x 至 5.0.32 解决CVE-2025-14847。
9. 邮箱配置,支持配置安全模式以及端口号。
## ⚙️ 优化
1. 优化获取 redis 所有 key 的逻辑,避免大量获取时导致阻塞。
2. MongoDB, Redis 和 MQ 的重连逻辑优化。
3. 变量输入框禁用状态可复制。
4. LLM 请求空响应判断,排除敏感过滤错误被误认为无响应。
5. 完善 AI 对话和工具调用的错误提示,提供更多原始数据。
6. 增大文件解析接口的请求大小限制为 10MB。
7. 对话回复下方的引用列表,仅显示 AI 实际引用的知识库内容。
8. 更新 MCP SDK 版本。
9. Chats 表索引,减少冗余,增加条件索引。
## 🐛 修复
1. 重要 - 工作流并行合并后,可能导致重复运行问题。
2. MCP 工具创建时,使用自定义鉴权头会报错。
3. 获取对话日志列表时,如果用户头像为空,会抛错。
4. chatAgent 未开启问题优化时,前端 UI 显示开启。
5. 加载默认模型时,maxTokens 字段未赋值,导致模型最大响应值配置为空。
6. S3 文件清理队列因网络稳定问题出现阻塞,导致删除任务不再执行。
7. 对话日志接口适配 mongo4.x 语法。
8. 变量更新节点将文件 URL 字符串数组错误转换为对象数组。
9. 多个表单输入节点共享 sessionStorage 导致默认值不显示。
10. 代码运行节点切换语言后,AI 仍使用旧语言生成代码。
11. 多个自定义反馈节点并发写入触发数据库写入冲突。
12. 交互节点后续的自定义反馈节点写入失败。
## 插件
file: ./content/self-host/upgrading/4-14/41451.en.mdx
meta: {
"title": "V4.14.5.1 (Upgrade Script)",
"description": "FastGPT V4.14.5.1 Release Notes"
}
## Upgrade Guide
### 1. Update Images:
* Update FastGPT image tag: v4.14.5.1
* Update FastGPT commercial edition image tag: v4.14.5.1
* Update fastgpt-plugin image tag: v0.4.0
* mcp\_server: no update needed
* Sandbox: no update needed
* AIProxy: no update needed
* mongo: no update needed
### 2. Run the Upgrade Script
From any terminal, send an HTTP request. Replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your **FastGPT domain**.
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv41451' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
1. Migrates system secret key configuration for system tools.
## New Features
1. Markdown tables now support CSV export.
## Improvements
1. Workflow trackpad scrolling is no longer blocked when encountering input fields.
2. Workflow node paste now positions precisely at the mouse cursor.
3. Precisely removes extraneous system fields from LLM requests to prevent errors with certain model APIs.
4. Uses path.extname to extract file extensions from URLs.
## Bug Fixes
1. After setting system secret keys for a system toolset, child tools could not read the configured secret keys.
2. Password-type global variables had incorrect required field validation.
3. Time-type global variable month picker was obscured.
4. Line breaks were lost in the manual copy dialog.
5. Chat API threw an error when file upload type variables were not provided.
file: ./content/self-host/upgrading/4-14/41451.mdx
meta: {
"title": "V4.14.5.1(升级脚本)",
"description": "FastGPT V4.14.5.1 更新说明"
}
## 更新指南
### 1. 更新镜像:
* 更新 FastGPT 镜像tag: v4.14.5.1
* 更新 FastGPT 商业版镜像tag: v4.14.5.1
* 更新 fastgpt-plugin 镜像 tag: v0.4.0
* mcp\_server 无需更新
* Sandbox 无需更新
* AIProxy 无需更新
* mongo 无需更新
### 2. 执行升级脚本
从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv41451' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
1. 迁移系统工具的系统密钥配置
## 🚀 新增内容
1. Markdown 表格支持导出 csv。
## ⚙️ 优化
1. 工作流触摸板移动时,遇到输入框后会被强制阻拦。
2. 工作流粘贴节点,精确按鼠标位置粘贴。
3. 精确移除请求 LLM 时多余的系统字段,避免部分模型接口报错。
4. 使用 path.extname 从 URL 获取文件扩展名
## 🐛 修复
1. 系统工具工具集设置系统密钥后,子工具无法读取到设置的系统密钥
2. 密码类型的全局变量,必填规则校验错误。
3. 时间类型的全局变量,选择月份被遮挡。
4. 手动复制弹窗,换行丢失。
5. 未传入文件上传类型变量,对话接口报错。
file: ./content/self-host/upgrading/4-14/4146.en.mdx
meta: {
"title": "V4.14.6",
"description": "FastGPT V4.14.6 Release Notes"
}
## Upgrade Guide
### 1. Update Images:
* Update FastGPT image tag: v4.14.6.1
* Update FastGPT commercial edition image tag: v4.14.6
* Update fastgpt-plugin image tag: v0.5.2
* mcp\_server: no update needed
* sandbox: no update needed
* AIProxy: no update needed
* mongo: no update needed
### 2. Update System Plugins
Go to the Plugin Marketplace and update the following system tools (skip this step if you already upgraded to 4.14.6):
* base64Decode: Base64 decode conversion
* dallle3: DALL-E 3 image generation
* docDiff: Document diff comparison
* drawing: BI charts
* gptImage: GPT image generation
* markdownTransform: Markdown file conversion
* mineru: MinerU PDF parsing
* minimax: MiniMax chat
* openrouterMultiModal: OpenRouter multimodal
* stability: Stability image generation
## New Features
1. System tools now support configurable custom category attributes.
2. Subscription plans now support configuring maximum file upload count and size.
3. Plugin Marketplace supports batch plugin updates.
4. Cloud service supports dedicated WeCom integration.
5. Seekdb vector database preset configuration.
## Improvements
### Feature Improvements
1. Workflow trackpad scrolling is no longer blocked when encountering input fields.
2. Workflow node paste now positions precisely at the mouse cursor.
3. Precisely removes extraneous system fields from LLM requests to prevent errors with certain model APIs.
### Code Quality
1. Replaced useRequest with useRequest2 to reduce unused code.
## Bug Fixes
1. After setting system secret keys for a system toolset, child tools could not read the configured secret keys.
2. Date picker overflow issue resolved with dynamic position adaptation.
3. "Explore More" link for system tools on the workflow editor page pointed to the wrong URL.
4. Default model avatar path /imgs/model/huggingface.svg was incorrect.
5. Empty values are now filtered out when setting tool tags.
## Plugin Updates
1. Added tutorial documentation for Lark Multidimensional Table.
2. WeCom-related plugins: Get WeCom enterprise access\_token; WeCom smart table toolset.
3. Added model preset for qwen-flash.
4. Adjusted preset parameters for qwen3-max and qwen-plus.
file: ./content/self-host/upgrading/4-14/4146.mdx
meta: {
"title": "V4.14.6",
"description": "FastGPT V4.14.6 更新说明"
}
## 更新指南
### 1. 更新镜像:
* 更新 FastGPT 镜像 tag: v4.14.6.1
* 更新 FastGPT 商业版镜像 tag: v4.14.6
* 更新 fastgpt-plugin 镜像 tag: v0.5.2
* mcp\_server 无需更新
* sandbox 无需更新
* AIProxy 无需更新
* mongo 无需更新
### 2. 更新系统插件
前往插件市场更新以下几个系统工具(如果 4.14.6 升级了,这里可以跳过)
* base64Decode:base64 解码转化
* dallle3: dall-e 3 图片生成
* docDiff: 文档差异对比
* drawing: BI图表
* gptImage: gpt 图片生成
* markdownTransform: markdown 转换文件
* mineru: Mineru pdf解析
* minimax: minimax 对话
* openrouterMultiModal: openrouter 多模态
* stability: stability 图片生成
## 🚀 新增内容
1. 系统工具可配置自定义的分类属性。
2. 订阅套餐支持配置最大文件上传数量和大小。
3. 插件市场支持批量更新插件。
4. 云服务支持企微特定版接入。
5. Seekdb 向量库预设配置。
## ⚙️ 优化
### 功能优化
1. 工作流触摸板移动时,遇到输入框后会被强制阻拦。
2. 工作流粘贴节点,精确按鼠标位置粘贴。
3. 精确移除请求 LLM 时多余的系统字段,避免部分模型接口报错。
### 代码质量
1. useRequest2 替代 useRequest。减少无用代码。
## 🐛 修复
1. 系统工具工具集设置系统密钥后,子工具无法读取到设置的系统密钥
2. 日期选择器溢出问题,增加了动态位置适配。
3. 工作流编排页面系统工具“探索更多”跳转地址错误
4. 模型头像缺省值 /imgs/model/huggingface.svg 路径错误
5. 设置工具标签时过滤多余的空值
## 插件
1. 添加飞书多维表格的引导教程文档
2. 企微相关的插件:获取企微企业 access\_token; 企微智能表工具集
3. 新增模型 qwen-flash
4. 调整 qwen3-max 和 qwen-plus 的预设参数
file: ./content/self-host/upgrading/4-14/4147.en.mdx
meta: {
"title": "V4.14.7 (Environment Changes, Upgrade Script)",
"description": "FastGPT V4.14.7 Release Notes"
}
## Upgrade Guide
### 1. Update Images
* Update FastGPT image tag: v4.14.7.2
* Update FastGPT commercial edition image tag: v4.14.7.1
* Update fastgpt-plugin image tag: v0.5.4
* mcp\_server: no update needed (4.14.7 image is not available; use the previous version)
* sandbox: no update needed
* Update AIProxy image tag: 0.3.15
* mongo: no update needed
### 2. Update System Environment Variables
The logging system has been updated, including log output, log collection, and log analysis.
```dotenv
# Remove these environment variables
LOG_LEVEL=
STORE_LOG_LEVEL=
SIGNOZ_BASE_URL=
SIGNOZ_SERVICE_NAME=
SIGNOZ_STORE_LEVEL=
# Add the following 6 variables (same variables for fastgpt, fastgpt-pro, fastgpt-plugin, and fastgpt-mcp-server)
LOG_ENABLE_CONSOLE=true # Enable console output
LOG_CONSOLE_LEVEL=debug # Minimum log level for console output
LOG_ENABLE_OTEL=false # Enable OTEL log collection
LOG_OTEL_LEVEL=info # Minimum log level for OTEL collection
LOG_OTEL_SERVICE_NAME=fastgpt-client # Service name passed to the OTLP collector
LOG_OTEL_URL=http://localhost:4318/v1/logs # Your OTLP collector URL. Do not omit /v1/logs
```
### 3. Update System Plugins
Go to the Plugin Marketplace and update the following system tools (skip this step if you already upgraded to 4.14.6). You can also directly download the [zip package](https://github.com/labring/fastgpt-plugin/raw/refs/heads/main/.github/assets/upgrade_pkg.zip) and install it.
* base64Decode: Base64 decode conversion
* dallle3: DALL-E 3 image generation
* docDiff: Document diff comparison
* drawing: BI charts
* gptImage: GPT image generation
* markdownTransform: Markdown file conversion
* mineru: MinerU PDF parsing
* minimax: MiniMax chat
* openrouterMultiModal: OpenRouter multimodal
* stability: Stability image generation
### 4. Run the Upgrade Script
From any terminal, send an HTTP request. Replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your **FastGPT domain**.
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv4147' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
1. Adds chat log records containing errors to the statistics table.
### 5. API Changes
In the new version's chat records, the `type` field has been removed from the value. `/api/core/chat/getPaginationRecords` has temporary backward compatibility, but users of this API should update their value parsing logic as soon as possible -- simply check whether fields like `text`, `tools`, etc. exist.
## New Features
1. Context-engineering-based Agent mode, suitable for long task decomposition scenarios. (Beta)
2. Temporarily added LLM request tracing for debugging. All LLM request bodies and responses are retained (default retention: 6 hours, configurable via `LLM_REQUEST_TRACKING_RETENTION_HOURS`).
3. Knowledge base search now supports filtering by collectionIds.
4. Model monitoring now includes cache hit rate.
5. Share link with custom authentication: the finish event now transmits chatId.
6. Chat log list now includes an error-only filter option.
7. Chat log list now supports precise user filtering.
8. Dependency pre-check: validates infrastructure and sub-service availability at startup for easier troubleshooting.
9. MCP service parsing now supports `$ref` syntax in schemas.
10. Rebuilt the logging system using [LogTape](https://logtape.org/), covering log output, collection, and analysis. Mongo-based log storage has been removed -- use an OTEL collector instead.
## Improvements
1. Improved UX for tool selection and knowledge base selection in Chat Agent.
2. MCP now automatically filters out extraneous fields on save to maintain mongo 4.x compatibility.
3. Backend automatically filters out unconfigured tools to prevent model errors from calling unconfigured tools. Uses the same filter function to ensure frontend-backend consistency.
4. Added memory selection for workflow AI models in chat log mode.
5. Tool calls now auto-fill empty arguments with `"{}"` to prevent errors from providers that don't support empty strings.
6. Adapted for Kimi 2.5 tool calls in thinking mode.
7. Improved internal network domain validation.
8. Orphaned edges are removed before workflow execution.
9. When calling workflows via API with file links, the file type is now saved directly from the input instead of being inferred from the URL, ensuring 100% correct file types.
## Bug Fixes
1. Some global variable types had incorrect defaultValueType assignments in workflows.
2. Workflow AI node thinking output was not rendered correctly.
3. Precisely retrieves permissions for individual MCP sub-tools to prevent unauthorized access.
4. Toolset ToolName starting with a number caused tool call failures.
5. Converting a simple app to a workflow did not duplicate the avatar.
6. When importing workflows, reference-type model fields were incorrectly identified as invalid models and cleared.
7. On iPhone Safari, share links had a chance of triggering requests with an empty uid on first visit.
8. MCP could not pass file links when exposing an Agent.
9. Creating an HTTP tool with variables in the body caused JSON parsing errors.
10. Workflow canvas auto-positioning stopped working after switching tabs.
11. When a workflow node encountered an uncaught system error, it did not correctly follow the error capture branch.
## Plugin Updates
1. Added user info retrieval tool.
2. Added Kimi 2.5 model preset.
## Code Quality
1. Added vector database integration tests.
2. Improved packages/global unit test coverage to 90+.
file: ./content/self-host/upgrading/4-14/4147.mdx
meta: {
"title": "V4.14.7(环境变量变更、升级脚本)",
"description": "FastGPT V4.14.7 更新说明"
}
## 更新指南
### 1. 更新镜像
* 更新 FastGPT 镜像 tag: v4.14.7.2
* 更新 FastGPT 商业版镜像 tag: v4.14.7.1
* 更新 fastgpt-plugin 镜像 tag: v0.5.4
* mcp\_server 无需更新(4.14.7 镜像不可用,可用旧的)
* sandbox 无需更新
* 更新 AIProxy 镜像 tag: 0.3.15
* mongo 无需更新
### 2. 更新系统环境变量
更新了日志系统,包括但不限于日志打印、日志采集和日志分析等。
```dotenv
# 移除环境变量
LOG_LEVEL=
STORE_LOG_LEVEL=
SIGNOZ_BASE_URL=
SIGNOZ_SERVICE_NAME=
SIGNOZ_STORE_LEVEL=
# 新增以下 6 个变量(fastgpt,fastgpt-pro,fastgpt-plugin,fastgpt-mcp-server均为相同变量)
LOG_ENABLE_CONSOLE=true # 是否开启控制台打印
LOG_CONSOLE_LEVEL=debug # 控制台打印最低日志等级
LOG_ENABLE_OTEL=false # 是否开启 OTEL 日志收集
LOG_OTEL_LEVEL=info # OTEL 日志收集的最低日志等级
LOG_OTEL_SERVICE_NAME=fastgpt-client # 传递给 OTLP 收集器的服务名称
LOG_OTEL_URL=http://localhost:4318/v1/logs # 你的 OTLP 收集器的地址,不要把 /v1/logs 遗漏了
```
### 3. 更新系统插件
前往插件市场更新以下几个系统工具(如果 4.14.6 升级了,这里可以跳过)。可以直接下载[zip 包](https://github.com/labring/fastgpt-plugin/raw/refs/heads/main/.github/assets/upgrade_pkg.zip)直接安装。
* base64Decode:base64 解码转化
* dallle3: dall-e 3 图片生成
* docDiff: 文档差异对比
* drawing: BI图表
* gptImage: gpt 图片生成
* markdownTransform: markdown 转换文件
* mineru: Mineru pdf解析
* minimax: minimax 对话
* openrouterMultiModal: openrouter 多模态
* stability: stability 图片生成
### 4. 执行升级脚本
从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv4147' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
1. 会将对话日志中,含错误的记录添加到统计表里。
### 5. 接口更新
在新版本的对话记录中,value 值的 type 已被移除,`/api/core/chat/getPaginationRecords`暂时做了适配,请使用该 API 的用户尽快调整 value 解析方案,直接判断 `text`,`tools`等字段是否存在即可。
## 🚀 新增内容
1. 基于上下文工程的 Agent 模式,适合长任务拆解的场景。(测试版)
2. 临时增加 LLM 请求追踪,方便调试。会保留所有 LLM 的请求体和响应(默认保留 6 小时,通过 `LLM_REQUEST_TRACKING_RETENTION_HOURS` 变量调整)
3. 知识库搜索,支持指定 collectionIds 来进行筛选。
4. 模型监控增加缓存命中率。
5. 分享链接,自定义鉴权模式下,finish 事件会传输 chatId。
6. 对话日志列表,增加仅看错误日志过滤选项。
7. 对话日志列表,精准的过滤使用者。
8. 依赖预检查,启动项目时进行infra/子服务有效性检测,便于准确定位不可用的服务。
9. MCP 服务解析时,支持解析 schema 中的 $ref 语法。
10. 使用 [LogTape](https://logtape.org/) 重构了日志系统,包括但不限于日志打印、日志采集和日志分析等。同时移除了 mongo 的日志存储,可使用 OTEL 收集器进行收集。
## ⚙️ 优化
1. Chat Agent 中工具选择和知识库选择 UX。
2. MCP 保存时,自动过滤掉多余的字段,避免 mongo4.x 不兼容。
3. 后端自动过滤掉未配置的工具,避免模型调用未配置的工具导致报错。采用相同的过滤函数,保证前后端逻辑一致性。
4. 增加对话日志模式,工作流 AI 模型的记忆选择。
5. 工具调用时,自动补充空的 arguments 成 "{}",避免部分模型服务商不支持空字符串导致报错。
6. 适配 kimi2.5 思考模式下工具调用。
7. 内网域名检查方式。
8. 工作流运行前,去除孤立的边。
9. 通过 API 调用工作流,传入文件链接时,不再采用根据链接推测类型的方式,直接保存输入的 type,确保文件类型 100% 正确。
## 🐛 修复
1. 工作流全局变量中,部分类型赋值错误的 defaultValueType。
2. 工作流 AI 节点,思考输出值未正常渲染。
3. 精确获取 MCP 单个子工具的权限,避免越权调用。
4. 工具集 ToolName 避免数字开头导致工具调用失败。
5. 简易应用转工作流,未复制一份头像。
6. 导入工作流时,引用类型的模型字段被误判为无效模型而清空。
7. Iphone safari 浏览器下,分享链接首次进入有概率触发 uid 为空的请求。
8. MCP 暴露 Agent 时,无法传入文件链接。
9. 创建 http 工具时,body 包含变量会报错 JSON 解析错误。
10. 工作流切换 Tab 后画布自动定位失效。
11. 工作流节点出现系统未捕获的错误时,未正确走报错捕获分支。
## 插件
1. 新增获取用户信息工具。
2. 增加 kimi2.5 模型预设。
## 代码质量
1. 增加向量数据库集成测试。
2. 完善 packages/global 单元测试,提高覆盖到 90+。
file: ./content/self-host/upgrading/4-14/4148.en.mdx
meta: {
"title": "V4.14.8 (Environment Changes)",
"description": "FastGPT V4.14.8 Release Notes"
}
## Upgrade Guide
### Update Images
* FastGPT image tag: v4.14.8
* FastGPT commercial image tag: v4.14.8
* fastgpt-plugin image tag: no update needed
* mcp\_server: no update needed
* sandbox image tag: v4.14.8
* AIProxy: no update needed
* mongo: no update needed
## 🚀 New Features
1. Upgraded Next.js to version 16 with rspack for local development, delivering 3–5× faster local development performance.
2. Refactored the code sandbox with a unified isolation model, adding support for network requests and built-in dependency packages.
## ⚙️ Improvements
1. MCP JSON Schema `type` fields no longer need to be restricted to enum values.
2. Updated the variable reference label in Knowledge Base search to use clearer, more intuitive wording.
## 🐛 Bug Fixes
1. New SDK compatibility: fixed errors caused by multiple connections when calling the same MCP service consecutively.
2. Fixed incorrect ordering of text and tool outputs after saving when both are produced simultaneously.
3. Fixed variable update logic where `$1` in input values was incorrectly replaced by a regex capture group.
4. API Knowledge Base now returns the `title` of the uploaded file in the response; if no `title` was provided, the field is omitted.
file: ./content/self-host/upgrading/4-14/4148.mdx
meta: {
"title": "V4.14.8(环境变量变更)",
"description": "FastGPT V4.14.8 更新说明"
}
## 更新指南
### 环境变量更新
fastgpt-sandbox 支持配置安全凭证(可选)
```bash
# fastgpt-sandbox 增加凭证
SANDBOX_TOKEN=
# 对应的 fastgpt 和fastgpt-pro也需要增加环境变量
SANDBOX_TOKEN=
```
### 更新镜像
* 更新 FastGPT 镜像 tag: v4.14.8
* 更新 FastGPT 商业版镜像 tag: v4.14.8
* 更新 fastgpt-plugin 镜像 tag: 无需更新
* mcp\_server 无需更新
* 更新 sandbox 镜像 tag: v4.14.8
* AIProxy 无需更新
## 🚀 新增内容
1. Next.js 版本升级到 16, 本地开发使用 rspacak,本地开发性能提高 3\~5 倍。
2. 重构代码沙盒,统一隔离方案,支持网络请求以及内置依赖包。
## ⚙️ 优化
1. 兼容 MCP 中 JSON Schema type 类型不在枚举类型里。
2. 知识库搜索 变量引用文案修改为更直观的描述。
## 🐛 修复
1. 新 SDK 兼容:连续调用同一个 MCP 服务时,多次连接导致报错。
2. 文本与工具同时输出时,保存后顺序异常。
3. 变量更新逻辑,如果输入中有 `$1` 会被替换为捕获组。
4. API 知识库返回值返回传入的文件 title,若没有传入 title 则不返回内容。
file: ./content/self-host/upgrading/4-14/41481.en.mdx
meta: {
"title": "V4.14.8.1",
"description": "FastGPT V4.14.8.1 Update Notes"
}
## Update Guide
### Update Images
* Update FastGPT image tag: v4.14.8.1
* Update FastGPT commercial image tag: v4.14.8.1
* Update fastgpt-plugin image tag: No update required
* mcp\_server: No update required
* Update sandbox image tag: v4.14.8
* AIProxy: No update required
* mongo: No update required
## 🚀 New Features
## ⚙️ Improvements
## 🐛 Bug Fixes
1. Fixed an issue where the version list of agent tools could not be retrieved in the workflow orchestration.
file: ./content/self-host/upgrading/4-14/41481.mdx
meta: {
"title": "V4.14.8.1",
"description": "FastGPT V4.14.8.1 更新说明"
}
## 更新指南
### 更新镜像
* 更新 FastGPT 镜像 tag: v4.14.8.1
* 更新 FastGPT 商业版镜像 tag: v4.14.8.1
* 更新 fastgpt-plugin 镜像 tag: 无需更新
* mcp\_server 无需更新
* 更新 sandbox 镜像 tag: v4.14.8
* AIProxy 无需更新
* mongo 无需更新
## 🚀 新增内容
## ⚙️ 优化
1. api文件库接口返回 title 值 fallback 为 url
## 🐛 修复
1. 修复工作流编排中获取不到 agent 工具的版本列表的问题。
file: ./content/self-host/upgrading/4-14/4149.en.mdx
meta: {
"title": "V4.14.9 (Environment Changes)",
"description": "FastGPT V4.14.9 Release Notes"
}
## Upgrade Guide
### 1. Environment Variable Updates
1. Rename the following FastGPT environment variables — `SANDBOX_URL` and `SANDBOX_TOKEN` are now `CODE_SANDBOX_URL` and `CODE_SANDBOX_TOKEN`:
```bash
# Old
SANDBOX_URL=
SANDBOX_TOKEN=
# New
CODE_SANDBOX_URL=
CODE_SANDBOX_TOKEN=
```
2. Internal-network security checks are now disabled by default. To re-enable them, set the environment variable `CHECK_INTERNAL_IP=true` (applies to fastgpt, fastgpt-pro, and fastgpt-sandbox).
### 2. Update Images
* FastGPT image tag: v4.14.9.1
* FastGPT Commercial Edition image tag: v4.14.9.1
* fastgpt-plugin image tag: v0.5.5
* mcp\_server — no update required
* sandbox image tag: v4.14.9.1
* AIProxy — no update required
## API Changes
The `/api/core/chat/getPaginationRecords` endpoint now returns a `useAgentSandbox: boolean` field indicating whether the AI sandbox tool was used in the current conversation turn. The `llmModuleAccount` and `historyPreviewLength` fields will be removed soon — please migrate away from them as soon as possible.
## New Features
1. Added AI Sandbox — attach a sandbox tool to the AI for richer operations. (Currently available on the cloud service only; a lightweight self-hosted deployment will ship in the next release.)
2. Publish channels now support WeChat personal accounts.
3. AgentV2 context now adapts to the paused state.
4. Introduced a logger SDK with Metrics tracking.
5. Updating a single Knowledge Base entry now also refreshes the collection's update timestamp.
6. Form file inputs now support opening files for preview.
## Improvements
1. API-based Knowledge Base sync now has additional fallback methods for retrieving file names.
2. Added SSRF protection to the HTTP tool.
3. Improved compatibility with more MCP JsonSchema fields — older versions could not handle mixed-type fields.
4. Optimized parts of the workflow runtime pool logic to reduce computational complexity.
5. Replaced DFS with Tarjan's SCC algorithm for edge grouping in the workflow runtime, resolving issues where complex cyclic workflows failed to run.
6. System toolsets no longer display a version number (since they have no selectable versions).
## Bug Fixes
1. When a workflow nested a plugin, plugin execution details were not properly preserved. Also cleaned up all tool-type prefixes.
2. Updating and saving an MCP toolset could prevent it from being called correctly (due to an incorrect toolId lookup).
3. The search box was missing from the API Knowledge Base file list.
4. Workflow variable values containing special characters (`$.`) caused incorrect value substitution.
5. Referencing an agent tool in a workflow caused a version retrieval error.
6. When switching from a model that supports certain parameters to one that does not, the unsupported parameters were not removed, causing model invocation failures.
7. Closing a shared link's display status caused AI responses in the chat history to render incorrectly.
8. Re-opening the preview dialog in workflow preview mode lost form input content.
9. Custom fields in subscription plans were not applied.
10. The login endpoint had an async session issue that produced error logs.
11. The condition evaluator was missing selectable conditions for the `arrayAny` type.
12. Video/audio custom file type workflows were missing file link variables at the start node.
13. User input messages were not escaped to Markdown format.
14. Fixed partial context concatenation errors in AgentV2.
## Code Improvements
1. Fixed a monorepo issue in Commercial Edition development where different React references required a full package reinstall.
file: ./content/self-host/upgrading/4-14/4149.mdx
meta: {
"title": "V4.14.9(环境变量变更)",
"description": "FastGPT V4.14.9 更新说明"
}
## 升级指南
### 1. 环境变量更新
1. 修改 FastGPT 环境变量:SANDBOX\_URL 和 SANDBOX\_TOKEN,改名成 CODE\_SANDBOX\_URL 和 CODE\_SANDBOX\_TOKEN:
```bash
# 旧的
SANDBOX_URL=代码运行沙盒的地址
SANDBOX_TOKEN=代码运行沙盒的凭证(可以为空,4.14.8 新增加了鉴权)
# 新的
CODE_SANDBOX_URL=代码运行沙盒的地址
CODE_SANDBOX_TOKEN=代码运行沙盒的凭证
```
2. 默认关闭内网安全检查,如需开启,需设置环境变量 `CHECK_INTERNAL_IP=true`(fastgpt,fastgpt-pro,fastgpt-sandbox 通用变量)
### 2. 更新镜像
* 更新 FastGPT 镜像 tag: v4.14.9.5
* 更新 FastGPT 商业版镜像 tag: v4.14.9.5
* 更新 fastgpt-plugin 镜像 tag: v0.5.5
* mcp\_server 无需更新
* 更新 sandbox 镜像 tag: v4.14.9.1
* AIProxy 无需更新
## 接口变更
`/api/core/chat/getPaginationRecords` 接口,增加返回 `useAgentSandbox:boolean` 字段,代表本轮对话,是否使用了虚拟机工具。即将移除 `llmModuleAccount` 和 `historyPreviewLength` 字段,如使用该字段,请尽快适配。
## 🚀 新增内容
1. 新增 AI 虚拟机功能,可以给 AI 挂载一个虚拟机工具进行更丰富的操作。(目前仅云服务开放使用,下个版本会推出轻量部署方案)
2. 发布渠道支持微信个人号。
3. AgentV2 上下文适配暂停态。
4. 封装 logger sdk。增加 Metrics 追踪。
5. 更新知识库单个数据时,同步更新 collection 更新时间。
6. 表单输入文件时,支持打开文件进行预览。
## ⚙️ 优化
1. API 知识库同步时,增加更多 fallback 获取文件名方式。
2. HTTP 工具,增加 SSRF 防御。
3. 兼容更多 MCP JsonSchema 字段,旧版无法适配混合类型字段。
4. 优化部分工作流运行池逻辑,减少计算复杂度
5. 调整工作流 runtime,用 Tarjan SCC 算法替代 DSC 进行 edges 分组,解决工作流复杂循环无法运行问题。
6. 系统工具集不显示版本(因为其无版本可选)。
## 🐛 修复
1. 工作流嵌套插件时,未成功保留插件运行详情。同时整理所有 tool 类型前缀。
2. 更新并保存 MCP toolset 后可能无法正常调用(由于 toolId 获取错误)。
3. API 知识库,文件列表搜索框丢失。
4. 工作流变量值,包含特殊值($.)的时候,导致值替换异常。
5. 工作流引用 agent 工具时,获取版本异常。
6. 不支持某些属性的参数的模型,从支持该参数的模型切换过来时,该模型未被去掉,导致模型调用失败。
7. 分享链接关闭状态显示后,会导致历史记录里的 AI 回复内容无法正常展示。
8. 修复工作流预览模式下,重新打开预览弹窗,会丢失表单输入内容。
9. 修复订阅套餐自定义字段未生效
10. login 接口,存在异步 session 问题,会出现报错日志。
11. 修复判断器 arrayAny 类型无判断条件可选
12. 修复视频音频自定义文件类型流程开始无文件链接变量
13. 用户输入框消息不转义成 Markdown 格式
14. 修复 AgentV2 部分上下文拼接错误。
15. login 接口安全风险。
16. 工作流工具未按预期连接到结束节点时,嵌套调用工作流工具会导致父工作流无法停止。
## 🛠️ 代码优化
1. 商业版开发时,monorepo 指向不同 react 导致需重装包。
file: ./content/guide/build/tools/system-plugins/upload_system_tool.en.mdx
meta: {
"title": "Upload System Tools Online",
"description": "FastGPT System Tool Online Upload Guide"
}
> Starting from FastGPT 4.14.0, system admins can upload and update system tools directly through the web interface for hot reloading.
## Permission Requirements
⚠️ **Important**: Only **root users** can use the online system tool upload feature.
* Make sure you are logged in with the `root` account
## Supported File Formats
* **File type**: `.pkg` files
* **File size**: Maximum 100 MB
* **File count**: Up to 15 files per upload
## Upload Steps
### 1. Access the Configuration Page

### 2. Prepare Tool Files
Before uploading, make sure your `.pkg` files are from the `dist/pkgs` folder, built by running `bun run build:pkg` in the fastgpt-plugin project.

### 3. Upload
1. Click the **"Import/Update"** button
2. In the dialog that appears, click the file selection area
3. Select your prepared `.pkg` tool files
4. After confirming the file details, click **"Confirm Import"**
### 4. Upload Process
* A success message will appear after the upload completes
* The page auto-refreshes and the new tools will appear in the tool list
## Features
### Tool Management
* **View tools**: All users can view installed system tools
* **Upload tools**: Only root users can upload new tools or update existing ones
* **Delete tools**: Only root users can delete uploaded tools
## FAQ
### Q: Can't see the "Import/Update" button
**Reason:** The current user is not a root user
**Solution:** Log in again with the root account
file: ./content/guide/build/tools/system-plugins/upload_system_tool.mdx
meta: {
"title": "如何在线上传系统工具",
"description": "FastGPT 系统工具在线上传指南"
}
> 从 FastGPT 4.14.0 版本开始,系统管理员可以通过 Web 界面直接上传和更新系统工具进行热更新
## 权限要求
⚠️ **重要提示**:只有 **root 用户** 才能使用在线上传系统工具功能。
* 确保您已使用 `root` 账户登录 FastGPT
## 支持的文件格式
* **文件类型**:`.pkg` 文件
* **文件大小**:最大 100 MB
* **文件数量**:每次最多上传 15 个文件
## 上传步骤
### 1. 进入配置页面

### 2. 准备工具文件
在上传之前,请确保您的 `.pkg` 文件是从 fastgpt-plugin 项目中通过 `bun run build:pkg` 命令打包后的 `dist/pkgs` 文件夹下得到的

### 3. 执行上传
1. 点击 **"导入/更新"** 按钮
2. 在弹出的对话框中,点击文件选择区域
3. 选择您准备好的 `.pkg` 工具文件
4. 确认文件信息无误后,点击 **"确认导入"**
### 4. 上传过程
* 上传成功后会显示成功提示
* 页面自动刷新,新工具会出现在工具列表中
## 功能特点
### 工具管理
* **查看工具**:所有用户都可以查看已安装的系统工具
* **上传工具**:仅 root 用户可以上传新工具或更新现有工具
* **删除工具**:仅 root 用户可以删除已上传的工具
## 常见问题
### Q: 无法看到"导入/更新"按钮
**原因:** 当前用户不是 root 用户
**解决方案:** 使用 root 账户重新登录
file: ./content/guide/build/workflow/nodes/ai_chat.en.mdx
meta: {
"title": "AI Chat",
"description": "FastGPT AI Chat node overview"
}
import { Alert } from '@/components/docs/Alert';
## Characteristics
* Can be added multiple times
* Trigger-based execution
* Core module

## Parameters
## AI Model
Configure available chat models via [config.json](../../../../self-host/config/model/intro.en.mdx)。
Click the AI model to configure its parameters.


For detailed parameter descriptions, see: [AI Parameter Configuration](../../general/ai_settings.en.mdx)
file: ./content/guide/build/workflow/nodes/ai_chat.mdx
meta: {
"title": "AI 对话",
"description": "FastGPT AI 对话模块介绍"
}
import { Alert } from '@/components/docs/Alert';
## 特点
* 可重复添加
* 触发执行
* 核心模块

## 参数说明
## AI模型
可以通过 [config.json](../../../../self-host/config/model/intro.mdx) 配置可选的对话模型。
点击AI模型后,可以配置模型的相关参数。


具体配置参数介绍可以参考: [AI参数配置说明](../../general/ai_settings.mdx)
file: ./content/guide/build/workflow/nodes/content_extract.en.mdx
meta: {
"title": "Text Content Extraction",
"description": "FastGPT Text Content Extraction node overview"
}
## Characteristics
* Can be added multiple times
* Requires manual configuration
* Trigger-based execution
* function\_call module
* Core module

## What It Does
Extracts structured data from text, typically used with the HTTP node for extended functionality. It can also perform direct extraction tasks such as translation.
## Parameters
### Extraction Requirement Description
Set a goal for the model describing what content needs to be extracted.
**Example 1**
> You are a lab appointment assistant. Extract the name, appointment time, and lab number from the conversation. Current time `{{cTime}}`
**Example 2**
> You are a Google search assistant. Extract search keywords from the conversation.
**Example 3**
> Translate my question directly into English without answering it.
### Chat History
Some chat history is usually needed for more complete extraction. For example, if the task requires a name, time, and lab name, the user might initially provide only the time and lab name. After being prompted for the missing info, the user provides their name. At that point, the previous record is needed to extract all 3 fields completely.
### Target Fields
Target fields correspond to extraction results. As shown above, each new field adds a corresponding output.
* **key**: Unique identifier for the field. Must not be duplicated.
* **Field description**: Describes what the field represents, e.g., name, time, search keyword, etc.
* **Required**: Whether the model is forced to extract this field. It may still return an empty string.
## Output
* **Complete extraction result**: A JSON string containing all extracted fields.
* **Target field extraction results**: All returned as string type.
file: ./content/guide/build/workflow/nodes/content_extract.mdx
meta: {
"title": "文本内容提取",
"description": "FastGPT 内容提取模块介绍"
}
## 特点
* 可重复添加
* 需要手动配置
* 触发执行
* function\_call 模块
* 核心模块

## 功能
从文本中提取结构化数据,通常是配合 HTTP 模块实现扩展。也可以做一些直接提取操作,例如:翻译。
## 参数说明
### 提取要求描述
顾名思义,给模型设置一个目标,需要提取哪些内容。
**示例 1**
> 你是实验室预约助手,从对话中提取出姓名,预约时间,实验室号。当前时间 `{{cTime}}`
**示例 2**
> 你是谷歌搜索助手,从对话中提取出搜索关键词
**示例 3**
> 将我的问题直接翻译成英文,不要回答问题
### 历史记录
通常需要一些历史记录,才能更完整的提取用户问题。例如上图中需要提供姓名、时间和实验室名,用户可能一开始只给了时间和实验室名,没有提供自己的姓名。再经过一轮缺失提示后,用户输入了姓名,此时需要结合上一次的记录才能完整的提取出 3 个内容。
### 目标字段
目标字段与提取的结果相对应,从上图可以看到,每增加一个字段,输出会增加一个对应的出口。
* **key**: 字段的唯一标识,不可重复!
* **字段描述**:描述该字段是关于什么的,例如:姓名、时间、搜索词等等。
* **必须**:是否强制模型提取该字段,可能提取出来是空字符串。
## 输出介绍
* **完整提取结果**: 一个 JSON 字符串,包含所有字段的提取结果。
* **目标字段提取结果**:类型均为字符串。
file: ./content/guide/build/workflow/nodes/coreferenceResolution.en.mdx
meta: {
"title": "Query Enhancement",
"description": "FastGPT Query Enhancement node overview and usage"
}
## Characteristics
* Can be added multiple times
* Has external input
* Trigger-based execution

## Background
In RAG, we perform embedding searches against the database based on the input query to find relevant content (Knowledge Base search).
During search -- especially in multi-turn conversations -- follow-up questions often fail to retrieve useful results. One reason is that Knowledge Base search only uses the "current" question. Consider this example:

When the user asks "What is the second point?", the system searches the Knowledge Base for exactly that phrase and finds nothing. The actual intended query is "What is the QA structure?". This is why we need a Query Enhancement node to refine the user's current question so the Knowledge Base search can return relevant results. With query enhancement applied:

## What It Does
Calls an AI model to complete and refine the user's current question. It primarily resolves coreferences (pronouns and vague references), making search queries more complete and reliable. This improves Knowledge Base search accuracy in multi-turn conversations.
The main challenge is that the model may not have a clear understanding of "completion" and often struggles to determine how to properly refine queries with long context.
file: ./content/guide/build/workflow/nodes/coreferenceResolution.mdx
meta: {
"title": "问题优化",
"description": "问题优化模块介绍和使用"
}
## 特点
* 可重复添加
* 有外部输入
* 触发执行

## 背景
在 RAG 中,我们需要根据输入的问题去数据库里执行 embedding 搜索,查找相关的内容,从而查找到相似的内容(简称知识库搜索)。
在搜索的过程中,尤其是连续对话的搜索,我们通常会发现后续的问题难以搜索到合适的内容,其中一个原因是知识库搜索只会使用“当前”的问题去执行。看下面的例子:

用户在提问“第二点是什么”的时候,只会去知识库里查找“第二点是什么”,压根查不到内容。实际上需要查询的是“QA 结构是什么”。因此我们需要引入一个【问题优化】模块,来对用户当前的问题进行补全,从而使得知识库搜索能够搜索到合适的内容。使用补全后效果如下:

## 功能
调用 AI 去对用户当前的问题进行补全。目前主要是补全“指代”词,使得检索词更加的完善可靠,从而增强上下文连续对话的知识库搜索能力。
遇到最大的难题在于:模型对于【补全】的概念可能不清晰,且对于长上下文往往无法准确的知道应该如何补全。
file: ./content/guide/build/workflow/nodes/custom_feedback.en.mdx
meta: {
"title": "Custom Feedback",
"description": "FastGPT Custom Feedback node overview"
}
This is a temporary module that will receive a more comprehensive redesign in the future.
## Characteristics
* Can be added multiple times
* No external input
* Auto-executed
| | |
| ------------------------------ | ------------------------------ |
|  |  |
|  |  |
## Overview
The Custom Feedback node adds a feedback tag to conversations, making it easier to analyze conversation data from the admin panel.
In debug mode, feedback content is not recorded. Instead it displays: `Auto feedback test: feedback content`.
In conversation mode (chat, shared window, or API calls with chatId), feedback content is recorded in the conversation log with a 60-second delay.
## Use Cases
The Custom Feedback node works like event tracking in software development, letting you observe and monitor data within conversations.
file: ./content/guide/build/workflow/nodes/custom_feedback.mdx
meta: {
"title": "自定义反馈",
"description": "自定义反馈模块介绍"
}
该模块为临时模块,后续会针对该模块进行更全面的设计。
## 特点
* 可重复添加
* 无外部输入
* 自动执行
| | |
| ------------------------------ | ------------------------------ |
|  |  |
|  |  |
## 介绍
自定义反馈模块,可以为你的对话增加一个反馈标记,从而方便在后台更好的分析对话的数据。
在调试模式下,不会记录反馈内容,而是直接提示: `自动反馈测试: 反馈内容`。
在对话模式(对话、分享窗口、带 chatId 的 API 调用)时,会将反馈内容记录到对话日志中。(会延迟60s记录)
## 作用
自定义反馈模块的功能类似于程序开发的`埋点`,便于你观测的对话中的数据。
file: ./content/guide/build/workflow/nodes/dataset_search.en.mdx
meta: {
"title": "Knowledge Base Search",
"description": "FastGPT Knowledge Base Search node overview"
}
For detailed parameters and internal logic, see: [FastGPT Knowledge Base Search](../../../dataset/rag.en.mdx)
## Characteristics
* Can be added multiple times (keeps connections tidy in complex workflows)
* Has external input
* Has static configuration
* Trigger-based execution
* Core module

## Parameters
### Input - Linked Knowledge Bases
Select one or more Knowledge Bases using the **same embedding model** for vector search.
### Input - Search Parameters
[View parameter details](../../../dataset/dataset_engine.en.mdx#搜索参数)
### Output - Referenced Content
Outputs references as an array with a possible length of 0. This means the output path will still execute even when no results are found.
file: ./content/guide/build/workflow/nodes/dataset_search.mdx
meta: {
"title": "知识库搜索",
"description": "FastGPT AI 知识库搜索模块介绍"
}
知识库搜索具体参数说明,以及内部逻辑请移步:[FastGPT知识库搜索方案](../../../dataset/rag.mdx)
## 特点
* 可重复添加(复杂编排时防止线太乱,可以更美观)
* 有外部输入
* 有静态配置
* 触发执行
* 核心模块

## 参数说明
### 输入 - 关联的知识库
可以选择一个或多个**相同向量模型**的知识库,用于向量搜索。
### 输入 - 搜索参数
[点击查看参数介绍](../../../dataset/dataset_engine.mdx#搜索参数)
### 输出 - 引用内容
以数组格式输出引用,长度可以为 0。意味着,即使没有搜索到内容,这个输出链路也会走通。
file: ./content/guide/build/workflow/nodes/document_parsing.en.mdx
meta: {
"title": "Document Parsing",
"description": "FastGPT Document Parsing node overview"
}
| | |
| --------------------------------- | --------------------------------- |
|  |  |
The Document Parsing component becomes available after enabling file upload.
## Features
## Use Cases
file: ./content/guide/build/workflow/nodes/document_parsing.mdx
meta: {
"title": "文档解析",
"description": "FastGPT 文档解析模块介绍"
}
| | |
| --------------------------------- | --------------------------------- |
|  |  |
开启文件上传后,可使用文档解析组件。
## 功能
## 作用
file: ./content/guide/build/workflow/nodes/form_input.en.mdx
meta: {
"title": "Form Input",
"description": "FastGPT Form Input node overview"
}
## Characteristics
* User interaction
* Can be added multiple times
* Trigger-based execution

## What It Does
The Form Input node is a user interaction node. When triggered, the conversation enters an "interactive" state -- the workflow state is saved and execution pauses until the user completes the interaction.

In the example above, when the Form Input node is triggered, the chat box is hidden and the conversation enters interactive mode.

After the user fills in the required fields and clicks submit, the node collects the form data and passes it to subsequent nodes.
## Use Cases
Precisely collect specific user information, then perform follow-up operations based on that data.
file: ./content/guide/build/workflow/nodes/form_input.mdx
meta: {
"title": "表单输入",
"description": "FastGPT 表单输入模块介绍"
}
## 特点
* 用户交互
* 可重复添加
* 触发执行

## 功能
「表单输入」节点属于用户交互节点,当触发这个节点时,对话会进入“交互”状态,会记录工作流的状态,等用户完成交互后,继续向下执行工作流

比如上图中的例子,当触发表单输入节点时,对话框隐藏,对话进入“交互状态”

当用户填完必填的信息并点击提交后,节点能够收集用户填写的表单信息,传递到后续的节点中使用
## 作用
能够精准收集需要的用户信息,再根据用户信息进行后续操作
file: ./content/guide/build/workflow/nodes/http.en.mdx
meta: {
"title": "HTTP Request",
"description": "FastGPT HTTP Request node overview"
}
import { Alert } from '@/components/docs/Alert';
## Characteristics
* Can be added multiple times
* Manual configuration
* Trigger-based execution
* Core of core modules

## Overview
The HTTP node sends an `HTTP` request to a specified URL. It works similarly to tools like Postman and ApiFox.
* Params are query parameters, commonly used in GET requests.
* Body is the request body, commonly used in POST/PUT requests.
* Headers are request headers for passing additional information.
* Custom variables can receive outputs from upstream nodes.
* All 3 data types support variable references via `{{}}`.
* The URL also supports `{{}}` variable references.
* Variables come from `global variables`, `system variables`, and `upstream node outputs`.
## Parameter Structure
### System Variables
Hover over the question mark next to `Request Parameters` to see available variables.
* appId: Application ID
* chatId: Current conversation ID (not available in test mode)
* responseChatItemId: Response message ID in the current conversation (not available in test mode)
* variables: Global variables for the current conversation
* cTime: Current time
* histories: Chat history (defaults to max 10 entries, length is not configurable)
### Params, Headers
Usage is the same as Postman and ApiFox.
Use `{{key}}` to reference variables. For example:
| key | value |
| ------------- | ------------------ |
| appId | `{{appId}}` |
| Authorization | Bearer `{{token}}` |
### Body
Only takes effect with certain request types.
Write a custom JSON body and use `{{key}}` to reference variables. For example:
```json
{
"string": "字符串",
"number": 123,
"boolean": true,
"array": [1, 2, 3],
"obj": {
"name": "FastGPT",
"url": "https://fastgpt.io"
}
}
```
When referencing a `string` in the Body, wrap it in quotes: `"{{string}}"`.
```json
{
"string": "{{string}}",
"token": "Bearer {{string}}",
"number": {{number}},
"boolean": {{boolean}},
"array": [{{number}}, "{{string}}"],
"array2": {{array}},
"object": {{obj}}
}
```
```json
{
"string": "字符串",
"token": "Bearer 字符串",
"number": 123,
"boolean": true,
"array": [123, "字符串"],
"array2": [1, 2, 3],
"object": {
"name": "FastGPT",
"url": "https://fastgpt.io"
}
}
```
### Extracting Return Values
As shown in the image, FastGPT lets you add multiple return values. These don't represent the raw API response -- they define `how to parse the API response`. You can use `JSON path` syntax to `extract` values from the response.
Syntax reference: [https://github.com/JSONPath-Plus/JSONPath?tab=readme-ov-file](https://github.com/JSONPath-Plus/JSONPath?tab=readme-ov-file)
```json
{
"message": "测试",
"data": {
"user": {
"name": "xxx",
"age": 12
},
"list": [
{
"name": "xxx",
"age": 50
},
[{ "test": 22 }]
],
"psw": "xxx"
}
}
```
```json
{
"$.message": "测试",
"$.data.user": { "name": "xxx", "age": 12 },
"$.data.user.name": "xxx",
"$.data.user.age": 12,
"$.data.list": [{ "name": "xxx", "age": 50 }, [{ "test": 22 }]],
"$.data.list[0]": { "name": "xxx", "age": 50 },
"$.data.list[0].name": "xxx",
"$.data.list[0].age": 50,
"$.data.list[1]": [{ "test": 22 }],
"$.data.list[1][0]": { "test": 22 },
"$.data.list[1][0].test": 22,
"$.data.psw": "xxx"
}
```
Configure the `key` to extract values from FastGPT's parsed format, following standard JavaScript object access rules. For example:
1. To get the `message` content, set the `key` to `message`.
2. To get the user's name, set the `key` to `data.user.name`.
3. To get the second element in the list, set the `key` to `data.list[1]`. If you select string as the output type, it will automatically return the JSON string `[ { "test": 22 } ]`.
### Auto-format Output
Starting from FastGPT v4.6.8, output formatting was added, primarily converting `JSON` to `string`. If you select `string` as the output type, the HTTP node will convert the corresponding key's value to a JSON string. This lets you pipe HTTP output directly into a `Text Processing` node, append appropriate prompts, and feed the result into `AI Chat`.
The HTTP node is extremely versatile. You can integrate public APIs to extend your workflow
capabilities.
## HTTP Service Integration Example
Here is a POST request service example:
```ts
type RequestType = {
appId: string;
appointment: string;
action: 'post' | 'delete' | 'put' | 'get';
};
export async function handleAppointmentRequest(body: RequestType) {
try {
const { appId, appointment, action } = body;
const parseBody = JSON.parse(appointment);
if (action === 'get') {
return await getRecord(appId, parseBody);
}
if (action === 'post') {
return await createRecord(appId, parseBody);
}
if (action === 'put') {
return await putRecord(appId, parseBody);
}
if (action === 'delete') {
return await removeRecord(appId, parseBody);
}
return {
response: 'Error'
};
} catch (err) {
return {
response: 'Error'
};
}
}
```
## Use Cases
The HTTP node enables unlimited extensibility, such as:
* Database operations
* External data source calls
* Web searches
* Sending emails
* ....
file: ./content/guide/build/workflow/nodes/http.mdx
meta: {
"title": "HTTP 请求",
"description": "FastGPT HTTP 模块介绍"
}
import { Alert } from '@/components/docs/Alert';
## 特点
* 可重复添加
* 手动配置
* 触发执行
* 核中核模块

## 介绍
HTTP 模块会向对应的地址发送一个 `HTTP` 请求,实际操作与 Postman 和 ApiFox 这类直流工具使用差不多。
* Params 为路径请求参数,GET 请求中用的居多。
* Body 为请求体,POST/PUT 请求中用的居多。
* Headers 为请求头,用于传递一些特殊的信息。
* 自定义变量中可以接收前方节点的输出作为变量
* 3 种数据中均可以通过 `{{}}` 来引用变量。
* URL 也可以通过 `{{}}` 来引用变量。
* 变量来自于 `全局变量`、`系统变量`、`前方节点输出`
## 参数结构
### 系统变量说明
你可以将鼠标放置在 `请求参数` 旁边的问号中,里面会提示你可用的变量。
* appId: 应用的 ID
* chatId: 当前对话的 ID,测试模式下不存在。
* responseChatItemId: 当前对话中,响应的消息 ID,测试模式下不存在。
* variables: 当前对话的全局变量。
* cTime: 当前时间。
* histories: 历史记录(默认最多取 10 条,无法修改长度)
### Params, Headers
不多描述,使用方法和 Postman, ApiFox 基本一致。
可通过 `{{key}}` 来引入变量。例如:
| key | value |
| ------------- | ------------------ |
| appId | `{{appId}}` |
| Authorization | Bearer `{{token}}` |
### Body
只有特定请求类型下会生效。
可以写一个 `自定义的 Json`,并通过 `{{key}}` 来引入变量。例如:
```json
{
"string": "字符串",
"number": 123,
"boolean": true,
"array": [1, 2, 3],
"obj": {
"name": "FastGPT",
"url": "https://fastgpt.io"
}
}
```
注意,在 Body 中,你如果引用 `字符串`,则需要加上 `""`,例如:`"{{string}}"`。
```json
{
"string": "{{string}}",
"token": "Bearer {{string}}",
"number": {{number}},
"boolean": {{boolean}},
"array": [{{number}}, "{{string}}"],
"array2": {{array}},
"object": {{obj}}
}
```
```json
{
"string": "字符串",
"token": "Bearer 字符串",
"number": 123,
"boolean": true,
"array": [123, "字符串"],
"array2": [1, 2, 3],
"object": {
"name": "FastGPT",
"url": "https://fastgpt.io"
}
}
```
### 如何获取返回值
从图中可以看出,FastGPT 可以添加多个返回值,这个返回值并不代表接口的返回值,而是代表 `如何解析接口返回值`,可以通过 `JSON path` 的语法,来 `提取` 接口响应的值。
语法可以参考: [https://github.com/JSONPath-Plus/JSONPath?tab=readme-ov-file](https://github.com/JSONPath-Plus/JSONPath?tab=readme-ov-file)
```json
{
"message": "测试",
"data": {
"user": {
"name": "xxx",
"age": 12
},
"list": [
{
"name": "xxx",
"age": 50
},
[{ "test": 22 }]
],
"psw": "xxx"
}
}
```
```json
{
"$.message": "测试",
"$.data.user": { "name": "xxx", "age": 12 },
"$.data.user.name": "xxx",
"$.data.user.age": 12,
"$.data.list": [{ "name": "xxx", "age": 50 }, [{ "test": 22 }]],
"$.data.list[0]": { "name": "xxx", "age": 50 },
"$.data.list[0].name": "xxx",
"$.data.list[0].age": 50,
"$.data.list[1]": [{ "test": 22 }],
"$.data.list[1][0]": { "test": 22 },
"$.data.list[1][0].test": 22,
"$.data.psw": "xxx"
}
```
你可以配置对应的 `key` 来从 `FastGPT 转化后的格式` 获取需要的值,该规则遵守 JS 的对象取值规则。例如:
1. 获取 `message` 的内容,那么你可以配置 `message` 的 `key` 为 `message`,这样就可以获取到 `message` 的内容。
2. 获取 `user的name`,则 `key` 可以为:`data.user.name`。
3. 获取 list 中第二个元素,则 `key` 可以为:`data.list[1]`,然后输出类型选择字符串,则获自动获取到 `[ { "test": 22 } ]` 的 `json` 字符串。
### 自动格式化输出
FastGPT v4.6.8 后,加入了出参格式化功能,主要以 `json` 格式化成 `字符串` 为主。如果你的输出类型选择了 `字符串`,则会将 `HTTP` 对应 `key` 的值,转成 `json` 字符串进行输出。因此,未来你可以直接从 `HTTP` 接口输出内容至 `文本加工` 中,然后拼接适当的提示词,最终输入给 `AI对话`。
HTTP 模块非常强大,你可以对接一些公开的 API,来提高编排的功能。
## HTTP 对接业务服务示例
下面是一个 POST 请求服务示例:
```ts
type RequestType = {
appId: string;
appointment: string;
action: 'post' | 'delete' | 'put' | 'get';
};
export async function handleAppointmentRequest(body: RequestType) {
try {
const { appId, appointment, action } = body;
const parseBody = JSON.parse(appointment);
if (action === 'get') {
return await getRecord(appId, parseBody);
}
if (action === 'post') {
return await createRecord(appId, parseBody);
}
if (action === 'put') {
return await putRecord(appId, parseBody);
}
if (action === 'delete') {
return await removeRecord(appId, parseBody);
}
return {
response: '异常'
};
} catch (err) {
return {
response: '异常'
};
}
}
```
## 作用
通过 HTTP 模块你可以无限扩展,比如:
* 操作数据库
* 调用外部数据源
* 执行联网搜索
* 发送邮箱
* ……
file: ./content/guide/build/workflow/nodes/knowledge_base_search_merge.en.mdx
meta: {
"title": "Knowledge Base Search Merge",
"description": "FastGPT Knowledge Base Search Merge node overview"
}

## What It Does
Merges search results from multiple Knowledge Bases into a single output, re-ranks them using RRF (Reciprocal Rank Fusion), and supports max token filtering.
## Usage
The AI Chat node can only accept one Knowledge Base reference input. If you call multiple Knowledge Bases, you cannot directly reference all of them (as shown below).

Use **Knowledge Base Search Merge** to combine results from multiple Knowledge Bases into one.

## Example Use Cases
1. After question classification, search different Knowledge Bases per category, then feed the merged results to a single AI Chat node. This avoids adding a separate AI Chat node to each branch.
file: ./content/guide/build/workflow/nodes/knowledge_base_search_merge.mdx
meta: {
"title": "知识库搜索引用合并",
"description": "FastGPT 知识库搜索引用合并模块介绍"
}

## 作用
将多个知识库搜索结果合并成一个结果进行输出,并会通过 RRF 进行重新排序(根据排名情况),并且支持最大 tokens 过滤。
## 使用方法
AI对话只能接收一个知识库引用内容。因此,如果调用了多个知识库,无法直接引用所有知识库(如下图)

使用**知识库搜索引用合并**,可以把多个知识库的搜索结果合在一起。

## 可用例子:
1. 经过问题分类后对不同知识库进行检索,然后统一给一个 AI 进行回答,此时可以用到合并,不需要每个分支都添加一个 AI 对话。
file: ./content/guide/build/workflow/nodes/loop.en.mdx
meta: {
"title": "Batch Processing",
"description": "FastGPT Batch Processing node overview and usage"
}
## Node Overview
The **Batch Processing** node was introduced in FastGPT V4.8.11. It allows workflows to iterate over array-type input data, processing one element at a time and automatically executing subsequent nodes until the entire array is processed.
This node is inspired by loop structures in programming languages, presented in a visual format.

> In programming terms, nodes are like functions or API endpoints -- each one is a **step**. By connecting multiple nodes together, you build a step-by-step process that produces the final AI output.
The **Batch Processing** node is essentially a function whose job is to automate repeated execution of a specific workflow.
## Core Features
1. **Array Batch Processing**
* Accepts array-type data input
* Automatically iterates through array elements
* Maintains processing order
* Supports parallel processing for performance optimization
2. **Automatic Iteration**
* Automatically triggers downstream nodes
* Supports conditional termination
* Supports loop counting
* Maintains execution context
3. **Works with Other Nodes**
* AI Chat nodes
* HTTP Request nodes
* Content Extraction nodes
* Conditional nodes
## Use Cases
The **Batch Processing** node extends workflow capabilities through automation, enabling FastGPT to handle batch tasks and complex data processing pipelines. It significantly improves efficiency when processing large-scale data or scenarios requiring multiple iterations.
The **Batch Processing** node is ideal for:
1. **Batch Data Processing**
* Batch text translation
* Batch document summarization
* Batch content generation
2. **Data Pipeline Processing**
* Analyzing search results one by one
* Processing Knowledge Base retrieval results individually
* Processing array data from HTTP responses item by item
3. **Recursive or Iterative Tasks**
* Long text segmented processing
* Multi-round content refinement
* Chained data processing
## Usage
### Input Parameters
The **Batch Processing** node requires two core inputs:
1. **Array (Required)**: An array-type input, which can be:
* String array (`Array`)
* Number array (`Array`)
* Boolean array (`Array`)
* Object array (`Array
)?(?=\\r? \\n\\r?\\n|$))` +
"|" +
// 11. HTML-like tags and their content (including self-closing tags and attributes, with length constraints)
`(?:<[a-zA-Z][^>]{0,${MAX_HTML_TAG_ATTRIBUTES_LENGTH}}(?:>[\\s\\S]{0,${MAX_HTML_TAG_CONTENT_LENGTH}}?[a-zA-Z]+>|\\s*/>))` +
"|" +
// 12. LaTeX-style math expressions (inline and block, with length constraints)
`(?:(?:\\$\\$[\\s\\S]{0,${MAX_MATH_BLOCK_LENGTH}}?\\$\\$)|(?:\\$[^\\$\\r\\n]{0,${MAX_MATH_INLINE_LENGTH}}\\$))` +
"|" +
// 14. Fallback for any remaining content (with length constraints)
`(?!${AVOID_AT_START})${SENTENCE_PATTERN.replace(/{MAX_LENGTH}/g, String(MAX_STANDALONE_LINE_LENGTH))}` +
")",
"gmu"
);
function main({text}){
const chunks = [];
let currentChunk = '';
const tokens = countToken(text)
const matches = text.match(regex);
if (matches) {
matches.forEach((match) => {
if (currentChunk.length + match.length <= 1000) {
currentChunk += match;
} else {
if (currentChunk) {
chunks.push(currentChunk);
}
currentChunk = match;
}
});
if (currentChunk) {
chunks.push(currentChunk);
}
}
return {chunks, tokens};
}
```
This uses [a powerful regex open-sourced by Jina AI](https://x.com/JinaAI_/status/1823756993108304135) that leverages all possible boundary clues and heuristics for precise text splitting.
2. Configure the Batch Processing node

* Array input: Select the `chunks` output from the previous Code Execution node.
* Add a Code Execution node inside the loop body to format the source text.
* Add a Search Glossary node to look up proper nouns from a terminology Knowledge Base before translation.
* Add an AI Chat node using CoT (Chain of Thought) to have the LLM explicitly generate a reasoning chain showing the complete translation thought process.
* Add a Code Execution node to extract the final translation result from the AI Chat node's last round.
* Add a Specified Reply node to output the translated text.
* Set the Loop Body End node's output variable to the `result` output from the Extract Translation Text node.
file: ./content/guide/build/workflow/nodes/loop.mdx
meta: {
"title": "批量运行",
"description": "FastGPT 批量运行节点介绍和使用"
}
## 节点概述
【**批量运行**】节点是 FastGPT V4.8.11 版本新增的一个重要功能模块。它允许工作流对数组类型的输入数据进行迭代处理,每次处理数组中的一个元素,并自动执行后续节点,直到完成整个数组的处理。
这个节点的设计灵感来自编程语言中的循环结构,但以可视化的方式呈现。

> 在程序中,节点可以理解为一个个 Function 或者接口。可以理解为它就是一个**步骤**。将多个节点一个个拼接起来,即可一步步的去实现最终的 AI 输出。
【**批量运行**】节点本质上也是一个 Function,它的主要职责是自动化地重复执行特定的工作流程。
## 核心特性
1. **数组批量处理**
* 支持输入数组类型数据
* 自动遍历数组元素
* 保持处理顺序
* 支持并行处理 (性能优化)
2. **自动迭代执行**
* 自动触发后续节点
* 支持条件终止
* 支持循环计数
* 维护执行上下文
3. **与其他节点协同**
* 支持与 AI 对话节点配合
* 支持与 HTTP 节点配合
* 支持与内容提取节点配合
* 支持与判断器节点配合
## 应用场景
【**批量运行**】节点的主要作用是通过自动化的方式扩展工作流的处理能力,使 FastGPT 能够更好地处理批量任务和复杂的数据处理流程。特别是在处理大规模数据或需要多轮迭代的场景下,批量运行节点能显著提升工作流的效率和自动化程度。
【**批量运行**】节点特别适合以下场景:
1. **批量数据处理**
* 批量翻译文本
* 批量总结文档
* 批量生成内容
2. **数据流水线处理**
* 对搜索结果逐条分析
* 对知识库检索结果逐条处理
* 对 HTTP 请求返回的数组数据逐项处理
3. **递归或迭代任务**
* 长文本分段处理
* 多轮优化内容
* 链式数据处理
## 使用方法
### 输入参数设置
【**批量运行**】节点需要配置两个核心输入参数:
1. **数组 (必填)**:接收一个数组类型的输入,可以是:
* 字符串数组 (`Array`)
* 数字数组 (`Array`)
* 布尔数组 (`Array`)
* 对象数组 (`Array