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/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-14/41930](/en/self-host/upgrading/4-14/41930) * [/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-15/4157](/en/self-host/upgrading/4-15/4157) * [/en/self-host/upgrading/4-16/41601](/en/self-host/upgrading/4-16/41601) * [/en/self-host/upgrading/4-16/41602](/en/self-host/upgrading/4-16/41602) * [/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/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-14/41930](/self-host/upgrading/4-14/41930) * [/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-15/4157](/self-host/upgrading/4-15/4157) * [/self-host/upgrading/4-16/41601](/self-host/upgrading/4-16/41601) * [/self-host/upgrading/4-16/41602](/self-host/upgrading/4-16/41602) * [/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/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/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. ![System Tools local debug entry](/imgs/plugins/system-tool-debug-entry.png) 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. ![Generate local debug link](/imgs/plugins/system-tool-debug-link.png) 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. 进入「系统工具」页面,点击「本地调试」。 ![系统工具本地调试入口](/imgs/plugins/system-tool-debug-entry.png) 3. 在弹窗中点击「生成链接」,复制生成的调试链接。 4. 已有调试会话时,可点击「刷新链接」生成新的 connection key;旧链接会失效。 ![生成本地调试链接](/imgs/plugins/system-tool-debug-link.png) 调试链接只用于本地 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/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 ![alt text](../../public/imgs/image-120.png) ## 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 ![alt text](../../public/imgs/image-120.png) ## 日志接口 ### 获取应用总体数据统计 ```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. ![](../../public/imgs/appid.png) # 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。 ![](../../public/imgs/appid.png) ## 发起会话 ### 密钥使用规范 * 使用 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) | | --------------------------------------- | ----------------------------------------- | | ![](../../public/imgs/getDatasetId.jpg) | ![](../../public/imgs/getfile_id.webp) | ## 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 POST '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 Each request can push up to 200 data groups. FastGPT automatically creates the training usage record, so you do not need to provide `billId`. ```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", "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) | | --------------------------------------- | -------------------------------------- | | ![](../../public/imgs/getDatasetId.jpg) | ![](../../public/imgs/getfile_id.webp) | ## 知识库 ### 创建知识库 ```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 POST '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 组数据。训练账单会在接口调用时自动创建,无需手动传入 `billId`。 ```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 模式下忽略", "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.** ![](../../public/imgs/fastgpt-api-baseurl.png) ### 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 是没有用的。** ![](../../public/imgs/fastgpt-api-baseurl.png) ### 基本配置 OpenAPI 中,所有的接口都通过 Header.Authorization 进行鉴权。 ``` baseUrl: "http://localhost:3000/api" headers: { Authorization: "Bearer {{apikey}}" } ``` 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. ![](/imgs/sso2.png) ## 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
![WeCom](/imgs/sso15.png) ![DingTalk](/imgs/sso16.png) ![Lark](/imgs/sso17.png)
#### 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) ![](/imgs/sso1.png) #### 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. ![](/imgs/sso3.png) #### 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. ![](/imgs/sso4.png) 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. ![](/imgs/sso5.png) #### 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. ![](/imgs/sso6.png) #### 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 ![](/imgs/sso7.png) 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) ![](/imgs/sso8.png) ![](/imgs/sso9.png) 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 ![](/imgs/sso10.png) ![](/imgs/sso11.png) ![](/imgs/sso12.png) 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 ![](/imgs/sso13.png) 5. Enable interface sync 6. Get the Secret 7. Configure enterprise trusted IPs ![](/imgs/sso14.png) #### 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. ![](/imgs/sso18.png) 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 可识别的接口。 ![](/imgs/sso2.png) ## 系统配置教程 ### 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:
协议/功能 SSO 成员同步支持
飞书
企业微信
钉钉
Saml2.0
Oauth2.0
### 2. 配置 fastgpt-pro #### 1. 配置环境变量 环境变量中的 `EXTERNAL_USER_SYSTEM_BASE_URL` 为内网地址,例如上述例子中的配置,环境变量应该设置为 ```yaml env: - EXTERNAL_USER_SYSTEM_BASE_URL=http://fastgpt-sso:3000 - EXTERNAL_USER_SYSTEM_AUTH_TOKEN=xxxxx ``` #### 2. 在商业版后台配置按钮文字,图标等。
企业微信 钉钉 飞书
![企业微信](/imgs/sso15.png) ![钉钉](/imgs/sso16.png) ![飞书](/imgs/sso17.png)
#### 3. 开启成员同步(可选) 如果需要同步外部系统的成员,可以选择开启成员同步。团队模式具体可参考:[团队模式说明文档](./teamMode.mdx) ![](/imgs/sso1.png) #### 4. 可选配置 1. 自动定时成员同步 设置 fastgpt-pro 环境变量则可开启自动成员同步 ```yaml env: - "SYNC_MEMBER_CRON=0 0 * * *" # Cron 表达式,每天 0 点执行,注意需要以 UTC (0时区)为准,例如如果设置北京时间 12:00 进行同步,则此处需要配置为 "0 4 * * *" (UTC 4:00执行) ``` ## 内置的通用协议/IM 配置示例 ### 飞书 #### 1. 参数获取 App ID和App Secret 进入开发者后台,点击企业自建应用,在凭证与基础信息页面查看应用凭证。 ![](/imgs/sso3.png) #### 2. 权限配置 进入开发者后台,点击企业自建应用,在开发配置的权限管理页面开通权限。 ![](/imgs/sso4.png) 可以使用**批量导入/导出权限** 功能,导入如下权限配置: ```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": [] } } ``` 注意:可访问的数据范围需要开启全员可见 #### 3. 重定向URL 进入开发者后台,点击企业自建应用,在开发配置的安全设置中设置重定向URL, 重定向 URL 形如 `https://www.fastgpt.cn/login/provider` 前面的域名修改为部署后公开可访问的 fastgpt 的域名 ![](/imgs/sso5.png) #### 4. yml 配置示例 ```yaml fastgpt-sso: image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.14.16 container_name: fastgpt-sso restart: always networks: - fastgpt environment: - SSO_PROVIDER=feishu - AUTH_TOKEN=xxxxx # oauth 接口(私有化部署的飞书改为私有化的地址, 下同) - SSO_TARGET_URL=https://accounts.feishu.cn/open-apis/authen/v1/authorize # 获取token 接口 - FEISHU_TOKEN_URL=https://open.feishu.cn/open-apis/authen/v2/oauth/token # 获取用户信息接口 - FEISHU_GET_USER_INFO_URL=https://open.feishu.cn/open-apis/authen/v1/user_info # 重定向地址,设置为上面第三部中一模一样的地址 - FEISHU_REDIRECT_URI=https://fastgpt.cn/login/provider # 飞书APP的应用ID,一般以cli开头 - FEISHU_APP_ID=xxx # 飞书APP的应用密钥 - FEISHU_APP_SECRET=xxx ``` ### 钉钉 #### 1. 参数获取 CLIENT\_ID 与 CLIENT\_SECRET 进入钉钉开放平台,点击应用开发,选择自己的应用进入,记录在凭证与基础信息页面下的Client ID与Client secret。 ![](/imgs/sso6.png) #### 2. 权限配置 进入钉钉开放平台,点击应用开发,选择自己的应用进入,在开发配置的权限管理页面操作,需要开通的权限包括: 1. ***个人手机号信息*** 2. ***通讯录个人信息读权限*** 3. ***获取钉钉开放接口用户访问凭证的基础权限*** #### 3. 重定向URL 进入钉钉开放平台,点击应用开发,选择自己的应用进入,在开发配置的安全设置页面操作 需要填写的内容有两个: 1. 服务器出口IP (调用钉钉服务端API的服务器IP列表) 2. 重定向URL(回调域名) #### 4. yml 配置示例 ```yaml fastgpt-sso: image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.14.16 container_name: fastgpt-sso restart: always networks: - fastgpt environment: - SSO_PROVIDER=dingtalk - AUTH_TOKEN=xxxxx #oauth 接口 - SSO_TARGET_URL=https://login.dingtalk.com/oauth2/auth #获取token 接口 - DINGTALK_TOKEN_URL=https://api.dingtalk.com/v1.0/oauth2/userAccessToken #获取用户信息接口 - DINGTALK_GET_USER_INFO_URL=https://oapi.dingtalk.com/v1.0/contact/users/me #钉钉APP的应用ID - DINGTALK_CLIENT_ID=xxx #钉钉APP的应用密钥 - DINGTALK_CLIENT_SECRET=xxx ``` ### 企业微信 #### 1. 参数获取 1. 企业的 CorpID a. 使用管理员账号登陆企业微信管理后台 `https://work.weixin.qq.com/wework_admin/loginpage_wx` b. 点击 【我的企业】 页面,查看企业的 **企业ID** ![](/imgs/sso7.png) 2. 创建一个供 FastGPT 使用的内部应用: a. 获取应用的 AgentID 和 Secret b. 保证这个应用的可见范围为全部(也就是根部门) ![](/imgs/sso8.png) ![](/imgs/sso9.png) 3. 一个域名。并且要求: a. 解析到可公网访问的服务器上 b. 可以在该服务的根目录地址上挂载静态文件(以便进行域名归属认证 ,按照配置处的提示进行操作,只需要挂载一个静态文件,认证后可以删除) c. 配置网页授权,JS-SDK以及企业微信授权登陆 d. 可以在【企业微信授权登陆】页面下方设置"在工作台隐藏应用" ![](/imgs/sso10.png) ![](/imgs/sso11.png) ![](/imgs/sso12.png) 4. 获取 "通讯录同步助手" secret 获取通讯录,组织成员 ID 需要使用 "通讯录同步助手" secret 【安全与管理】-- 【管理工具】 -- 【通讯录同步】 ![](/imgs/sso13.png) 5. 开启接口同步 6. 获取 Secret 7. 配置企业可信 IP ![](/imgs/sso14.png) #### 2. yml 配置示例 ```yaml fastgpt-sso: image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.14.16 container_name: fastgpt-sso restart: always networks: - fastgpt environment: - AUTH_TOKEN=xxxxx - SSO_PROVIDER=wecom # oauth 接口,在企微终端使用 - WECOM_TARGET_URL_OAUTH=https://open.weixin.qq.com/connect/oauth2/authorize # sso 接口,扫码 - WECOM_TARGET_URL_SSO=https://login.work.weixin.qq.com/wwlogin/sso/login # 获取用户id(只能拿id) - WECOM_GET_USER_ID_URL=https://qyapi.weixin.qq.com/cgi-bin/auth/getuserinfo # 获取用户详细信息(除了名字都有) - WECOM_GET_USER_INFO_URL=https://qyapi.weixin.qq.com/cgi-bin/auth/getuserdetail # 获取用户信息(有名字,没其他信息) - WECOM_GET_USER_NAME_URL=https://qyapi.weixin.qq.com/cgi-bin/user/get # 获取组织 id 列表 - WECOM_GET_DEPARTMENT_LIST_URL=https://qyapi.weixin.qq.com/cgi-bin/department/list # 获取用户 id 列表 - WECOM_GET_USER_LIST_URL=https://qyapi.weixin.qq.com/cgi-bin/user/list_id # 企微 CorpId - WECOM_CORPID= # 企微 App 的 AgentId 一般是 1000xxx - WECOM_AGENTID= # 企微 App 的 Secret - WECOM_APP_SECRET= # 通讯录同步助手的 Secret - WECOM_SYNC_SECRET= ``` ### 标准 OAuth2.0 我们提供一套 RFC 6749 中鉴权码模式的 OAuth2.0 接入支持。 参考: * [RFC 6749](https://datatracker.ietf.org/doc/html/rfc6749) 文档。 * [阮一峰的网络日志](https://www.ruanyifeng.com/blog/2014/05/oauth_2_0.html) #### 参数需求 ##### 三个地址 我们提供一套标准的 OAuth2.0 接入流程。需要三个地址: 1. 登陆鉴权地址(用户点击 SSO 按钮后将携带参数直接跳转到该地址), 例如:`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" ``` 用户输入账号密码后,会跳转到 redirect\_uri 中,并携带 code 参数: `https://fastgpt.cn/login/provider?code=4/P7qD2qAz4&state=xyz` 2. 获取 access\_token 的地址,获取到 code 后,通过*服务器请求*该地址获取 access\_token 例如:`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" ``` 注意:Content-Type 必须是 application/x-www-form-urlencoded, 而不是 application/json 3. 获取用户信息的地址,需要传入 access\_token 例如:`http://example.com/oauth/user_info` ```bash curl -X GET\ -H "Authorization: Bearer 4/P7qD2qAz4"\ "http://example.com/oauth/user_info" ``` 注意: access\_token 作为 Authorization 头部传入, 格式为 Bearer xxxx ##### 参数配置 * CLIENT\_ID: 必须 * CLIENT\_SECRET: 非必须,如果没有可以不配置 * SCOPE: 非必须,如果没有可以不配置 > redirect\_uri 参数会根据运行环境自动补全 > > 其他固定参数如 grant\_type, response\_type 等会自动补全 #### 配置示例 ```yaml fastgpt-sso: image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.14.16 container_name: fastgpt-sso restart: always networks: - fastgpt environment: - SSO_PROVIDER=oauth2 - AUTH_TOKEN=xxxxx # OAuth2.0 # === 请求地址 === # 1. OAuth2 登陆鉴权地址 (必填) - OAUTH2_AUTHORIZE_URL= # 2. OAuth2 获取 AccessToken 地址 (必填) - OAUTH2_TOKEN_URL= # 3. OAuth2 获取用户信息地址 (必填) - OAUTH2_USER_INFO_URL= # === 参数 === # 1. client_id (必填) - OAUTH2_CLIENT_ID= # 2. client_secret (选填,如果没有则不传) - OAUTH2_CLIENT_SECRET= # 3. scope (选填) - OAUTH2_SCOPE= # === 字段映射 === # OAuth2 用户名字段映射(必填) - OAUTH2_USERNAME_MAP= # OAuth2 头像字段映射(选填) - OAUTH2_AVATAR_MAP= # OAuth2 成员名字段映射(选填) - OAUTH2_MEMBER_NAME_MAP= # OAuth2 联系方式字段映射(选填) - OAUTH2_CONTACT_MAP= ``` ## 标准接口文档 以下是 FastGPT-pro 中,SSO 和成员同步的标准接口文档,如果需要对接非标准系统,可以参考该章节进行开发。 ![](/imgs/sso18.png) FastGPT 提供如下标准接口支持: 1. [https://example.com/login/oauth/getAuthURL](https://example.com/login/oauth/getAuthURL) 获取鉴权重定向地址 2. [https://example.com/login/oauth/getUserInfo?code=xxxxx](https://example.com/login/oauth/getUserInfo?code=xxxxx) 消费 code,换取用户信息 3. [https://example.com/org/list](https://example.com/org/list) 获取组织列表 4. [https://example.com/user/list](https://example.com/user/list) 获取成员列表 ### 获取 SSO 登录重定向地址 返回一个重定向登录地址,fastgpt 会自动重定向到该地址。redirect\_uri 会自动拼接到该地址的 query中。 ```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" ``` 成功: ```json { "success": true, "message": "", "authURL": "https://example.com/somepath/login/oauth?redirect_uri=https%3A%2F%2Ffastgpt.cn%2Flogin%2Fprovider%0A" } ``` 失败: ```json { "success": false, "message": "错误信息", "authURL": "" } ``` ### SSO 获取用户信息 该接口接受一个 code 参数作为鉴权,消费 code 返回用户信息。 ```bash curl -X GET "https://oauth.example/login/oauth/getUserInfo?code=xxxxxx" \ -H "Authorization: Bearer your_token_here" \ -H "Content-Type: application/json" ``` 成功: ```json { "success": true, "message": "", "username": "fastgpt-123456789", "avatar": "https://example.webp", "contact": "+861234567890", "memberName": "成员名(非必填)", } ``` 失败: ```json { "success": false, "message": "错误信息", "username": "", "avatar": "", "contact": "" } ``` ### 获取组织 ```bash curl -X GET "https://example.com/org/list" \ -H "Authorization: Bearer your_token_here" \ -H "Content-Type: application/json" ``` ⚠️注意:只能存在一个根部门。如果你的系统中存在多个根部门,需要先进行处理,加一个虚拟的根部门。返回值类型: ```ts type OrgListResponseType = { message?: string; // 报错信息 success: boolean; orgList: { id: string; // 部门的唯一 id name: string; // 名字 parentId: string; // parentId,如果为根部门,传空字符串。 }[]; } ``` ```json { "success": true, "message": "", "orgList": [ { "id": "od-125151515", "name": "根部门", "parentId": "" }, { "id": "od-51516152", "name": "子部门", "parentId": "od-125151515" } ] } ``` ### 获取成员 ```bash curl -X GET "https://example.com/user/list" \ -H "Authorization: Bearer your_token_here" \ -H "Content-Type: application/json" ``` 返回值类型: ```typescript type UserListResponseListType = { message?: string; // 报错信息 success: boolean; userList: { username: string; // 唯一 id username 必须与 SSO 接口返回的用户 username 相同。并且必须携带一个前缀,例如: sync-aaaaa,和 sso 接口返回的前缀一致 memberName?: string; // 名字,作为 tmbname avatar?: string; contact?: string; // email or phone number orgs?: string[]; // 人员所在组织的 ID。没有组织传 [] }[]; } ``` curl示例 ```json { "success": true, "message": "", "userList": [ { "username": "fastgpt-123456789", "memberName": "张三", "avatar": "https://example.webp", "contact": "+861234567890", "orgs": ["od-125151515", "od-51516152"] }, { "username": "fastgpt-12345678999", "memberName": "李四", "avatar": "", "contact": "", "orgs": ["od-125151515"] } ] } ``` ## 如何对接非标准系统 1. 客户自己开发:按 fastgpt 提供的标准接口进行开发,并将部署后的服务地址填入 fastgpt-pro 可以参考该模版库:[fastgpt-sso-template](https://github.com/labring/fastgpt-sso-template) 进行开发 2. 由 fastgpt 团队定制开发: a. 提供系统的 SSO 文档、获取成员和组织的文档、以及外网测试地址。 b. 在 fastgpt-sso-service 中,增加对应的 provider 和环境变量,并编写代码来对接。 file: ./content/guide/admin/teamMode.en.mdx meta: { "title": "Team Mode", "description": "FastGPT Team Mode Documentation" } ## Overview Currently supported team modes: 1. Multi-team mode (default) 2. Single-team mode (one global team) 3. Member sync mode (all members synced from external systems)
Team Mode SMS/Email Registration Admin Direct Add SSO Registration
Creates Default Team Joins Root Team Creates Default Team Joins Root Team Creates Default Team Joins Root Team
Single-team Mode
Multi-team Mode
Sync Mode
### 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. ![](/imgs/teammode.png) file: ./content/guide/admin/teamMode.mdx meta: { "title": "团队模式说明文档", "description": "FastGPT 团队模式说明文档" } ## 介绍 目前支持的团队模式: 1. 多团队模式(默认模式) 2. 单团队模式(全局只有一个团队) 3. 成员同步模式(所有成员自外部同步)
团队模式 短信/邮箱 注册 管理员直接添加 SSO 注册
是否创建默认团队 是否加入 Root 团队 是否创建默认团队 是否加入 Root 团队 是否创建默认团队 是否加入 Root 团队
单团队模式
多团队模式
同步模式
### 多团队模式(默认模式) 多团队模式下,每个用户创建时默认创建以自己为所有者的默认团队。 ### 单团队模式 单团队模式是 v4.9 推出的新功能。为了简化企业进行人员和资源的管理,开启单团队模式后,所有新增的用户都不再创建自己的默认团队,而是加入 root 用户所在的团队。 ### 同步模式 在完成系统配置,开启同步模式的情况下,外部成员系统的成员会自动同步到 FastGPT 中。 具体的同步方式和规则请参考 [SSO & 外部成员同步](./sso.mdx)。 ## 配置 在 `fastgpt-pro` 的`系统配置-成员配置`中,可以配置团队模式。 ![](/imgs/teammode.png) file: ./content/guide/chat/htmlRendering.en.mdx meta: { "title": "Dialog Boxes & HTML Rendering", "description": "How to embed HTML code blocks in FastGPT via Markdown, with fullscreen, source code toggle, and other interactive features" } | Source Mode | Preview Mode | Fullscreen Mode | | ----------------------------- | ----------------------------- | ----------------------------- | | ![](/imgs/htmlRendering1.png) | ![](/imgs/htmlRendering2.png) | ![](/imgs/htmlRendering3.png) | ### 1. Design Background While Markdown natively supports embedded HTML tags, many platforms restrict HTML rendering for security reasons -- especially for dynamic content, interactive elements, and external resources. These restrictions limit flexibility when authoring complex documents that need embedded HTML. To address this, FastGPT uses `iframe` to embed and render HTML content, combined with the `sandbox` attribute to ensure safe rendering. ### 2. Feature Overview This module extends FastGPT's Markdown rendering to support embedded HTML content. Since rendering uses an iframe, the content height cannot be determined automatically, so FastGPT sets a fixed height for the iframe. JavaScript execution within the HTML is not supported. ### 3. Technical Implementation This module implements HTML rendering and interactivity through: * **Component Design:** The module displays HTML content via `iframe`-type code blocks using a custom `IframeBlock` component. The `sandbox` attribute ensures embedded content security by restricting behaviors like script execution and form submissions. Helper functions integrate with the Markdown renderer to handle `iframe`-embedded HTML content. * **Security Mechanism:** The `iframe`'s `sandbox` attribute and `referrerPolicy` prevent potential security risks. The `sandbox` attribute provides fine-grained control, allowing specific capabilities (scripts, forms, popups, etc.) to run in a restricted environment so rendered HTML cannot compromise the system. * **Display & Interaction:** Users can switch between display modes (fullscreen, preview, source code) for flexible viewing and control of embedded HTML. The `iframe` adapts to the parent container's width while ensuring content displays properly. ### 4. How to Use Simply use a Markdown code block with the language set to `html`. For example: ````md ```html Welcome to FastGPT ```` ``` ``` file: ./content/guide/chat/htmlRendering.mdx meta: { "title": "对话框与HTML渲染", "description": "如何在FastGPT中通过Markdown嵌入HTML代码块,并提供全屏、源代码切换等交互功能" } | 源码模式 | 预览模式 | 全屏模式 | | ----------------------------- | ----------------------------- | ----------------------------- | | ![](/imgs/htmlRendering1.png) | ![](/imgs/htmlRendering2.png) | ![](/imgs/htmlRendering3.png) | ### 1. **设计背景** 尽管Markdown本身支持嵌入HTML标签,但由于安全问题,许多平台和环境对HTML的渲染进行了限制,特别是在渲染动态内容、交互式元素以及外部资源时。这些限制大大降低了用户在撰写和展示复杂文档时的灵活性,尤其是当需要嵌入外部HTML内容时。为了应对这一问题,我们通过使用 `iframe` 来嵌入和渲染HTML内容,并结合 `sandbox` 属性,保障了外部HTML的安全渲染。 ### 2. 功能简介 该功能模块的主要目的是扩展FastGPT在Markdown渲染中的能力,支持嵌入和渲染HTML内容。由于是利用 Iframe 渲染,所以无法确认内容的高度,FastGPT 中会给 Iframe 设置一个固定高度来进行渲染。并且不支持 HTML 中执行 js 脚本。 ### 3. 技术实现 本模块通过以下方式实现了HTML渲染和互动功能: * **组件设计**:该模块通过渲染 `iframe` 类型的代码块展示HTML内容。使用自定义的 `IframeBlock` 组件,结合 `sandbox` 属性来保障嵌入内容的安全性。`sandbox` 限制了外部HTML中的行为,如禁用脚本执行、限制表单提交等,确保HTML内容的安全性。通过辅助函数与渲染Markdown内容的部分结合,处理 `iframe` 嵌入的HTML内容。 * **安全机制**:通过 `iframe` 的 `sandbox` 属性和 `referrerPolicy` 来防止潜在的安全风险。`sandbox` 属性提供了细粒度的控制,允许特定的功能(如脚本、表单、弹出窗口等)在受限的环境中执行,以确保渲染的HTML内容不会对系统造成威胁。 * **展示与互动功能**:用户可以通过不同的展示模式(如全屏、预览、源代码模式)自由切换,以便更灵活地查看和控制嵌入的HTML内容。嵌入的 `iframe` 自适应父容器的宽度,同时保证 `iframe`嵌入的内容能够适当显示。 ### 4. 如何使用 你只需要通过 Markdown 代码块格式,并标记语言为 `html` 即可。例如: ````md ```html 欢迎使用FastGPT ```` file: ./content/guide/chat/quoteList.en.mdx meta: { "title": "Knowledge Base Chunk Reader", "description": "FastGPT Chunk Reader feature overview" } In enterprise AI deployments, the accuracy and transparency of document citations have always been a key concern. The Knowledge Base Chunk Reader introduced in FastGPT 4.9.1 solves this pain point, making AI citations no longer a "black box." # Why a Chunk Reader? In traditional AI conversations, when a model cites content from an enterprise knowledge base, users typically only see the cited fragment without the full context. This makes content verification and deeper understanding difficult. The Chunk Reader lets users view the complete source document directly within the conversation and jump to the exact citation location, bringing true explainability to AI citations. ## Limitations of Traditional Citations Previously, after uploading documents to the knowledge base, traditional citations only displayed the matched chunks with no way to see the surrounding context: | Question | Citation | | --------------------------- | --------------------------- | | ![](/imgs/chunkReader1.png) | ![](/imgs/chunkReader2.jpg) | ## FastGPT Chunk Reader: Precise Positioning, Seamless Reading With FastGPT's Chunk Reader, the same knowledge base content and questions are presented in a fundamentally better way: ![](/imgs/chunkReader4.jpg) When AI cites knowledge base content, click the citation link to open a popup showing the full original text with the cited passage clearly highlighted. This ensures traceability while providing a convenient reading experience. # Core Features ## Full-Text Display & Positioning The Chunk Reader lets users see exactly where AI responses draw from in the knowledge base. In the conversation interface, when AI cites knowledge base content, source information appears below the reply. Click any citation link to open a popup with the complete original text and the cited passage highlighted. This design ensures answer traceability and makes it easy to verify AI accuracy and review surrounding context. ![](/imgs/chunkReader3.webp) ## Citation Navigation The top-right corner of the Chunk Reader provides simple navigation controls for switching between multiple citations. The navigation area displays the current citation index and total count (e.g., "7/10"), so you always know your browsing progress. ![](/imgs/chunkReader5.jpg) ## Citation Quality Scoring Each citation includes a relevance score label showing its ranking among all matched knowledge fragments. Hover over the label to see full scoring details, including why the citation was selected and how its relevance score breaks down. ![](/imgs/chunkReader6.png) ## One-Click Document Export The Chunk Reader includes a content export feature so valuable information is never lost. Users with read access to the knowledge base can save the full cited document to their local device with a single click. ![](/imgs/chunkReader7.jpg) # Advanced Features ## Flexible Visibility Control FastGPT provides flexible citation visibility settings to balance openness and security. For example, with anonymous share links, administrators can precisely control what external visitors can see. When set to "citation content only," external users clicking a citation link will only see the specific cited text fragments, not the full source document. The Chunk Reader automatically adjusts its display mode accordingly. | | | | --------------------------- | --------------------------- | | ![](/imgs/chunkReader8.png) | ![](/imgs/chunkReader9.jpg) | ## Instant Annotation While browsing, authorized users can annotate and correct citation content in real time. The system processes updates without interrupting the conversation. Modified content is clearly marked with an "Updated" label, maintaining both citation accuracy and conversation history integrity. This seamless knowledge refinement workflow is ideal for team collaboration, allowing the knowledge base to evolve during actual use so AI responses always draw from the latest, most accurate sources. ## Smart Document Performance For real-world scenarios with ultra-long documents containing thousands of chunks, FastGPT uses advanced performance optimization to keep the Chunk Reader responsive. The system manages loading intelligently based on citation relevance ranking and database indexing, implementing on-demand rendering -- only content the user actually needs to view is loaded into memory. Whether jumping to a specific citation or scrolling through a document, the experience stays smooth regardless of document size. This optimization lets FastGPT handle enterprise-scale knowledge bases efficiently, even for professional documents with massive amounts of content. file: ./content/guide/chat/quoteList.mdx meta: { "title": "知识库引用分块阅读器", "description": "FastGPT 分块阅读器功能介绍" } 在企业 AI 应用落地过程中,文档知识引用的精确性和透明度一直是用户关注的焦点。FastGPT 4.9.1 版本带来的知识库分块阅读器,巧妙解决了这一痛点,让 AI 引用不再是"黑盒"。 # 为什么需要分块阅读器? 传统的 AI 对话中,当模型引用企业知识库内容时,用户往往只能看到被引用的片段,无法获取完整语境,这给内容验证和深入理解带来了挑战。分块阅读器的出现,让用户可以在对话中直接查看引用内容的完整文档,并精确定位到引用位置,实现了引用的"可解释性"。 ## 传统引用体验的局限 以往在知识库中上传文稿后,当我们在工作流中输入问题时,传统的引用方式只会展示引用到的分块,无法确认分块在文章中的上下文: | 问题 | 引用 | | --------------------------- | --------------------------- | | ![](/imgs/chunkReader1.png) | ![](/imgs/chunkReader2.jpg) | ## FastGPT 分块阅读器:精准定位,无缝阅读 而在 FastGPT 全新的分块式阅读器中,同样的知识库内容和问题,呈现方式发生了质的飞跃 ![](/imgs/chunkReader4.jpg) 当 AI 引用知识库内容时,用户只需点击引用链接,即可打开一个浮窗,呈现完整的原文内容,并通过醒目的高亮标记精确显示引用的文本片段。这既保证了回答的可溯源性,又提供了便捷的原文查阅体验。 # 核心功能 ## 全文展示与定位 "分块阅读器" 让用户能直观查看AI回答引用的知识来源。 在对话界面中,当 AI 引用了知识库内容,系统会在回复下方展示出处信息。用户只需点击这些引用链接,即可打开一个优雅的浮窗,呈现完整的原文内容,并通过醒目的高亮标记精确显示 AI 引用的文本片段。 这一设计既保证了回答的可溯源性,又提供了便捷的原文查阅体验,让用户能轻松验证AI回答的准确性和相关上下文。 ![](/imgs/chunkReader3.webp) ## 便捷引用导航 分块阅读器右上角设计了简洁实用的导航控制,用户可以通过这对按钮轻松在多个引用间切换浏览。导航区还直观显示当前查看的引用序号及总引用数量(如 "7/10"),帮助用户随时了解浏览进度和引用内容的整体规模。 ![](/imgs/chunkReader5.jpg) ## 引用质量评分 每条引用内容旁边都配有智能评分标签,直观展示该引用在所有知识片段中的相关性排名。用户只需将鼠标悬停在评分标签上,即可查看完整的评分详情,了解这段引用内容为何被AI选中以及其相关性的具体构成。 ![](/imgs/chunkReader6.png) ## 文档内容一键导出 分块阅读器贴心配备了内容导出功能,让有效信息不再流失。只要用户拥有相应知识库的阅读权限,便可通过简单点击将引用涉及的全文直接保存到本地设备。 ![](/imgs/chunkReader7.jpg) # 进阶特性 ## 灵活的可见度控制 FastGPT提供灵活的引用可见度设置,让知识共享既开放又安全。以免登录链接为例,管理员可精确控制外部访问者能看到的信息范围。 当设置为"仅引用内容可见"时,外部用户点击引用链接将只能查看 AI 引用的特定文本片段,而非完整原文档。如图所示,分块阅读器此时智能调整显示模式,仅呈现相关引用内容。 | | | | --------------------------- | --------------------------- | | ![](/imgs/chunkReader8.png) | ![](/imgs/chunkReader9.jpg) | ## 即时标注优化 在浏览过程中,授权用户可以直接对引用内容进行即时标注和修正,系统会智能处理这些更新而不打断当前的对话体验。所有修改过的内容会通过醒目的"已更新"标签清晰标识,既保证了引用的准确性,又维持了对话历史的完整性。 这一无缝的知识优化流程特别适合团队协作场景,让知识库能在实际使用过程中持续进化,确保AI回答始终基于最新、最准确的信息源。 ## 智能文档性能优化 面对现实业务中可能包含成千上万分块的超长文档,FastGPT采用了先进的性能优化策略,确保分块阅读器始终保持流畅响应。 系统根据引用相关性排序和数据库索引进行智能加载管理,实现了"按需渲染"机制——根据索引排序和数据库 id,只有当用户实际需要查看的内容才会被加载到内存中。这意味着无论是快速跳转到特定引用,还是自然滚动浏览文档,都能获得丝滑的用户体验,不会因为文档体积庞大而出现卡顿或延迟。 这一技术优化使FastGPT能够轻松应对企业级的大规模知识库场景,让即使是包含海量信息的专业文档也能高效展示和查阅。 file: ./content/guide/build/evaluation.en.mdx meta: { "title": "App Evaluation (Beta)", "description": "A quick overview of FastGPT app evaluation" } Starting from FastGPT v4.11.0, batch app evaluation is supported. By providing multiple QA pairs, the system automatically scores your app's responses, enabling quantitative assessment of app performance. The system supports three evaluation metrics: answer accuracy, question relevance, and semantic accuracy. The current beta only includes answer accuracy — the remaining metrics will be added in future releases. ## Create an App Evaluation ### Go to the Evaluation Page ![Create app evaluation](/imgs/evaluation1.png) Navigate to the App Evaluation section under Workspace and click the "Create Task" button in the upper right corner. ### Fill in Evaluation Details ![Create app evaluation](/imgs/evaluation2.png) On the task creation page, provide the following: * **Task Name**: A label to identify this evaluation * **Evaluation Model**: The model used for scoring * **Target App**: The app to be evaluated ### Prepare Evaluation Data ![Create app evaluation](/imgs/evaluation2.png) After selecting the target app, a button appears to download the CSV template. The template includes these fields: * Global variables * q (question) * a (expected answer) * Chat history **Notes:** * Maximum of 1,000 QA pairs * Follow the template format when filling in data Upload the completed file and click "Start Evaluation" to create the task. ## View Evaluation Results ### Evaluation List ![View app evaluation](/imgs/evaluation4.png) The evaluation list shows all tasks with key information: * **Progress**: Current execution status * **Created By**: The user who created the task * **Target App**: The app being evaluated * **Start/End Time**: Execution time range * **Overall Score**: The task's aggregate score Use this to compare results across iterations as you improve your app. ### Evaluation Details ![View app evaluation](/imgs/evaluation5.png) Click "View Details" to open the detail page: **Task Overview**: The top section shows overall task information, including evaluation configuration and summary statistics. **Detailed Results**: The bottom section lists each QA pair with its score, showing: * User question * Expected output * App output file: ./content/guide/build/evaluation.mdx meta: { "title": "应用评测(Beta)", "description": "快速了解 FastGPT 应用评测功能" } FastGPT v4.11.0 版本开始支持应用批量评测功能。通过传入多组问答对,系统会对应用执行结果进行自动打分,实现应用运行效果的定量评估。 系统支持三种评估指标:回答准确性、问题相关性和语义准确性。当前测试版仅包含回答准确性这一个指标,其余指标将在后续版本中补充完善。 ## 创建应用评测 ### 进入评测页面 ![创建应用评测](/imgs/evaluation1.png) 进入工作台下的应用评测目录,点击右上角的"创建任务"按钮。 ### 填写评测信息 ![创建应用评测](/imgs/evaluation2.png) 在创建任务页面中,需要填写以下信息: * **评测任务名**:任务的标识名称 * **评测模型**:用于本次任务打分的模型 * **评测应用**:需要被打分的应用 ### 准备评测数据 ![创建应用评测](/imgs/evaluation2.png) 选择评测应用后,系统会弹出下载CSV模板的按钮。模板包含以下字段: * 全局变量 * q(问题) * a(标准答案) * 历史记录 **注意事项:** * 最多支持1000组问答对 * 请按照模板格式填写数据 填写完成后上传文件并点击"开始评测",即可创建一个应用评测任务 ## 查看应用评测 ### 评测列表 ![查看应用评测](/imgs/evaluation4.png) 评测列表页面显示所有评测任务,包含以下关键信息: * **进度**:当前评测任务的执行状态 * **执行人**:创建评测任务的用户 * **评测应用**:被评测的应用名称 * **开始时间/结束时间**:评测任务的执行时间范围 * **综合评分**:评测任务的整体得分 通过这些信息,可以清晰地比较每次应用改进后的效果。 ### 评测详情 ![查看应用评测](/imgs/evaluation5.png) 点击"查看详情"可进入评测任务的详情页面: **任务概览**:页面顶部显示任务的整体信息,包括评测配置和统计结果。 **详细结果**:页面下方展示评测任务中的每一条问答对及其评分,可以查看: * 用户问题 * 标准输出 * 应用输出 file: ./content/guide/build/faq.en.mdx meta: { "title": "App Building FAQ", "description": "Common FastGPT app building questions, including simple apps, workflows, and plugins" } ## Multi-Turn Classification The Question Classification node has access to conversation context. When two consecutive questions are closely related, the model can usually classify them accurately based on their connection. For example, if a user asks "How do I use this feature?" followed by "What are the limitations?", the model leverages context to understand and respond correctly. However, when consecutive questions have little relation to each other, classification accuracy may drop. To handle this, you can use a global variable to store the classification result. In subsequent classification steps, check the global variable first — if a result exists, reuse it; otherwise, let the model classify on its own. Tip: Build batch test scripts to evaluate your question classification accuracy. ## Scheduled Execution Timing If a user opens a shared link and stays on the page, scheduled execution still works as expected — it takes effect after the app is published and runs in the background. ## Changes Not Applied After changing an app, click **Publish**. Chat and published channels only use the updated app configuration after publishing. ## Disable Markdown Formatting Edit the Knowledge Base default prompt. The built-in standard template instructs the model to use Markdown. You can remove that requirement: | | | | ----------------------- | ----------------------- | | ![](/imgs/image-83.png) | ![](/imgs/image-84.png) | ## Inconsistent App Results Q: The app produces different results in debug mode vs. production, or when called via API. A: This is usually caused by differences in context. Check the conversation logs, find the relevant entry, and compare the run details side by side. | | | | | ----------------------- | ----------------------- | ----------------------- | | ![](/imgs/image-85.png) | ![](/imgs/image-86.png) | ![](/imgs/image-87.png) | The Knowledge Base response settings require a custom prompt. Without one, the default prompt (which includes Markdown formatting instructions) is used. ## Skip Classification for Follow-Ups Scenario: A workflow starts with a Question Classification node that routes to different branches, each with its own Knowledge Base and AI Chat. After the first AI response, you want subsequent questions to skip classification and go straight to the Knowledge Base with chat history as context. Solution: Add a condition check — if it's the first message (history count is 0), route through Question Classification. Otherwise, go directly to the Knowledge Base and AI Chat. ## Formula Rendering Issues Add a prompt to guide the model to output formulas in LaTeX/Markdown format: ```bash Latex inline: \(x^2\) Latex block: $$e=mc^2$$ ``` file: ./content/guide/build/faq.mdx meta: { "title": "常见问题", "description": "FastGPT 应用构建常见问题,包括简易应用、工作流和插件" } ## 多轮对话分类 问题分类节点具有获取上下文信息的能力,当处理两个关联性较大的问题时,模型的判断准确性往往依赖于这两个问题之间的联系和模型的能力。例如,当用户先问“我该如何使用这个功能?”接着又询问“这个功能有什么限制?”时,模型借助上下文信息,就能够更精准地理解并响应。 但是,当连续问题之间的关联性较小,模型判断的准确度可能会受到限制。在这种情况下,我们可以引入全局变量的概念来记录分类结果。在后续的问题分类阶段,首先检查全局变量是否存有分类结果。如果有,那么直接沿用该结果;若没有,则让模型自行判断。 建议:构建批量运行脚本进行测试,评估问题分类的准确性。 ## 定时执行触发时机 系统编排配置中的定时执行,如果用户打开分享的连接,停留在那个页面,定时执行触发问题: 定时执行会在应用发布后生效,会在后台生效。 ## 修改后未生效 应用变更后,需要点击发布后,聊天和发布渠道的使用才会更新应用。 ## 取消 Markdown 输出 修改知识库默认提示词, 默认用的是标准模板提示词,会要求按 Markdown 输出,可以去除该要求: | | | | ----------------------- | ----------------------- | | ![](/imgs/image-83.png) | ![](/imgs/image-84.png) | ## 不同来源效果不一致 Q: 应用在调试和正式发布后,效果不一致;在 API 调用时,效果不一致。 A: 通常是由于上下文不一致导致,可以在对话日志中,找到对应的记录,并查看运行详情来进行比对。 | | | | | ----------------------- | ----------------------- | ----------------------- | | ![](/imgs/image-85.png) | ![](/imgs/image-86.png) | ![](/imgs/image-87.png) | 在针对知识库的回答要求里有, 要给它配置提示词,不然他就是默认的,默认的里面就有该语法。 ## 后续问题跳过分类节点 做个判断器,如果是初次开始对话也就是历史记录为 0,就走问题分类;不为零直接走知识库和 ai。 ## 公式无法正常显示 添加相关提示词,引导模型按 Markdown 输出公式 ```bash Latex inline: \(x^2\) Latex block: $$e=mc^2$$ ``` file: ./content/guide/dataset/collection_tags.en.mdx meta: { "title": "Knowledge Base Collection Tags", "description": "How to use collection tags in FastGPT Knowledge Base" } Collection tags are a commercial-edition feature in FastGPT. They let you tag and categorize data collections within a knowledge base for more efficient data management. You can also use tags as collection filters during knowledge base searches for more precise results. | | | | | -------------------------------- | -------------------------------- | -------------------------------- | | ![](/imgs/collection-tags-1.png) | ![](/imgs/collection-tags-2.png) | ![](/imgs/collection-tags-3.png) | ## Basic Tag Operations On the knowledge base detail page, you can manage tags with the following operations: * Create a tag * Rename a tag * Delete a tag * Assign a tag to multiple collections * Add multiple tags to a single collection You can also filter collections by tags. ## Collection Filtering in Knowledge Base Search Tags can be used to filter collections during knowledge base searches by filling in the "Collection Filter" field. Here's an example: ```json { "tags": { "$and": ["Tag 1","Tag 2"], "$or": ["When $and tags are present, $and takes effect and $or is ignored"] }, "createTime": { "$gte": "YYYY-MM-DD HH:mm format, matches collections created after this time", "$lte": "YYYY-MM-DD HH:mm format, matches collections created before this time. Can be used together with $gte" } } ``` Two important notes: * Tag values can be a `string` tag name or `null`, where `null` represents collections with no tags assigned * There are two filter condition types: `$and` and `$or`. When both are set, only `$and` takes effect file: ./content/guide/dataset/collection_tags.mdx meta: { "title": "知识库集合标签", "description": "FastGPT 知识库集合标签使用说明" } 知识库集合标签是 FastGPT 商业版特有功能。它允许你对知识库中的数据集合添加标签进行分类,更高效地管理知识库数据。 而进一步可以在问答中,搜索知识库时添加集合过滤,实现更精确的搜索。 | | | | | -------------------------------- | -------------------------------- | -------------------------------- | | ![](/imgs/collection-tags-1.png) | ![](/imgs/collection-tags-2.png) | ![](/imgs/collection-tags-3.png) | ## 标签基础操作说明 在知识库详情页面,可以对标签进行管理,可执行的操作有 * 创建标签 * 修改标签名 * 删除标签 * 将一个标签赋给多个数据集合 * 给一个数据集合添加多个标签 也可以利用标签对数据集合进行筛选 ## 知识库搜索-集合过滤说明 利用标签可以在知识库搜索时,通过填写「集合过滤」这一栏来实现更精确的搜索,具体的填写示例如下 ```json { "tags": { "$and": ["标签 1","标签 2"], "$or": ["有 $and 标签时,and 生效,or 不生效"] }, "createTime": { "$gte": "YYYY-MM-DD HH:mm 格式即可,集合的创建时间大于该时间", "$lte": "YYYY-MM-DD HH:mm 格式即可,集合的创建时间小于该时间,可和 $gte 共同使用" } } ``` 在填写时有两个注意的点, * 标签值可以为 `string` 类型的标签名,也可以为 `null`,而 `null` 代表着未设置标签的数据集合 * 标签过滤有 `$and` 和 `$or` 两种条件类型,在同时设置了 `$and` 和 `$or` 的情况下,只有 `$and` 会生效 file: ./content/guide/dataset/dataset_engine.en.mdx meta: { "title": "Knowledge Base Search Methods and Parameters", "description": "This section covers FastGPT's knowledge base architecture, including its QA storage format and multi-vector mapping, to help you build better knowledge bases. It also explains each search parameter. This guide focuses on practical usage rather than in-depth theory." } ## Understanding Vectors FastGPT uses an Embedding-based RAG approach for its knowledge base. To use FastGPT effectively, you need a basic understanding of how `Embedding` vectors work and their characteristics. Human text, images, and other media cannot be directly understood by computers. To determine whether two pieces of text are similar or related, they typically need to be converted into a computer-readable format — vectors are one such method. A vector is essentially an array of numbers. The "distance" between two vectors can be calculated using mathematical formulas — the smaller the distance, the more similar the vectors. This maps back to text, images, and other media to measure similarity between them. Vector search leverages this principle. Since text comes in many types with countless combinations, exact matching is hard to guarantee when converting to vectors for similarity comparison. In vector-based knowledge bases, a `top-k` recall approach is typically used — finding the top `k` most similar results and passing them to an LLM for further `semantic evaluation`, `logical reasoning`, and `summarization`, enabling knowledge base Q\&A. This makes vector search the most critical step in the process. Many factors affect vector search accuracy, including: vector model quality, data quality (length, completeness, diversity), and retriever precision (the speed vs. accuracy tradeoff). Search query quality is equally important. Retriever precision is relatively straightforward to address, and training vector models is more complex, so optimizing data and query quality becomes a key focus. ### Improving Vector Search Accuracy 1. Better tokenization and chunking: When a text segment has complete and singular structure and semantics, accuracy improves. Many systems optimize their tokenizers to preserve data completeness. 2. Streamline `index` content by reducing vector content length: Shorter, more precise `index` content improves search accuracy, though it may narrow the search scope. Best suited for scenarios requiring strict answers. 3. Increase `index` quantity: Add multiple `index` entries for the same `chunk` to improve recall. 4. Optimize search queries: In practice, user questions are often vague or incomplete. Refining the query (search term) can significantly improve accuracy. 5. Fine-tune vector models: Off-the-shelf vector models are general-purpose and may underperform in specific domains. Fine-tuning can greatly improve domain-specific search results. ## FastGPT Knowledge Base Architecture ### Data Storage Structure In FastGPT, a knowledge base consists of three parts: libraries, collections, and data entries. A collection can be thought of as a "file." A library can contain multiple collections, and a collection can contain multiple data entries. The smallest searchable unit is the library — searches span the entire library. Collections are only for organizing and managing data and do not affect search results (at least for now). ![](/imgs/dataset_tree.png) ### Vector Storage Structure FastGPT uses `PostgreSQL`'s `PG Vector` extension as the vector retriever, with `HNSW` indexing. `PostgreSQL` is used solely for vector search (this engine can be swapped for other databases), while `MongoDB` handles all other data storage. In `MongoDB`'s `dataset.datas` collection, vector source data is stored along with an `indexes` field that records corresponding vector IDs. This is an array, meaning a single data entry can map to multiple vectors. In addition to default text indexes, image content can also generate image description indexes or image vector indexes when the configured models support it. In `PostgreSQL`, a `vector` field stores the vectors. During search, vectors are recalled first, then their IDs are used to look up the original data in `MongoDB`. If multiple vectors map to the same source data, they are merged and the highest vector score is used. ![](/imgs/datasetSetting1.png) ### Purpose and Usage of Multi-Vector Mapping In a single vector, content length and semantic richness are often at odds. FastGPT uses multi-vector mapping to map a single data entry to multiple vectors, preserving both data completeness and semantic richness. You can add multiple vectors to a longer text so that if any one vector is matched during search, the entire data entry is recalled. This means you can continuously improve data chunk accuracy through annotation. ### Overall Search Strategy A Knowledge Base search is not simply "user question -> vector database -> result." Depending on the input and search parameters, FastGPT combines text, images, semantic recall, full-text recall, query optimization, and reranking, then fuses multiple result paths into the final quoted content. 1. Use `Query Optimization` for coreference resolution and query expansion, improving multi-turn conversation search capability and semantic richness. 2. Use `Semantic Search`, `Full-Text Search`, or `Hybrid Search` to recall candidate content. 3. If the input contains images, use image description search or image vector search depending on model capability. 4. Use `RRF` (Reciprocal Rank Fusion) to merge results from multiple search channels. 5. Use `Rerank` for secondary sorting to improve text result relevance. 6. Apply similarity filtering and the reference limit to produce the final quoted content sent to the model. ![](/imgs/dataset_search_process.png) ### Image Search Method In Knowledge Base search, images can participate in retrieval in addition to text questions. FastGPT handles images differently depending on the configured model capabilities. Image search mainly works in two ways: 1. Image description search: If an available vision model is configured, the system can understand the image first, generate a text description, and use that description in regular text retrieval. 2. Image vector search: If the selected embedding model supports image input, the system can generate vectors for images directly and match them against image vectors in the Knowledge Base. Image search is not a separate system outside the Knowledge Base. It adds an image-input path to the existing Knowledge Base search pipeline. Common usage patterns include: * Text-to-image search: enter text to find semantically related image content. * Image-to-image search: enter an image to find visually or semantically similar image content. * Text + image search: enter both text and an image, using the text question as an additional constraint on image search results. Image search quality usually depends on image clarity, whether the image content is easy for the model to understand, whether a vision model is configured, and whether the embedding model supports image vectors. Whether an image can be retrieved does not only depend on uploading an image at search time. It also depends on which indexes were created during ingestion: | Knowledge Base capability | Text-only query | Image-only query | Text + image query | | ------------------------------------------------- | -------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------- | | Regular embedding model, no vision model | Normal text retrieval | Usually unavailable | Mainly uses the text part | | Regular embedding model with a vision model | Normal text retrieval | Converts the image into a description, then uses text retrieval | Text + image description participate in retrieval | | Image-capable embedding model, no vision model | Normal text retrieval | Image vector retrieval | Text retrieval + image vector retrieval | | Image-capable embedding model with a vision model | Text retrieval, including image descriptions | Image description + image vector retrieval | Text + image description + image vector retrieval | So when image-to-image search performs poorly, do not only adjust search parameters. Also check whether the Knowledge Base is configured with a vision model or an image-capable embedding model, and whether valid image indexes were generated during ingestion. ### Result Ranking and Fusion FastGPT fuses results from different recall paths instead of using only one path. Common paths include text vector recall, full-text recall, image description recall, image vector recall, and reranked results. Keep these points in mind: 1. `Semantic Search` relies more on vector similarity and is better for natural-language questions and semantically related content. 2. `Full-Text Search` relies more on keyword matches and is better for IDs, model numbers, proper nouns, error codes, and other exact queries. 3. `Hybrid Search` uses both semantic recall and full-text recall, then merges the results with `RRF`. 4. `Rerank` re-sorts candidate text results and works best when the question is clear and there are enough candidates. 5. Image search adds image description or image vector results, which are then fused with text-side results. This means final quoted content may not be strictly sorted by a single vector similarity score. Content matched by multiple recall paths is usually more likely to rank higher. ## Search Parameters | | | | | ------------------------------------- | ------------------------------------- | ------------------------------------- | | ![](/imgs/dataset_search_params1.png) | ![](/imgs/dataset_search_params2.png) | ![](/imgs/dataset_search_params3.png) | ### Search Modes #### Semantic Search Semantic search calculates the vector distance between the user's query and knowledge base content to determine "similarity" — mathematical similarity, not linguistic. Pros: * Understands similar semantics * Cross-language understanding (e.g., Chinese query matching English content) * Multimodal understanding (text, images, etc., depending on model capability) Cons: * Depends on model training quality * Inconsistent accuracy * Affected by keywords and sentence completeness #### Full-Text Search Uses traditional full-text search. Best for finding key subjects, predicates, and other specific terms. #### Hybrid Search Combines vector search and full-text search, merging results using the RRF formula. Generally produces richer and more accurate results. Since hybrid search covers a large range and cannot directly filter by similarity, a rerank model is typically used to re-sort results and filter by rerank scores. #### Result Reranking Uses a `ReRank` model to re-sort search results. In most cases, this significantly improves accuracy. Rerank models work better with complete questions (with proper subjects and predicates), so query optimization is usually applied before search and reranking. Reranking produces a score between `0-1` representing the relevance between the search content and the query — this score is typically more accurate than vector similarity scores and can be used for filtering. FastGPT uses `RRF` to merge rerank results, vector search results, and full-text search results into the final output. ### Search Filters #### Reference Limit The maximum number of `tokens` to reference per search. Instead of using `top k`, we found that in mixed knowledge bases (Q\&A + document), different `chunk` lengths vary significantly, making `top k` results unstable. Using a `token` limit provides more consistent control. #### Minimum Relevance A value between `0-1` that filters out low-relevance search results. This only takes effect when using `Semantic Search` or `Result Reranking`. Note that minimum relevance is a filtering threshold, not the final sorting rule. After query optimization, hybrid search, image search, or result reranking is enabled, final results may be fused from multiple recall paths and may not be strictly sorted by a single vector similarity score. ### Query Optimization #### Background In RAG, we need to perform embedding searches against the database based on the input query to find similar content (i.e., knowledge base search). During search — especially in multi-turn conversations — follow-up questions often fail to find relevant content because knowledge base search only uses the "current" question. Consider this example: ![](/imgs/coreferenceResolution2.webp) When the user asks "What's the second point?", the system searches for "What's the second point?" in the knowledge base, which returns nothing useful. The actual query should be "What is the QA structure?". This is why we need a Query Optimization module to complete the user's current question, enabling the knowledge base search to find relevant content. Here's the result after optimization: ![](/imgs/coreferenceResolution3.webp) #### How It Works Before performing `data retrieval`, the model first performs `coreference resolution` and `query expansion`. This resolves ambiguous references and enriches the query's semantic content. You can view the optimized query in the conversation details after each interaction. Query Optimization adds an extra model call before the actual search. It often improves retrieval in multi-turn conversations, but it also increases total latency. If the current question is already clear, or response speed is more important, decide whether to enable it based on actual results. ### Common Tuning Tips If search results are not as expected, start from the symptom. Avoid changing every parameter at once. | Symptom | What to check or adjust first | | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | No results found | Confirm the data has finished training; lower the minimum relevance; increase the reference limit; check whether the question is too short or missing a subject | | Results are too broad or off-topic | Raise the minimum relevance; reduce the reference limit; improve chunking; check whether recalled content contains too many unrelated chunks | | IDs, model numbers, or proper nouns are inaccurate | Use full-text or hybrid search; reduce semantic search weight; avoid overusing query optimization for exact ID queries | | Natural-language questions do not retrieve well | Use semantic or hybrid search; enable query optimization; add more accurate indexes to the data | | Query optimization makes search slower | Query optimization adds an extra model call. Use a faster optimization model, or enable it only for follow-up questions and short queries | | Rerank still gives poor ordering | Check whether the user question is complete; make sure enough candidates are recalled; adjust minimum relevance and reference limit | | Image-to-image search is weak | Confirm the embedding model supports image input; confirm image vector indexes were generated during ingestion; check whether the image is clear and has an obvious subject | | Text + image search is unstable | Clarify whether text or image should be more important; if you only want visual similarity, reduce extra text constraints | file: ./content/guide/dataset/dataset_engine.mdx meta: { "title": "知识库搜索方案和参数", "description": "本节会详细介绍 FastGPT 知识库结构设计,理解其 QA 的存储格式和多向量映射,以便更好的构建知识库。同时会介绍每个搜索参数的功能。这篇介绍主要以使用为主,详细原理不多介绍。" } ## 理解向量 FastGPT 采用了 RAG 中的 Embedding 方案构建知识库,要使用好 FastGPT 需要简单的理解 `Embedding` 向量是如何工作的及其特点。 人类的文字、图片等媒介是无法直接被计算机理解的,要想让计算机理解两段文字是否有相似性、相关性,通常需要将它们转成计算机可以理解的语言,向量是其中的一种方式。 向量可以简单理解为一个数字数组,两个向量之间可以通过数学公式得出一个 `距离`,距离越小代表两个向量的相似度越大。从而映射到文字、图片等媒介上,可以用来判断两个媒介之间的相似度。向量搜索便是利用了这个原理。 而由于文字是有多种类型,并且拥有成千上万种组合方式,因此在转成向量进行相似度匹配时,很难保障其精确性。在向量方案构建的知识库中,通常使用 `topk` 召回的方式,也就是查找前 `k` 个最相似的内容,丢给大模型去做更进一步的 `语义判断`、`逻辑推理` 和 `归纳总结`,从而实现知识库问答。因此,在知识库问答中,向量搜索的环节是最为重要的。 影响向量搜索精度的因素非常多,主要包括:向量模型的质量、数据的质量(长度,完整性,多样性)、检索器的精度(速度与精度之间的取舍)。与数据质量对应的就是检索词的质量。 检索器的精度比较容易解决,向量模型的训练略复杂,因此数据和检索词质量优化成了一个重要的环节。 ### 提高向量搜索精度的方法 1. 更好分词分段:当一段话的结构和语义是完整的,并且是单一的,精度也会提高。因此,许多系统都会优化分词器,尽可能的保障每组数据的完整性。 2. 精简 `index` 的内容,减少向量内容的长度:当 `index` 的内容更少,更准确时,检索精度自然会提高。但与此同时,会牺牲一定的检索范围,适合答案较为严格的场景。 3. 丰富 `index` 的数量,可以为同一个 `chunk` 内容增加多组 `index`。 4. 优化检索词:在实际使用过程中,用户的问题通常是模糊的或是缺失的,并不一定是完整清晰的问题。因此优化用户的问题(检索词)很大程度上也可以提高精度。 5. 微调向量模型:由于市面上直接使用的向量模型都是通用型模型,在特定领域的检索精度并不高,因此微调向量模型可以很大程度上提高专业领域的检索效果。 ## FastGPT 构建知识库方案 ### 数据存储结构 在 FastGPT 中,整个知识库由库、集合和数据 3 部分组成。集合可以简单理解为一个 `文件`。一个 `库` 中可以包含多个 `集合`,一个 `集合` 中可以包含多组 `数据`。最小的搜索单位是 `库`,也就是说,知识库搜索时,是对整个 `库` 进行搜索,而集合仅是为了对数据进行分类管理,与搜索效果无关。(起码目前还是) ![](/imgs/dataset_tree.png) ### 向量存储结构 FastGPT 采用了 `PostgresSQL` 的 `PG Vector` 插件作为向量检索器,索引为 `HNSW`。且 `PostgresSQL` 仅用于向量检索(该引擎可以替换成其它数据库),`MongoDB` 用于其他数据的存取。 在 `MongoDB` 的 `dataset.datas` 表中,会存储向量原数据的信息,同时有一个 `indexes` 字段,会记录其对应的向量 ID,这是一个数组,也就是说,一组数据可以对应多个向量。除默认文本索引外,如果模型能力支持,图片内容也可以生成图片描述索引或图片向量索引。 在 `PostgresSQL` 的表中,设置一个 `vector` 字段用于存储向量。在检索时,会先召回向量,再根据向量的 ID,去 `MongoDB` 中寻找原数据内容,如果对应了同一组原数据,则进行合并,向量得分取最高得分。 ![](/imgs/datasetSetting1.png) ### 多向量的目的和使用方式 在一组向量中,内容的长度和语义的丰富度通常是矛盾的,无法兼得。因此,FastGPT 采用了多向量映射的方式,将一组数据映射到多组向量中,从而保障数据的完整性和语义的丰富度。 你可以为一组较长的文本,添加多组向量,从而在检索时,只要其中一组向量被检索到,该数据也将被召回。 意味着,你可以通过标注数据块的方式,不断提高数据块的精度。 ### 整体检索方案 一次知识库检索不是简单的“用户问题 -> 向量库 -> 返回结果”。FastGPT 会根据输入内容和搜索参数,将文本、图片、语义召回、全文召回、问题优化和重排等能力组合起来,最后再把多路结果融合成引用内容。 1. 通过 `问题优化` 实现指代消除和问题扩展,从而增加连续对话的检索能力以及语义丰富度。 2. 通过 `语义检索`、`全文检索` 或 `混合检索` 召回候选内容。 3. 如果输入中包含图片,会根据模型能力额外进行图片描述检索或图片向量检索。 4. 通过 `RRF` 合并方式,综合多个渠道的检索效果。 5. 通过 `Rerank` 来二次排序,提高文本结果的相关性。 6. 最终经过相似度过滤和引用上限裁剪,得到返回给模型的引用内容。 ![](/imgs/dataset_search_process.png) ### 图片检索方案 在知识库搜索中,除了文本问题外,也可以让图片参与检索。FastGPT 会根据当前模型能力,对图片进行不同处理。 图片检索主要有两种方式: 1. 图片描述检索:如果配置了可用的视觉模型,系统可以先理解图片内容,并生成一段文本描述,再使用这段描述参与普通文本检索。 2. 图片向量检索:如果当前向量模型支持图片输入,系统可以直接对图片生成向量,并与知识库中的图片向量进行相似度匹配。 因此,图片检索不是独立于知识库之外的一套能力,而是在原有知识库搜索链路上增加了图片输入的处理路径。 常见使用方式包括: * 文搜图:输入文字,搜索语义相关的图片内容。 * 图搜图:输入图片,搜索视觉或语义相似的图片内容。 * 图文混合搜索:同时输入文字和图片,让文字问题对图片搜索结果进行补充约束。 图片检索效果通常取决于图片清晰度、图片内容是否容易被模型理解、是否配置了视觉模型,以及向量模型是否支持图片向量。 需要注意的是,图片能否被检索到,不只取决于搜索时是否上传了图片,也取决于入库时是否建立了对应索引: | 知识库能力 | 纯文本查询 | 纯图片查询 | 图文混合查询 | | --------------- | ------------- | --------------- | -------------------- | | 普通向量模型,无视觉模型 | 正常文本检索 | 基本不可用 | 主要使用文字部分 | | 普通向量模型,有视觉模型 | 正常文本检索 | 图片先转成描述,再参与文本检索 | 文字 + 图片描述共同参与检索 | | 支持图片的向量模型,无视觉模型 | 正常文本检索 | 图片向量检索 | 文本检索 + 图片向量检索 | | 支持图片的向量模型,有视觉模型 | 文本检索,也可命中图片描述 | 图片描述 + 图片向量双路检索 | 文本 + 图片描述 + 图片向量多路检索 | 所以,图搜图效果不理想时,除了调整搜索参数,也要确认当前知识库是否配置了视觉模型或支持图片的向量模型,以及图片入库时是否生成了有效的图片索引。 ### 结果排序与融合 FastGPT 会把不同召回路径的结果进行融合,而不是简单采用某一路结果。常见路径包括文本向量召回、全文召回、图片描述召回、图片向量召回和重排结果。 因此,最终排序需要这样理解: 1. `语义检索` 更依赖向量相似度,适合自然语言问题和语义相近内容。 2. `全文检索` 更依赖关键词命中,适合编号、型号、专有名词、错误码等精确查询。 3. `混合检索` 会同时使用语义召回和全文召回,再通过 `RRF` 融合结果。 4. `Rerank` 会对候选文本进行二次排序,更适合文本问题明确、候选结果较多的场景。 5. 图片检索会额外引入图片描述或图片向量结果,最终和文本侧结果一起融合。 这意味着,最终引用内容不一定严格按照单一向量相似度排序。某条内容如果同时被多路召回命中,通常会更容易排在前面。 ## 搜索参数 | | | | | ------------------------------------- | ------------------------------------- | ------------------------------------- | | ![](/imgs/dataset_search_params1.png) | ![](/imgs/dataset_search_params2.png) | ![](/imgs/dataset_search_params3.png) | ### 搜索模式 #### 语义检索 语义检索是通过向量距离,计算用户问题与知识库内容的距离,从而得出“相似度”,当然这并不是语文上的相似度,而是数学上的。 优点: * 相近语义理解 * 跨多语言理解(例如输入中文问题匹配英文知识点) * 多模态理解(文本、图片等,取决于模型能力) 缺点: * 依赖模型训练效果 * 精度不稳定 * 受关键词和句子完整度影响 #### 全文检索 采用传统的全文检索方式。适合查找关键的主谓语等。 #### 混合检索 同时使用向量检索和全文检索,并通过 RRF 公式进行两个搜索结果合并,一般情况下搜索结果会更加丰富准确。 由于混合检索后的查找范围很大,并且无法直接进行相似度过滤,通常需要进行利用重排模型进行一次结果重新排序,并利用重排的得分进行过滤。 #### 结果重排 利用 `ReRank` 模型对搜索结果进行重排,绝大多数情况下,可以有效提高搜索结果的准确率。不过,重排模型与问题的完整度(主谓语齐全)有一些关系,通常会先走问题优化后再进行搜索 - 重排。重排后可以得到一个 `0-1` 的得分,代表着搜索内容与问题的相关度,该分数通常比向量的得分更加精确,可以根据得分进行过滤。 FastGPT 会使用 `RRF` 对重排结果、向量搜索结果、全文检索结果进行合并,得到最终的搜索结果。 ### 搜索过滤 #### 引用上限 每次搜索最多引用 `n` 个 `tokens` 的内容。 之所以不采用 `top k`,是发现在混合知识库(问答库、文档库)时,不同 `chunk` 的长度差距很大,会导致 `top k` 的结果不稳定,因此采用了 `tokens` 的方式进行引用上限的控制。 #### 最低相关度 一个 `0-1` 的数值,会过滤掉一些低相关度的搜索结果。 该值仅在 `语义检索` 或使用 `结果重排` 时生效。 需要注意的是,最低相关度是过滤阈值,不是最终排序规则。开启问题优化、混合检索、图片检索或结果重排后,最终结果可能会经过多路召回融合,不一定严格按照单一向量相似度排序。 ### 问题优化 #### 背景 在 RAG 中,我们需要根据输入的问题去数据库里执行 embedding 搜索,查找相关的内容,从而查找到相似的内容(简称知识库搜索)。 在搜索的过程中,尤其是连续对话的搜索,我们通常会发现后续的问题难以搜索到合适的内容,其中一个原因是知识库搜索只会使用“当前”的问题去执行。看下面的例子: ![](/imgs/coreferenceResolution2.webp) 用户在提问“第二点是什么”的时候,只会去知识库里查找“第二点是什么”,压根查不到内容。实际上需要查询的是“QA 结构是什么”。因此我们需要引入一个【问题优化】模块,来对用户当前的问题进行补全,从而使得知识库搜索能够搜索到合适的内容。使用补全后效果如下: ![](/imgs/coreferenceResolution3.webp) #### 实现方式 在进行 `数据检索` 前,会先让模型进行 `指代消除` 与 `问题扩展`,一方面可以可以解决指代对象不明确问题,同时可以扩展问题的语义丰富度。你可以通过每次对话后的对话详情,查看补全的结果。 问题优化会在正式检索前增加一次模型调用,因此通常会提升连续对话检索效果,但也会增加整体耗时。如果当前问题本身已经非常明确,或对响应速度要求更高,可以根据实际效果决定是否开启。 ### 常见调参建议 如果搜索结果不符合预期,可以先根据现象定位问题,不建议一次性调整所有参数。 | 现象 | 优先检查和调整 | | -------------- | ---------------------------------------------- | | 搜不到内容 | 确认数据是否已完成训练;适当降低最低相关度;提高引用上限;检查问题是否过短或缺少主体 | | 结果太泛、答非所问 | 提高最低相关度;减少引用上限;优化数据分块;检查召回内容是否包含过多无关片段 | | 编号、型号、专有名词搜不准 | 使用全文检索或混合检索;降低语义检索权重;避免对精确编号类问题过度使用问题优化 | | 自然语言问法搜不准 | 使用语义检索或混合检索;开启问题优化;补充更准确的数据索引 | | 开启问题优化后变慢 | 问题优化会额外调用模型,可以换更快的优化模型,或只在多轮追问、短问题场景中开启 | | Rerank 后仍然排序不准 | 确认用户问题是否完整;检查召回候选是否足够;适当调整最低相关度和引用上限 | | 图搜图效果弱 | 确认向量模型是否支持图片输入;确认入库时是否生成图片向量索引;检查图片是否清晰、主体是否明确 | | 图文混合结果不稳定 | 明确文字和图片哪个更重要;如果只想找视觉相似图片,减少额外文字约束 | file: ./content/guide/dataset/faq.en.mdx meta: { "title": "Knowledge Base Usage", "description": "Common Knowledge Base usage questions" } ## Garbled File Content Re-save the file with UTF-8 encoding. ## Processing Model vs. Index Model * **File Processing Model**: Used for **Enhanced Processing** and **Q\&A Splitting** during data ingestion. Enhanced Processing generates related questions and summaries; Q\&A Splitting generates question-answer pairs. * **Index Model**: Used for vectorization — it processes and organizes text data into a structure optimized for fast retrieval. ## Excel File Import Yes. You can upload xlsx and other spreadsheet formats, not just CSV. ## Token Calculation All token counts use the GPT-3.5 tokenizer as the standard. ## Restore a Rerank Model ![](/imgs/dataset3.png) Add the rerank model configuration in your `config.json` file, then you'll be able to select it again. ## Data Retention After Expiration On the free plan, Knowledge Base data is cleared after 30 days of inactivity (no login). Apps are not affected. Paid plans automatically downgrade to the free plan upon expiration. ![](/imgs/dataset4.png) ## Too Many Results Interrupt Answers FastGPT calculates the maximum response length as: Max Response = min(Configured Max Response, Max Context Window - History) For example, with an 18K context model, input + output share the same window. As output grows, available input shrinks. To fix this: 1. Check your configured max response (response limit) setting. 2. Reduce input to free up space for output — specifically, reduce the number of chat history turns included in the workflow. Where to find the max response setting: ![](/imgs/dataset1.png) ![](/imgs/dataset2.png) For self-hosted deployments, you can reserve headroom when configuring model context limits. For example, set a 128K model to 120K — the remaining space will be allocated to output. ## Chat History Context Limits FastGPT calculates the maximum response length as: Max Response = min(Configured Max Response, Max Context Window - History) For example, with an 18K context model, input + output share the same window. As output grows, available input shrinks. To fix this: 1. Check your configured max response (response limit) setting. 2. Reduce input to free up space for output — specifically, reduce the number of chat history turns included in the workflow. Where to find the max response setting: ![](/imgs/dataset1.png) ![](/imgs/dataset2.png) For self-hosted deployments, you can reserve headroom when configuring model context limits. For example, set a 128K model to 120K — the remaining space will be allocated to output. file: ./content/guide/dataset/faq.mdx meta: { "title": "常见问题", "description": "知识库常见问题" } ## 文件解析失败 未打开 PDF 增强解析。如果在上传文件设置参数时,没有打开【PDF 增强解析】设置时,需要在 Admin 后台正确配置 OCR 模块以支持增强解析。 ## 文件中文乱码 将文件另存为 UTF-8 编码格式。 ## 文件处理模型与索引模型 * **文件处理模型**:用于数据处理的【增强处理】和【问答拆分】。在【增强处理】中,生成相关问题和摘要,在【问答拆分】中执行问答对生成。 * **索引模型**:用于向量化,即通过对文本数据进行处理和组织,构建出一个能够快速查询的数据结构。 ## Excel 文件导入 xlsx 等都可以上传的,不止支持 CSV。 ## Tokens 计算方式 统一按 gpt3.5 标准。 ## 恢复重排模型 ![](/imgs/dataset3.png) config.json 文件里面配置后就可以勾选重排模型 ## 套餐到期后的数据保留 免费版是三十天不登录后清空知识库,应用不会动。其他付费套餐到期后自动切免费版。![](/imgs/dataset4.png) ## 知识库结果过多导致回答中断 FastGPT 回复长度计算公式: 最大回复=min(配置的最大回复(内置的限制),最大上下文(输入和输出的总和)- 历史记录) 18K 模型 ->输入与输出的和 输出增多 ->输入减小 所以可以: 1. 检查配置的最大回复(回复上限) 2. 减小输入来增大输出,即减小历史记录,在工作流其实也就是“聊天记录” 配置的最大回复: ![](/imgs/dataset1.png) ![](/imgs/dataset2.png) 另外私有化部署的时候,后台配模型参数,可以在配置最大上文时,预留一些空间,比如 128000 的模型,可以只配置 120000, 剩余的空间后续会被安排给输出 ## 聊天记录触发上下文限制 FastGPT 回复长度计算公式: 最大回复=min(配置的最大回复(内置的限制),最大上下文(输入和输出的总和)- 历史记录) 18K 模型 ->输入与输出的和 输出增多 ->输入减小 所以可以: 1. 检查配置的最大回复(回复上限) 2. 减小输入来增大输出,即减小历史记录,在工作流其实也就是“聊天记录” 配置的最大回复: ![](/imgs/dataset1.png) ![](/imgs/dataset2.png) 另外,私有化部署的时候,后台配模型参数,可以在配置最大上文时,预留一些空间,比如 128000 的模型,可以只配置 120000, 剩余的空间后续会被安排给输出。 ## 知识库页面闪烁 未配置索引模型,补齐索引模型配置。 file: ./content/guide/dataset/rag.en.mdx meta: { "title": "Knowledge Base Fundamentals", "description": "This section covers the core mechanisms, application scenarios, advantages, and limitations of the RAG model in generation tasks." } [RAG Documentation](https://huggingface.co/docs/transformers/model_doc/rag) # 1. Introduction As natural language processing (NLP) technology has advanced rapidly, generative language models (such as GPT and BART) have excelled at text generation tasks, particularly in language generation and context understanding. However, purely generative models have inherent limitations when handling factual tasks. Since these models rely on fixed pre-training data, they may "hallucinate" — fabricating information when answering questions that require up-to-date or real-time knowledge, leading to inaccurate or unfounded results. Additionally, generative models often struggle with long-tail questions and complex reasoning tasks due to a lack of domain-specific external knowledge. Meanwhile, retrieval models (Retrievers) can quickly locate relevant information across massive document collections, addressing factual query needs. However, traditional retrieval models (such as BM25) often return isolated results when facing ambiguous queries or cross-domain questions, and cannot generate coherent natural language answers. Without contextual reasoning capabilities, the answers they produce tend to lack coherence and completeness. To address the shortcomings of both approaches, Retrieval-Augmented Generation (RAG) was developed. RAG combines the strengths of generative and retrieval models by fetching relevant information from external knowledge bases in real time and incorporating it into the generation process. This ensures that generated text is both contextually coherent and factually grounded. This hybrid architecture performs particularly well in intelligent Q\&A, information retrieval and reasoning, and domain-specific content generation. ## 1.1 Definition of RAG RAG is a hybrid architecture that combines information retrieval with generative models. First, the retriever fetches content fragments relevant to the user's query from an external knowledge base or document collection. Then, the generator produces natural language output based on these retrieved fragments, ensuring the output is information-rich, highly relevant, and accurate. # 2. Core Mechanisms of RAG RAG models consist of two main modules: the Retriever and the Generator. These modules work together to ensure generated text contains relevant external knowledge while maintaining natural, fluent language. ## 2.1 Retriever The retriever's primary task is to fetch the most relevant content from an external knowledge base or document collection for a given input query. Common techniques in RAG include: * Vector retrieval: Using models like BERT to convert documents and queries into vector space representations, then matching them via similarity calculations. Vector retrieval excels at capturing semantic similarity rather than relying solely on lexical matching. * Traditional retrieval algorithms: Such as BM25, which uses term frequency and inverse document frequency (TF-IDF) weighted scoring to rank and retrieve documents. BM25 works well for straightforward keyword matching tasks. The retriever in RAG provides contextual background for the generator, enabling it to produce more relevant answers based on the retrieved document fragments. ## 2.2 Generator The generator is responsible for producing the final natural language output. Common generators in RAG systems include: * BART: A sequence-to-sequence model focused on text generation, capable of improving output quality through various noise-handling techniques. * GPT series: Pre-trained language models that excel at generating fluent, natural text, particularly strong in generation tasks thanks to large-scale training data. After receiving document fragments from the retriever, the generator uses them as context alongside the input query to produce relevant, natural text answers. This ensures the output draws on both existing knowledge and the latest external information. ## 2.3 RAG Workflow The RAG model workflow can be summarized as follows: 1. Input query: The user submits a question, which the system converts to a vector representation. 2. Document retrieval: The retriever extracts the most relevant document fragments from the knowledge base, typically using vector retrieval or traditional techniques like BM25. 3. Answer generation: The generator receives the retrieved fragments and produces a natural language answer based on both the original query and the retrieved context, providing richer, more contextually relevant responses. 4. Output: The generated answer is returned to the user, ensuring they receive an accurate response grounded in relevant, up-to-date information. # 3. How RAG Works ## 3.1 Retrieval Phase In RAG, the user's query is first converted to a vector representation, then vector search is performed against the knowledge base. The retriever typically uses pre-trained models like BERT to generate vector representations of both queries and document fragments, matching the most relevant fragments through similarity calculations (such as cosine similarity). RAG's retriever goes beyond simple keyword matching by using semantic-level vector representations, enabling more accurate results even for complex or ambiguous queries. This step is critical because retrieval quality directly determines the context available to the generator. ## 3.2 Generation Phase The generation phase is the core of RAG. The generator produces coherent, natural text answers based on retrieved content. RAG generators like BART or GPT combine the user's query with retrieved document fragments to produce more precise and comprehensive answers. Unlike traditional generative models, RAG's generator can incorporate factual information from external knowledge bases, improving accuracy. ## 3.3 Multi-Turn Interaction and Feedback RAG models effectively support multi-turn interactions in dialogue systems. Each round's query and generated results serve as input for the next round. Through this feedback loop, RAG progressively refines its retrieval and generation strategies, producing increasingly relevant answers across multiple conversation turns. This also enhances RAG's adaptability in complex dialogue scenarios involving cross-turn knowledge integration and reasoning. # 4. Advantages and Limitations of RAG ## 4.1 Advantages * Information completeness: RAG combines retrieval and generation, producing text that is both naturally fluent and grounded in real-time information from external knowledge bases. This significantly improves accuracy in knowledge-intensive scenarios like medical Q\&A or legal opinion generation, avoiding the risk of hallucinated information. * Knowledge reasoning: RAG can efficiently retrieve from large-scale external knowledge bases and reason with real data to generate fact-based answers. Compared to traditional generative models, RAG handles more complex tasks, particularly cross-domain or cross-document reasoning — such as legal case analysis or financial report generation. * Strong domain adaptability: RAG adapts well across domains, performing efficient retrieval and generation within specific fields. In domains like healthcare, law, and finance that require real-time updates and high accuracy, RAG outperforms models that rely solely on pre-training. ## 4.2 Limitations Despite its strong potential and cross-domain adaptability, RAG faces several key limitations in practice that constrain large-scale deployment and optimization: #### 4.2.1 Retriever Dependency and Quality Issues RAG performance depends heavily on the quality of documents returned by the retriever. If retrieved fragments are irrelevant or inaccurate, the generated text may be biased or misleading — especially with ambiguous queries or cross-domain retrieval. * Challenge: Improving retriever precision for complex queries across large, diverse knowledge bases remains difficult. Methods like BM25 have limitations, particularly with semantically ambiguous queries where keyword matching falls short. * Solution: Adopt hybrid retrieval combining sparse retrieval (BM25) with dense retrieval (vector search). For example, Faiss enables BERT-based dense vector representations that significantly improve semantic matching, reducing the impact of irrelevant documents on generation. #### 4.2.2 Generator Computational Complexity and Performance Bottlenecks Combining retrieval and generation modules significantly increases computational complexity. When processing large datasets or long texts, the generator must integrate information from multiple document fragments, increasing generation time and reducing inference speed. This is a major bottleneck for real-time Q\&A systems. * Challenge: As knowledge base scale grows, both retrieval computation and the generator's multi-fragment integration capabilities significantly impact system efficiency. GPU and memory consumption can multiply in multi-turn dialogues or complex generation tasks. * Solution: Use model compression and knowledge distillation to reduce generator complexity and inference time. Distributed computing and model parallelization techniques like [DeepSpeed](https://www.deepspeed.ai/) can effectively handle high computational demands in large-scale scenarios. #### 4.2.3 Knowledge Base Updates and Maintenance RAG models typically rely on a pre-built external knowledge base containing documents, papers, legal provisions, and other information. The timeliness and accuracy of this content directly affects the credibility of generated results. Over time, knowledge base content may become outdated, producing answers that don't reflect current information — particularly problematic in fast-moving fields like healthcare and finance. * Challenge: Knowledge bases need frequent updates, but manual updates are time-consuming and error-prone. Implementing continuous automated updates without impacting system performance is a significant challenge. * Solution: Use automated crawlers and information extraction systems (such as Scrapy) to automatically fetch and update knowledge base content. Combined with [dynamic indexing techniques](https://arxiv.org/pdf/2102.03315), retrievers can update indexes in real time. Incremental learning allows the generator to gradually absorb new information, avoiding outdated answers. #### 4.2.4 Generated Content Controllability and Transparency RAG models have controllability and transparency challenges. In complex tasks or with ambiguous user input, the generator may produce incorrect reasoning based on inaccurate document fragments. Due to RAG's "black box" nature, users find it difficult to understand how the generator uses retrieved information — a significant concern in sensitive domains like law and healthcare, potentially eroding user trust. * Challenge: Insufficient model transparency makes it hard for users to verify the source and credibility of generated answers. For tasks requiring high explainability (medical consultations, legal advice), inability to trace answer sources undermines trust. * Solution: Introduce explainable AI (XAI) techniques like LIME or SHAP ([link](https://github.com/marcotcr/lime)) to provide detailed provenance for each generated answer, showing which knowledge fragments were referenced. Additionally, rule constraints and user feedback mechanisms can progressively optimize generator output for greater trustworthiness. # 5. RAG Improvement Directions RAG model performance depends on knowledge base accuracy and retrieval efficiency. Optimizing data collection, content chunking, retrieval precision, and answer generation are key to improving overall effectiveness. ## 5.1 Data Collection and Knowledge Base Construction RAG's core dependency is knowledge base data quality and breadth — the knowledge base serves as "external memory." A high-quality knowledge base should include content from diverse, authoritative sources such as scientific literature databases (PubMed, IEEE Xplore), established news media, and industry standards and reports. It also needs automated update capabilities to stay current. * Challenges: * Single or limited data sources leading to insufficient coverage across domains * Inconsistent data quality from non-authoritative or low-quality sources introducing bias * Lack of regular update mechanisms, especially in fast-changing fields like law, finance, and technology * Time-consuming and error-prone data processing workflows * Data sensitivity and privacy concerns in domains like healthcare, law, and finance * Improvements: * Expand data source coverage across multiple domains, including specialized databases like PubMed, LexisNexis, and financial databases * Build data quality review and filtering mechanisms using automated detection algorithms combined with manual review * Implement automated knowledge base updates using web crawlers with change detection algorithms * Adopt efficient data cleaning and classification using NLP techniques like BERT for entity recognition and text denoising * Strengthen data security with de-identification, anonymization, and differential privacy protection * Standardize data formats using JSON, XML, or knowledge graphs for structured storage * Incorporate user feedback mechanisms to continuously optimize knowledge base content ## 5.2 Data Chunking and Content Management Proper chunking strategies help models efficiently locate target information and provide clear context during answer generation. Chunking by paragraph, section, or topic improves retrieval efficiency and prevents redundant data from interfering with generation — especially important in complex, long-form text. * Challenges: * Unreasonable chunking breaking information chains and context * Redundant data causing repetitive or overloaded generated content * Inappropriate chunk granularity affecting retrieval precision * Difficulty implementing topic-based or logic-based chunking for complex texts * Improvements: * Use NLP techniques (syntactic analysis, semantic segmentation) for automated, logic-based chunking * Apply deduplication and information consolidation using similarity algorithms (TF-IDF, cosine similarity) * Dynamically adjust chunk granularity based on task requirements * Introduce topic-based chunking using topic models (LDA) or embedding-based text clustering * Implement feedback mechanisms to continuously evaluate and optimize chunking strategies ## 5.3 Retrieval Optimization The retrieval module determines the relevance and accuracy of generated answers. Hybrid retrieval strategies (combining BM25 and DPR) complement each other — BM25 handles keyword matching efficiently while DPR excels at deep semantic understanding. * Challenges: * Single retrieval strategies causing answer bias * Tension between retrieval efficiency and resource consumption * Redundant retrieval results leading to repetitive content * Poor adaptability of fixed retrieval strategies across different task types * Improvements: * Combine BM25 and DPR in a hybrid retrieval strategy — BM25 for initial keyword filtering, then DPR for deep semantic matching * Optimize retrieval efficiency using caching for frequent queries and distributed computing for parallel processing * Apply deduplication and ranking optimization algorithms to retrieval results * Dynamically adjust retrieval strategies based on task type — favoring semantic retrieval for medical Q\&A, keyword matching for news scenarios * Integrate retrieval optimization frameworks like Haystack for enhanced extensibility ## 5.4 Answer Generation and Optimization The generator produces natural language answers based on retrieved context. Accuracy and logical coherence directly impact user experience. Knowledge graphs and structured information help the generator better understand and connect context for more coherent, accurate answers. * Challenges: * Insufficient context leading to logically incoherent answers * Inadequate accuracy in specialized domain answers * Difficulty effectively integrating multi-turn user feedback * Insufficient controllability and consistency in generated content * Improvements: * Integrate knowledge graphs and structured data to enhance context understanding * Design domain-specific generation rules and terminology constraints * Optimize user feedback mechanisms for dynamic generation logic adjustment * Implement collaborative optimization between generator and retriever — allowing the generator to request additional context as needed * Apply consistency detection and semantic correction to ensure uniform terminology and logical structure ## 5.5 RAG Pipeline ![](/imgs/RAG1.png) 1. Data loading and query input: 1. The user submits a natural language query through the UI or API. 2. The input is passed to a vectorizer (such as BERT or Sentence Transformer) to convert the query into a vector representation. 2. Document retrieval: 1. The vectorized query is passed to the retriever, which finds the most relevant document fragments in the knowledge base. 2. Retrieval can use sparse techniques (BM25) or dense techniques (DPR) for improved matching efficiency and precision. 3. Generator processing and natural language generation: 1. Retrieved document fragments are fed to the generator (such as GPT, BART, or T5), which produces a natural language answer based on the query and document content. 2. The generator combines external retrieval results with pre-trained language knowledge for more precise, natural answers. 4. Result output: 1. The generated answer is returned to the user via API or UI, ensuring coherence and factual accuracy. 5. Feedback and optimization: 1. Users can provide feedback on generated answers, which the system uses to optimize retrieval and generation. 2. Through model fine-tuning or retrieval weight adjustments, the system progressively improves accuracy and efficiency. # 6. RAG Case Studies [RAG Across Various Domains](https://github.com/hymie122/RAG-Survey) # 7. RAG Applications RAG models have been widely adopted across multiple domains: ## 7.1 Intelligent Q\&A Systems * RAG generates accurate, detailed answers by retrieving from external knowledge bases in real time, avoiding the hallucination issues of traditional generative models. For example, in medical Q\&A systems, RAG can incorporate the latest medical literature to generate answers with current treatment protocols, helping medical professionals quickly access the latest research and clinical recommendations. * [Medical Q\&A System Case Study](https://www.apexon.com/blog/empowering-discovery-the-role-of-rag-architecture-generative-ai-in-healthcare-life-sciences/) * ![](/imgs/RAG2.png) * User submits a query through the web application: 1. The user enters a query in the web app, which enters the backend system and initiates the data processing pipeline. * Authentication via Azure AD: 1. The system authenticates the user through Azure Active Directory (Azure AD), ensuring only authorized users can access the system and data. * User permission check: 1. The system filters accessible content based on user group permissions managed by Azure AD. * Azure AI Search Service: 1. The filtered query is passed to Azure AI Search, which finds relevant content in indexed databases or documents using semantic search. * Document intelligence processing: 1. The system uses OCR and document extraction to convert unstructured data into structured, searchable data for Azure AI retrieval. * Document sources: 1. Documents come from pre-stored collections that have been processed and indexed before user queries. * Azure OpenAI generates response: 1. After retrieving relevant information, data is passed to Azure OpenAI, which uses natural language generation (NLG) to produce a coherent answer based on the query and retrieval results. * Response returned to user: 1. The final answer is returned through the web application, completing the query-to-response flow. * The entire pipeline demonstrates Azure AI technology integration, handling complex queries through document retrieval, intelligent processing, and natural language generation while ensuring data security and compliance. ## 7.2 Information Retrieval and Text Generation * Text generation: RAG can not only retrieve relevant documents but also generate summaries, reports, or document abstracts, enhancing coherence and accuracy. For example, in the legal domain, RAG can integrate relevant statutes and case law to generate detailed legal opinions, ensuring comprehensiveness and rigor — particularly valuable for lawyers and legal practitioners to improve efficiency. * [Legal Domain RAG Case Study](https://www.apexon.com/blog/empowering-discovery-the-role-of-rag-architecture-generative-ai-in-healthcare-life-sciences/) * Summary: * Background: Traditional LLMs perform well in generation tasks but have limitations with complex legal tasks. Legal documents have unique structures and terminology that standard retrieval benchmarks often fail to capture. LegalBench-RAG aims to provide a dedicated benchmark for evaluating legal document retrieval. * LegalBench-RAG structure: 1. ![](/imgs/RAG3.png) 2. Workflow: 3. User inputs a question (Q: ?, A: ?): The user submits a query through the interface. 4. Embed + Retrieve module: Receives the query, embeds it as a vector, and performs similarity search in external knowledge bases or documents. 5. Answer generation (A): Based on the most relevant retrieved information, the generation model produces a coherent natural language answer. 6. Compare and return results: The generated answer is compared with previous related answers and returned to the user. 7. The benchmark is built on the LegalBench dataset with 6,858 query-answer pairs traced to exact locations in original legal documents. 8. LegalBench-RAG focuses on precisely retrieving small passages from legal texts rather than broad, contextually irrelevant fragments. 9. The dataset covers various legal document types including contracts and privacy policies, ensuring coverage across multiple legal scenarios. * Significance: LegalBench-RAG is the first publicly available benchmark specifically for legal retrieval systems, providing a standardized framework for comparing retrieval algorithms in high-precision legal tasks such as citation lookup and clause interpretation. * Key challenges: 1. RAG's generation component depends on retrieved information — incorrect retrieval can lead to incorrect generation. 2. The length and terminological complexity of legal documents increase retrieval and generation difficulty. * Quality control: The dataset construction process ensures high-quality human annotations and textual precision, with multiple rounds of manual verification when mapping annotation categories and document IDs to specific text fragments. ## 7.3 Other Applications RAG can also be applied to multimodal generation scenarios, including image, audio, and 3D content generation. Cross-modal applications like ReMoDiffuse and Make-An-Audio leverage RAG technology for generation across different data modalities. In enterprise decision support, RAG can rapidly retrieve external resources (industry reports, market data) to generate high-quality forward-looking reports, enhancing strategic decision-making capabilities. ## 8. Summary This document systematically covers the core mechanisms, advantages, and applications of Retrieval-Augmented Generation (RAG). By combining generative and retrieval models, RAG addresses the hallucination problem of traditional generative models in factual tasks and the inability of retrieval models to produce coherent natural language output. RAG models retrieve information from external knowledge bases in real time, generating content that is both factually accurate and linguistically fluent — applicable to knowledge-intensive domains like healthcare, law, and intelligent Q\&A systems. In practice, while RAG offers significant advantages in information completeness, reasoning capability, and cross-domain adaptability, it also faces challenges around data quality, computational resource consumption, and knowledge base maintenance. To further improve RAG performance, this document proposes comprehensive improvements across data collection, content chunking, retrieval strategy optimization, and answer generation — including knowledge graph integration, user feedback optimization, and efficient deduplication algorithms — to enhance model applicability and efficiency. RAG has demonstrated strong potential in intelligent Q\&A, information retrieval, and text generation, and continues to expand into multimodal generation and enterprise decision support. Through hybrid retrieval techniques, knowledge graphs, and dynamic feedback mechanisms, RAG can flexibly address complex user needs, generating factually grounded and logically coherent answers. Going forward, RAG will further improve trustworthiness and practicality in specialized domains through enhanced model transparency and controllability, providing broader applications for intelligent information retrieval and content generation. file: ./content/guide/dataset/rag.mdx meta: { "title": "知识库基础原理介绍", "description": "本节详细介绍RAG模型的核心机制、应用场景及其在生成任务中的优势与局限性。" } [RAG文档](https://huggingface.co/docs/transformers/model_doc/rag) # 1. 引言 随着自然语言处理(NLP)技术的迅猛发展,生成式语言模型(如GPT、BART等)在多种文本生成任务中表现卓越,尤其在语言生成和上下文理解方面。然而,纯生成模型在处理事实类任务时存在一些固有的局限性。例如,由于这些模型依赖于固定的预训练数据,它们在回答需要最新或实时信息的问题时,可能会出现“编造”信息的现象,导致生成结果不准确或缺乏事实依据。此外,生成模型在面对长尾问题和复杂推理任务时,常因缺乏特定领域的外部知识支持而表现不佳,难以提供足够的深度和准确性。 与此同时,检索模型(Retriever)能够通过在海量文档中快速找到相关信息,解决事实查询的问题。然而,传统检索模型(如BM25)在面对模糊查询或跨域问题时,往往只能返回孤立的结果,无法生成连贯的自然语言回答。由于缺乏上下文推理能力,检索模型生成的答案通常不够连贯和完整。 为了解决这两类模型的不足,检索增强生成模型(Retrieval-Augmented Generation,RAG)应运而生。RAG通过结合生成模型和检索模型的优势,实时从外部知识库中获取相关信息,并将其融入生成任务中,确保生成的文本既具备上下文连贯性,又包含准确的知识。这种混合架构在智能问答、信息检索与推理、以及领域特定的内容生成等场景中表现尤为出色。 ## 1.1 RAG的定义 RAG是一种将信息检索与生成模型相结合的混合架构。首先,检索器从外部知识库或文档集中获取与用户查询相关的内容片段;然后,生成器基于这些检索到的内容生成自然语言输出,确保生成的内容既信息丰富,又具备高度的相关性和准确性。 # 2. RAG模型的核心机制 RAG 模型由两个主要模块构成:检索器(Retriever)与生成器(Generator)。这两个模块相互配合,确保生成的文本既包含外部的相关知识,又具备自然流畅的语言表达。 ## 2.1 检索器(Retriever) 检索器的主要任务是从一个外部知识库或文档集中获取与输入查询最相关的内容。在RAG中,常用的技术包括: * 向量检索:如BERT向量等,它通过将文档和查询转化为向量空间中的表示,并使用相似度计算来进行匹配。向量检索的优势在于能够更好地捕捉语义相似性,而不仅仅是依赖于词汇匹配。 * 传统检索算法:如BM25,主要基于词频和逆文档频率(TF-IDF)的加权搜索模型来对文档进行排序和检索。BM25适用于处理较为简单的匹配任务,尤其是当查询和文档中的关键词有直接匹配时。 RAG中检索器的作用是为生成器提供一个上下文背景,使生成器能够基于这些检索到的文档片段生成更为相关的答案。 ## 2.2 生成器(Generator) 生成器负责生成最终的自然语言输出。在RAG系统中,常用的生成器包括: * BART:BART是一种序列到序列的生成模型,专注于文本生成任务,可以通过不同层次的噪声处理来提升生成的质量 。 * GPT系列:GPT是一个典型的预训练语言模型,擅长生成流畅自然的文本。它通过大规模数据训练,能够生成相对准确的回答,尤其在任务-生成任务中表现尤为突出 。 生成器在接收来自检索器的文档片段后,会利用这些片段作为上下文,并结合输入的查询,生成相关且自然的文本回答。这确保了模型的生成结果不仅仅基于已有的知识,还能够结合外部最新的信息。 ## 2.3 RAG的工作流程 RAG模型的工作流程可以总结为以下几个步骤: 1. 输入查询:用户输入问题,系统将其转化为向量表示。 2. 文档检索:检索器从知识库中提取与查询最相关的文档片段,通常使用向量检索技术或BM25等传统技术进行。 3. 生成答案:生成器接收检索器提供的片段,并基于这些片段生成自然语言答案。生成器不仅基于原始的用户查询,还会利用检索到的片段提供更加丰富、上下文相关的答案。 4. 输出结果:生成的答案反馈给用户,这个过程确保了用户能够获得基于最新和相关信息的准确回答。 # 3. RAG模型的工作原理 ## 3.1 检索阶段 在RAG模型中,用户的查询首先被转化为向量表示,然后在知识库中执行向量检索。通常,检索器采用诸如BERT等预训练模型生成查询和文档片段的向量表示,并通过相似度计算(如余弦相似度)匹配最相关的文档片段。RAG的检索器不仅仅依赖简单的关键词匹配,而是采用语义级别的向量表示,从而在面对复杂问题或模糊查询时,能够更加准确地找到相关知识。这一步骤对于最终生成的回答至关重要,因为检索的效率和质量直接决定了生成器可利用的上下文信息 。 ## 3.2 生成阶段 生成阶段是RAG模型的核心部分,生成器负责基于检索到的内容生成连贯且自然的文本回答。RAG中的生成器,如BART或GPT等模型,结合用户输入的查询和检索到的文档片段,生成更加精准且丰富的答案。与传统生成模型相比,RAG的生成器不仅能够生成语言流畅的回答,还可以根据外部知识库中的实际信息提供更具事实依据的内容,从而提高了生成的准确性 。 ## 3.3 多轮交互与反馈机制 RAG模型在对话系统中能够有效支持多轮交互。每一轮的查询和生成结果会作为下一轮的输入,系统通过分析和学习用户的反馈,逐步优化后续查询的上下文。通过这种循环反馈机制,RAG能够更好地调整其检索和生成策略,使得在多轮对话中生成的答案越来越符合用户的期望。此外,多轮交互还增强了RAG在复杂对话场景中的适应性,使其能够处理跨多轮的知识整合和复杂推理 。 # 4. RAG的优势与局限 ## 4.1 优势 * 信息完整性:RAG 模型结合了检索与生成技术,使得生成的文本不仅语言自然流畅,还能够准确利用外部知识库提供的实时信息。这种方法能够显著提升生成任务的准确性,特别是在知识密集型场景下,如医疗问答或法律意见生成。通过从知识库中检索相关文档,RAG 模型避免了生成模型“编造”信息的风险,确保输出更具真实性 。 * 知识推理能力:RAG 能够利用大规模的外部知识库进行高效检索,并结合这些真实数据进行推理,生成基于事实的答案。相比传统生成模型,RAG 能处理更为复杂的任务,特别是涉及跨领域或跨文档的推理任务。例如,法律领域的复杂判例推理或金融领域的分析报告生成都可以通过RAG的推理能力得到优化 。 * 领域适应性强:RAG 具有良好的跨领域适应性,能够根据不同领域的知识库进行特定领域内的高效检索和生成。例如,在医疗、法律、金融等需要实时更新和高度准确性的领域,RAG 模型的表现优于仅依赖预训练的生成模型 。 ## 4.2 局限 RAG(检索增强生成)模型通过结合检索器和生成器,实现了在多种任务中知识密集型内容生成的突破性进展。然而,尽管其具有较强的应用潜力和跨领域适应能力,但在实际应用中仍然面临着一些关键局限,限制了其在大规模系统中的部署和优化。以下是RAG模型的几个主要局限性: #### 4.2.1 检索器的依赖性与质量问题 RAG模型的性能很大程度上取决于检索器返回的文档质量。由于生成器主要依赖检索器提供的上下文信息,如果检索到的文档片段不相关、不准确,生成的文本可能出现偏差,甚至产生误导性的结果。尤其在多模糊查询或跨领域检索的情况下,检索器可能无法找到合适的片段,这将直接影响生成内容的连贯性和准确性。 * 挑战:当知识库庞大且内容多样时,如何提高检索器在复杂问题下的精确度是一大挑战。当前的方法如BM25等在特定任务上有局限,尤其是在面对语义模糊的查询时,传统的关键词匹配方式可能无法提供语义上相关的内容。 * 解决途径:引入混合检索技术,如结合稀疏检索(BM25)与密集检索(如向量检索)。例如,Faiss的底层实现允许通过BERT等模型生成密集向量表示,显著提升语义级别的匹配效果。通过这种方式,检索器可以捕捉深层次的语义相似性,减少无关文档对生成器的负面影响。 #### 4.2.2 生成器的计算复杂度与性能瓶颈 RAG模型将检索和生成模块结合,尽管生成结果更加准确,但也大大增加了模型的计算复杂度。尤其在处理大规模数据集或长文本时,生成器需要处理来自多个文档片段的信息,导致生成时间明显增加,推理速度下降。对于实时问答系统或其他需要快速响应的应用场景,这种高计算复杂度是一个主要瓶颈。 * 挑战:当知识库规模扩大时,检索过程中的计算开销以及生成器在多片段上的整合能力都会显著影响系统的效率。同时,生成器也面临着资源消耗的问题,尤其是在多轮对话或复杂生成任务中,GPU和内存的消耗会成倍增加。 * 解决途径:使用模型压缩技术和知识蒸馏来减少生成器的复杂度和推理时间。此外,分布式计算与模型并行化技术的引入,如[DeepSpeed](https://www.deepspeed.ai/)和模型压缩工具,可以有效应对生成任务的高计算复杂度,提升大规模应用场景中的推理效率。 #### 4.2.3 知识库的更新与维护 RAG模型通常依赖于一个预先建立的外部知识库,该知识库可能包含文档、论文、法律条款等各类信息。然而,知识库内容的时效性和准确性直接影响到RAG生成结果的可信度。随着时间推移,知识库中的内容可能过时,导致生成的回答不能反映最新的信息。这对于需要实时信息的场景(如医疗、金融)尤其明显。 * 挑战:知识库需要频繁更新,但手动更新知识库既耗时又容易出错。如何在不影响系统性能的情况下实现知识库的持续自动更新是当前的一大挑战。 * 解决途径:利用自动化爬虫和信息提取系统,可以实现对知识库的自动化更新,例如,Scrapy等爬虫框架可以自动抓取网页数据并更新知识库。结合[动态索引技术](https://arxiv.org/pdf/2102.03315),可以帮助检索器实时更新索引,确保知识库反映最新信息。同时,结合增量学习技术,生成器可以逐步吸收新增的信息,避免生成过时答案。此外,动态索引技术也可以帮助检索器实时更新索引,确保知识库检索到的文档反映最新的内容。 #### 4.2.4 生成内容的可控性与透明度 RAG模型结合了检索与生成模块,在生成内容的可控性和透明度上存在一定问题。特别是在复杂任务或多义性较强的用户输入情况下,生成器可能会基于不准确的文档片段生成错误的推理,导致生成的答案偏离实际问题。此外,由于RAG模型的“黑箱”特性,用户难以理解生成器如何利用检索到的文档信息,这在高敏感领域如法律或医疗中尤为突出,可能导致用户对生成内容产生不信任感。 * 挑战:模型透明度不足使得用户难以验证生成答案的来源和可信度。对于需要高可解释性的任务(如医疗问诊、法律咨询等),无法追溯生成答案的知识来源会导致用户不信任模型的决策。 * 解决途径:为提高透明度,可以引入可解释性AI(XAI)技术,如LIME或SHAP([链接](https://github.com/marcotcr/lime)),为每个生成答案提供详细的溯源信息,展示所引用的知识片段。这种方法能够帮助用户理解模型的推理过程,从而增强对模型输出的信任。此外,针对生成内容的控制,可以通过加入规则约束或用户反馈机制,逐步优化生成器的输出,确保生成内容更加可信。 # 5. RAG整体改进方向 RAG模型的整体性能依赖于知识库的准确性和检索的效率,因此在数据采集、内容分块、精准检索和回答生成等环节进行优化,是提升模型效果的关键。通过加强数据来源、改进内容管理、优化检索策略及提升回答生成的准确性,RAG模型能够更加适应复杂且动态的实际应用需求。 ## 5.1 数据采集与知识库构建 RAG模型的核心依赖在于知识库的数据质量和广度,知识库在某种程度上充当着“外部记忆”的角色。因此,高质量的知识库不仅应包含广泛领域的内容,更要确保数据来源的权威性、可靠性以及时效性。知识库的数据源应涵盖多种可信的渠道,例如科学文献数据库(如PubMed、IEEE Xplore)、权威新闻媒体、行业标准和报告等,这样才能提供足够的背景信息支持RAG在不同任务中的应用。此外,为了确保RAG模型能够提供最新的回答,知识库需要具备自动化更新的能力,以避免数据内容老旧,导致回答失准或缺乏现实参考。 * 挑战: * 尽管数据采集是构建知识库的基础,但在实际操作中仍存在以下几方面的不足: * 数据采集来源单一或覆盖不全 1. RAG模型依赖多领域数据的支持,然而某些知识库过度依赖单一或有限的数据源,通常集中在某些领域,导致在多任务需求下覆盖不足。例如,依赖医学领域数据而缺乏法律和金融数据会使RAG模型在跨领域问答中表现不佳。这种局限性削弱了RAG模型在处理不同主题或多样化查询时的准确性,使得系统在应对复杂或跨领域任务时能力欠缺。 * 数据质量参差不齐 1. 数据源的质量差异直接影响知识库的可靠性。一些数据可能来源于非权威或低质量渠道,存在偏见、片面或不准确的内容。这些数据若未经筛选录入知识库,会导致RAG模型生成偏差或不准确的回答。例如,在医学领域中,如果引入未经验证的健康信息,可能导致模型给出误导性回答,产生负面影响。数据质量不一致的知识库会大大降低模型输出的可信度和适用性。 * 缺乏定期更新机制 1. 许多知识库缺乏自动化和频繁的更新机制,特别是在信息变动频繁的领域,如法律、金融和科技。若知识库长期未更新,则RAG模型无法提供最新信息,生成的回答可能过时或不具备实时参考价值。对于用户而言,特别是在需要实时信息的场景下,滞后的知识库会显著影响RAG模型的可信度和用户体验。 * 数据处理耗时且易出错 1. 数据的采集、清洗、分类和结构化处理是一项繁琐而复杂的任务,尤其是当数据量巨大且涉及多种格式时。通常,大量数据需要人工参与清洗和结构化,而自动化处理流程也存在缺陷,可能会产生错误或遗漏关键信息。低效和易出错的数据处理流程会导致知识库内容不准确、不完整,进而影响RAG模型生成的答案的准确性和连贯性。 * 数据敏感性和隐私问题 1. 一些特定领域的数据(如医疗、法律、金融)包含敏感信息,未经适当的隐私保护直接引入知识库可能带来隐私泄露的风险。此外,某些敏感数据需要严格的授权和安全存储,以确保在知识库使用中避免违规或隐私泄漏。若未能妥善处理数据隐私问题,不仅会影响系统的合规性,还可能对用户造成严重后果。 * 改进: * 针对以上不足,可以从以下几个方面进行改进,以提高数据采集和知识库构建的有效性: * 扩大数据源覆盖范围,增加数据的多样性 1. 具体实施:将知识库的数据源扩展至多个重要领域,确保包含医疗、法律、金融等关键领域的专业数据库,如PubMed、LexisNexis和金融数据库。使用具有开放许可的开源数据库和经过认证的数据,确保来源多样化且权威性强。 2. 目的与效果:通过跨领域数据覆盖,知识库的广度和深度得以增强,确保RAG模型能够在多任务场景下提供可靠回答。借助多领域合作机构的数据支持,在应对多样化需求时将更具优势。 * 构建数据质量审查与过滤机制 1. 具体实施:采用自动化数据质量检测算法,如文本相似度检查、情感偏差检测等工具,结合人工审查过滤不符合标准的数据。为数据打分并构建“数据可信度评分”,基于来源可信度、内容完整性等指标筛选数据。 2. 目的与效果:减少低质量、偏见数据的干扰,确保知识库内容的可靠性。此方法保障了RAG模型输出的权威性,特别在回答复杂或专业问题时,用户能够获得更加精准且中立的答案。 * 实现知识库的自动化更新 1. 具体实施:引入自动化数据更新系统,如网络爬虫,定期爬取可信站点、行业数据库的最新数据,并利用变化检测算法筛选出与已有知识库重复或已失效的数据。更新机制可以结合智能筛选算法,仅采纳与用户查询高相关性或时效性强的数据。 2. 目的与效果:知识库保持及时更新,确保模型在快速变化的领域(如金融、政策、科技)中提供最新信息。用户体验将因此大幅提升,特别是在需要动态或最新信息的领域,输出的内容将更具时效性。 * 采用高效的数据清洗与分类流程 1. 具体实施:使用自然语言处理技术,如BERT等模型进行数据分类、实体识别和文本去噪,结合去重算法清理重复内容。采用自动化的数据标注和分类算法,将不同数据类型分领域存储。 2. 目的与效果:数据清洗和分领域管理可以大幅提高数据处理的准确性,减少低质量数据的干扰。此改进确保RAG模型的回答生成更流畅、上下文更连贯,提升用户对生成内容的理解和信赖。 * 强化数据安全与隐私保护措施 1. 具体实施:针对医疗、法律等敏感数据,采用去标识化处理技术(如数据脱敏、匿名化等),并结合差分隐私保护。建立数据权限管理和加密存储机制,对敏感信息进行严格管控。 2. 目的与效果:在保护用户隐私的前提下,确保使用的数据合规、安全,适用于涉及个人或敏感数据的应用场景。此措施进一步保证了系统的法律合规性,并有效防止隐私泄露风险。 * 优化数据格式与结构的标准化 1. 具体实施:建立统一的数据格式与标准编码格式,例如使用JSON、XML或知识图谱形式组织结构化数据,以便于检索系统在查询时高效利用。同时,使用知识图谱等结构化工具,将复杂数据间的关系进行系统化存储。 2. 目的与效果:提高数据检索效率,确保模型在生成回答时能够高效使用数据的关键信息。标准化的数据结构支持高效的跨领域检索,并提高了RAG模型的内容准确性和知识关系的透明度。 * 用户反馈机制 1. 具体实施:通过用户反馈系统,记录用户对回答的满意度、反馈意见及改进建议。使用机器学习算法从反馈中识别知识库中的盲区与信息误差,反馈至数据管理流程中进行更新和优化。 2. 目的与效果:利用用户反馈作为数据质量的调整依据,帮助知识库持续优化内容。此方法不仅提升了RAG模型的实际效用,还使知识库更贴合用户需求,确保输出内容始终符合用户期望。 ## 5.2 数据分块与内容管理 RAG模型的数据分块与内容管理是优化检索与生成流程的关键。合理的分块策略能够帮助模型高效定位目标信息,并在回答生成时提供清晰的上下文支持。通常情况下,将数据按段落、章节或主题进行分块,不仅有助于检索效率的提升,还能避免冗余数据对生成内容造成干扰。尤其在复杂、长文本中,适当的分块策略可保证模型生成的答案具备连贯性、精确性,避免出现内容跳跃或上下文断裂的问题。 * 挑战: * 在实际操作中,数据分块与内容管理环节存在以下问题: * 分块不合理导致的信息断裂 1. 部分文本过度切割或分块策略不合理,可能导致信息链条被打断,使得模型在回答生成时缺乏必要的上下文支持。这会使生成内容显得零散,不具备连贯性,影响用户对答案的理解。例如,将法律文本或技术文档随意切割成小段落会导致重要的上下文关系丢失,降低模型的回答质量。 * 冗余数据导致生成内容重复或信息过载 1. 数据集中往往包含重复信息,若不去重或优化整合,冗余数据可能导致生成内容的重复或信息过载。这不仅影响用户体验,还会浪费计算资源。例如,在新闻数据或社交媒体内容中,热点事件的描述可能重复出现,模型在生成回答时可能反复引用相同信息。 * 分块粒度选择不当影响检索精度 1. 如果分块粒度过细,模型可能因缺乏足够的上下文而生成不准确的回答;若分块过大,检索时将难以定位具体信息,导致回答内容冗长且含有无关信息。选择适当的分块粒度对生成答案的准确性和相关性至关重要,特别是在问答任务中需要精确定位答案的情况下,粗放的分块策略会明显影响用户的阅读体验和回答的可读性。 * 难以实现基于主题或内容逻辑的分块 1. 某些复杂文本难以直接按主题或逻辑结构进行分块,尤其是内容密集或领域专业性较强的数据。基于关键字或简单的规则切割往往难以识别不同主题和信息层次,导致模型在回答生成时信息杂乱。对内容逻辑或主题的错误判断,尤其是在医学、金融等场景下,会大大影响生成答案的准确度和专业性。 * 改进: * 为提高数据分块和内容管理的有效性,可以从以下几方面进行优化: * 引入NLP技术进行自动化分块和上下文分析 1. 具体实施:借助自然语言处理(NLP)技术,通过句法分析、语义分割等方式对文本进行逻辑切割,以确保分块的合理性。可以基于BERT等预训练模型实现主题识别和上下文分析,确保每个片段均具备完整的信息链,避免信息断裂。 2. 目的与效果:确保文本切割基于逻辑或语义关系,避免信息链条被打断,生成答案时能够更具连贯性,尤其适用于长文本和复杂结构的内容,使模型在回答时上下文更加完整、连贯。 * 去重与信息整合,优化内容简洁性 1. 具体实施:利用相似度算法(如TF-IDF、余弦相似度)识别冗余内容,并结合聚类算法自动合并重复信息。针对内容频繁重复的情况,可设置内容标记或索引,避免生成时多次引用相同片段。 2. 目的与效果:通过去重和信息整合,使数据更具简洁性,避免生成答案中出现重复信息。减少冗余信息的干扰,使用户获得简明扼要的回答,增强阅读体验,同时提升生成过程的计算效率。 * 根据任务需求动态调整分块粒度 1. 具体实施:根据模型任务的不同,设置动态分块策略。例如,在问答任务中对关键信息较短的内容可采用小粒度分块,而在长文本或背景性内容中采用较大粒度。分块策略可基于查询需求或内容复杂度自动调整。 2. 目的与效果:分块粒度的动态调整确保模型在检索和生成时既能准确定位关键内容,又能为回答提供足够的上下文支持,提升生成内容的精准性和相关性,确保用户获取的信息既准确又不冗长。 * 引入基于主题的分块方法以提升上下文完整性 1. 具体实施:使用主题模型(如LDA)或嵌入式文本聚类技术,对文本内容按主题进行自动分类与分块。基于相同主题内容的聚合分块,有助于模型识别不同内容层次,尤其适用于复杂的学术文章或多章节的长篇报告。 2. 目的与效果:基于主题的分块确保同一主题的内容保持在一个片段内,提升模型在回答生成时的上下文连贯性。适用于主题复杂、层次清晰的内容场景,提高回答的专业性和条理性,使用户更容易理解生成内容的逻辑关系。 * 实时评估分块策略与内容呈现效果的反馈机制 1. 具体实施:通过用户反馈机制和生成质量评估系统实时监测生成内容的连贯性和准确性。对用户反馈中涉及分块效果差的部分进行重新分块,通过用户使用数据优化分块策略。 2. 目的与效果:用户反馈帮助识别不合理的分块和内容呈现问题,实现分块策略的动态优化,持续提升生成内容的质量和用户满意度。 ## 5.3 检索优化 在RAG模型中,检索模块决定了生成答案的相关性和准确性。有效的检索策略可确保模型获取到最适合的上下文片段,使生成的回答更加精准且贴合查询需求。常用的混合检索策略(如BM25和DPR结合)能够在关键词匹配和语义检索方面实现优势互补:BM25适合高效地处理关键字匹配任务,而DPR在理解深层语义上表现更为优异。因此,合理选用检索策略有助于在不同任务场景下达到计算资源和检索精度的平衡,以高效提供相关上下文供生成器使用。 * 挑战: * 检索优化过程中,仍面临以下不足之处: * 检索策略单一导致的回答偏差 1. 当仅依赖BM25或DPR等单一技术时,模型可能难以平衡关键词匹配与语义理解。BM25在处理具象关键字时表现良好,但在面对复杂、含义丰富的语义查询时效果欠佳;相反,DPR虽然具备深度语义匹配能力,但对高频关键词匹配的敏感度较弱。检索策略单一将导致模型难以适应复杂的用户查询,回答中出现片面性或不够精准的情况。 * 检索效率与资源消耗的矛盾 1. 检索模块需要在短时间内处理大量查询,而语义检索(如DPR)需要进行大量的计算和存储操作,计算资源消耗高,影响系统响应速度。特别是对于需要实时响应的应用场景,DPR的计算复杂度往往难以满足实际需求,因此在实时性和资源利用率上亟需优化。 * 检索结果的冗余性导致内容重复 1. 当检索策略未对结果进行去重或排序优化时,RAG模型可能从知识库中检索出相似度高但内容冗余的文档片段。这会导致生成的回答中包含重复信息,影响阅读体验,同时增加无效信息的比例,使用户难以迅速获取核心答案。 * 不同任务需求下检索策略的适配性差 1. RAG模型应用场景丰富,但不同任务对检索精度、速度和上下文长度的需求不尽相同。固定检索策略难以灵活应对多样化的任务需求,导致在应对不同任务时,模型检索效果受限。例如,面向精确性较高的医疗问答场景时,检索策略应偏向语义准确性,而在热点新闻场景中则应偏重检索速度。 * 改进: * 针对上述不足,可以从以下几个方面优化检索模块: * 结合BM25与DPR的混合检索策略 1. 具体实施:采用BM25进行关键词初筛,快速排除无关信息,然后使用DPR进行深度语义匹配筛选。这样可以有效提升检索精度,平衡关键词匹配和语义理解。 2. 目的与效果:通过多层筛选过程,确保检索结果在语义理解和关键词匹配方面互补,提升生成内容的准确性,特别适用于多意图查询或复杂的长文本检索。 * 优化检索效率,控制计算资源消耗 1. 具体实施:利用缓存机制存储近期高频查询结果,避免对相似查询的重复计算。同时,可基于分布式计算结构,将DPR的语义计算任务分散至多节点并行处理。 2. 目的与效果:缓存与分布式计算结合可显著减少检索计算压力,使系统能够在有限资源下提高响应速度,适用于高并发、实时性要求高的应用场景。 * 引入去重和排序优化算法 1. 具体实施:在检索结果中应用余弦相似度去重算法,筛除冗余内容,并基于用户偏好或时间戳对检索结果排序,以确保输出内容的丰富性和新鲜度。 2. 目的与效果:通过去重和优化排序,确保生成内容更加简洁、直接,减少重复信息的干扰,提高用户获取信息的效率和体验。 * 动态调整检索策略适应多任务需求 1. 具体实施:设置不同检索策略模板,根据任务类型自动调整检索权重、片段长度和策略组合。例如在医疗场景中偏向语义检索,而在金融新闻场景中更重视快速关键词匹配。 2. 目的与效果:动态调整检索策略使RAG模型更加灵活,能够适应不同任务需求,确保检索的精准性和生成答案的上下文适配性,显著提升多场景下的用户体验。 * 借助Haystack等检索优化框架 1. 具体实施:在RAG模型中集成Haystack框架,以实现更高效的检索效果,并利用框架中的插件生态系统来增强检索模块的可扩展性和可调节性。 2. 目的与效果:Haystack提供了检索和生成的整合接口,有助于快速优化检索模块,并适应复杂多样的用户需求,在多任务环境中提供更稳定的性能表现。 ## 5.4 回答生成与优化 在RAG模型中,生成器负责基于检索模块提供的上下文,为用户查询生成自然语言答案。生成内容的准确性和逻辑性直接决定了用户的体验,因此优化生成器的表现至关重要。通过引入知识图谱等结构化信息,生成器能够更准确地理解和关联上下文,从而生成逻辑连贯、准确的回答。此外,生成器的生成逻辑可结合用户反馈持续优化,使回答风格和内容更加符合用户需求。 * 挑战: * 在回答生成过程中,RAG模型仍面临以下不足: * 上下文不充分导致的逻辑不连贯 1. 当生成器在上下文缺失或信息不完整的情况下生成回答时,生成内容往往不够连贯,特别是在处理复杂、跨领域任务时。这种缺乏上下文支持的问题,容易导致生成器误解或忽略关键信息,最终生成内容的逻辑性和完整性欠佳。如在医学场景中,若生成器缺少对病例或症状的全面理解,可能导致回答不准确或不符合逻辑,影响专业性和用户信任度。 * 专业领域回答的准确性欠佳 1. 在医学、法律等高专业领域中,生成器的回答需要高度的准确性。然而,生成器可能因缺乏特定知识而生成不符合领域要求的回答,出现内容偏差或理解错误,尤其在涉及专业术语和复杂概念时更为明显。如在法律咨询中,生成器可能未能正确引用相关法条或判例,导致生成的答案不够精确,甚至可能产生误导。 * 难以有效整合多轮用户反馈 1. 生成器缺乏有效机制来利用多轮用户反馈进行自我优化。用户反馈可能涉及回答内容的准确性、逻辑性以及风格适配等方面,但生成器在连续对话中缺乏充分的调节机制,难以持续调整生成策略和回答风格。如在客服场景中,生成器可能连续生成不符合用户需求的回答,降低了用户满意度。 * 生成内容的可控性和一致性不足 1. 在特定领域回答生成中,生成器的输出往往不具备足够的可控性和一致性。由于缺乏领域特定的生成规则和约束,生成内容的专业性和风格一致性欠佳,难以满足高要求的应用场景。如在金融报告生成中,生成内容需要确保一致的风格和术语使用,否则会影响输出的专业性和可信度。 * 改进: * 针对以上不足,可以从以下方面优化回答生成模块: * 引入知识图谱与结构化数据,增强上下文理解 1. 具体实施:结合知识图谱或知识库,将医学、法律等专业领域的信息整合到生成过程中。生成器在生成回答时,可以从知识图谱中提取关键信息和关联知识点,确保回答具备连贯的逻辑链条。 2. 目的与效果:知识图谱的引入提升了生成内容的连贯性和准确性,尤其在高专业性领域中,通过丰富的上下文理解,使生成器能够产生符合逻辑的回答。 * 设计专业领域特定的生成规则和约束 1. 具体实施:在生成模型中加入领域特定的生成规则和用语约束,特别针对医学、法律等领域的常见问答场景,设定回答模板、术语库等,以提高生成内容的准确性和一致性。 2. 目的与效果:生成内容更具领域特征,输出风格和内容的专业性增强,有效降低了生成器在专业领域中的回答偏差,满足用户对专业性和可信度的要求。 * 优化用户反馈机制,实现动态生成逻辑调整 1. 具体实施:利用机器学习算法对用户反馈进行分析,从反馈中提取生成错误或用户需求的调整信息,动态调节生成器的生成逻辑和策略。同时,在多轮对话中逐步适应用户的需求和风格偏好。 2. 目的与效果:用户反馈的高效利用能够帮助生成器优化生成内容,提高连续对话中的响应质量,提升用户体验,并使回答更贴合用户需求。 * 引入生成器与检索器的协同优化机制 1. 具体实施:通过协同优化机制,在生成器生成答案之前,允许生成器请求检索器补充缺失的上下文信息。生成器可基于回答需求自动向检索器发起上下文补充请求,从而获取完整的上下文。 2. 目的与效果:协同优化机制保障了生成器在回答时拥有足够的上下文支持,避免信息断层或缺失,提升回答的完整性和准确性。 * 实施生成内容的一致性检测和语义校正 1. 具体实施:通过一致性检测算法对生成内容进行术语、风格的统一管理,并结合语义校正模型检测生成内容是否符合用户需求的逻辑结构。在复杂回答生成中,使用语义校正对不符合逻辑的生成内容进行自动优化。 2. 目的与效果:生成内容具备高度一致性和逻辑性,特别是在多轮对话和专业领域生成中,保障了内容的稳定性和专业水准,提高了生成答案的可信度和用户满意度。 ## 5.5 RAG流程 ![](/imgs/RAG1.png) 1. 数据加载与查询输入: 1. 用户通过界面或API提交自然语言查询,系统接收查询作为输入。 2. 输入被传递至向量化器,利用向量化技术(如BERT或Sentence Transformer)将自然语言查询转换为向量表示。 2. 文档检索: 1. 向量化后的查询会传递给检索器,检索器通过在知识库中查找最相关的文档片段。 2. 检索可以基于稀疏检索技术(如BM25)或密集检索技术(如DPR)来提高匹配效率和精度。 3. 生成器处理与自然语言生成: 1. 检索到的文档片段作为生成器的输入,生成器(如GPT、BART或T5)基于查询和文档内容生成自然语言回答。 2. 生成器结合了外部检索结果和预训练模型的语言知识,使回答更加精准、自然。 4. 结果输出: 1. 系统生成的答案通过API或界面返回给用户,确保答案连贯且知识准确。 5. 反馈与优化: 1. 用户可以对生成的答案进行反馈,系统根据反馈优化检索与生成过程。 2. 通过微调模型参数或调整检索权重,系统逐步改进其性能,确保未来查询时更高的准确性与效率。 # 6. RAG相关案例整合 [各种分类领域下的RAG](https://github.com/hymie122/RAG-Survey) # 7. RAG模型的应用 RAG模型已在多个领域得到广泛应用,主要包括: ## 7.1 智能问答系统中的应用 * RAG通过实时检索外部知识库,生成包含准确且详细的答案,避免传统生成模型可能产生的错误信息。例如,在医疗问答系统中,RAG能够结合最新的医学文献,生成包含最新治疗方案的准确答案,避免生成模型提供过时或错误的建议。这种方法帮助医疗专家快速获得最新的研究成果和诊疗建议,提升医疗决策的质量。 * [医疗问答系统案例](https://www.apexon.com/blog/empowering-discovery-the-role-of-rag-architecture-generative-ai-in-healthcare-life-sciences/) * ![](/imgs/RAG2.png) * 用户通过Web应用程序发起查询: 1. 用户在一个Web应用上输入查询请求,这个请求进入后端系统,启动了整个数据处理流程。 * 使用Azure AD进行身份验证: 1. 系统通过Azure Active Directory (Azure AD) 对用户进行身份验证,确保只有经过授权的用户才能访问系统和数据。 * 用户权限检查: 1. 系统根据用户的组权限(由Azure AD管理)过滤用户能够访问的内容。这个步骤保证了用户只能看到他们有权限查看的信息。 * Azure AI搜索服务: 1. 过滤后的用户查询被传递给Azure AI搜索服务,该服务会在已索引的数据库或文档中查找与查询相关的内容。这个搜索引擎通过语义搜索技术检索最相关的信息。 * 文档智能处理: 1. 系统使用OCR(光学字符识别)和文档提取等技术处理输入的文档,将非结构化数据转换为结构化、可搜索的数据,便于Azure AI进行检索。 * 文档来源: 1. 这些文档来自预先存储的输入文档集合,这些文档在被用户查询之前已经通过文档智能处理进行了准备和索引。 * Azure Open AI生成响应: 1. 在检索到相关信息后,数据会被传递到Azure Open AI,该模块利用自然语言生成(NLG)技术,根据用户的查询和检索结果生成连贯的回答。 * 响应返回用户: 1. 最终生成的回答通过Web应用程序返回给用户,完成整个查询到响应的流程。 * 整个流程展示了Azure AI技术的集成,通过文档检索、智能处理以及自然语言生成来处理复杂的查询,并确保了数据的安全和合规性。 ## 7.2 信息检索与文本生成 * 文本生成:RAG不仅可以检索相关文档,还能根据这些文档生成总结、报告或文档摘要,从而增强生成内容的连贯性和准确性。例如,法律领域中,RAG可以整合相关法条和判例,生成详细的法律意见书,确保内容的全面性和严谨性。这在法律咨询和文件生成过程中尤为重要,可以帮助律师和法律从业者提高工作效率。 * [法律领域检索增强生成案例](https://www.apexon.com/blog/empowering-discovery-the-role-of-rag-architecture-generative-ai-in-healthcare-life-sciences/) * 内容总结: * 背景: 传统的大语言模型 (LLMs) 在生成任务中表现优异,但在处理法律领域中的复杂任务时存在局限。法律文档具有独特的结构和术语,标准的检索评估基准往往无法充分捕捉这些领域特有的复杂性。为了弥补这一不足,LegalBench-RAG 旨在提供一个评估法律文档检索效果的专用基准。 * LegalBench-RAG 的结构: 1. ![](/imgs/RAG3.png) 2. 工作流程: 3. 用户输入问题(Q: ?,A: ?):用户通过界面输入查询问题,提出需要答案的具体问题。 4. 嵌入与检索模块(Embed + Retrieve):该模块接收到用户的查询后,会对问题进行嵌入(将其转化为向量),并在外部知识库或文档中执行相似度检索。通过检索算法,系统找到与查询相关的文档片段或信息。 5. 生成答案(A):基于检索到的最相关信息,生成模型(如GPT或类似的语言模型)根据检索的结果生成连贯的自然语言答案。 6. 对比和返回结果:生成的答案会与之前的相关问题答案进行对比,并最终将生成的答案返回给用户。 7. 该基准基于 LegalBench 的数据集,构建了 6858 个查询-答案对,并追溯到其原始法律文档的确切位置。 8. LegalBench-RAG 侧重于精确地检索法律文本中的小段落,而非宽泛的、上下文不相关的片段。 9. 数据集涵盖了合同、隐私政策等不同类型的法律文档,确保涵盖多个法律应用场景。 * 意义: LegalBench-RAG 是第一个专门针对法律检索系统的公开可用的基准。它为研究人员和公司提供了一个标准化的框架,用于比较不同的检索算法的效果,特别是在需要高精度的法律任务中,例如判决引用、条款解释等。 * 关键挑战: 1. RAG 系统的生成部分依赖检索到的信息,错误的检索结果可能导致错误的生成输出。 2. 法律文档的长度和术语复杂性增加了模型检索和生成的难度。 * 质量控制: 数据集的构建过程确保了高质量的人工注释和文本精确性,特别是在映射注释类别和文档ID到具体文本片段时进行了多次人工校验。 ## 7.3 其它应用场景 RAG还可以应用于多模态生成场景,如图像、音频和3D内容生成。例如,跨模态应用如ReMoDiffuse和Make-An-Audio利用RAG技术实现不同数据形式的生成。此外,在企业决策支持中,RAG能够快速检索外部资源(如行业报告、市场数据),生成高质量的前瞻性报告,从而提升企业战略决策的能力。 ## 8 总结 本文档系统阐述了检索增强生成(RAG)模型的核心机制、优势与应用场景。通过结合生成模型与检索模型,RAG解决了传统生成模型在面对事实性任务时的“编造”问题和检索模型难以生成连贯自然语言输出的不足。RAG模型能够实时从外部知识库获取信息,使生成内容既包含准确的知识,又具备流畅的语言表达,适用于医疗、法律、智能问答系统等多个知识密集型领域。 在应用实践中,RAG模型虽然有着信息完整性、推理能力和跨领域适应性等显著优势,但也面临着数据质量、计算资源消耗和知识库更新等挑战。为进一步提升RAG的性能,提出了针对数据采集、内容分块、检索策略优化以及回答生成的全面改进措施,如引入知识图谱、优化用户反馈机制、实施高效去重算法等,以增强模型的适用性和效率。 RAG在智能问答、信息检索与文本生成等领域展现了出色的应用潜力,并在不断发展的技术支持下进一步拓展至多模态生成和企业决策支持等场景。通过引入混合检索技术、知识图谱以及动态反馈机制,RAG能够更加灵活地应对复杂的用户需求,生成具有事实支撑和逻辑连贯性的回答。未来,RAG将通过增强模型透明性与可控性,进一步提升在专业领域中的可信度和实用性,为智能信息检索与内容生成提供更广泛的应用空间。 file: ./content/guide/dataset/template.en.mdx meta: { "title": "Template Import", "description": "Batch-import knowledge base data from a CSV or Excel template" } Template import lets you add prepared content or question-answer pairs to a knowledge base in batches. FastGPT accepts `.csv` and `.xlsx` files and creates knowledge base entries from the questions, answers, indexes, and metadata in the template. ## File Structure The first row must contain the headers. The following columns are supported: | Header | Required | Count | Description | | ---------- | -------- | ---------- | --------------------------------------------------------------- | | `q` | Yes | Exactly 1 | Content or a question | | `a` | Yes | Exactly 1 | The answer; it can be empty when importing standalone content | | `index` | No | Repeatable | A custom index. A row can contain multiple indexes | | `metadata` | No | At most 1 | A JSON object for custom information such as source or category | Each row represents one knowledge base entry. `q` and `a` should not both be empty. Headers can appear in any order, but do not add unsupported headers. ### CSV Example ```csv q,a,index,index,metadata "What is FastGPT?","FastGPT is an AI agent development platform.","FastGPT overview","AI agent platform","{""source"":""product-doc"",""category"":""overview""}" "How do I import knowledge base data?","Use a CSV or Excel template.","knowledge base import","template import","{""source"":""help-center""}" ``` Use UTF-8 encoding for CSV files. Cells that contain commas, line breaks, or double quotes must be escaped according to CSV rules. ### Excel Example Excel files use the same headers and data structure as CSV files: | q | a | index | index | metadata | | ------------------------------------ | -------------------------------------------- | --------------------- | ----------------- | ------------------------------------------------ | | What is FastGPT? | FastGPT is an AI agent development platform. | FastGPT overview | AI agent platform | `{"source":"product-doc","category":"overview"}` | | How do I import knowledge base data? | Use a CSV or Excel template. | knowledge base import | template import | `{"source":"help-center"}` | Excel files must meet these requirements: * Use the `.xlsx` extension. `.xls` files are not supported. * Include exactly one worksheet. * Do not contain merged cells. * Use the first row for the template headers. ## Import a Template 1. Open the target knowledge base and select **Template Import** from the import menu. ![Template Import dialog](/imgs/template-import-dialog.png) 2. Select **Download CSV Template** for an example, or prepare an `.xlsx` file with the same structure. 3. Add your data and verify the headers, cell contents, and file format. 4. Select the file and confirm the import. You can import one file at a time. 5. After the import finishes, review the data and training status in the knowledge base collection. ![Knowledge base collection after a template import](/imgs/template-import-result.png) ## Metadata Use `metadata` to attach structured information to each entry. The cell must contain a valid JSON object, for example: ```json { "source": "product-doc", "category": "overview", "version": 2 } ``` Do not use an array, plain text, or invalid JSON. In CSV files, escape the JSON according to CSV rules. In Excel files, enter the JSON string directly in the cell. ## Invalid File Format If FastGPT reports an invalid file format, check the following: * The file uses the `.csv` or `.xlsx` extension. * The header row contains only supported columns. * There is exactly one `q` column and one `a` column, with no more than one `metadata` column. * Quotes, commas, and line breaks are correctly escaped in CSV files. * The Excel file contains exactly one worksheet and no merged cells. Start with a small test file. After confirming the format, import larger datasets in batches. file: ./content/guide/dataset/template.mdx meta: { "title": "模板导入", "description": "使用 CSV 或 Excel 模板批量导入知识库数据" } 模板导入适合将已经整理好的内容或问答对批量写入知识库。FastGPT 支持导入 `.csv` 和 `.xlsx` 文件,并根据模板中的问题、答案、索引和元数据创建知识库数据。 ## 文件结构 文件的第一行必须是表头。支持以下列: | 表头 | 是否必需 | 数量 | 说明 | | ---------- | ---- | ------ | ----------------------- | | `q` | 是 | 1 列 | 内容或问题 | | `a` | 是 | 1 列 | 答案;导入普通内容时可以留空 | | `index` | 否 | 可重复 | 自定义索引,同一行可以填写多个索引 | | `metadata` | 否 | 最多 1 列 | JSON 对象,用于保存来源、分类等自定义信息 | 每一行代表一条知识库数据,`q` 和 `a` 不应同时为空。表头顺序不受限制,但不要使用模板之外的表头。 ### CSV 示例 ```csv q,a,index,index,metadata "FastGPT 是什么?","FastGPT 是一个 AI Agent 构建平台。","FastGPT 简介","AI Agent 平台","{""source"":""product-doc"",""category"":""overview""}" "如何导入知识库数据?","可以使用 CSV 或 Excel 模板导入。","知识库导入","模板导入","{""source"":""help-center""}" ``` CSV 文件建议使用 UTF-8 编码。如果单元格中包含逗号、换行或双引号,需要按照 CSV 规则正确转义。 ### Excel 示例 Excel 文件使用与 CSV 相同的表头和数据结构: | q | a | index | index | metadata | | ------------ | -------------------------- | ---------- | ----------- | ------------------------------------------------ | | FastGPT 是什么? | FastGPT 是一个 AI Agent 构建平台。 | FastGPT 简介 | AI Agent 平台 | `{"source":"product-doc","category":"overview"}` | | 如何导入知识库数据? | 可以使用 CSV 或 Excel 模板导入。 | 知识库导入 | 模板导入 | `{"source":"help-center"}` | Excel 文件需要满足以下要求: * 文件扩展名为 `.xlsx`,不支持 `.xls` * 只能包含一个工作表 * 不能包含合并单元格 * 第一行必须是模板表头 ## 导入步骤 1. 打开目标知识库,在导入菜单中选择「模板导入」。 ![模板导入弹窗](/imgs/template-import-dialog.png) 2. 点击「下载 CSV 模板」获取示例文件,或者按照相同结构准备 `.xlsx` 文件。 3. 填写数据并检查表头、单元格内容和文件格式。 4. 选择文件并确认导入。每次只能导入一个文件。 5. 导入完成后,在知识库集合中检查数据及训练状态。 ![模板导入完成后的知识库集合](/imgs/template-import-result.png) ## 元数据 `metadata` 用于为每条数据附加结构化信息。单元格内容应为有效的 JSON 对象,例如: ```json { "source": "product-doc", "category": "overview", "version": 2 } ``` 不要填写数组、纯文本或包含语法错误的 JSON。CSV 中的 JSON 需要按照 CSV 规则转义;Excel 单元格中可以直接填写 JSON 字符串。 ## 文件格式异常 出现「文件格式异常」提示时,请依次检查: * 文件是否为 `.csv` 或 `.xlsx` * 表头是否包含且仅包含支持的列 * `q`、`a` 是否各有一列,`metadata` 是否不超过一列 * CSV 的引号、逗号和换行是否正确转义 * Excel 是否只有一个工作表且没有合并单元格 建议先使用少量数据测试,确认格式正确后再分批导入大量数据。 file: ./content/guide/dataset/websync.en.mdx meta: { "title": "Web Site Sync", "description": "Introduction and usage of the FastGPT Web Site Sync feature" } ![](/imgs/webSync1.jpg) This feature is currently only available to commercial edition users. ## What is Web Site Sync Web Site Sync uses crawler technology to automatically discover all pages under the `same domain` from an entry URL, supporting up to `200` sub-pages. For compliance and security reasons, FastGPT only supports crawling `static sites`, primarily intended for quickly building knowledge bases from documentation sites. Tip: Most China-based media sites are not supported, including WeChat Official Accounts, CSDN, Zhihu, etc. You can verify whether a site is static by sending a `curl` request from the terminal: ```bash curl https://doc.fastgpt.io/guide/getting-started ``` ## How to Use ### 1. Create a New Knowledge Base and Select Web Site Sync ![](/imgs/webSync2.jpg) ![](/imgs/webSync3.jpg) ### 2. Click to Configure Site Information ![](/imgs/webSync4.jpg) ### 3. Enter the URL and Selector ![](/imgs/webSync5.jpg) ![](/imgs/webSync5-1.jpg) Click Start Sync and wait for the system to automatically crawl the site content. ## Create an App and Bind the Knowledge Base ![](/imgs/webSync6.jpg) ## How to Use Selectors Selectors are based on HTML/CSS/JS. You can use selectors to target specific content to crawl rather than the entire site. Here's how: ### Open the Browser DevTools (usually F12, or Right-click > Inspect) ![](/imgs/webSync7.webp) ![](/imgs/webSync8.webp) ### Enter the Element Selector For a CSS selectors reference, see the [MDN CSS Selectors guide](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors). In the image above, we selected an area corresponding to a `div` tag with three attributes: `data-prismjs-copy`, `data-prismjs-copy-success`, and `data-prismjs-copy-error`. We only need one, so the selector is: **`div[data-prismjs-copy]`** Besides attribute selectors, class and ID selectors are also common. For example: ![](/imgs/webSync9.webp) The `class` in the image contains class names (there may be multiple separated by spaces — just pick one). The selector would be: **`.docs-content`** ### Using Multiple Selectors In the earlier demo, we used multiple selectors for the FastGPT documentation site, separated by commas. ![](/imgs/webSync10.webp) We want to select content from the two tags shown above, which requires two selectors. The first is: `.docs-content .mb-0.d-flex`, meaning child elements under the `docs-content` class that have both the `mb-0` and `d-flex` classes. The second is `.docs-content div[data-prismjs-copy]`, meaning `div` elements under the `docs-content` class that have the `data-prismjs-copy` attribute. Separate the two selectors with a comma: `.docs-content .mb-0.d-flex, .docs-content div[data-prismjs-copy]` file: ./content/guide/dataset/websync.mdx meta: { "title": "Web 站点同步", "description": "FastGPT Web 站点同步功能介绍和使用方式" } ![](/imgs/webSync1.jpg) 该功能目前仅向商业版用户开放。 ## 什么是 Web 站点同步 Web 站点同步利用爬虫的技术,可以通过一个入口网站,自动捕获`同域名`下的所有网站,目前最多支持`200`个子页面。出于合规与安全角度,FastGPT 仅支持`静态站点`的爬取,主要用于各个文档站点快速构建知识库。 Tips: 国内的媒体站点基本不可用,公众号、csdn、知乎等。可以通过终端发送`curl`请求检测是否为静态站点,例如: ```bash curl https://doc.fastgpt.io/guide/getting-started ``` ## 如何使用 ### 1. 新建知识库,选择 Web 站点同步 ![](/imgs/webSync2.jpg) ![](/imgs/webSync3.jpg) ### 2. 点击配置站点信息 ![](/imgs/webSync4.jpg) ### 3. 填写网址和选择器 ![](/imgs/webSync5.jpg) ![](/imgs/webSync5-1.jpg) 好了, 现在点击开始同步,静等系统自动抓取网站信息即可。 ## 创建应用,绑定知识库 ![](/imgs/webSync6.jpg) ## 选择器如何使用 选择器是 HTML CSS JS 的产物,你可以通过选择器来定位到你需要抓取的具体内容,而不是整个站点。使用方式为: ### 首先打开浏览器调试面板(通常是 F12,或者【右键 - 检查】) ![](/imgs/webSync7.webp) ![](/imgs/webSync8.webp) ### 输入对应元素的选择器 [菜鸟教程 css 选择器](https://www.runoob.com/cssref/css-selectors.html),具体选择器的使用方式可以参考菜鸟教程。 上图中,我们选中了一个区域,对应的是`div`标签,它有 `data-prismjs-copy`, `data-prismjs-copy-success`, `data-prismjs-copy-error` 三个属性,这里我们用到一个就够。所以选择器是: **`div[data-prismjs-copy]`** 除了属性选择器,常见的还有类和ID选择器。例如: ![](/imgs/webSync9.webp) 上图 class 里的是类名(可能包含多个类名,都是空格隔开的,选择一个即可),选择器可以为:**`.docs-content`** ### 多选择器使用 在开头的演示中,我们对 FastGPT 文档是使用了多选择器的方式来选择,通过逗号隔开了两个选择器。 ![](/imgs/webSync10.webp) 我们希望选中上图两个标签中的内容,此时就需要两组选择器。一组是:`.docs-content .mb-0.d-flex`,含义是 `docs-content` 类下同时包含 `mb-0`和`d-flex` 两个类的子元素; 另一组是`.docs-content div[data-prismjs-copy]`,含义是`docs-content` 类下包含`data-prismjs-copy`属性的`div`元素。 把两组选择器用逗号隔开即可:`.docs-content .mb-0.d-flex, .docs-content div[data-prismjs-copy]` file: ./content/guide/getting-started/index.en.mdx meta: { "title": "Quick Overview of FastGPT", "description": "FastGPT's capabilities and advantages" } import { Alert } from '@/components/docs/Alert'; import FastGPTLink from '@/components/docs/linkFastGPT'; FastGPT is an AI Agent application development platform built on large language models. It combines Knowledge Base Q\&A, visual Workflows, Agent orchestration, tool calling, and skill extensions so developers and business users can quickly build custom AI applications. Try FastGPT now * International: {'https://fastgpt.io'} * China Mainland: {'https://fastgpt.cn'} | | | | ---------------------------------------------- | ---------------------------------------------- | | ![alt text](../../../public/imgs/image-30.png) | ![alt text](../../../public/imgs/image-45.png) | | ![alt text](../../../public/imgs/image-46.png) | ![alt text](../../../public/imgs/image-47.png) | ## Why FastGPT ### 1. Simple and Flexible, Like Building Blocks 🧱 Build AI applications as easily as snapping LEGO bricks together. FastGPT provides rich functional modules that let you create personalized AI apps through simple drag-and-drop — no coding required, even for complex business processes. ### 2. Make Your Data Smarter 🧠 FastGPT provides a complete data intelligence solution — from data import and preprocessing to knowledge matching and intelligent Q\&A — fully automated. Combined with visual workflow design, you can easily build professional-grade AI applications. ### 3. Open Source and Easy to Integrate 🔗 FastGPT supports custom development. Integrate quickly through standard APIs without modifying source code. It supports mainstream models including ChatGPT, Claude, DeepSeek, and ERNIE Bot, with continuous iteration to keep the product evolving. *** ## What Can FastGPT Do ### 1. Comprehensive Knowledge Base Import documents and data with automatic knowledge structuring. Features intelligent Q\&A with multi-turn context understanding and a continuously improving knowledge base management experience. ![](/imgs/intro/image3.png) ### 2. Visual Workflow FastGPT's intuitive drag-and-drop interface lets you build complex business processes with zero code. Rich functional node components handle diverse business needs with flexible process orchestration. ![](/imgs/intro/image4.png) ### 3. Intelligent Data Parsing FastGPT's knowledge base system handles imported data with great flexibility — intelligently processing complex PDF structures while preserving images, tables, and LaTeX formulas. It automatically recognizes scanned files and structures content into clean Markdown format. It also supports automatic image annotation and indexing, making visual content searchable and ensuring knowledge is presented accurately in AI Q\&A. ![](/imgs/intro/image5.png) ### 4. Workflow Orchestration Flow-based workflow orchestration lets you design complex Q\&A processes — such as querying databases, checking inventory, or booking lab resources. ![](/imgs/intro/image6.png) ### 5. Powerful API Integration FastGPT is fully compatible with the OpenAI API interface, supporting one-click integration with WeCom, WeChat Official Account, Lark, DingTalk, and more — bringing AI capabilities into your business workflows. ![](/imgs/intro/image7.png) *** ## Core Features * Out-of-the-box knowledge base system * Visual low-code workflow orchestration * Support for mainstream LLMs * Simple and easy-to-use API interface * Flexible data processing capabilities *** ## Knowledge Base Core Process Diagram ![](/imgs/intro/image8.png) *** ## Community FastGPT is an open source project driven by users and contributors. If you have questions or suggestions, try the following support channels. Our team and community will do our best to help. * 📱 Scan to join the Lark community group 👇 * 🐞 Submit any FastGPT bugs, issues, or feature requests to [GitHub Issues](https://github.com/labring/fastgpt/issues/new/choose). file: ./content/guide/getting-started/index.mdx meta: { "title": "快速了解 FastGPT", "description": "FastGPT 的能力与优势" } import { Alert } from '@/components/docs/Alert'; import FastGPTLink from '@/components/docs/linkFastGPT'; FastGPT 是一个基于大语言模型的 AI Agent 应用开发平台,集知识库问答、可视化工作流、Agent 编排、工具调用和技能扩展于一体,让开发者和业务人员都能快速构建专属 AI 应用。 快速开始体验 * 国际版:{'https://fastgpt.io'} * 中国大陆版:{'https://fastgpt.cn'} | | | | ---------------------------------------------- | ---------------------------------------------- | | ![alt text](../../../public/imgs/image-30.png) | ![alt text](../../../public/imgs/image-45.png) | | ![alt text](../../../public/imgs/image-46.png) | ![alt text](../../../public/imgs/image-47.png) | ## FastGPT 的优势 ### 1. 简单灵活,像搭积木一样简单 🧱 像搭乐高一样简单有趣,FastGPT 提供丰富的功能模块,通过简单拖拽就能搭建出个性化的 AI 应用,零代码也能实现复杂的业务流程。 ### 2. 让数据更智能 🧠 FastGPT 提供完整的数据智能化解决方案,从数据导入、预处理到知识匹配,再到智能问答,全流程自动化。配合可视化的工作流设计,轻松打造专业级 AI 应用。 ### 3. 开源开放,易于集成 🔗 FastGPT 支持二次开发。通过标准 API 即可快速接入,无需修改源码。支持 ChatGPT、Claude、DeepSeek 和文心一言等主流模型,持续迭代优化,始终保持产品活力。 *** ## FastGPT 能做什么 ### 1. 全能知识库 可轻松导入各式各样的文档及数据,能自动对其开展知识结构化处理工作。同时,具备支持多轮上下文理解的智能问答功能,还可为用户带来持续优化的知识库管理体验。 ![](/imgs/intro/image3.png) ### 2. 可视化工作流 FastGPT 直观的拖拽式界面设计,可零代码搭建复杂业务流程。还拥有丰富的功能节点组件,能应对多种业务需求,有着灵活的流程编排能力,按需定制业务流程。 ![](/imgs/intro/image4.png) ### 3. 数据智能解析 FastGPT 知识库系统对导入数据的处理极为灵活,可以智能处理 PDF 文档的复杂结构,保留图片、表格和 LaTeX 公式,自动识别扫描文件,并将内容结构化为清晰的 Markdown 格式。同时支持图片自动标注和索引,让视觉内容可被理解和检索,确保知识在 AI 问答中能被完整、准确地呈现和应用。 ![](/imgs/intro/image5.png) ### 4. 工作流编排 基于 Flow 模块的工作流编排,可以帮助你设计更加复杂的问答流程。例如查询数据库、查询库存、预约实验室等。 ![](/imgs/intro/image6.png) ### 5. 强大的 API 集成 FastGPT 完全对齐 OpenAI 官方接口,支持一键接入企业微信、公众号、飞书、钉钉等平台,让 AI 能力轻松融入您的业务场景。 ![](/imgs/intro/image7.png) *** ## 核心特性 * 开箱即用的知识库系统 * 可视化的低代码工作流编排 * 支持主流大模型 * 简单易用的 API 接口 * 灵活的数据处理能力 *** ## 知识库核心流程图 ![](/imgs/intro/image8.png) *** ## 社区交流群 FastGPT 是一个由用户和贡献者参与推动的开源项目,如果您对产品使用存在疑问和建议,可尝试以下方式寻求支持。我们的团队与社区会竭尽所能为您提供帮助。 * 📱 扫码加入飞书交流群👇 * 🐞 请将任何 FastGPT 的 Bug、问题和需求提交到 [GitHub Issue](https://github.com/labring/fastgpt/issues/new/choose)。 file: ./content/guide/getting-started/quick-start.en.mdx meta: { "title": "Quick Start", "description": "Quickly experience FastGPT through four use cases: Conversational Agent, Knowledge Base, Workflow, and Agent V2" } This article uses four complete use cases to help you quickly understand FastGPT's core application types and complete the basic setup from simple conversations to complex task orchestration. This page is suitable for first-time FastGPT users, as well as pre-sales, delivery, operations, legal, and administrative roles who want to quickly experience the platform's capabilities. After completing this page, you will build the following in order: 1. Conversational Agent: Corporate email writing assistant. 2. Knowledge Base + Conversational Agent: Civil Code Q\&A assistant. 3. Workflow: Content review and automatic rewriting. 4. Agent V2: Intelligent data analysis Agent. We recommend preparing the following in advance: * An available AI model, such as GLM-5.1 or other configured models. * A knowledge base test file, such as the Civil Code, company policies, product manuals, etc. * If you want to test the Email tool, prepare an email SMTP authorization code. * If you want to test Agent V2 data analysis, prepare a sample Excel or CSV file. When reading, focus on three things: what kind of problems each application type is suitable for, why the key configurations are written this way, and what to observe during validation. The parameters and prompts in this article are reusable starting points; for production deployment, you can replace them with your own business materials, review rules, notification channels, and data files. ## Case 1: Conversational Agent — Corporate Email Writing Assistant ### 1.1 Use Cases Conversational Agents are suitable for lightweight Q\&A, content generation, copy refinement, and standardized output. This case does not link a knowledge base or rely on complex workflows; it simply uses model configuration, prompts, and an Email tool to build a corporate email writing assistant. Employees often need to handle emails for project updates, cross-departmental collaboration, customer replies, meeting minutes, and more. Using AI to standardize email formats and expression styles can improve writing efficiency and maintain the professionalism of external corporate communications. The focus of this case is not to have the AI randomly generate an email, but to consolidate the stable requirements of corporate email writing into the prompt, such as subject lines, salutations, body structure, action items, and risk reminders. For beginners, it also serves as a minimal closed loop for understanding FastGPT application configuration: first define the role, then constrain the output, and finally extend execution actions through tools. ### 1.2 Configuration Steps 1. **Create a Conversational Agent** Click "New" in the workspace, select "Conversational Agent", and fill in the application name as `Corporate Email Writing Assistant`. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-01.png) 2. **Enter the Application Configuration Page** After creation, enter the application configuration page. The page is usually divided into left and right columns: the left is AI configuration, and the right is debug preview. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-02.png) 3. **Select a Model** In the AI configuration, select the base model for the Conversational Agent. This case uses GLM-5.1, but you can replace it with other available models configured in your current environment. When selecting a model, prioritize two aspects: first, whether the model is good at business writing, and second, whether it consistently follows the required format. Email writing is a low-risk, low-structure task, so you usually do not need the strongest model available, but you should still choose one with a natural tone and reliable instruction following. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-03.png) 4. **Write the Prompt** The prompt needs to clearly describe the assistant's role, output format, and constraints. You can use the following example: ```md You are a corporate email writing expert, helping employees write professional, clear, and appropriate work emails. Output format: - **Subject line**: Concise and clear - **Salutation**: Choose "Dear Mr./Ms. XX" or "Hi XX" based on the relationship with the recipient - **Body**: Three-part structure (Background → Core content → Action items) - **Sign-off**: Name, Title, Department Rules: - Keep the body between 200-500 words - List action items and to-dos with bullet points - When involving sensitive content like salary, HR, or legal matters, remind the user to send with caution - Use a neutral and polite tone when unsure of the relationship with the recipient ``` Write the prompt into the prompt module. This prompt consists of three parts: the role definition stabilizes the assistant's identity, the output format constrains the email structure, and the rules control risk boundaries. In actual business, you can continue to add corporate tone requirements, brand terminology, banned words, signature formats, and more to make the output more aligned with internal standards. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-04.png) 5. **Add the Email Tool** Tools encapsulate complex operations. This case uses the Email sending tool to give the AI assistant the ability to send emails after generating them. Click the plus sign on the right side of the tools and select "Send Email". You can think of tools as the AI's external capabilities. Without tools, the assistant can only generate the email body; after adding the Email tool, the assistant can execute the sending action after user confirmation. In a production environment, it is recommended to have the assistant generate an email draft first, and then have the user confirm the sending, to avoid accidental sending or sending to the wrong recipient. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-05.png) 6. **Configure the Email Tool** Enter the tool configuration page and fill in the parameters related to the email service. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-06.png) 7. **Activate the Tool** Click "Settings" to enter the tool activation page, then click "Activate Tool". ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-07.png) 8. **Fill in the Email SMTP Information** This case uses QQ Mail as an example. When testing, you can fill it out as follows: ```text SMTP Server Address: smtp.qq.com SMTP Port: 465 Enable SSL SMTP Username: Email address SMTP Password: Authorization code ``` For the authorization code, please refer to the [Authorization Code Acquisition Tutorial](https://cloud.tencent.com/developer/article/2177098). ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-08.png) 9. **Set the Conversation Opening** The conversation opening is used to tell users what this AI assistant can do. You can fill in: ```text Hello! I am the Email Writing Assistant 📧 Please tell me: Who is the recipient? What is the purpose of the email? What key information needs to be included? I will help you generate a professional and appropriate email. ``` After filling it out, you can see the effect in the preview area on the right. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-09.png) 10. **Validate the Result** After configuration, enter your email requirements in the debug preview to check whether the assistant can generate an email with a clear structure and appropriate tone. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-10.png) If the user's information is insufficient, the assistant should proactively prompt to supplement the recipient, email purpose, key information, etc. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-11.png) When verifying, it is recommended to test at least three types of inputs: an email requirement with complete information, a vague requirement missing the recipient or purpose, and an email requirement containing sensitive information. An email assistant ready for production not only needs to be able to "write", but also needs to be able to ask follow-up questions when information is insufficient, and remind users to send with caution in sensitive scenarios. ### 1.3 Business Value * **Improve Writing Efficiency**: Transform high-frequency emails like project updates, customer follow-ups, and meeting minutes from "writing from scratch" to "generating after filling in key information", reducing repetitive labor. * **Unify Communication Standards**: Consolidate standards for salutations, body structure, action items, and sign-offs into the Prompt, reducing the communication costs caused by differences in writing styles among employees. * **Reduce Sending Risks**: Add sensitive information reminders, missing information follow-ups, and neutral tone constraints through the Prompt to reduce incomplete, inappropriate, or over-promising emails. * **Expand Office Automation**: Combined with the Email tool, you can continue to integrate office workflows such as notifications, approvals, Lark, DingTalk, and WeCom, extending email writing from content generation to business action execution. ## Case 2: Knowledge Base + Conversational Agent — Civil Code Q\&A Assistant ### 2.1 Use Cases A knowledge base is ideal for scenarios where answers must be based on provided materials, such as policy Q\&A, product manual Q\&A, legal article retrieval, and customer service knowledge support. Without a knowledge base, the AI primarily relies on its own model capabilities to answer questions. Once a knowledge base is connected, the AI first searches your materials and then organizes answers based on the search results. In this case, we import the *Civil Code of the People's Republic of China* into the knowledge base and create a Civil Code Q\&A assistant. When users ask questions in natural language, the assistant should prioritize citing the original Civil Code text to reduce fabricated responses. Think of the knowledge base as a "reference room" configured for the AI. The model itself has general knowledge but doesn't know your company policies, product details, internal processes, or specific regulatory versions. The knowledge base turns these materials into searchable content, allowing the AI to look up information before organizing an answer. For legal, policy, customer service, and after-sales scenarios, this is more controllable than relying solely on the model's memory. ### 2.2 Preparation * Example file: Prepare a copy of the *Civil Code of the People's Republic of China* or another regulatory/documentation file. * A usable conversation model and vector model. * A legal question for testing, e.g., "My lease isn't up yet, but the landlord wants to sell the house. What should I do?" ### 2.3 Configuration Steps 1. **Create a Knowledge Base** Click **Knowledge Base** on the left side of the homepage, then click **New** in the top right corner. Name the knowledge base `Civil Code Q&A Assistant`. Keep the other default settings for this case. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-12.png) 2. **Create a Text Dataset** Click **New**, then select **Text Dataset** to import local documents. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-13.png) 3. **Upload a Local File** Click **Upload Local File** and select the example file. In real use, you can upload multiple files at once; for this case, we upload only one file as a demonstration. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-14.png) 4. **Set Parsing Parameters** After entering the parameter settings page, choose the parsing method based on the file type. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-15.png) Recommended common settings: * **File Parsing Settings**: Enable when uploading PDFs; for regular Word, Markdown, TXT files, start with the default configuration. * **Processing Method**: For most scenarios, choose chunked storage — it's lower cost and faster for retrieval. * **Chunking Conditions**: Controls how many tokens each chunk contains. Use the default values for quick testing. * **Index Enhancement**: For plain text, usually check the first two options; if the document contains images, enable image-related enhancements. These parameters directly affect the quality of subsequent Q\&A. If chunks are too large, search results may include too much irrelevant content, making answers verbose. If chunks are too small, key context may be split, causing answers to lack supporting evidence. For the quick-start phase, use the default configuration. When officially integrating enterprise policies, contracts, or product manuals, adjust these parameters gradually based on Q\&A performance. 5. **Preview Chunking Results** After reaching the data preview step, check whether the chunks are complete and readable. If chunks are too long or too short, go back and adjust the parameters. When previewing chunks, focus on three things: whether paragraphs are abnormally cut off, whether titles and body text remain within the same semantic range, and whether tables, clauses, or numbering are still readable. If the quality of these knowledge fragments is unstable, even a well-written Prompt in the application will struggle to consistently produce accurate answers. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-16.png) 6. **Wait for the Knowledge Base to Be Ready** Once the data status changes to "Ready," the knowledge base can be referenced by applications. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-17.png) 7. **Create and Link a Conversational Agent** Create a new Conversational Agent, also named `Civil Code Q&A Assistant`. After creation, link the knowledge base you just created in the application configuration. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-18.png) After linking the knowledge base, the application's response flow changes from simple conversation to "user question → knowledge base search → model summarizes answer." This is the key difference between Case 1 and Case 2: Case 1 emphasizes content generation, while Case 2 emphasizes answering based on provided materials. 8. **Configure the Q\&A Prompt** The Civil Code Q\&A assistant needs to emphasize "answer based on the knowledge base" and "cite the original text." You can use the following Prompt: ```md You are a professional Civil Code Q&A assistant, answering legal questions based on the original text of the _Civil Code of the People's Republic of China_. Rules: - Strictly answer based on the Civil Code articles retrieved from the knowledge base; do not fabricate legal provisions. - Every answer must cite the original Civil Code text (book, chapter, article). - If there is no directly corresponding provision in the Civil Code, state this honestly and do not give legal advice. - When applying the law to specific cases, remind the user: "This answer is for reference only; please consult a professional lawyer." - Provide plain-language explanations of legal terms so that users without a legal background can understand. Output format: 1. **Legal Conclusion** (1–3 sentence summary) 2. **Relevant Article Citation** (original excerpt + book/chapter/article number) 3. **Plain-Language Explanation** (explain the meaning of the article in everyday language) 4. **Practical Advice** (2–3 actionable suggestions) 5. **Disclaimer** ("This answer is based on the original Civil Code text and does not constitute legal advice. For specific cases, please consult a professional lawyer.") ``` For legal Q\&A scenarios, it's especially important to define boundaries: what can be answered is a general explanation based on the materials; the model's output should never be packaged as formal legal advice. Requiring article citations, stating uncertainty, and adding disclaimers in the Prompt all aim to make the output more traceable and compliant with high-risk knowledge Q\&A usage norms. 9. **Configure the Opening Message** The opening greeting can include a few example questions to help users quickly understand how to use this assistant: ```text Hello! I'm the Civil Code Q&A Assistant ⚖️ I answer legal questions based on the original text of the *Civil Code of the People's Republic of China*. You can ask me: ["My lease isn't up yet, but the landlord wants to sell the house. What should I do?"] ["I received a product I bought online and it was broken, but the seller won't accept a return. What does the law say?"] ["The upstairs neighbor's leak soaked my ceiling. Can I claim compensation?"] ⚠️ Note: My answers are for reference only. For specific legal issues, please consult a professional lawyer. ``` If you add `[question content]` in the opening greeting, users can click the question to ask it directly — useful for demonstrations and guidance. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-19.png) 10. **Verify Q\&A Performance** Ask a question related to the Civil Code and check whether the answer includes a legal conclusion, article citation, plain-language explanation, and disclaimer. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-20.png) When verifying, don't just check whether the answer "looks like a legal answer" — also check whether it actually references the knowledge base content. It's recommended to test with questions inside the materials, outside the materials, and ambiguous questions: questions inside the materials should cite the original text; questions outside the materials should state that a direct confirmation is not possible; ambiguous questions should proactively prompt the user to provide more facts. ### 2.4 Business Value * **Lower the barrier to material retrieval**: Turn lengthy regulations, policies, and manuals into a natural language Q\&A entry point, allowing business users to quickly find relevant content without needing to know keywords or directory locations first. * **Improve answer credibility**: Through knowledge base retrieval and original text citations, answers have a source basis, reducing the risk of the model fabricating or giving vague responses based on experience. * **Accumulate organizational knowledge**: Internal company policies, product FAQs, after-sales SOPs, contract templates, and other materials can be continuously added to the knowledge base, forming maintainable and reusable knowledge assets. * **Adapt to high-frequency support scenarios**: Legal, HR, administrative, customer service, and delivery teams can all use a similar model to turn repetitive inquiries into self-service Q\&A, improving response efficiency. ## Case 3: Workflow — Content Review and Automatic Rewriting ### 3.1 Use Cases Workflows are ideal for tasks with fixed steps, clear logic, and the need for branching decisions or human confirmation. This case breaks down content compliance review into several stages: knowledge base retrieval, AI classification, conditional branching, automatic rewriting, rejection explanation, and human confirmation, simulating the review process before enterprise content is published. Its core value lies in two aspects: 1. **Automation**: Once triggered, the system automatically executes multiple steps according to the preset workflow. 2. **Standardization**: The same input goes through the same judgment and processing, reducing human variability. To determine whether a task is suitable for a workflow, check if it has three characteristics: "stable steps, clear rules, and repeatable execution." Content review is a typical scenario: the input is content to be published, the rules come from a compliance knowledge base, and the output is usually pass, rewrite, or reject, with the option to add human confirmation in between. This improves processing efficiency while retaining risk control. ### 3.2 Preparation First, create a "Content Compliance Rules" knowledge base and upload a simple text file. You can directly use the following rule template: ```text Content Compliance Rules Safe Content (can be published directly) - Objective factual statements - Normal event notifications, meeting arrangements - Product feature descriptions (based on real data) - Industry knowledge sharing Sensitive Wording (needs rewriting) - Absolute language: "best," "first," "100%," "absolute," "only" - Exaggerated claims: "disrupting the industry," "unprecedented," "unmatched" - Unverified data: conversion rates, satisfaction rates, growth rates without sources - Comparative disparagement: directly naming competitors and belittling them Prohibited Content (must not be published) - Illegal information: involving pornography, gambling, drugs, fraud, pyramid schemes - Personal attacks: insults, defamation against individuals or groups - False information: fabricated data, forged qualifications, impersonating official sources - Sensitive topics: political sensitivity, religious discrimination, regional attacks ``` The rule base does not need to be complex at the start. For quick validation, split the rules into three categories: "safe, needs rewriting, prohibited." For formal use, you can continue adding rules by industry, brand, channel, or region, such as advertising-sensitive terms, medical compliance requirements, prohibited financial marketing claims, brand tone guidelines, and so on. ### 3.3 Workflow Design Before configuring nodes, it's recommended to confirm the complete workflow. This case can be designed as follows: 1. **User Input**: As the workflow starting point, receives the content to be reviewed. 2. **Knowledge Base Retrieval**: Recalls relevant rules from the content compliance rules base. It is recommended to set the citation limit to 1-2 entries. 3. **AI Content Compliance Classification**: Combines user input and retrieval results to classify the content as "Safe / Sensitive but Rewritable / Prohibited." 4. **Conditional Branching**: Enters different branches based on the classification result. 5. **Safe Branch**: Directly outputs the original text, indicating it can be published. 6. **Sensitive but Rewritable Branch**: Calls AI to rewrite the content, then submits it for user confirmation. 7. **Prohibited Branch**: Outputs a rejection explanation and provides revision suggestions. 8. **Final Output**: Returns the original text, rewritten version, or rejection explanation. When designing a workflow, first determine the responsibility of each node to avoid having a single AI node simultaneously handle "retrieving rules, judging classification, rewriting content, explaining reasons," etc. Once responsibilities are clearly separated, each node's prompt will be shorter and more stable, making it easier to locate issues later: whether the knowledge base failed to recall rules, the review node misclassified, or the condition in the decision node didn't match. ### 3.4 Configuration Steps 1. **Create a Workflow** Go to the workflow homepage, click "New Workflow," and name it `Content Review and Automatic Rewriting`. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-21.png) After creation, enter the workflow editing page. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-22.png) The complete workflow diagram for this case is as follows: ![Content Compliance Review Workflow](/imgs/guide/getting-started/quick-start/image-23.png) 2. **Configure the Opening Message** In the system configuration, fill in the opening statement to explain the assistant's review rules and usage. ```md Hello! I am the Content Compliance Review Assistant 🛡️ Please send me the content you need reviewed, and I will automatically judge it according to the rules: - **✅ Safe** — Content has no sensitive information and can be published directly - **⚠️ Sensitive but Rewritable** — Contains correctable wording; I will rewrite it and send it back for your confirmation - **🚫 Prohibited** — Contains red-line content and is rejected with an explanation Supports single text review or batch submission (multiple items separated by line breaks). **Let's get started.** ``` 3. **Call the Knowledge Base** Add a knowledge base retrieval node in the workflow, select the previously created content compliance rules base. The input for this node uses the user input, and the output is referenced by subsequent AI nodes. The purpose of this node is not to have the model read the entire rule base, but to retrieve the rule fragments most relevant to the current content for the subsequent review node. You can initially set the citation limit to 1-2 entries to keep the prompt context focused; if the rule base is larger or the categories are more detailed, gradually increase the citation count. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-24.png) ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-25.png) 4. **Configure the Content Review Node** Add an AI dialogue node and rename it to "Content Review Node." This node is responsible for outputting the classification result based on the user input and knowledge base rules. ```md You are a content compliance review expert. Based on the compliance rules retrieved from the knowledge base, determine the compliance level of the user's input content. Classification criteria: - Safe: Content has no sensitive information and can be published directly - Sensitive but Rewritable: Contains correctable sensitive wording; can be published after rewriting - Prohibited: Contains red-line content and cannot be published Output format: Output only one of three labels: Safe / Sensitive but Rewritable / Prohibited ``` Note: The knowledge base reference must select the previously created knowledge base, otherwise the AI cannot read the rule content. The output of the review node should be as stable as possible, because it directly affects the decision node's branching. For a quick demo, you can output only the three labels "Safe / Sensitive but Rewritable / Prohibited"; if you need stricter automation integration later, you can switch to structured output, such as returning the classification, reason, and matched rules together, making it easier for downstream nodes to perform precise matching and logging. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-26.png) 5. **Test the Review Node** Click "Run" in the top right corner, input a piece of content to be reviewed, and confirm that the review node returns a stable classification result. Test this node individually instead of waiting until the entire workflow is built. Input a normal event announcement, marketing copy containing absolute language, and clearly prohibited text, and observe whether the classification meets expectations. If the classification is unstable, first adjust the rule base wording and the review prompt before continuing to configure subsequent branches. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-27.png) 6. **Hide Intermediate Output** Click the settings button on the right side of the model to adjust the node's basic settings. Since the user only needs the final result, it is recommended to hide the intermediate output of the content review node. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-28.png) 7. **Configure the Decision Node** Add a decision node to branch based on the "Safe / Sensitive but Rewritable / Prohibited" output from the content review node. The decision node acts as a switch in the workflow. The more stable the output from the previous step, the easier it is to configure the decision node; if the review node's output contains explanatory text, the condition may fail to match. Therefore, in branching workflows, it is common to first constrain the output format of the upstream node before configuring the decision node conditions. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-29.png) 8. **Configure the Safe Branch** When the review result is "Safe," directly output the original text. In a production scenario, you could also add spot-checking or human confirmation. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-30.png) The output effect is as follows: ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-31.png) 9. **Configure the Sensitive but Rewritable Branch** When the review result is "Sensitive but Rewritable," add an AI dialogue node to automatically rewrite the content. You can use the following prompt: ```md You are a content rewriting expert. Rewrite the user's input content into a compliant version. Rewriting principles: - Preserve the original meaning and information, do not change the core expression - Replace absolute language with objective statements, e.g., "best" → "industry-leading" - Replace unverified data statements with reasonable speculation, e.g., "100% effective" → "most users report it effective" - Replace sensitive wording with neutral expressions - Maintain the original style and tone ``` After rewriting, you can add a user choice node to let the user accept the rewrite, continue rewriting, or abandon it. The human confirmation node is suitable for paths that are risky but correctable. AI can propose rewrite suggestions, but whether to publish is still left to the business personnel to confirm. This reduces the time spent on initial screening and repeated revisions while not handing over the final publishing decision entirely to the automated workflow. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-32.png) ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-33.png) If the user accepts the rewrite, output the rewritten result; if the user chooses to continue rewriting, it can be connected back to the content rewriting node; if the user abandons it, output the original text. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-34.png) 10. **Configure the Prohibited Branch** When the review result is "Prohibited," add an AI dialogue node to output a rejection explanation. You can use the following prompt: ```md The content submitted by the user cannot be published because it contains prohibited information. Please explain the reason in a polite and professional tone. Output format: 1. One sentence stating that the content cannot be published 2. List specific violation points (1-3 items) 3. Provide alternative suggestions (e.g., suggest which aspects to modify before resubmitting) ``` 11. **Verify the Complete Workflow** Input safe content, sensitive content, and prohibited content separately, and confirm that all three branches return the expected results. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-35.png) When verifying the complete workflow, it is recommended to record the input, review classification, branch entered, and final output for each test case. If the output does not meet expectations, troubleshoot node by node: first check whether the knowledge base recalled the correct rules, then whether the review node classified accurately, and finally whether the decision node conditions and branch output are configured correctly. ### 3.5 Business Value * **Standardize review rules into a workflow**: Embed the judgment criteria for pre-publication content review into a knowledge base and node configuration, reducing reliance on personal experience passed down verbally. * **Improve processing efficiency**: Safe content can pass quickly, sensitive content is automatically rewritten, and prohibited content receives a direct explanation, allowing reviewers to focus on content that requires judgment. * **Retain human control points**: Add user confirmation for gray-area scenarios like "sensitive but rewritable," preventing the automated workflow from making publishing decisions directly for business personnel. * **Easy to reuse and extend**: The same workflow can be applied to marketing copy, customer service scripts, announcements, event pages, short video scripts, and other content review scenarios by replacing the rule base and a few prompts. * **Reduce compliance risk**: Through fixed branches and rejection explanations, high-risk content has a clear interception path, reducing the risk of accidental publication, exaggerated claims, or non-compliant expressions. ## Case 4: Agent V2 — Intelligent Data Analysis Agent ### 4.1 Use Cases Agent V2 is ideal for open-ended, multi-step tasks that require dynamic planning. Unlike workflows, where every step must be predefined, Agent V2 is better suited for tasks with “unfixed steps,” such as data analysis, file processing, multi-tool collaboration, and complex problems that require follow-up clarification. This case simulates the daily data analysis needs of operations, product, or sales teams: upload an Excel file, ask questions in natural language, and let the Agent autonomously read the file, formulate an analysis plan, and execute the analysis in a virtual machine. In Case 3, the workflow required you to design a fixed path of “retrieval rules → classification → branching → rewriting or rejection.” Agent V2, on the other hand, acts more like an autonomous executor. You don’t need to define every step in advance; just provide the goal and the file. The Agent decides whether to read the file first, perform statistics, ask follow-up questions, or run code based on the data structure and problem complexity. Data analysis is a great way to experience Agent V2 because it naturally has three characteristics: the analysis path is not fixed, it often requires multi-step reasoning, and the requirements may need clarification. With the same Excel file, different users might care about product sales, channel ROI, regional trends, or anomalous orders. A fixed workflow can hardly cover all paths in advance, but Agent V2 can dynamically plan based on the question. ### 4.2 Preparation * Sample file: Prepare a sales data Excel or CSV table. * A conversation model that supports Agent V2. * Virtual machine capability is available in the current environment. ### 4.3 Configuration Steps 1. **Create an Agent V2 Application** In the workspace, click “Create Application,” select `Conversational Agent V2`, and name it `Intelligent Data Analysis Agent`. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-36.png) 2. **Configure Model and Prompt** Continue using the GLM-5.1 model for AI configuration. The system prompt can refer to: ```md You are a senior data analyst Agent. You can read data files uploaded by users, run Python analysis code in the sandbox, and proactively ask users for clarification. Tools: - 📄 **Read File** — Read Excel/CSV data uploaded by the user - 💻 **Sandbox Execution** — Run Python scripts (pandas/matplotlib/numpy) - ❓ **Proactive Follow-up** — Confirm with the user when analysis requirements are unclear Workflow: 1. After receiving data and a question, first read the file to understand the data structure and content 2. Formulate an analysis plan and present it to the user as a list of steps 3. Execute step by step according to the plan, showing key findings at each step 4. Proactively ask follow-up questions when encountering ambiguous requirements, such as unclear metric definitions or missing comparison baselines 5. Dynamically update the plan based on follow-up results 6. Output an analysis report containing data overview, core findings, visual charts, and business recommendations Security Rules: - Only data analysis is allowed in the sandbox; no network access, no writing files to the host machine - Data is used only for this analysis; do not expose raw sensitive data in the report - Mark confidence levels for uncertain conclusions Output Format: 1. 📋 Analysis Plan (automatically generated based on data) 2. 📊 Data Overview (row count, column names, missing values, basic statistics) 3. 🔍 Core Findings (3-5 key insights, supported by charts) 4. 💡 Business Recommendations (actionable suggestions based on data) ``` The key point of this prompt is to have the Agent plan before executing, rather than jumping straight to conclusions. For data analysis tasks, first reading the data structure, confirming field meanings, and formulating an analysis plan can significantly reduce the risk of misunderstanding requirements or misusing metrics. In production use, you can continue to supplement internal metric definitions, such as GMV, ROI, conversion rate, active customers, repurchase rate, etc. 3. **Configure the Opening Message** The opening remarks guide the user to upload a data file and ask analysis questions: ```text Hello! I am the Intelligent Data Analysis Agent 📊 Just drag and drop your Excel or CSV file here and tell me what you want to analyze. For example: - "Analyze this sales data and find the best-selling products and trends" - "Help me look at changes in user activity and find the reasons for the decline" - "Compare the conversion rates of three channels, which one has the highest ROI?" I will first understand your data, formulate an analysis plan, and then run the analysis code in the sandbox. I will proactively ask you for clarification when needed. ``` 4. **Enable Virtual Machine Capability** Data analysis usually requires reading files and executing code, so the virtual machine configuration needs to be enabled. The virtual machine capability is used to isolate the code execution environment. The Agent can run data analysis scripts, read uploaded files, and generate statistical results within it, without directly affecting the local host environment. For scenarios that require running Python, processing Excel, drawing charts, or performing batch calculations, this is an important capability that distinguishes Agent V2 from ordinary conversation applications. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-37.png) 5. **Upload File and Test** Upload the sample sales data file and enter the question: ```text Help me analyze this sales data to see which products sell well and which channel has the highest ROI ``` The Agent will first break down the task and then execute the analysis step by step. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-38.png) During execution, you can see the task running in the virtual machine without affecting the local environment. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-39.png) When testing, focus on whether the Agent has a complete analysis process: does it first identify the table fields, explain the analysis plan, run code when needed, and give business recommendations based on the results? If the problem description is unclear, the ideal behavior is not to force an analysis but to first ask the user for key definitions. ### 4.4 Verification of Results The final result should include the analysis plan, data overview, core findings, and business recommendations. ![FastGPT screenshot](/imgs/guide/getting-started/quick-start/image-40.png) When verifying results, it is recommended to focus on four dimensions: whether the conclusions come from actual data, whether the metric definitions are clear, whether the charts or statistics support the conclusions, and whether the business recommendations are actionable. The value of a data analysis Agent is not just to output a summary, but to connect the process of “reading data, calculating metrics, explaining results, and proposing recommendations.” ### 4.5 Business Value * **Lower the barrier to data analysis**: Business users can directly upload Excel or CSV files and ask questions in natural language, without needing to write SQL, Python, or complex formulas first. * **Support open-ended exploration**: The same data can be repeatedly queried around sales, channels, regions, customers, trends, outliers, etc., suitable for scenarios without a fixed analysis path. * **Increase analysis transparency**: The Agent shows the analysis plan and key steps, so users can see how it understands the data, calculates metrics, and draws conclusions. * **Isolate code execution risk**: By executing analysis scripts in a virtual machine, risks of local environment contamination, dependency conflicts, and permission misuse are reduced. * **Consolidate business analysis capabilities**: Scenarios such as sales reviews, weekly operations reports, campaign attribution, and product metric diagnostics can all reuse this type of Agent, turning data analysis from an expert task into a daily workflow. ## Choosing Between the Four Types After completing the four cases, you can understand the common application types of FastGPT as a progression from simple to complex capabilities: Conversational Agent solves "how to answer and generate content," Knowledge Base solves "what materials to base answers on," Workflow solves "what fixed process to follow," and Agent V2 solves "how to autonomously plan and execute open-ended tasks." | Application Type | Suitable Scenarios | Core Capabilities | | ------------------------------------- | --------------------------------------------------------------------- | ------------------------------------------------------------ | | Conversational Agent | Lightweight Q\&A, copywriting, standardized output | Prompt, model configuration, tool calling | | Knowledge Base + Conversational Agent | Q\&A based on documents, policies, regulations, product manuals | File import, knowledge base retrieval, citing sources | | Workflow | Fixed steps, conditional branches, review flows, automated processing | Node orchestration, decision nodes, human confirmation | | Agent V2 | Data analysis, complex tasks, multi-step reasoning, dynamic planning | Autonomous planning, tool calling, virtual machine execution | When selecting, you can judge based on task complexity: 1. If it's just lightweight conversation or standardized copy generation, prioritize the Conversational Agent. 2. If answers must be based on existing materials, choose Knowledge Base + Conversational Agent. 3. If the process is fixed and requires conditional branches, human confirmation, or automated processing, choose Workflow. 4. If the task is open-ended with unfixed steps and requires autonomous analysis, tool calling, or code execution, choose Agent V2. In real projects, you can also combine these capabilities. For example, a customer service assistant can use a Knowledge Base to answer product questions and then query orders via tools; content review can use a Workflow to fix the review path while maintaining rules with a Knowledge Base; data analysis scenarios can first use Agent V2 for exploration, then solidify stable analysis steps into a Workflow. file: ./content/guide/getting-started/quick-start.mdx meta: { "title": "快速上手", "description": "通过对话 Agent、知识库、工作流和 Agent V2 四个案例快速体验 FastGPT" } 本文通过四个完整案例,帮助你快速理解 FastGPT 的核心应用类型,并完成从简单对话到复杂任务编排的基础搭建。 本页适合第一次接触 FastGPT 的用户,也适合售前、交付、运营、法务、行政等角色快速体验平台能力。完成本页后,你将依次搭建: 1. 对话 Agent:企业邮件撰写助手。 2. 知识库 + 对话 Agent:民法典问答助手。 3. 工作流:内容审核与自动改写。 4. Agent V2:智能数据分析 Agent。 建议提前准备以下内容: * 可用的 AI 模型,例如 GLM-5.1 或其他已配置模型。 * 一个知识库测试文件,例如民法典、公司制度、产品手册等。 * 如果要测试 Email 工具,准备邮箱 SMTP 授权码。 * 如果要测试 Agent V2 数据分析,准备一个 Excel 或 CSV 示例文件。 阅读时建议重点关注三件事:每种应用类型适合解决什么问题、关键配置为什么这样写、验证时应该观察哪些效果。本文中的参数和 Prompt 都是可复用的起点,正式落地时可以替换为你自己的业务资料、审核规则、通知渠道和数据文件。 ## 案例一:对话 Agent—企业邮件撰写助手 ### 1.1 适用场景 对话 Agent 适合轻量问答、内容生成、文案润色、标准化输出等场景。本案例不关联知识库,也不依赖复杂流程,只通过模型配置、Prompt 和 Email 工具完成一个企业邮件撰写助手。 企业员工经常需要处理项目同步、跨部门协作、客户回复、会议纪要等邮件。通过 AI 统一邮件格式和表达风格,可以提升写作效率,也能保持企业对外沟通的专业性。 这个案例的重点不是让 AI 随意生成一封邮件,而是把企业邮件写作中的稳定要求沉淀到 Prompt 中,例如主题行、称呼、正文结构、行动项和风险提醒。对于新手来说,它也是理解 FastGPT 应用配置的最小闭环:先定义角色,再约束输出,最后通过工具扩展执行动作。 ### 1.2 配置步骤 1. **创建对话 Agent** 在工作台点击新建,选择对话 Agent,应用名称填写为 `企业邮件撰写助手`。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-01.png) 2. **进入应用配置页** 创建完成后进入应用配置页。页面通常分为左右两栏:左侧是 AI 配置,右侧是调试预览。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-02.png) 3. **选择模型** 在 AI 配置中选择对话 Agent 使用的基础模型。本案例使用 GLM-5.1,你也可以替换为当前环境中已配置的其他可用模型。 选择模型时优先关注两点:一是模型是否擅长中文商务表达,二是输出是否稳定遵守格式。邮件撰写属于低风险、低结构复杂度任务,通常不需要过度追求最强模型,但要确保语气自然、指令遵循能力较好。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-03.png) 4. **编写 Prompt** Prompt 需要清晰描述助手的角色、输出格式和约束。可以使用以下示例: ```md 你是一个企业邮件撰写专家,帮助员工撰写专业、清晰、得体的工作邮件。 输出格式: - **主题行**:简洁明确 - **称呼**:根据收件人关系选择“尊敬的 XX 总”或“Hi XX” - **正文**:三段式(背景 → 核心内容 → 行动项) - **落款**:署名、职位、部门 规则: - 正文控制在 200-500 字 - 行动项和待办用项目符号列出 - 涉及薪资、人事、法律等敏感内容时,提醒用户谨慎发送 - 不确定收件人关系时使用中性礼貌语气 ``` 将 Prompt 写入提示词模块。 这段 Prompt 由三部分组成:角色定义用于稳定助手身份,输出格式用于约束邮件结构,规则用于控制风险边界。实际业务中可以继续补充企业语气要求、品牌用语、禁用词、签名格式等内容,让输出更贴合内部规范。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-04.png) 5. **添加 Email 工具** 工具是对复杂操作的封装。本案例使用 Email 邮件发送工具,让 AI 助手在生成邮件后具备发送能力。点击工具右侧的加号,选择 Email 邮件发送。 可以把工具理解为 AI 的外部能力。没有工具时,助手只能生成邮件正文;添加 Email 工具后,助手可以在用户确认后执行发送动作。正式环境中建议先让助手生成邮件草稿,再由用户确认发送,避免误发或发送给错误收件人。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-05.png) 6. **配置 Email 工具** 进入工具配置页,填写邮件服务相关参数。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-06.png) 7. **激活工具** 点击设置后进入工具激活页面,再点击工具激活。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-07.png) 8. **填写邮箱 SMTP 信息** 本案例以 QQ 邮箱为例。测试时可以按以下方式填写: ```text SMTP 服务器地址:smtp.qq.com SMTP 端口:465 启用 SSL SMTP 用户名:邮箱地址 SMTP 密码:授权码 ``` 授权码可参考 [授权码获取教程](https://cloud.tencent.com/developer/article/2177098)。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-08.png) 9. **设置对话开场白** 对话开场白用于告诉用户这个 AI 助手可以做什么。可以填写: ```text 你好!我是邮件撰写助手 📧 请告诉我:收件人是谁?邮件目的是什么?需要包含哪些关键信息? 我会帮你生成一封专业、得体的邮件。 ``` 填写后,可以在右侧预览区域看到效果。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-09.png) 10. **验证运行效果** 配置完成后,在调试预览中输入邮件需求,检查助手是否能生成结构清晰、语气得体的邮件。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-10.png) 如果用户信息不足,助手应主动提示补充收件人、邮件目的、关键信息等内容。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-11.png) 验证时建议至少测试三类输入:信息完整的邮件需求、缺少收件人或目的的模糊需求、包含敏感信息的邮件需求。一个可上线的邮件助手不只要“能写”,还要能在信息不足时追问,在敏感场景下提醒用户谨慎发送。 ### 1.3 业务价值 * **提升写作效率**:将项目同步、客户跟进、会议纪要等高频邮件从“从零写”变成“填写关键信息后生成”,减少重复劳动。 * **统一沟通标准**:把称呼、正文结构、行动项、落款等规范固化到 Prompt 中,降低不同员工写作风格差异带来的沟通成本。 * **降低发送风险**:通过 Prompt 增加敏感信息提醒、信息缺失追问和中性语气约束,减少不完整、不恰当或过度承诺的邮件。 * **扩展办公自动化**:配合 Email 工具后,可以继续接入通知、审批、飞书、钉钉、企业微信等办公流程,将邮件撰写从内容生成延伸到业务动作执行。 ## 案例二:知识库 + 对话 Agent—民法典问答助手 ### 2.1 适用场景 知识库适合“回答必须基于资料”的场景,例如制度问答、产品手册问答、法律条文检索、客服知识支持等。没有知识库时,AI 主要依赖模型自身能力回答;接入知识库后,AI 会先检索你的资料,再基于检索结果组织答案。 本案例将《中华人民共和国民法典》导入知识库,并创建一个民法典问答助手。用户用自然语言提问时,助手需要优先引用民法典原文,减少凭空生成。 可以把知识库理解为给 AI 配置的“资料室”。模型本身具备通用知识,但不了解你的公司制度、产品细节、内部流程或指定法规版本;知识库把这些资料变成可检索内容,让 AI 在回答前先查资料,再组织答案。对于法律、制度、客服、售后等场景,这比单纯依赖模型记忆更可控。 ### 2.2 准备内容 * 示例文件:准备一份《中华人民共和国民法典》或其他法规制度类文档。 * 一个可用的对话模型和向量模型。 * 一个用于测试的法律问题,例如“租房合同没到期,房东要卖房,我该怎么办?”。 ### 2.3 配置步骤 1. **创建知识库** 在主页点击左侧的知识库,进入后点击右上角的新建。知识库名称填写为 `民法典问答助手`,案例阶段其他配置保持默认即可。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-12.png) 2. **创建文本数据集** 点击新建,再选择文本数据集,用于导入本地文档。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-13.png) 3. **上传本地文件** 点击上传本地文件,选择示例文件。实际使用时可以同时上传多个文件,本案例只上传一个文件作为演示。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-14.png) 4. **设置解析参数** 进入参数设置页后,根据文件类型选择解析方式。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-15.png) 常用配置建议: * **文件解析设置**:上传 PDF 时建议开启;普通 Word、Markdown、TXT 等文件可先使用默认配置。 * **处理方式**:大多数场景选择分块存储,成本较低,检索速度也更快。 * **分块条件**:控制每个分块包含多少 Token,快速测试时使用默认值即可。 * **索引增强**:纯文本通常勾选前两个选项;如果文档包含图片,可勾选图片相关增强。 这些参数会直接影响后续问答质量。分块过大时,检索结果可能包含太多无关内容,回答容易变得冗长;分块过小时,关键上下文可能被拆散,回答容易缺少依据。快速上手阶段可以先使用默认配置,正式接入企业制度、合同、产品手册时,再根据问答效果逐步调整。 5. **预览分块效果** 到数据预览步骤后,检查分块是否完整、可读。如果分块过长或过短,再返回调整参数。 预览分块时重点看三点:段落是否被异常截断,标题与正文是否保留在同一语义范围内,表格、条款或编号是否仍然可读。只要这里的知识片段质量不稳定,后续应用即使 Prompt 写得很好,也很难稳定给出准确答案。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-16.png) 6. **等待知识库就绪** 当数据状态变为“已就绪”后,知识库即可被应用引用。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-17.png) 7. **创建并关联对话 Agent** 创建一个新的对话 Agent,名称同样填写为 `民法典问答助手`。创建完成后,在应用配置中关联刚刚创建的知识库。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-18.png) 关联知识库后,应用的回答链路会从单纯对话变成“用户问题 → 知识库检索 → 模型总结回答”。这也是案例一和案例二的关键差异:案例一强调内容生成,案例二强调基于资料回答。 8. **配置问答 Prompt** 民法典问答助手需要强调“基于知识库回答”和“引用原文”。可以使用以下 Prompt: ```md 你是一个专业的民法典问答助手,基于《中华人民共和国民法典》原文回答法律问题。 规则: - 严格基于知识库检索到的民法典条文回答,不得臆造法条 - 每条回答必须引用民法典原文(编、章、条) - 如果民法典中没有直接对应的规定,如实说明,不做法律建议 - 涉及具体案件的法律适用时,提醒用户“本回答仅供参考,建议咨询专业律师” - 对法律术语做通俗解释,让非法学背景的用户也能理解 输出格式: 1. **法律结论**(1-3 句概述) 2. **相关法条引用**(原文摘录 + 编章节条号) 3. **通俗解读**(用日常语言解释法条含义) 4. **实务建议**(2-3 条可操作建议) 5. **免责声明**(“本回答基于民法典原文,不构成法律意见,具体案件请咨询专业律师”) ``` 法律问答类场景尤其要强调边界:能回答的是基于资料的通用解释,不能把模型回答包装成正式法律意见。Prompt 中要求引用条文、说明不确定性、添加免责声明,目的都是让输出更可追溯,也更符合高风险知识问答的使用规范。 9. **配置开场白** 开场白可以内置几个示例问题,帮助用户快速理解这个助手的使用方式: ```text 你好!我是民法典问答助手 ⚖️ 我基于《中华人民共和国民法典》原文,帮你解答法律问题。 你可以问我: ["租房合同没到期,房东要卖房,我该怎么办?"] ["网购商品收到后发现坏了,商家不给退,法律怎么规定?"] ["楼上漏水把我家的天花板泡了,能索赔吗?"] ⚠️ 提示:我的回答仅供参考,具体法律问题建议咨询专业律师。 ``` 如果在开场白里添加 `[问题内容]`,用户可以点击问题一键提问,适合用于演示和引导。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-19.png) 10. **验证问答效果** 提出一个民法典相关问题,检查回答是否包含法律结论、法条引用、通俗解读和免责声明。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-20.png) 验证时不要只看回答是否“像法律回答”,还要看它是否真的引用了知识库内容。建议同时测试资料内问题、资料外问题和模糊问题:资料内问题应能引用原文,资料外问题应说明无法直接确认,模糊问题应主动提示需要补充事实。 ### 2.4 业务价值 * **降低资料检索门槛**:把长篇法规、制度、手册转成自然语言问答入口,让业务人员不用先知道关键词或目录位置,也能快速找到相关内容。 * **提升回答可信度**:通过知识库检索和原文引用,让答案具备来源依据,减少模型凭经验编造或泛泛而谈的风险。 * **沉淀组织知识**:企业内部制度、产品 FAQ、售后 SOP、合同模板等资料可以持续进入知识库,形成可维护、可复用的知识资产。 * **适配高频支持场景**:法务、HR、行政、客服、交付团队都可以使用类似模式,把重复咨询转成自助问答,提高响应效率。 ## 案例三:工作流—内容审核与自动改写 ### 3.1 适用场景 工作流适合步骤固定、逻辑清晰、需要分支判断或人工确认的任务。本案例将“内容合规审核”拆成知识库检索、AI 分类、条件判断、自动改写、拒绝说明和人工确认几个环节,用来模拟企业内容发布前的审核流程。 它的核心价值有两个: 1. **自动化**:一次触发后,系统可以按预设流程自动执行多个步骤。 2. **标准化**:同样的输入会经过同样的判断和处理,减少人工差异。 判断一个任务是否适合工作流,可以看它是否具备“步骤稳定、规则明确、可重复执行”三个特征。内容审核就是典型场景:输入是一段待发布内容,规则来自合规知识库,输出通常是通过、改写或拒绝,中间还可以加入人工确认,既提升处理效率,也保留风险控制。 ### 3.2 准备内容 先创建一个“内容合规规则库”知识库,并上传一个简单的文本文件。可以直接使用以下规则模板: ```text 内容合规规则 安全内容(可直接发布) - 客观事实陈述 - 正常的活动通知、会议安排 - 产品功能介绍(基于真实数据) - 行业知识分享 敏感措辞(需改写) - 绝对化用语:“最好的”“第一”“100%”“绝对”“唯一” - 夸张宣传:“颠覆行业”“史无前例”“无人能比” - 未证实数据:无来源的转化率、满意度、增长率 - 对比贬低:直接点名竞品并贬低 违规内容(禁止发布) - 违法信息:涉及黄赌毒、诈骗、传销 - 人身攻击:针对个人或群体的侮辱、诽谤 - 虚假信息:伪造数据、虚构资质、冒充官方 - 敏感话题:政治敏感、宗教歧视、地域攻击 ``` 规则库不需要一开始就非常复杂。快速验证时,先把规则拆成“安全、需改写、禁止发布”三类即可;正式使用时,可以继续按行业、品牌、渠道、地区增加规则,例如广告法敏感词、医疗合规要求、金融营销禁用表达、品牌语气规范等。 ### 3.3 流程设计 正式配置节点之前,建议先确认完整流程。这个案例可以按以下方式设计: 1. **用户输入**:作为工作流起点,接收待审核内容。 2. **知识库检索**:从内容合规规则库中召回相关规则,建议引用上限设置为 1-2 条。 3. **AI 内容合规分类**:结合用户输入和检索结果,将内容分为“安全 / 敏感可改 / 违规”。 4. **分支判断**:根据分类结果进入不同分支。 5. **安全分支**:直接输出原文,表示可发布。 6. **敏感可改分支**:调用 AI 改写内容,再交由用户确认。 7. **违规分支**:输出拒绝说明,并给出修改建议。 8. **最终输出**:返回原文、改写稿或拒绝说明。 工作流设计时要先确定每个节点的职责,避免让一个 AI 节点同时承担“检索规则、判断分类、改写内容、解释原因”等过多任务。职责拆清楚后,每个节点的 Prompt 会更短、更稳定,后续也更容易定位问题:是知识库没有召回规则,是审核节点分类不准,还是判断器条件没有匹配上。 ### 3.4 配置步骤 1. **创建工作流** 进入工作流主页,点击新建工作流,名称填写为 `内容审核与自动改写`。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-21.png) 创建完成后进入工作流编辑页。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-22.png) 本案例的完整流程图如下: ![内容合规审核工作流](/imgs/guide/getting-started/quick-start/image-23.png) 2. **配置开场白** 在系统配置中填写开场白,说明助手的审核规则和使用方式。 ```md 你好!我是内容合规审核助手 🛡️ 请把需要审核的内容发给我,我会按规则自动判断: - **✅ 安全** — 内容无敏感信息,可以直接发布 - **⚠️ 敏感可改** — 包含可修正的措辞,我会改写后发回你确认 - **🚫 违规** — 包含红线内容,直接拒绝并说明原因 支持单个文本审核,也可以批量发(多条用换行分隔)。 **开始吧。** ``` 3. **调用知识库** 在工作流中添加知识库检索节点,选择前面创建的内容合规规则库。该节点的输入使用用户输入,输出供后续 AI 节点引用。 这个节点的目的不是让模型阅读完整规则库,而是把与当前内容最相关的规则片段召回给后续审核节点。引用上限可以先设置为 1-2 条,保证提示词上下文足够聚焦;如果规则库较大或分类较细,再逐步提高引用数量。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-24.png) ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-25.png) 4. **配置内容审核节点** 添加 AI 对话节点,并重命名为“内容审核节点”。该节点负责根据用户输入和知识库规则输出分类结果。 ```md 你是一个内容合规审核专家。结合知识库检索到的合规规则,判断用户输入内容的合规等级。 分类标准: - 安全:内容无敏感信息,可以直接发布 - 敏感可改:包含可修正的敏感措辞,改写后可发布 - 违规:包含红线内容,不可发布 输出格式: 仅输出三个词之一:安全 / 敏感可改 / 违规 ``` 注意:知识库引用处必须选择前面创建的知识库,否则 AI 无法读取规则内容。 审核节点的输出要尽量稳定,因为它会直接影响判断器分支。快速演示时可以只输出“安全 / 敏感可改 / 违规”三个词;如果后续要做更严格的自动化集成,可以改成结构化输出,例如同时返回分类、原因和命中的规则,方便下游节点做精确匹配和日志记录。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-26.png) 5. **测试审核节点** 点击右上角运行,输入一段待审核内容,确认审核节点能够返回稳定的分类结果。 这一步建议单独测试节点,而不是等全部流程搭完再调试。可以分别输入正常活动通知、包含绝对化宣传的营销文案、明显违规的文本,观察分类是否符合预期。如果分类不稳定,优先调整规则库表达和审核 Prompt,再继续配置后续分支。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-27.png) 6. **隐藏中间输出** 点击模型右侧的设置按钮,调整节点基础设置。由于用户只需要最终结果,建议隐藏内容审核节点的中间输出。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-28.png) 7. **配置判断器** 添加判断器节点,根据内容审核节点输出的“安全 / 敏感可改 / 违规”进入不同分支。 判断器相当于流程中的分流开关。上一步输出越稳定,判断器越容易配置;如果审核节点输出包含解释性文字,判断条件就可能匹配失败。因此在分支类工作流中,通常要先约束上游节点的输出格式,再配置判断器条件。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-29.png) 8. **配置安全分支** 当审核结果为“安全”时,直接输出原文即可。生产场景中也可以增加抽样复核或人工确认。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-30.png) 输出效果如下: ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-31.png) 9. **配置敏感可改分支** 当审核结果为“敏感可改”时,添加 AI 对话节点自动改写内容。可以使用以下 Prompt: ```md 你是一个内容改写专家。将用户输入的内容改写为合规版本。 改写原则: - 保留原意和信息量,不改变核心表达 - 将绝对化用语替换为客观表述,例如“最好的”改为“行业领先的” - 将未证实的数据表述替换为合理推测,例如“100% 有效”改为“多数用户反馈有效” - 将敏感措辞替换为中性表达 - 保持原文风格和语气 ``` 改写完成后,可以添加用户选择节点,让用户选择接受改写、继续改写或放弃。 人工确认节点适合放在有风险但可修正的路径上。AI 可以负责提出改写建议,但是否发布仍交给业务人员确认。这样既能减少人工初筛和反复改稿的时间,也不会把最终发布权完全交给自动化流程。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-32.png) ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-33.png) 如果用户接受改写,输出改写结果;如果用户选择继续改写,可连接回内容改写节点;如果用户放弃,则输出原文。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-34.png) 10. **配置违规分支** 当审核结果为“违规”时,添加 AI 对话节点输出拒绝说明。可以使用以下 Prompt: ```md 用户提交的内容因涉及违规信息无法发布。请用礼貌、专业的语气说明原因。 输出格式: 1. 一句话说明内容无法发布 2. 列举具体的违规点(1-3 条) 3. 提供替代建议(如:建议修改哪些方面后重新提交) ``` 11. **验证完整流程** 分别输入安全内容、敏感内容和违规内容,确认三条分支都能返回预期结果。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-35.png) 完整流程验证时,建议记录每条测试内容的输入、审核分类、进入分支和最终输出。若输出不符合预期,按节点顺序排查:先看知识库是否召回正确规则,再看审核节点分类是否准确,最后看判断器条件和分支输出是否配置正确。 ### 3.5 业务价值 * **把审核规则流程化**:将内容发布前的判断标准沉淀为知识库和节点配置,减少依赖个人经验口头传递。 * **提高处理效率**:安全内容可快速通过,敏感内容自动改写,违规内容直接说明原因,让审核人员把精力集中在需要判断的内容上。 * **保留人工控制点**:对“敏感可改”这类灰度场景加入用户确认,避免自动化流程直接替业务人员做发布决策。 * **便于复用和扩展**:同样的流程可以迁移到营销文案、客服话术、公告通知、活动页面、短视频脚本等内容审核场景,只需要替换规则库和部分 Prompt。 * **降低合规风险**:通过固定分支和拒绝说明,让高风险内容有明确拦截路径,减少误发、夸大宣传或不合规表达带来的风险。 ## 案例四:Agent V2—智能数据分析 Agent ### 4.1 适用场景 Agent V2 适合开放式、多步骤、需要动态规划的任务。与工作流不同,工作流需要提前定义每一步;Agent V2 更适合“步骤不固定”的任务,例如数据分析、文件处理、多工具协作和需要追问澄清的复杂问题。 本案例模拟运营、产品或销售团队的日常数据分析需求:上传 Excel 文件后,直接用自然语言提出问题,让 Agent 自主读取文件、制定分析计划,并在虚拟机中执行分析。 案例三的工作流需要你先设计“检索规则 → 分类 → 分支 → 改写或拒绝”的固定路径;Agent V2 则更像一个可以自主规划的执行者。你不需要提前定义每一步,只需要提供目标和文件,Agent 会根据数据结构和问题复杂度决定先读取文件、再做统计、是否需要追问、是否需要运行代码。 数据分析很适合用来体验 Agent V2,因为它天然具备三个特点:分析路径不固定、经常需要多步推理、需求可能需要澄清。同一份 Excel,不同用户可能关心产品销量、渠道 ROI、区域趋势或异常订单,固定工作流很难提前覆盖所有路径,而 Agent V2 可以根据问题动态规划。 ### 4.2 准备内容 * 示例文件:准备一份销售数据 Excel 或 CSV 表格。 * 一个支持 Agent V2 的对话模型。 * 虚拟机能力已在当前环境中可用。 ### 4.3 配置步骤 1. **创建 Agent V2 应用** 工作台点击新建应用,选择 `对话 Agent V2`,名称填写为 `智能数据分析 Agent`。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-36.png) 2. **配置模型与 Prompt** AI 配置继续使用 GLM-5.1 模型。系统提示词可以参考: ```md 你是一个资深数据分析师 Agent。你可以读取用户上传的数据文件、在沙箱中运行 Python 分析代码、并主动向用户追问澄清需求。 工具: - 📄 **读取文件** — 读取用户上传的 Excel/CSV 数据 - 💻 **沙箱执行** — 运行 Python 脚本(pandas/matplotlib/numpy) - ❓ **主动追问** — 分析需求不明确时向用户确认 工作方式: 1. 收到数据和问题后,先读取文件了解数据结构和内容 2. 制定分析计划,以步骤列表展示给用户 3. 按计划逐步执行,每步展示关键发现 4. 遇到模糊需求时主动追问,如指标定义不明确或缺少对比基准 5. 根据追问结果动态更新计划 6. 输出分析报告,包含数据概览、核心发现、可视化图表、业务建议 安全规则: - 沙箱中只能做数据分析,禁止访问网络,禁止写文件到宿主机 - 数据仅用于本次分析,不在报告中暴露原始敏感数据 - 不确定的结论标注置信度 输出格式: 1. 📋 分析计划(根据数据自动生成) 2. 📊 数据概览(行数、列名、缺失值、基本统计) 3. 🔍 核心发现(3-5 个关键洞察,图表辅助) 4. 💡 业务建议(基于数据的可操作建议) ``` 这段 Prompt 的重点是让 Agent 先规划再执行,而不是直接给结论。对于数据分析类任务,先读取数据结构、确认字段含义、制定分析计划,可以显著减少误解需求或误用指标的风险。正式使用时,可以继续补充企业内部指标定义,例如 GMV、ROI、转化率、有效客户、复购率等口径。 3. **配置开场白** 开场白用于引导用户上传数据文件并提出分析问题: ```text 你好!我是智能数据分析 Agent 📊 直接把 Excel 或 CSV 文件拖进来,告诉我你想分析什么。 例如: - "分析这份销售数据,找出销量最好的产品和趋势" - "帮我看看用户活跃度的变化,找出下降的原因" - "对比三个渠道的转化率,哪个 ROI 最高?" 我会先了解你的数据,制定分析计划,然后在沙箱中运行分析代码。 需要确认的地方我会主动问你。 ``` 4. **开启虚拟机能力** 数据分析通常需要读取文件并执行代码,因此需要开启虚拟机配置。 虚拟机能力用于隔离代码执行环境。Agent 可以在其中运行数据分析脚本、读取上传文件、生成统计结果,但不会直接影响本地宿主环境。对于需要运行 Python、处理 Excel、绘制图表或做批量计算的场景,这是 Agent V2 区别于普通对话应用的重要能力。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-37.png) 5. **上传文件并测试** 上传销售数据示例文件,并输入问题: ```text 帮我分析这份销售数据,看看哪些产品卖得好,哪个渠道 ROI 最高 ``` Agent 会先拆解任务,再逐步执行分析。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-38.png) 执行过程中可以看到任务在虚拟机中运行,不会影响本地环境。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-39.png) 测试时重点观察 Agent 是否具备完整的分析过程:是否先识别表格字段,是否解释分析计划,是否在需要时运行代码,是否根据结果给出业务建议。如果问题描述不清晰,理想行为不是强行分析,而是先向用户追问关键口径。 ### 4.4 验证效果 最终结果应包含分析计划、数据概览、关键发现和业务建议。 ![FastGPT 操作截图](/imgs/guide/getting-started/quick-start/image-40.png) 结果验证时建议关注四个维度:结论是否来自实际数据,指标口径是否清楚,图表或统计是否能支撑结论,业务建议是否可执行。数据分析 Agent 的价值不只是输出一段总结,而是把“读数据、算指标、解释结果、提出建议”的过程串起来。 ### 4.5 业务价值 * **降低数据分析门槛**:业务人员可以直接上传 Excel 或 CSV,用自然语言提出问题,不必先写 SQL、Python 或复杂公式。 * **支持开放式探索**:同一份数据可以围绕销量、渠道、区域、客户、趋势、异常值等方向反复追问,适合没有固定分析路径的场景。 * **提升分析透明度**:Agent 会展示分析计划和关键步骤,用户可以看到它如何理解数据、如何计算指标、如何得出结论。 * **隔离代码执行风险**:通过虚拟机执行分析脚本,降低本地环境污染、依赖冲突和权限误用风险。 * **沉淀业务分析能力**:销售复盘、运营周报、活动归因、产品指标诊断等场景都可以复用这一类 Agent,把数据分析从专家任务变成日常工作流。 ## 四种类型选型回顾 完成四个案例后,可以把 FastGPT 的常见应用类型理解为从简单到复杂的能力递进:对话 Agent 解决“怎么回答和生成内容”,知识库解决“基于什么资料回答”,工作流解决“按什么固定流程处理”,Agent V2 解决“面对开放任务如何自主规划和执行”。 | 应用类型 | 适合场景 | 核心能力 | | -------------- | ------------------- | ---------------- | | 对话 Agent | 轻量问答、文案生成、标准化输出 | Prompt、模型配置、工具调用 | | 知识库 + 对话 Agent | 基于资料、制度、法条、产品手册的问答 | 文件导入、知识库检索、引用原文 | | 工作流 | 固定步骤、条件分支、审核流、自动化处理 | 节点编排、判断器、人工确认 | | Agent V2 | 数据分析、复杂任务、多步推理、动态规划 | 自主规划、工具调用、虚拟机执行 | 选型时可以按任务复杂度判断: 1. 如果只是做轻量对话或标准化文案生成,优先选择对话 Agent。 2. 如果回答必须基于已有资料,选择知识库 + 对话 Agent。 3. 如果流程固定且需要条件分支、人工确认或自动化处理,选择工作流。 4. 如果任务开放、步骤不固定,并且需要自主分析、工具调用或代码执行,选择 Agent V2。 实际项目中也可以组合使用这些能力。例如客服助手可以使用知识库回答产品问题,再通过工具查询订单;内容审核可以用工作流固定审核路径,同时用知识库维护规则;数据分析场景可以先用 Agent V2 完成探索,再把稳定下来的分析步骤沉淀成工作流。 file: ./content/guide/workspace/customDomain.en.mdx meta: { "title": "Configure Custom Domain", "description": "How to configure a custom domain in FastGPT" } FastGPT Cloud supports custom domain configuration starting from v4.14.4. ## How to Configure a Custom Domain ### 1. Open the "Custom Domain" Page In the sidebar, go to "Account" -> "Custom Domain" to open the configuration page. If your plan does not support this feature, follow the on-screen instructions to upgrade. ![Open configuration page](/imgs/guide/team_permissions/customDomain/1.png) ### 2. Add a Custom Domain 1. Have your domain ready. Your domain must have an ICP filing. Currently supported filing providers are Alibaba Cloud, Tencent Cloud, and Volcano Engine. 2. Click the "Edit" button to enter edit mode. 3. Enter your domain, e.g. [www.example.com](http://www.example.com) 4. In your domain provider's DNS management console, add the CNAME record shown on the screen. 5. After adding the DNS record, click "Save". The system will automatically verify the DNS configuration -- this usually takes less than a minute. If verification takes too long, try again. 6. Once the status shows "Active", click "Confirm" to finish. ![Configure custom domain](/imgs/guide/team_permissions/customDomain/2.png) You can now access FastGPT services and call FastGPT APIs using your own domain. ## DNS Resolution Failure The system checks DNS resolution daily. If the DNS record becomes invalid, the custom domain will be disabled. You can re-verify it by clicking "Edit" on the "Custom Domain" management page. ![Edit](/imgs/guide/team_permissions/customDomain/3.png) To change your custom domain or switch providers, delete the existing configuration and set it up again. ## Use Cases * [Integrate with WeCom Bot](../build/publish/wecom.en.mdx) file: ./content/guide/workspace/customDomain.mdx meta: { "title": "配置自定义域名", "description": "如何在 FastGPT 中配置自定义域名" } FastGPT 云服务版自 v4.14.4 后支持配置自定义域名。 ## 如何配置自定义域名 ### 1. 打开“自定义域名”页面 在侧边栏选择“账号” -> “自定义域名”,打开自定义域名配置页。 如果您的套餐等级不支持配置,请根据页面的指引升级套餐。 ![打开配置页面](/imgs/guide/team_permissions/customDomain/1.png) ### 2. 添加自定义域名 1. 准备好您的域名。您的域名必须先经过备案,目前支持“阿里云”、“腾讯云”、“火山引擎”三家服务商的备案域名。 2. 点击“编辑”按钮,进入编辑状态。 3. 填入您的域名,例如 [www.example.com](http://www.example.com) 4. 在域名服务商的域名解析处,添加界面中提示的 DNS 记录,注意记录类型为 CNAME。 5. 添加解析记录后,点击"保存"按钮。系统将自动检查 DNS 解析情况,一般情况下,在一分钟内就可以获取到解析记录。如果长时间没有获取到记录,可以重试一次。 6. 待状态提示显示为“已生效”后,点击“确认”按钮即可。 ![配置自定义域名](/imgs/guide/team_permissions/customDomain/2.png) 现在您可以通过您自己的域名访问 fastgpt 服务、调用 fastgpt 的 API 了。 ## 域名解析失效 系统会每天对 DNS 解析进行检查,如果发现 DNS 解析记录失效,则会停用该自定义域名,可以在"自定义域名"管理界面中点击"编辑"进行重新解析。 ![编辑](/imgs/guide/team_permissions/customDomain/3.png) 如果您需要修改自定义域名、或修改服务商,则需要删除自定义域名配置后进行重新配置。 ## 使用案例 * [接入企业微信智能机器人](../build/publish/wecom.mdx) file: ./content/self-host/config/env.en.mdx meta: { "title": "Environment Variables", "description": "Environment variables for projects/app, projects/code-sandbox, and pro/admin" } This page describes the environment variables commonly used in a self-hosted FastGPT deployment. `projects/app` and `pro/admin` both reuse many settings from `packages/service/env.ts`, so database, secret, object storage, vector database, and service-level variables are documented together. Variables that are only read by `projects/app` or `pro/admin` are listed separately. ## Notes * `projects/app`: the main Next.js application, including pages, API routes, workflows, Knowledge Bases, object storage, and vector storage. * `pro/admin`: the commercial Admin service. Besides its own Admin variables, it also reuses App/Service settings such as database, secrets, object storage, models, and logging. * `projects/code-sandbox`: the code execution sandbox service. It exposes the `/sandbox` endpoint and is called by App through `CODE_SANDBOX_URL`. * `packages/service/env.ts` exports `serviceEnv`; `projects/app/src/env.ts` exports `appEnv`. * Shared App/Admin boolean variables use `true`, `1`, `yes`, or `y` to enable a feature. Other values are treated as disabled. * `FILE_TOKEN_KEY`, `AES256_SECRET_KEY`, and `INVOKE_TOKEN_SECRET` are required at runtime. Use strong random secrets and do not use the example values in production. ## Shared App/Admin Variables These variables are mainly validated by `packages/service/env.ts` and apply to `projects/app` and to `pro/admin` when it imports `@fastgpt/service`. A few App-side switches are still defined in `packages/service/env.ts`; they are also called out in the App-specific section below. ### Basics and Secrets | Variable | Default | Description | | --------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | `DB_MAX_LINK` | `5` | Maximum connection pool size for MongoDB, PG, OceanBase, openGauss, and other databases. | | `SYNC_INDEX` | `true` | Whether to create missing MongoDB indexes and remove explicitly declared deprecated indexes at startup. Maintain indexes manually when disabled. | | `FILE_TOKEN_KEY` | None, **required** | Secret for file read and file authorization flows. Must be at least 6 characters. | | `AES256_SECRET_KEY` | None, **required** | Secret used by AES encryption and decryption. Must be at least 6 characters. | | `INVOKE_TOKEN_SECRET` | None, **required** | JWT secret for Invoke reverse calls. Must be at least 32 characters. | | `ROOT_KEY` | `fastgpt_root_key` | Admin API key for the current system. It can call `/api/admin/**` APIs and must be at least 6 characters. | | `PRO_TOKEN` | Empty | Token for FastGPT app server calls to pro/admin internal APIs. It must match the pro/admin configuration and is required when App configures `PRO_URL`. | | `PRO_URL` | Empty | Commercial service URL. When set, App can call Pro APIs, and the domain is allowed by file URL validation. | ### Service URLs and Integrations | Variable | Default | Description | | ------------------------ | ----------------------------------- | --------------------------------------------------------------------------------------------------------- | | `PLUGIN_BASE_URL` | `http://localhost:3004` | FastGPT Plugin service URL. Deployment templates usually set this to the internal Plugin service URL. | | `PLUGIN_TOKEN` | `token` | Authentication token for calling the Plugin service. It must match the Plugin service configuration. | | `CODE_SANDBOX_URL` | `http://localhost:3002` | Code Sandbox service URL. Deployment templates usually set this to the internal Code Sandbox service URL. | | `CODE_SANDBOX_TOKEN` | `codesandbox` | Token used by App when calling Code Sandbox. It must match the sandbox service `SANDBOX_TOKEN`. | | `AIPROXY_API_ENDPOINT` | Empty | AI Proxy service URL. When configured, model requests prefer AI Proxy. | | `AIPROXY_API_TOKEN` | Empty | Token for calling AI Proxy. | | `OPENAI_BASE_URL` | `https://api.openai.com/v1` | Default OpenAI-compatible model endpoint when AI Proxy is not configured. | | `CHAT_API_KEY` | Empty | Default OpenAI-compatible model API key when AI Proxy token is not configured. | | `CRM_API_URL` | Empty | Lead attribution CRM API base URL (including `/api/v1`). Empty disables identity reporting. | | `CRM_API_KEY` | Empty | CRM admin API key used to bind a FastGPT user to `visitor_id` after registration or login. | | `MARKETPLACE_URL` | `https://v2.marketplace.fastgpt.cn` | Plugin marketplace API URL. | | `FEISHU_BASE_URL` | `https://open.feishu.cn` | Lark Open Platform URL. Use your private Lark domain when self-hosting Lark. | | `DINGTALK_BASE_URL` | `https://api.dingtalk.com` | DingTalk new API base URL. | | `DINGTALK_OAPI_BASE_URL` | `https://oapi.dingtalk.com` | DingTalk OAPI base URL. | | `YUQUE_DATASET_BASE_URL` | `https://www.yuque.com` | Yuque Knowledge Base URL. | ### Agent Sandbox | Variable | Default | Description | | ------------------------------------------------ | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `AGENT_SANDBOX_PROVIDER` | Empty | Agent Sandbox provider. Supported values are `sealosdevbox` and `opensandbox`. Empty disables Sandbox. Once set, the matching provider variables are required. `fastgpt-app` also requires all three proxy variables, while `fastgpt-pro` requires only the preview proxy URL. | | `AGENT_SANDBOX_SEALOS_BASEURL` | Empty | Sealos Devbox service URL. | | `AGENT_SANDBOX_SEALOS_TOKEN` | Empty | Sealos Devbox access token. | | `AGENT_SANDBOX_SEALOS_WORK_DIRECTORY` | `/home/devbox/workspace` | Working directory inside the Sealos Devbox sandbox. | | `AGENT_SANDBOX_SEALOS_IMAGE` | Empty | Runtime image used by Sealos Devbox. Required when `sealosdevbox` is enabled. | | `AGENT_SANDBOX_OPENSANDBOX_BASEURL` | Empty | OpenSandbox service URL. | | `AGENT_SANDBOX_OPENSANDBOX_API_KEY` | Empty | OpenSandbox API key. Required when OpenSandbox is enabled, and must match OpenSandbox server `[server].api_key`. | | `AGENT_SANDBOX_OPENSANDBOX_RUNTIME` | `docker` | OpenSandbox runtime, either `docker` or `kubernetes`. | | `AGENT_SANDBOX_OPENSANDBOX_IMAGE` | Empty | Full runtime image used by OpenSandbox. Required when `opensandbox` is enabled. | | `AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY` | `true` | Whether OpenSandbox access goes through the server proxy. | | `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_URL` | Empty | Required in OpenSandbox mode. Volume Manager service URL. | | `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN` | Empty | Required in OpenSandbox mode. Volume Manager authentication token. | | `AGENT_SANDBOX_OPENSANDBOX_VOLUME_NAME_PREFIX` | `fastgpt-session` | Prefix used by the FastGPT app when generating persistent OpenSandbox volume `claimName` values. When upgrading, reuse the previous `VM_VOLUME_NAME_PREFIX` value. | | `AGENT_SANDBOX_PROXY_SECRET` | Empty | Shared HMAC secret for the app and agent-sandbox-proxy. Required by `fastgpt-app` when Agent Sandbox is enabled; must be at least 32 bytes. | | `AGENT_SANDBOX_PROXY_URL` | Empty | Browser-accessible WebSocket URL for agent-sandbox-proxy. Required by `fastgpt-app` when Agent Sandbox is enabled; must start with `ws://` or `wss://`. | | `AGENT_SANDBOX_PREVIEW_PROXY_URL` | Empty | Browser-accessible HTTP(S) URL for Sandbox file previews. You must add it to both `fastgpt-app` and `fastgpt-pro` when Agent Sandbox is enabled. Use an origin separate from the FastGPT application. | | `AGENT_SANDBOX_FREE_TIP` | `false` | Whether the frontend shows the Agent Sandbox free-use hint. | | `AGENT_SANDBOX_STORAGE_SIZE_GI` | `1` | Agent Sandbox storage size in Gi. FastGPT derives the archive, Skill, and single-file limits from this value. | | `AGENT_SANDBOX_SUSPEND_MINUTES` | `60` | Number of inactive minutes before a running Agent Sandbox is automatically suspended. | | `AGENT_SANDBOX_ARCHIVE_INACTIVE_DAYS` | `7` | Number of inactive days before a suspended Agent Sandbox is automatically archived. | | `AGENT_SANDBOX_MAX_EDIT_DEBUG` | `100` | Limit for Agent edit/debug sandboxes. | | `AGENT_SANDBOX_NPM_REGISTRY` | Empty | npm registry used by npm, yarn, pnpm, and bun inside Agent sandboxes. | | `AGENT_SANDBOX_PYPI_INDEX_URL` | Empty | PyPI index URL used by pip, `python -m pip`, and uv inside Agent sandboxes. | ### Databases, Cache, and Vector Stores | Variable | Default | Description | | ---------------------------------------------- | ------------------------------------------- | -------------------------------------------------------------------------------------------------------- | | `REDIS_URL` | `redis://default:mypassword@localhost:6379` | Redis connection URL. | | `STREAM_RESUME_TTL_SECONDS` | `300` | TTL for an active stream resume mirror, in seconds. | | `STREAM_RESUME_POST_COMPLETE_TTL_SECONDS` | `30` | Shortened TTL after a stream completes, in seconds. | | `STREAM_RESUME_REDIS_MAXMEMORY_RATIO` | `0.5` | When Redis used memory divided by `maxmemory` reaches this ratio, new stream resume mirrors are skipped. | | `STREAM_RESUME_REDIS_MEMORY_CHECK_INTERVAL_MS` | `5000` | Redis memory watermark cache duration, in milliseconds. | | `MONGODB_URI` | Local MongoDB example URL | Main business MongoDB connection URL. | | `MONGODB_LOG_URI` | Same example as `MONGODB_URI` | MongoDB connection URL for logs. If unset, it can reuse the main database. | | `VECTOR_VQ_LEVEL` | `32` | Vector quantization level. Supported ranges depend on the vector store. | | `PG_URL` | Empty | PostgreSQL/pgvector connection URL. | | `OCEANBASE_URL` | Empty | OceanBase vector store connection URL. | | `SEEKDB_URL` | Empty | SeekDB vector store connection URL. | | `MILVUS_ADDRESS` | Empty | Milvus/Zilliz address. | | `MILVUS_TOKEN` | Empty | Milvus/Zilliz access token. | | `OPENGAUSS_URL` | Empty | openGauss vector store connection URL. | ### Object Storage | Variable | Default | Description | | --------------------------------------- | ----------------------- | ----------------------------------------------------------------------------------------------------- | | `STORAGE_VENDOR` | `minio` | Object storage vendor. Supported values are `minio`, `aws-s3`, `r2`, `cos`, and `oss`. | | `STORAGE_PUBLIC_BUCKET` | `fastgpt-public` | Public file bucket. | | `STORAGE_PRIVATE_BUCKET` | `fastgpt-private` | Private file bucket. | | `STORAGE_REGION` | `us-east-1` | Object storage region. | | `STORAGE_EXTERNAL_ENDPOINT` | Empty | Externally reachable object storage endpoint for browsers or external services. | | `STORAGE_R2_PUBLIC_ENDPOINT` | Empty | Public HTTPS domain for a Cloudflare R2 bucket; required when `STORAGE_VENDOR=r2`. | | `STORAGE_S3_CDN_ENDPOINT` | Empty | CDN endpoint used for temporary `short-redirect` download URLs. Requires `STORAGE_EXTERNAL_ENDPOINT`. | | `STORAGE_DOWNLOAD_URL_MODE` | `short-proxy` | Download mode: `short-proxy` or `short-redirect`. External URLs are always FastGPT short links. | | `STORAGE_DOWNLOAD_REDIRECT_TTL_SECONDS` | `300` | Lifetime of the temporary object storage or CDN URL used by `short-redirect`, in seconds. | | `STORAGE_S3_ENDPOINT` | `http://localhost:9000` | S3/MinIO-compatible API endpoint. | | `STORAGE_PUBLIC_ACCESS_EXTRA_SUB_PATH` | Empty | Extra sub-path for public file access URLs. | | `STORAGE_ACCESS_KEY_ID` | `minioadmin` | Object storage access key. | | `STORAGE_SECRET_ACCESS_KEY` | `minioadmin` | Object storage secret key. | | `STORAGE_S3_FORCE_PATH_STYLE` | `false` | Whether S3 path-style access is forced. MinIO usually requires this. | | `STORAGE_S3_MAX_RETRIES` | `3` | Maximum S3 client retry count. | | `STORAGE_COS_PROTOCOL` | `https:` | Tencent Cloud COS protocol, either `https:` or `http:`. | | `STORAGE_COS_USE_ACCELERATE` | `false` | Whether Tencent Cloud COS acceleration domain is used. | | `STORAGE_COS_CNAME_DOMAIN` | Empty | Tencent Cloud COS custom CNAME domain. | | `STORAGE_COS_PROXY` | Empty | Tencent Cloud COS proxy URL. | | `STORAGE_OSS_ENDPOINT` | Empty | Alibaba Cloud OSS endpoint. | | `STORAGE_OSS_CNAME` | `false` | Whether Alibaba Cloud OSS uses CNAME. | | `STORAGE_OSS_INTERNAL` | `false` | Whether Alibaba Cloud OSS uses an internal endpoint. | | `STORAGE_OSS_SECURE` | `false` | Whether Alibaba Cloud OSS uses HTTPS. | | `STORAGE_OSS_ENABLE_PROXY` | `true` | Whether Alibaba Cloud OSS proxy access is enabled. | ### Logging, Metrics, and Tracing | Variable | Default | Description | | --------------------------- | ---------------- | ----------------------------------------------------------------------------------------------------- | | `LOG_ENABLE_CONSOLE` | `true` | Whether console logging is enabled. | | `LOG_CONSOLE_LEVEL` | `debug` | Console log level. Supported values are `trace`, `debug`, `info`, `warning`, `error`, and `fatal`. | | `LOG_DEPTH` | `3` | Legacy template variable for log object depth. New structured logging mainly uses log-level settings. | | `LOG_ENABLE_OTEL` | `false` | Whether OpenTelemetry log export is enabled. | | `LOG_OTEL_LEVEL` | `info` | OTEL log level. | | `LOG_OTEL_SERVICE_NAME` | `fastgpt-client` | OTEL log service name. | | `LOG_OTEL_URL` | Empty | OTEL log export URL. | | `METRICS_ENABLE_OTEL` | `false` | Whether OpenTelemetry metrics export is enabled. | | `METRICS_EXPORT_INTERVAL` | `30000` | Metrics export interval, in milliseconds. | | `METRICS_OTEL_SERVICE_NAME` | `fastgpt-client` | OTEL metrics service name. | | `METRICS_OTEL_URL` | Empty | OTEL metrics export URL. | | `TRACING_ENABLE_OTEL` | `false` | Whether OpenTelemetry tracing is enabled. | | `TRACING_OTEL_SERVICE_NAME` | `fastgpt-client` | OTEL tracing service name. | | `TRACING_OTEL_URL` | Empty | OTEL tracing export URL. | | `TRACING_OTEL_SAMPLE_RATIO` | Empty | Trace sampling ratio from `0` to `1`. | | `CHAT_LOG_URL` | Empty | Chat log push service URL. Empty disables pushing. | | `CHAT_LOG_INTERVAL` | Empty | Chat log batch push interval, in milliseconds. | | `CHAT_LOG_SOURCE_ID_PREFIX` | `fastgpt-` | Prefix for chat log source IDs. | | `TRACK_BATCH_UPDATE_TIME` | `10000` | Event counter batch write interval, in milliseconds. | ### Domains, Frontend, and Runtime | Variable | Default | Description | | ------------------------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `FE_DOMAIN` | Required | The origin clients use to access FastGPT, including the scheme, host, and optional port. It completes file and image URLs. Local development can use `http://localhost:3000`. | | `FILE_DOMAIN` | Empty | File access domain. It usually points to FastGPT, but a separate domain can isolate file risk. | | `NEXT_PUBLIC_BASE_URL` | Empty | Next.js sub-path deployment prefix, such as `/fastgpt`. It must be fixed when building the image. | | `HOSTNAME` | `localhost` | Service host used for internal URLs and SSRF local-address detection. Containers commonly set it to `0.0.0.0`. | | `PORT` | `3000` | Next.js listening port. Also used for local-address detection. | | `NODE_ENV` | Empty | Standard Node/Next.js runtime environment. Production images set it to `production`. | | `NEXT_TELEMETRY_DISABLED` | `1` | Disables Next.js Telemetry in production images. | | `NODE_OPTIONS` | `--max-old-space-size=4096` | Node options used during production image builds to increase the build memory limit. | ### Security | Variable | Default | Description | | ----------------------------------- | ------- | --------------------------------------------------------------------------------------------------- | | `USE_IP_LIMIT` | `false` | Whether IP rate limiting is enabled for selected APIs. | | `CHECK_INTERNAL_IP` | `false` | Whether internal IP checks are enabled to reduce SSRF risk. | | `AUTH_COOKIE_SECURE` | `false` | Whether login cookies use the `Secure` attribute. Enable only when the site is HTTPS-only. | | `TRUSTED_PROXY_ENABLE` | `false` | Whether trusted reverse proxy client IP validation is enabled. Disabled keeps legacy behavior. | | `TRUSTED_PROXY_IPS` | Empty | Trusted reverse proxy IP/CIDR list, separated by commas or whitespace. | | `PASSWORD_LOGIN_MINUTE_LIMIT_COUNT` | `10` | Maximum password login requests per account per minute. | | `MAX_LOGIN_SESSION` | `10` | Maximum login clients per account. | | `ALLOWED_ORIGINS` | Empty | Allowed CORS origins. Use commas to separate multiple origins. Empty allows all origins by default. | | `MULTIPLE_DATA_TO_BASE64` | `false` | Whether images are forced into base64 before being sent to models. | | `DISABLE_CACHE` | `false` | Whether system cache hits are disabled, mainly for debugging. | | `HTTP_PROXY` | Empty | Outbound HTTP proxy for Node and workers. | | `HTTPS_PROXY` | Empty | Outbound HTTPS proxy for Node and workers. | | `NO_PROXY` | Empty | Address list that bypasses proxies. | | `ALL_PROXY` | Empty | General outbound proxy. | ### Feature Flags and Limits | Variable | Default | Description | | -------------------------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `AGENT_ENGINE` | `fastAgent` | Agent engine. Supported values are `fastAgent` and `piAgent`. | | `SKIP_FILE_TYPE_CHECK` | `false` | Whether upload file type checks are skipped. | | `WECHAT_CHANNEL_CONCURRENCY` | `1000` | WeChat channel poll worker concurrency. Minimum value is `10`. | | `PARSE_FILE_WORKERS` | `5` | Resident file parsing worker count. | | `HTML_TO_MARKDOWN_WORKERS` | `10` | Resident HTML-to-Markdown worker count. | | `TEXT_TO_CHUNKS_WORKERS` | `10` | Resident text chunking worker count. | | `PARSE_FILE_TIMEOUT_SECONDS` | `600` | Timeout for one file parsing task, in seconds. | | `WORKFLOW_MAX_RUN_TIMES` | `500` | Maximum workflow run count to avoid extreme infinite loops. | | `WORKFLOW_MAX_LOOP_TIMES` | `100` | Maximum input array length for loop and parallel nodes. | | `WORKFLOW_PARALLEL_MAX_CONCURRENCY` | `10` | Parallel node concurrency limit. It must not exceed `WORKFLOW_MAX_LOOP_TIMES`. | | `SYSTEM_MAX_STRING_LENGTH_M` | `100` | Maximum character length for synchronous system string operations such as variable replacement, in M characters. `1` means `1,000,000` characters. Valid range: `1` to `100`. | | `CHAT_MAX_QPM` | `5000` | Chat QPM limit. User plan limits take precedence when configured. | | `SERVICE_REQUEST_MAX_CONTENT_LENGTH` | `10` | Maximum request body size accepted by the service, in MB. | | `MAX_FOLDER_DEPTH` | `4` | Maximum folder depth. The default allows up to 4 folder levels under the root. Valid range: `2` to `20`. | | `APP_FOLDER_MAX_AMOUNT` | `1000` | Maximum number of App folders. | | `DATASET_FOLDER_MAX_AMOUNT` | `1000` | Maximum number of dataset folders. | | `UPLOAD_FILE_MAX_SIZE` | `1000` | Maximum upload file size, in MB. | | `UPLOAD_FILE_MAX_AMOUNT` | `1000` | Maximum upload file count. | | `LLM_REQUEST_TRACKING_RETENTION_HOURS` | `6` | LLM request tracking retention, in hours. | | `MAX_HTML_TRANSFORM_CHARS` | `1000000` | Maximum number of characters for HTML-to-Markdown conversion. Larger content is not converted. | ## Additional App Variables These variables are mainly read by `projects/app`. Some are currently defined in `packages/service/env.ts` for shared validation, but their actual consumers are still App-side code. | Variable | Default | Description | | ------------------------------- | -------- | --------------------------------------------------------------------------------------------------- | | `DEFAULT_ROOT_PSW` | `123456` | Default password for initializing the root user. | | `SYSTEM_NAME` | `AI` | Default system name for the page title. | | `SYSTEM_DESCRIPTION` | Empty | Page meta description. If unset, the default i18n text is used. | | `SYSTEM_FAVICON` | Empty | Page favicon URL. If unset, the favicon from system config is used. | | `CHINESE_IP_REDIRECT_URL` | Empty | China IP redirect URL in frontend config. | | `PAY_FORM_URL` | Empty | Payment form URL in frontend config. | | `SHOW_COUPON` | `false` | Whether redemption codes are shown. | | `SHOW_DISCOUNT_COUPON` | `false` | Whether discount coupons are shown. | | `HIDE_CHAT_COPYRIGHT_SETTING` | `false` | Whether copyright settings are hidden. | | `WECOM_LOGIN_AUTO_REDIRECT` | `false` | Whether WeCom terminals automatically redirect to login. | | `APP_REGISTRATION_URL` | Empty | App registration application URL. Currently kept mostly for compatibility. | | `PASSWORD_EXPIRED_MONTH` | Empty | Password expiration period in months. Empty means passwords do not expire. | | `OPENAPI_KEY_MAX_COUNT` | `100` | Maximum number of system API Keys one team member can create. Minimum is 1. | | `SSE_MCP_SERVER_PROXY_ENDPOINT` | Empty | MCP SSE server proxy URL. Do not include a trailing slash. Required when publishing an SSE MCP App. | ### Open-Source Only Starting with v4.15.0, the open-source edition no longer reads `config.json`. When upgrading from an earlier version, remove the file's volume mount and migrate the old settings to environment variables using the table below. If you did not use these optional settings, you do not need to add them. | Former `config.json` field | Current environment variable | Default | Description | | ------------------------------------------- | ---------------------------- | -------- | ------------------------------------------------------------------------------ | | `systemEnv.customPdfParse.url` | `CUSTOM_PDF_PARSE_URL` | Empty | Custom PDF parsing service URL. | | `systemEnv.customPdfParse.key` | `CUSTOM_PDF_PARSE_KEY` | Empty | Custom PDF parsing service key. | | `systemEnv.customPdfParse.doc2xKey` | `DOC2X_KEY` | Empty | Doc2x PDF parsing service key. | | `systemEnv.customPdfParse.textinAppId` | `TEXTIN_APP_ID` | Empty | TextIn service App ID. | | `systemEnv.customPdfParse.textinSecretCode` | `TEXTIN_SECRET_CODE` | Empty | TextIn service Secret Code. | | `systemEnv.hnswEfSearch` | `HNSW_EF_SEARCH` | `100` | The `hnsw.ef_search` vector search parameter for PG, OceanBase, and openGauss. | | `systemEnv.hnswMaxScanTuples` | `HNSW_MAX_SCAN_TUPLES` | `100000` | Maximum number of tuples scanned during vector search. Applies only to PG. | | `systemEnv.datasetParseMaxProcess` | `DATASET_PARSE_MAX_PROCESS` | `10` | Maximum concurrency for the Knowledge Base file parsing queue. | | `systemEnv.vectorMaxProcess` | `VECTOR_MAX_PROCESS` | `10` | Maximum concurrency for the vector training queue. | | `systemEnv.qaMaxProcess` | `QA_MAX_PROCESS` | `10` | Maximum concurrency for the Q\&A splitting queue. | | `systemEnv.vlmMaxProcess` | `VLM_MAX_PROCESS` | `10` | Maximum concurrency for the image understanding model queue. | #### Enhanced PDF Parsing The open-source edition supports custom PDF parsing services, SoMark, TextIn, and Doc2x. Configure only one service. If you configure more than one, FastGPT uses this priority order: custom PDF parsing service, SoMark, TextIn, then Doc2x. ##### Use the Sealos PDF Parsing Service 1. Open [Sealos AI Proxy](https://hzh.sealos.run/?uid=fnWRt09fZP\&openapp=system-aiproxy) and create an API key. 2. Add the API key to FastGPT: ```dotenv CUSTOM_PDF_PARSE_URL=https://aiproxy.hzh.sealos.run/v1/parse/pdf?model=parse-pdf CUSTOM_PDF_PARSE_KEY=your-sealos-api-key ``` ##### Use SoMark 1. Open [SoMark Studio](https://somark.ai/Studio/apikey) and create an API key. 2. Add the API key to FastGPT: ```dotenv SOMARK_API_KEY=sk-your-api-key ``` The SoMark synchronous parsing endpoint accepts files up to 200 MB and 300 pages. See the [SoMark API documentation](https://docs.somark.ai/en/api-reference) for the complete limits and error codes. ##### Use Another Custom PDF Parsing Service ```dotenv CUSTOM_PDF_PARSE_URL=https://your-pdf-parser.example.com/v2/parse/file CUSTOM_PDF_PARSE_KEY=your-service-key ``` `CUSTOM_PDF_PARSE_KEY` is optional. When set, FastGPT sends it to the parsing service as `Authorization: Bearer `. The service must accept a `multipart/form-data` POST request with a `file` field and return JSON in this format: ```json { "pages": 10, "markdown": "Parsed Markdown content" } ``` ##### Use TextIn ```dotenv TEXTIN_APP_ID=your-app-id TEXTIN_SECRET_CODE=your-secret-code ``` ##### Use Doc2x ```dotenv DOC2X_KEY=your-api-key ``` Restart FastGPT after changing the environment variables. Then enable **Enhanced PDF Parsing** when importing files into a Knowledge Base or configuring App file uploads. PDFs use the configured enhanced parsing service only when this option is enabled; otherwise, FastGPT uses its built-in parser. ## Admin-Specific Variables These variables are mainly read by `pro/admin`. Admin also uses the shared App/Admin variables above. | Variable | Default | Description | | ------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------ | | `PRO_TOKEN` | None, **required** | Service-to-service token for FastGPT app calls to pro/admin internal APIs. Must be at least 32 characters and match App. | | `EVAL_LINE_LIMIT` | `1000` | Maximum number of rows allowed when creating one evaluation task. Also sent to frontend config. | | `BATCH_UPDATE_TIME` | `3000` | Wallet balance batch update interval, in milliseconds. | | `INVOICE_FEISHU_WEBHOOK_URL` | Empty | Lark webhook URL for invoice application notifications. | | `INVOICE_FEISHU_WEBHOOK_CALLBACK_URL` | Empty | Callback URL for buttons in invoice notifications. | | `SMS_PROXY` | Empty | SMS sending proxy service URL. | | `MAX_CRAWL_PAGE` | `2000` | Maximum number of pages to crawl during website sync. | | `CRAWL_MAX_HTML_SIZE` | `10` | Estimated maximum HTML size for one static crawled page, in MB. | | `CRAWL_EXCLUDE_LIST` | Empty | Crawler exclusion rules for domains or paths. Use commas to separate values. | | `SHOW_GIT` | `false` | Whether Git information is shown in Admin. | | `CLEAR_FREE_ACCOUNT` | `false` | Whether free account resource cleanup is enabled. | | `SYNC_MEMBER_CRON` | Empty | Cron expression for automatic member sync. Empty disables the sync task. | | `WORKORDER_BASE_URL` | Empty | Work order system URL. When set, the frontend shows work order entry points. | | `WORKORDER_JWT_SECRET` | Empty | Secret used to sign JWTs when creating work orders. | | `EXTERNAL_USER_SYSTEM_BASE_URL` | Empty | External user system URL. | | `EXTERNAL_USER_SYSTEM_AUTH_TOKEN` | Empty | Authentication token for the external user system. | | `BAIDU_CONVERSION_TOKEN` | Empty | Baidu conversion tracking token. | | `BAIDU_CONVERSION_BASE_URL` | Empty | Baidu conversion tracking API URL. | | `BING_ADS_DEVELOPER_TOKEN` | Empty | Bing Ads developer token. | | `BING_ADS_CUSTOMER_ID` | Empty | Bing Ads customer ID. | | `BING_ADS_CUSTOMER_ACCOUNT_ID` | Empty | Bing Ads customer account ID. | | `BING_ADS_CONVERSION_NAME` | `fastgptcn` | Bing Ads conversion goal name. | | `BING_OAUTH_CLIENT_ID` | Empty | Bing OAuth client ID. | | `BING_OAUTH_CLIENT_SECRET` | Empty | Bing OAuth client secret. | | `BING_OAUTH_REFRESH_TOKEN` | Empty | Bing OAuth refresh token. | | `SHOW_WECOM_CONFIG` | `false` | Whether WeCom configuration is shown. | | `WECOM_DEV` | `false` | Development mode switch for WeCom Pay. | ## Code Sandbox Variables These variables are loaded and validated by `projects/code-sandbox/src/env.ts`. When App calls the sandbox, `CODE_SANDBOX_TOKEN` must match `SANDBOX_TOKEN`. | Variable | Default | Description | | --------------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | `SANDBOX_PORT` | `3000` | Code Sandbox listening port. | | `SANDBOX_TOKEN` | Empty | Bearer token for the `/sandbox` endpoint. Empty disables API authentication. It only allows printable ASCII characters and cannot contain spaces. | | `SANDBOX_POOL_SIZE` | `20` | Number of pre-warmed JS/Python workers, from `1` to `100`. | | `SANDBOX_QUEUE_ID_CONCURRENCY` | Empty | Number of requests with the same `queueId` that may enter execution concurrently. Empty disables `queueId` queueing. Range: `1` to `100`. | | `SANDBOX_API_MAX_BODY_MB` | `8` | Maximum `/sandbox` API JSON body size, including `variables`, in MB. Range: `1` to `100`. | | `SANDBOX_MAX_TIMEOUT` | `60000` | Timeout for one code execution, in milliseconds. Range: `1000` to `600000`. | | `SANDBOX_MAX_MEMORY_MB` | `256` | Maximum memory for one sandbox, in MB. Range: `32` to `4096`. The runtime reserves an extra `50` MB for overhead. | | `SANDBOX_MAX_OUTPUT_MB` | `10` | Maximum output JSON size for one code execution, including return values and logs, in MB. Range: `1` to `100`. | | `CHECK_INTERNAL_IP` | `true` | Whether internal IP checks are enabled for sandbox network requests. | | `SANDBOX_REQUEST_MAX_COUNT` | `30` | Maximum number of network requests allowed during one code execution. Range: `1` to `1000`. | | `SANDBOX_REQUEST_TIMEOUT` | `60000` | Timeout for one network request from inside the sandbox, in milliseconds. Range: `1000` to `300000`. | | `SANDBOX_REQUEST_MAX_RESPONSE_MB` | `10` | Maximum response body size for one sandbox network request, in MB. Range: `1` to `100`. | | `SANDBOX_REQUEST_MAX_BODY_MB` | `5` | Maximum request body size for one sandbox network request, in MB. Range: `1` to `100`. | | `SANDBOX_JS_ALLOWED_MODULES` | `lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring` | Module allowlist for JavaScript code. Use commas to separate modules. | | `SANDBOX_PYTHON_ALLOWED_MODULES` | Common standard libraries plus `numpy,pandas,matplotlib` | Module allowlist for Python code. Use commas to separate modules. | | `NODE_ENV` | Empty | Standard Node environment variable. Internal address checks are relaxed in `development`. | | `HOSTNAME` | `localhost` | Sandbox service host used for local-address detection. | | `PORT` | `3000` | Sandbox local service port used for local-address detection. Actual listening uses `SANDBOX_PORT` first. | ## Volume Manager Variables These variables are loaded and validated by `projects/volume-manager/src/env.ts`. The `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN` used by FastGPT for persistent OpenSandbox volumes must match `VM_AUTH_TOKEN`. | Variable | Default | Description | | -------------------------- | ---------------------- | ---------------------------------------------------------------- | | `PORT` | `3000` | Volume Manager listening port. | | `VM_AUTH_TOKEN` | None, **required** | API authentication token for Volume Manager. | | `VM_RUNTIME` | `kubernetes` | Runtime type, either `docker` or `kubernetes`. | | `VM_DOCKER_SOCKET` | `/var/run/docker.sock` | Docker socket path. Required only in `docker` mode. | | `VM_DOCKER_API_VERSION` | `v1.44` | Docker API version. Required only in `docker` mode. | | `VM_K8S_NAMESPACE` | `opensandbox` | Kubernetes namespace. Required only in `kubernetes` mode. | | `VM_K8S_PVC_STORAGE_CLASS` | `standard` | Kubernetes PVC StorageClass. Required only in `kubernetes` mode. | | `VM_LOG_LEVEL` | `info` | Log level. Supported values are `debug`, `info`, and `none`. | file: ./content/self-host/config/env.mdx meta: { "title": "环境变量说明", "description": "projects/app、projects/code-sandbox 与 pro/admin 环境变量说明" } 本文说明 FastGPT 自部署时常用服务的环境变量。`projects/app` 与 `pro/admin` 会大量复用 `packages/service/env.ts` 中的服务端配置,因此数据库、密钥、对象存储、向量库等变量合并说明;只有 `projects/app` 或 `pro/admin` 自己读取的变量单独列出。 ## 说明 * `projects/app`:主应用服务,包含 Next.js 页面、API 路由、工作流、知识库、对象存储、向量库等能力。 * `pro/admin`:商业版 Admin 服务。除自己的后台功能变量外,也会复用 App/Service 的数据库、密钥、对象存储、模型、日志等变量。 * `projects/code-sandbox`:代码沙箱服务,对外暴露 `/sandbox` 执行接口,供 App 通过 `CODE_SANDBOX_URL` 调用。 * 代码中 `packages/service/env.ts` 导出名为 `serviceEnv`,`projects/app/src/env.ts` 导出名为 `appEnv`。 * App/Admin 共享布尔变量使用 `true`、`1`、`yes` 或 `y` 表示开启;其他值视为关闭。 * `FILE_TOKEN_KEY`、`AES256_SECRET_KEY` 与 `INVOKE_TOKEN_SECRET` 为运行期必填,建议使用随机强密钥,不要使用示例值。 ## App/Admin 共享变量 这些变量主要由 `packages/service/env.ts` 校验,适用于 `projects/app`,也适用于会导入 `@fastgpt/service` 的 `pro/admin`。注意:`packages/service/env.ts` 当前也包含少量 App 侧开关;这类变量在下方 `projects/app` 额外变量中单独列出。 ### 基础与密钥 | 变量 | 默认值 | 说明 | | --------------------- | ------------------ | --------------------------------------------------------------------------- | | `DB_MAX_LINK` | `5` | MongoDB、PG、OceanBase、openGauss 等数据库连接池最大连接数。 | | `SYNC_INDEX` | `true` | 是否在启动时创建缺失的 MongoDB 索引并清理显式声明的废弃索引;关闭后需自行维护索引。 | | `FILE_TOKEN_KEY` | 无,**必填** | 文件读取、文件鉴权相关密钥,长度至少 6 位。 | | `AES256_SECRET_KEY` | 无,**必填** | AES 加解密密钥,长度至少 6 位。 | | `INVOKE_TOKEN_SECRET` | 无,**必填** | Invoke 反向调用 JWT 密钥,长度至少 32 位。 | | `ROOT_KEY` | `fastgpt_root_key` | 当前系统管理员 API 密钥,可用于调用 `/api/admin/**` 接口,长度至少 6 位。 | | `PRO_TOKEN` | 空 | FastGPT app 服务端调用 pro/admin 内部接口的凭证,需与 pro/admin 配置一致;App 配置 `PRO_URL` 时必填。 | | `PRO_URL` | 空 | 商业版服务地址,配置后 App 可调用 Pro API,也会作为文件 URL 安全校验允许域名。 | ### 服务地址与集成 | 变量 | 默认值 | 说明 | | ------------------------ | ----------------------------------- | ----------------------------------------------------------- | | `PLUGIN_BASE_URL` | `http://localhost:3004` | FastGPT Plugin 服务地址;部署模板通常会配置为内部 Plugin 服务地址。 | | `PLUGIN_TOKEN` | `token` | 调用 Plugin 服务使用的认证 Token;需与 Plugin 服务配置一致。 | | `CODE_SANDBOX_URL` | `http://localhost:3002` | Code Sandbox 服务地址;部署模板通常会配置为内部 Code Sandbox 服务地址。 | | `CODE_SANDBOX_TOKEN` | `codesandbox` | App 调用 Code Sandbox 时使用的认证 Token,需与沙箱服务 `SANDBOX_TOKEN` 一致。 | | `AIPROXY_API_ENDPOINT` | 空 | AI Proxy 服务地址;配置后模型请求会优先走 AI Proxy。 | | `AIPROXY_API_TOKEN` | 空 | 调用 AI Proxy 使用的认证 Token。 | | `OPENAI_BASE_URL` | `https://api.openai.com/v1` | 未配置 AI Proxy 时,兼容 OpenAI 协议的默认模型接口地址。 | | `CHAT_API_KEY` | 空 | 未配置 AI Proxy Token 时,兼容 OpenAI 协议的默认模型 API Key。 | | `CRM_API_URL` | 空 | 官网访客归因 CRM 的 API 基础地址(包含 `/api/v1`);为空时不进行身份上报。 | | `CRM_API_KEY` | 空 | CRM 管理 API Key,用于注册或登录成功后按 `visitor_id` 绑定 FastGPT 用户。 | | `MARKETPLACE_URL` | `https://v2.marketplace.fastgpt.cn` | 插件市场接口地址。 | | `FEISHU_BASE_URL` | `https://open.feishu.cn` | 飞书开放平台地址,私有化飞书可改为对应域名。 | | `DINGTALK_BASE_URL` | `https://api.dingtalk.com` | 钉钉新版 API 基础地址。 | | `DINGTALK_OAPI_BASE_URL` | `https://oapi.dingtalk.com` | 钉钉 OAPI 基础地址。 | | `YUQUE_DATASET_BASE_URL` | `https://www.yuque.com` | 语雀知识库地址。 | ### Agent Sandbox | 变量 | 默认值 | 说明 | | ------------------------------------------------ | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- | | `AGENT_SANDBOX_PROVIDER` | 空 | Agent 沙箱提供方,可选 `sealosdevbox`、`opensandbox`;为空时不启用沙箱。配置后必须同时配置对应 provider 的必填变量;`fastgpt-app` 还需要三项 Proxy 变量,`fastgpt-pro` 只需要预览 Proxy URL。 | | `AGENT_SANDBOX_SEALOS_BASEURL` | 空 | Sealos Devbox 服务地址。 | | `AGENT_SANDBOX_SEALOS_TOKEN` | 空 | Sealos Devbox 访问 Token。 | | `AGENT_SANDBOX_SEALOS_WORK_DIRECTORY` | `/home/devbox/workspace` | Sealos Devbox 沙箱内工作目录。 | | `AGENT_SANDBOX_SEALOS_IMAGE` | 空 | Sealos Devbox 使用的运行态镜像;启用 `sealosdevbox` 时必填。 | | `AGENT_SANDBOX_OPENSANDBOX_BASEURL` | 空 | OpenSandbox 服务地址。 | | `AGENT_SANDBOX_OPENSANDBOX_API_KEY` | 空 | OpenSandbox API Key;启用 OpenSandbox 时必填,并且必须与 OpenSandbox server 的 `[server].api_key` 一致。 | | `AGENT_SANDBOX_OPENSANDBOX_RUNTIME` | `docker` | OpenSandbox 运行时,可选 `docker` 或 `kubernetes`。 | | `AGENT_SANDBOX_OPENSANDBOX_IMAGE` | 空 | OpenSandbox 使用的完整运行态镜像;启用 `opensandbox` 时必填。 | | `AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY` | `true` | OpenSandbox 是否通过服务端代理访问。 | | `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_URL` | 空 | OpenSandbox 模式下必填,Volume Manager 服务地址。 | | `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN` | 空 | OpenSandbox 模式下必填,Volume Manager 认证 Token。 | | `AGENT_SANDBOX_OPENSANDBOX_VOLUME_NAME_PREFIX` | `fastgpt-session` | FastGPT app 生成 OpenSandbox 持久卷 `claimName` 时使用的前缀;升级时需沿用旧 `VM_VOLUME_NAME_PREFIX` 的值。 | | `AGENT_SANDBOX_PROXY_SECRET` | 空 | agent-sandbox-proxy 与主站共用的 HMAC 密钥;`fastgpt-app` 启用 Agent Sandbox 时必填,至少 32 字节。 | | `AGENT_SANDBOX_PROXY_URL` | 空 | 浏览器访问 agent-sandbox-proxy 的 WebSocket 地址;`fastgpt-app` 启用 Agent Sandbox 时必填,必须以 `ws://` 或 `wss://` 开头。 | | `AGENT_SANDBOX_PREVIEW_PROXY_URL` | 空 | 浏览器访问 Sandbox 文件预览的 HTTP(S) 地址;`fastgpt-app` 和 `fastgpt-pro` 启用 Agent Sandbox 时都必须增加。建议使用与 FastGPT 主站不同的 origin。 | | `AGENT_SANDBOX_FREE_TIP` | `false` | 前端是否展示 Agent Sandbox 免费提示。 | | `AGENT_SANDBOX_STORAGE_SIZE_GI` | `1` | Agent Sandbox 存储容量,单位 Gi;FastGPT 根据该值计算归档、Skill 和单文件限制。 | | `AGENT_SANDBOX_SUSPEND_MINUTES` | `60` | 运行中的 Agent 沙箱持续未活跃多少分钟后自动暂停。 | | `AGENT_SANDBOX_ARCHIVE_INACTIVE_DAYS` | `7` | 已暂停的 Agent 沙箱持续未活跃多少天后自动归档。 | | `AGENT_SANDBOX_MAX_EDIT_DEBUG` | `100` | Agent 编辑/调试沙箱数量限制。 | | `AGENT_SANDBOX_NPM_REGISTRY` | 空 | Agent 沙箱内 npm、yarn、pnpm、bun 使用的 npm registry。 | | `AGENT_SANDBOX_PYPI_INDEX_URL` | 空 | Agent 沙箱内 pip、`python -m pip`、uv 使用的 PyPI index URL。 | ### 数据库、缓存与向量库 | 变量 | 默认值 | 说明 | | ---------------------------------------------- | ------------------------------------------- | -------------------------------------------- | | `REDIS_URL` | `redis://default:mypassword@localhost:6379` | Redis 连接地址。 | | `STREAM_RESUME_TTL_SECONDS` | `300` | 流式恢复镜像在生成中的 TTL,单位秒。 | | `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 内存水位检测缓存时间,单位毫秒。 | | `MONGODB_URI` | 本地 MongoDB 示例地址 | 主业务 MongoDB 连接地址。 | | `MONGODB_LOG_URI` | 同 `MONGODB_URI` 示例地址 | 日志 MongoDB 连接地址;不配置时可复用主库。 | | `VECTOR_VQ_LEVEL` | `32` | 向量量化等级;不同向量库支持范围不同。 | | `PG_URL` | 空 | PostgreSQL/pgvector 向量库连接地址。 | | `OCEANBASE_URL` | 空 | OceanBase 向量库连接地址。 | | `SEEKDB_URL` | 空 | SeekDB 向量库连接地址。 | | `MILVUS_ADDRESS` | 空 | Milvus/Zilliz 连接地址。 | | `MILVUS_TOKEN` | 空 | Milvus/Zilliz 访问 Token。 | | `OPENGAUSS_URL` | 空 | openGauss 向量库连接地址。 | ### 对象存储 | 变量 | 默认值 | 说明 | | --------------------------------------- | ----------------------- | ------------------------------------------------------------------------ | | `STORAGE_VENDOR` | `minio` | 对象存储类型,可选 `minio`、`aws-s3`、`r2`、`cos`、`oss`。 | | `STORAGE_PUBLIC_BUCKET` | `fastgpt-public` | 公开文件 Bucket。 | | `STORAGE_PRIVATE_BUCKET` | `fastgpt-private` | 私有文件 Bucket。 | | `STORAGE_REGION` | `us-east-1` | 对象存储 Region。 | | `STORAGE_EXTERNAL_ENDPOINT` | 空 | 外部可访问的对象存储地址,用于浏览器或外部服务访问。 | | `STORAGE_R2_PUBLIC_ENDPOINT` | 空 | Cloudflare R2 公开 bucket 的 HTTPS 公网域名;`STORAGE_VENDOR=r2` 时必填。 | | `STORAGE_S3_CDN_ENDPOINT` | 空 | `short-redirect` 临时下载地址使用的 CDN 地址;配置时必须同时配置 `STORAGE_EXTERNAL_ENDPOINT`。 | | `STORAGE_DOWNLOAD_URL_MODE` | `short-proxy` | 下载模式,可选 `short-proxy` 或 `short-redirect`;对外始终返回 FastGPT 短链。 | | `STORAGE_DOWNLOAD_REDIRECT_TTL_SECONDS` | `300` | `short-redirect` 模式下临时对象存储/CDN 下载地址的有效时间,单位秒。 | | `STORAGE_S3_ENDPOINT` | `http://localhost:9000` | S3/MinIO 兼容 API 地址。 | | `STORAGE_PUBLIC_ACCESS_EXTRA_SUB_PATH` | 空 | 公开文件访问路径的额外子路径。 | | `STORAGE_ACCESS_KEY_ID` | `minioadmin` | 对象存储 Access Key。 | | `STORAGE_SECRET_ACCESS_KEY` | `minioadmin` | 对象存储 Secret Key。 | | `STORAGE_S3_FORCE_PATH_STYLE` | `false` | S3 是否强制 path-style 访问,MinIO 通常需要开启。 | | `STORAGE_S3_MAX_RETRIES` | `3` | S3 客户端最大重试次数。 | | `STORAGE_COS_PROTOCOL` | `https:` | 腾讯云 COS 访问协议,可选 `https:` 或 `http:`。 | | `STORAGE_COS_USE_ACCELERATE` | `false` | 腾讯云 COS 是否使用全球加速域名。 | | `STORAGE_COS_CNAME_DOMAIN` | 空 | 腾讯云 COS 自定义 CNAME 域名。 | | `STORAGE_COS_PROXY` | 空 | 腾讯云 COS 代理地址。 | | `STORAGE_OSS_ENDPOINT` | 空 | 阿里云 OSS Endpoint。 | | `STORAGE_OSS_CNAME` | `false` | 阿里云 OSS 是否使用 CNAME。 | | `STORAGE_OSS_INTERNAL` | `false` | 阿里云 OSS 是否使用内网 Endpoint。 | | `STORAGE_OSS_SECURE` | `false` | 阿里云 OSS 是否使用 HTTPS。 | | `STORAGE_OSS_ENABLE_PROXY` | `true` | 阿里云 OSS 是否启用代理访问。 | ### 日志、指标与追踪 | 变量 | 默认值 | 说明 | | --------------------------- | ---------------- | ------------------------------------------------------------ | | `LOG_ENABLE_CONSOLE` | `true` | 是否输出控制台日志。 | | `LOG_CONSOLE_LEVEL` | `debug` | 控制台日志等级,可选 `trace`、`debug`、`info`、`warning`、`error`、`fatal`。 | | `LOG_DEPTH` | `3` | 历史模板变量,用于日志对象展开深度;当前新版结构化日志主要使用日志等级配置。 | | `LOG_ENABLE_OTEL` | `false` | 是否启用 OpenTelemetry 日志上报。 | | `LOG_OTEL_LEVEL` | `info` | OTEL 日志等级。 | | `LOG_OTEL_SERVICE_NAME` | `fastgpt-client` | OTEL 日志服务名。 | | `LOG_OTEL_URL` | 空 | OTEL 日志上报地址。 | | `METRICS_ENABLE_OTEL` | `false` | 是否启用 OpenTelemetry 指标上报。 | | `METRICS_EXPORT_INTERVAL` | `30000` | 指标导出间隔,单位毫秒。 | | `METRICS_OTEL_SERVICE_NAME` | `fastgpt-client` | OTEL 指标服务名。 | | `METRICS_OTEL_URL` | 空 | OTEL 指标上报地址。 | | `TRACING_ENABLE_OTEL` | `false` | 是否启用 OpenTelemetry 链路追踪。 | | `TRACING_OTEL_SERVICE_NAME` | `fastgpt-client` | OTEL 追踪服务名。 | | `TRACING_OTEL_URL` | 空 | OTEL 追踪上报地址。 | | `TRACING_OTEL_SAMPLE_RATIO` | 空 | 追踪采样比例,范围 `0` 到 `1`。 | | `CHAT_LOG_URL` | 空 | 对话日志推送服务地址;为空时不推送。 | | `CHAT_LOG_INTERVAL` | 空 | 对话日志批量推送间隔,单位毫秒。 | | `CHAT_LOG_SOURCE_ID_PREFIX` | `fastgpt-` | 对话日志来源 ID 前缀。 | | `TRACK_BATCH_UPDATE_TIME` | `10000` | 事件计数批量写入间隔,单位毫秒。 | ### 域名、前端与运行时 | 变量 | 默认值 | 说明 | | ------------------------- | --------------------------- | ----------------------------------------------------------------------------------- | | `FE_DOMAIN` | 必填 | 客户端访问 FastGPT 时使用的地址(由协议、主机和可选端口组成),用于补全文件、图片等资源路径;本地开发可使用 `http://localhost:3000`。 | | `FILE_DOMAIN` | 空 | 文件访问域名,通常也指向 FastGPT 服务;可独立域名隔离文件风险。 | | `NEXT_PUBLIC_BASE_URL` | 空 | Next.js 子路径部署前缀,例如 `/fastgpt`;需要在构建镜像时确定。 | | `HOSTNAME` | `localhost` | 服务本机 Host,用于内部 URL 与 SSRF 本地地址识别;容器中常设为 `0.0.0.0`。 | | `PORT` | `3000` | Next.js 服务监听端口,也用于本地地址识别。 | | `NODE_ENV` | 空 | 标准 Node/Next.js 运行环境变量,生产镜像中为 `production`。 | | `NEXT_TELEMETRY_DISABLED` | `1` | 生产镜像中关闭 Next.js Telemetry。 | | `NODE_OPTIONS` | `--max-old-space-size=4096` | 生产镜像构建阶段使用的 Node.js 启动参数,用于提高构建内存上限。 | ### 安全配置 | 变量 | 默认值 | 说明 | | ----------------------------------- | ------- | ------------------------------------------- | | `USE_IP_LIMIT` | `false` | 是否启用部分接口的 IP 限流。 | | `CHECK_INTERNAL_IP` | `false` | 是否启用内网 IP 检查,用于降低 SSRF 风险。 | | `AUTH_COOKIE_SECURE` | `false` | 是否为登录 Cookie 添加 `Secure` 属性;仅在全站 HTTPS 时启用。 | | `TRUSTED_PROXY_ENABLE` | `false` | 是否启用可信反向代理客户端 IP 校验;关闭时兼容旧逻辑。 | | `TRUSTED_PROXY_IPS` | 空 | 可信反向代理 IP/CIDR 列表,逗号或空白分隔。 | | `PASSWORD_LOGIN_MINUTE_LIMIT_COUNT` | `10` | 单账号每分钟允许的密码登录请求次数。 | | `MAX_LOGIN_SESSION` | `10` | 单账号最大登录客户端数量。 | | `ALLOWED_ORIGINS` | 空 | 允许跨域来源,多个来源使用英文逗号分隔;为空默认允许所有跨域。 | | `MULTIPLE_DATA_TO_BASE64` | `false` | 是否强制将图片转成 base64 传递给模型。 | | `DISABLE_CACHE` | `false` | 是否关闭系统缓存命中,主要用于调试。 | | `HTTP_PROXY` | 空 | Node/worker 出站 HTTP 代理。 | | `HTTPS_PROXY` | 空 | Node/worker 出站 HTTPS 代理。 | | `NO_PROXY` | 空 | 不走代理的地址列表。 | | `ALL_PROXY` | 空 | 通用出站代理。 | ### 功能开关与限制 | 变量 | 默认值 | 说明 | | -------------------------------------- | ----------- | -------------------------------------------------------------- | | `AGENT_ENGINE` | `fastAgent` | Agent 引擎,可选 `fastAgent` 或 `piAgent`。 | | `SKIP_FILE_TYPE_CHECK` | `false` | 是否跳过上传文件类型检查。 | | `WECHAT_CHANNEL_CONCURRENCY` | `1000` | 微信渠道 poll worker 并发数,最小 `10`。 | | `PARSE_FILE_WORKERS` | `5` | 文件解析 worker 常驻线程数。 | | `HTML_TO_MARKDOWN_WORKERS` | `10` | HTML 转 Markdown worker 常驻线程数。 | | `TEXT_TO_CHUNKS_WORKERS` | `10` | 文本切块 worker 常驻线程数。 | | `PARSE_FILE_TIMEOUT_SECONDS` | `600` | 文件解析单任务超时时间,单位秒。 | | `WORKFLOW_MAX_RUN_TIMES` | `500` | 工作流最大运行次数,避免极端死循环。 | | `WORKFLOW_MAX_LOOP_TIMES` | `100` | 循环/并行节点最大输入数组长度。 | | `WORKFLOW_PARALLEL_MAX_CONCURRENCY` | `10` | 并行节点并发上限,且不能超过 `WORKFLOW_MAX_LOOP_TIMES`。 | | `SYSTEM_MAX_STRING_LENGTH_M` | `100` | 系统变量替换等同步字符串处理最大字符数,单位 M;`1` 表示 `1,000,000` 字符,范围 `1` 到 `100`。 | | `CHAT_MAX_QPM` | `5000` | 聊天 QPM 限制;若用户套餐另有限制,以套餐限制为准。 | | `SERVICE_REQUEST_MAX_CONTENT_LENGTH` | `10` | 服务端接收请求体最大大小,单位 MB。 | | `MAX_FOLDER_DEPTH` | `4` | 允许的最深文件夹层级,根目录下最多 4 层文件夹;范围 `2` 到 `20`。 | | `APP_FOLDER_MAX_AMOUNT` | `1000` | 应用文件夹最大数量。 | | `DATASET_FOLDER_MAX_AMOUNT` | `1000` | 数据集文件夹最大数量。 | | `UPLOAD_FILE_MAX_SIZE` | `1000` | 最大上传文件大小,单位 MB。 | | `UPLOAD_FILE_MAX_AMOUNT` | `1000` | 最大上传文件数量。 | | `LLM_REQUEST_TRACKING_RETENTION_HOURS` | `6` | LLM 请求追踪保留时长,单位小时。 | | `MAX_HTML_TRANSFORM_CHARS` | `1000000` | HTML 转 Markdown 的最大字符数,超过后不转换。 | ## App 额外变量 以下变量主要由 `projects/app` 读取。其中部分变量当前定义在 `packages/service/env.ts` 中做统一校验,但实际消费点仍在 App 层。 | 变量 | 默认值 | 说明 | | ------------------------------- | -------- | ------------------------------------------------- | | `DEFAULT_ROOT_PSW` | `123456` | 初始化 root 用户默认密码。 | | `SYSTEM_NAME` | `AI` | 页面标题默认系统名。 | | `SYSTEM_DESCRIPTION` | 空 | 页面 Meta 描述,不配置时使用默认国际化文案。 | | `SYSTEM_FAVICON` | 空 | 页面 favicon 地址,不配置时使用系统配置中的 favicon。 | | `CHINESE_IP_REDIRECT_URL` | 空 | 前端配置中的中国 IP 跳转地址。 | | `PAY_FORM_URL` | 空 | 前端配置中的付费表单地址。 | | `SHOW_COUPON` | `false` | 是否展示兑换码功能。 | | `SHOW_DISCOUNT_COUPON` | `false` | 是否展示优惠券功能。 | | `HIDE_CHAT_COPYRIGHT_SETTING` | `false` | 是否隐藏版权信息配置项。 | | `WECOM_LOGIN_AUTO_REDIRECT` | `false` | 是否允许企微终端自动跳转登录。 | | `APP_REGISTRATION_URL` | 空 | 应用备案申请地址;当前主要作为兼容配置保留。 | | `PASSWORD_EXPIRED_MONTH` | 空 | 密码过期月份数;为空表示不过期。 | | `OPENAPI_KEY_MAX_COUNT` | `100` | 单个团队成员最多可创建的系统 API Key 数量,最小值为 1。 | | `SSE_MCP_SERVER_PROXY_ENDPOINT` | 空 | MCP SSE Server 代理地址,末尾不要带 `/`。发布 SSE MCP 应用时需要配置。 | ### 开源版特有 从 4.15.0 起,开源版不再读取 `config.json`。如果从旧版本升级,请删除该文件的 volume 挂载,并按下表将原配置改为环境变量。没有使用过这些可选配置时,无需额外添加。 | 原 `config.json` 字段 | 当前环境变量 | 默认值 | 说明 | | ------------------------------------------- | --------------------------- | -------- | ------------------------------------------------------- | | `systemEnv.customPdfParse.url` | `CUSTOM_PDF_PARSE_URL` | 空 | 自定义 PDF 解析服务地址。 | | `systemEnv.customPdfParse.key` | `CUSTOM_PDF_PARSE_KEY` | 空 | 自定义 PDF 解析服务密钥。 | | `systemEnv.customPdfParse.doc2xKey` | `DOC2X_KEY` | 空 | Doc2x PDF 解析服务密钥。 | | `systemEnv.customPdfParse.textinAppId` | `TEXTIN_APP_ID` | 空 | 合合信息 TextIn 服务 App ID。 | | `systemEnv.customPdfParse.textinSecretCode` | `TEXTIN_SECRET_CODE` | 空 | 合合信息 TextIn 服务 Secret Code。 | | `systemEnv.hnswEfSearch` | `HNSW_EF_SEARCH` | `100` | 向量检索的 `hnsw.ef_search` 参数,仅对 PG、OceanBase、openGauss 生效。 | | `systemEnv.hnswMaxScanTuples` | `HNSW_MAX_SCAN_TUPLES` | `100000` | 向量检索最大扫描数据量,仅对 PG 生效。 | | `systemEnv.datasetParseMaxProcess` | `DATASET_PARSE_MAX_PROCESS` | `10` | 知识库文件解析队列最大并发数。 | | `systemEnv.vectorMaxProcess` | `VECTOR_MAX_PROCESS` | `10` | 向量训练队列最大并发数。 | | `systemEnv.qaMaxProcess` | `QA_MAX_PROCESS` | `10` | 问答拆分队列最大并发数。 | | `systemEnv.vlmMaxProcess` | `VLM_MAX_PROCESS` | `10` | 图片理解模型处理队列最大并发数。 | #### PDF 增强解析配置 开源版支持接入自定义 PDF 解析服务、SoMark、TextIn 或 Doc2x。选择一种服务配置即可;如果同时配置多种服务,调用优先级为:自定义 PDF 解析服务、SoMark、TextIn、Doc2x。 ##### 使用 Sealos PDF 解析服务 1. 打开 [Sealos AI Proxy](https://hzh.sealos.run/?uid=fnWRt09fZP\&openapp=system-aiproxy),申请 API Key。 2. 将 API Key 配置到 FastGPT: ```dotenv CUSTOM_PDF_PARSE_URL=https://aiproxy.hzh.sealos.run/v1/parse/pdf?model=parse-pdf CUSTOM_PDF_PARSE_KEY=your-sealos-api-key ``` ##### 使用 SoMark 1. 打开 [SoMark Studio](https://somark.ai/Studio/apikey),创建 API Key。 2. 将 API Key 配置到 FastGPT: ```dotenv SOMARK_API_KEY=sk-your-api-key ``` SoMark 同步解析接口单文件最大支持 200 MB、300 页。完整限制和错误码见 [SoMark API 文档](https://docs.somark.ai/en/api-reference)。 ##### 使用其他自定义 PDF 解析服务 ```dotenv CUSTOM_PDF_PARSE_URL=https://your-pdf-parser.example.com/v2/parse/file CUSTOM_PDF_PARSE_KEY=your-service-key ``` `CUSTOM_PDF_PARSE_KEY` 可选。配置后,FastGPT 会通过 `Authorization: Bearer ` 请求解析服务。解析服务需接收包含 `file` 字段的 `multipart/form-data` POST 请求,并返回以下 JSON: ```json { "pages": 10, "markdown": "Parsed Markdown content" } ``` ##### 使用 TextIn ```dotenv TEXTIN_APP_ID=your-app-id TEXTIN_SECRET_CODE=your-secret-code ``` ##### 使用 Doc2x ```dotenv DOC2X_KEY=your-api-key ``` 修改环境变量后需要重启 FastGPT。然后在知识库导入文件或应用文件上传配置中勾选“PDF 增强解析”,上传的 PDF 才会使用已配置的增强解析服务;未勾选时仍使用 FastGPT 内置解析器。 ## Admin 额外变量 以下变量主要由 `pro/admin` 读取。Admin 同时也会使用上面的 App/Admin 共享变量。 | 变量 | 默认值 | 说明 | | ------------------------------------- | ----------- | --------------------------------------------------------- | | `PRO_TOKEN` | 无,**必填** | FastGPT app 服务端调用 pro/admin 内部接口的服务间凭证,至少 32 位,需与 App 一致。 | | `EVAL_LINE_LIMIT` | `1000` | 单次创建评估任务允许的最大数据行数,也会下发给前端配置。 | | `BATCH_UPDATE_TIME` | `3000` | 钱包余额批量更新间隔,单位毫秒。 | | `INVOICE_FEISHU_WEBHOOK_URL` | 空 | 发票申请通知飞书 Webhook 地址。 | | `INVOICE_FEISHU_WEBHOOK_CALLBACK_URL` | 空 | 发票通知中按钮回调地址。 | | `SMS_PROXY` | 空 | 短信发送代理服务地址。 | | `MAX_CRAWL_PAGE` | `2000` | 网站同步最大抓取页面数。 | | `CRAWL_MAX_HTML_SIZE` | `10` | 静态网页爬虫单页 HTML 估算大小上限,单位 MB。 | | `CRAWL_EXCLUDE_LIST` | 空 | 爬虫排除域名或路径规则,多个值使用英文逗号分隔。 | | `SHOW_GIT` | `false` | 是否在后台展示 Git 信息。 | | `CLEAR_FREE_ACCOUNT` | `false` | 是否启用免费账号资源清理任务。 | | `SYNC_MEMBER_CRON` | 空 | 成员自动同步 Cron 表达式;为空则不启动同步任务。 | | `WORKORDER_BASE_URL` | 空 | 工单系统地址;配置后前端展示工单入口。 | | `WORKORDER_JWT_SECRET` | 空 | 创建工单时签发 JWT 使用的密钥。 | | `EXTERNAL_USER_SYSTEM_BASE_URL` | 空 | 外部用户系统地址。 | | `EXTERNAL_USER_SYSTEM_AUTH_TOKEN` | 空 | 外部用户系统认证 Token。 | | `BAIDU_CONVERSION_TOKEN` | 空 | 百度转化跟踪 Token。 | | `BAIDU_CONVERSION_BASE_URL` | 空 | 百度转化跟踪接口地址。 | | `BING_ADS_DEVELOPER_TOKEN` | 空 | Bing Ads Developer Token。 | | `BING_ADS_CUSTOMER_ID` | 空 | Bing Ads Customer ID。 | | `BING_ADS_CUSTOMER_ACCOUNT_ID` | 空 | Bing Ads Customer Account ID。 | | `BING_ADS_CONVERSION_NAME` | `fastgptcn` | Bing Ads 转化目标名称。 | | `BING_OAUTH_CLIENT_ID` | 空 | Bing OAuth Client ID。 | | `BING_OAUTH_CLIENT_SECRET` | 空 | Bing OAuth Client Secret。 | | `BING_OAUTH_REFRESH_TOKEN` | 空 | Bing OAuth Refresh Token。 | | `SHOW_WECOM_CONFIG` | `false` | 是否展示企业微信相关配置。 | | `WECOM_DEV` | `false` | 企业微信支付相关开发模式开关。 | ## Code Sandbox 变量 这些变量由 `projects/code-sandbox/src/env.ts` 加载和校验。App 调用沙箱时,`CODE_SANDBOX_TOKEN` 需要与这里的 `SANDBOX_TOKEN` 保持一致。 | 变量 | 默认值 | 说明 | | --------------------------------- | ------------------------------------------------------- | ----------------------------------------------------------------- | | `SANDBOX_PORT` | `3000` | Code Sandbox 服务监听端口。 | | `SANDBOX_TOKEN` | 空 | `/sandbox` 接口 Bearer Token;为空时不启用接口认证。仅允许 ASCII 可打印字符且不能包含空格。 | | `SANDBOX_POOL_SIZE` | `20` | JS/Python 预热 worker 数量,范围 `1` 到 `100`。 | | `SANDBOX_QUEUE_ID_CONCURRENCY` | 空 | 同一个 `queueId` 同时可进入执行流程的请求数;为空时不启用 `queueId` 排队,范围 `1` 到 `100`。 | | `SANDBOX_API_MAX_BODY_MB` | `8` | `/sandbox` API JSON 请求体总大小上限,包含 `variables`,单位 MB,范围 `1` 到 `100`。 | | `SANDBOX_MAX_TIMEOUT` | `60000` | 单次代码执行超时时间,单位毫秒,范围 `1000` 到 `600000`。 | | `SANDBOX_MAX_MEMORY_MB` | `256` | 单个沙箱最大内存,单位 MB,范围 `32` 到 `4096`;运行时会额外预留 `50` MB 开销。 | | `SANDBOX_MAX_OUTPUT_MB` | `10` | 单次代码执行输出 JSON 大小上限,包含返回值和日志,单位 MB,范围 `1` 到 `100`。 | | `CHECK_INTERNAL_IP` | `true` | 是否在沙箱网络请求中启用内网 IP 检查。 | | `SANDBOX_REQUEST_MAX_COUNT` | `30` | 单次代码执行允许发起的最大网络请求数,范围 `1` 到 `1000`。 | | `SANDBOX_REQUEST_TIMEOUT` | `60000` | 沙箱内单次网络请求超时时间,单位毫秒,范围 `1000` 到 `300000`。 | | `SANDBOX_REQUEST_MAX_RESPONSE_MB` | `10` | 沙箱内单次网络响应体最大大小,单位 MB,范围 `1` 到 `100`。 | | `SANDBOX_REQUEST_MAX_BODY_MB` | `5` | 沙箱内单次网络请求体最大大小,单位 MB,范围 `1` 到 `100`。 | | `SANDBOX_JS_ALLOWED_MODULES` | `lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring` | JS 代码允许导入的模块白名单,使用英文逗号分隔。 | | `SANDBOX_PYTHON_ALLOWED_MODULES` | 内置常用标准库与 `numpy,pandas,matplotlib` | Python 代码允许导入的模块白名单,使用英文逗号分隔。 | | `NODE_ENV` | 空 | 标准 Node.js 环境变量;`development` 下内网地址检查会放宽。 | | `HOSTNAME` | `localhost` | 沙箱服务本机 Host,用于本地地址识别。 | | `PORT` | `3000` | 沙箱本地服务端口识别;实际监听优先使用 `SANDBOX_PORT`。 | ## Volume Manager 变量 这些变量由 `projects/volume-manager/src/env.ts` 加载和校验。FastGPT 侧 OpenSandbox 持久化 Volume 使用的 `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN` 需要与这里的 `VM_AUTH_TOKEN` 保持一致。 | 变量 | 默认值 | 说明 | | -------------------------- | ---------------------- | ------------------------------------------------ | | `PORT` | `3000` | Volume Manager 服务监听端口。 | | `VM_AUTH_TOKEN` | 无,**必填** | Volume Manager API 鉴权 Token。 | | `VM_RUNTIME` | `kubernetes` | 运行时类型,可选 `docker` 或 `kubernetes`。 | | `VM_DOCKER_SOCKET` | `/var/run/docker.sock` | Docker socket 路径,仅 `docker` 模式需要。 | | `VM_DOCKER_API_VERSION` | `v1.44` | Docker API 版本,仅 `docker` 模式需要。 | | `VM_K8S_NAMESPACE` | `opensandbox` | Kubernetes 命名空间,仅 `kubernetes` 模式需要。 | | `VM_K8S_PVC_STORAGE_CLASS` | `standard` | Kubernetes PVC StorageClass,仅 `kubernetes` 模式需要。 | | `VM_LOG_LEVEL` | `info` | 日志等级,可选 `debug`、`info` 或 `none`。 | file: ./content/self-host/config/object-storage.en.mdx meta: { "title": "Object Storage Configuration", "description": "How to configure and connect to various object storage providers via environment variables, and common configuration issues" } import { Alert } from '@/components/docs/Alert'; import FastGPTLink from '@/components/docs/linkFastGPT'; ## Object Storage Configuration This guide covers environment variable configuration for object storage providers supported by FastGPT, including self-hosted MinIO, AWS S3, Cloudflare R2, Alibaba Cloud OSS, and Tencent Cloud COS. FastGPT supports MinIO, AWS S3, Alibaba Cloud OSS, Tencent Cloud COS, and Cloudflare R2. Except for local MinIO development, create `STORAGE_PUBLIC_BUCKET` and `STORAGE_PRIVATE_BUCKET` ahead of time and grant the FastGPT access key read/write permission on both buckets. ## Access Modes * Uploads always go through the FastGPT backend proxy. * External download URLs are always FastGPT short links. FastGPT no longer returns object storage presigned URLs directly. * `STORAGE_DOWNLOAD_URL_MODE` supports two modes and defaults to `short-proxy`: * `short-proxy`: FastGPT validates the short link and proxies the file stream. No public object storage endpoint is required. * `short-redirect`: FastGPT validates the short link, then redirects to a short-lived object storage or CDN URL. File traffic bypasses FastGPT. * Self-hosted MinIO requires `STORAGE_EXTERNAL_ENDPOINT` when using `short-redirect`. ## Provider Configuration ### MinIO > MinIO has strong AWS S3 protocol support and is suitable for local development and self-hosted deployments. In theory, any object storage with S3 protocol support comparable to MinIO will work, such as SeaweedFS or RustFS. * `STORAGE_S3_ENDPOINT` Internal connection address. Can be a container ID, e.g., `http://fastgpt-minio:9000` * `STORAGE_EXTERNAL_ENDPOINT` An address accessible by both **server** and **client** to reach the bucket. Use a fixed host IP or domain name — don't use `127.0.0.1` or `localhost` (containers can't access loopback addresses). This variable does not change the download mode automatically. * `STORAGE_S3_CDN_ENDPOINT` \[Optional] CDN endpoint used for temporary `short-redirect` download URLs. This variable does not change the default download mode and requires `STORAGE_EXTERNAL_ENDPOINT`. Uploads still go through the FastGPT backend proxy and do not use the CDN. * `STORAGE_S3_FORCE_PATH_STYLE` \[Optional] Virtual-hosted-style or path-style routing. If vendor is `minio`, this is fixed to `true`. * `STORAGE_S3_MAX_RETRIES` \[Optional] Maximum request retry attempts. Default: 3 **Complete Example** > If using Sealos object storage, set `STORAGE_VENDOR` to `minio` ```dotenv STORAGE_VENDOR=minio STORAGE_REGION=us-east-1 STORAGE_ACCESS_KEY_ID=your_access_key STORAGE_SECRET_ACCESS_KEY=your_secret_key STORAGE_PUBLIC_BUCKET=fastgpt-public STORAGE_PRIVATE_BUCKET=fastgpt-private STORAGE_S3_ENDPOINT=http://127.0.0.1:9000 STORAGE_S3_FORCE_PATH_STYLE=true STORAGE_S3_MAX_RETRIES=3 ``` ### AWS S3 AWS S3 uses the same S3-compatible variables as MinIO. For production, create separate public and private buckets in advance and configure public-read or CloudFront/custom-domain access only for the public bucket. ```dotenv STORAGE_VENDOR=aws-s3 STORAGE_REGION=ap-southeast-1 STORAGE_ACCESS_KEY_ID=your_access_key STORAGE_SECRET_ACCESS_KEY=your_secret_key STORAGE_PUBLIC_BUCKET=fastgpt-public STORAGE_PRIVATE_BUCKET=fastgpt-private STORAGE_S3_ENDPOINT=https://s3.ap-southeast-1.amazonaws.com STORAGE_S3_FORCE_PATH_STYLE=false STORAGE_S3_MAX_RETRIES=3 ``` ### Alibaba Cloud OSS > * [CORS Configuration](https://help.aliyun.com/zh/oss/user-guide/configure-cross-origin-resource-sharing/?spm=5176.8466032.console-base_help.dexternal.1bcd1450Wau6J6#b58400ec36rqf) * `STORAGE_OSS_ENDPOINT` Alibaba Cloud OSS hostname. Default is usually `{region}.aliyuncs.com`, e.g., `oss-cn-hangzhou.aliyuncs.com`. If using a custom domain, enter it here, e.g., `your-domain.com` * `STORAGE_OSS_CNAME` Whether custom domain is enabled * `STORAGE_OSS_SECURE` Whether TLS is enabled. Disable if your domain doesn't have a certificate. * `STORAGE_OSS_INTERNAL` \[Optional] Whether to use internal network access. Enable if your service is also on Alibaba Cloud to save bandwidth. Default: disabled Set the OSS public bucket to public-read and keep the private bucket private. The same Access Key can be used for both buckets, but the bucket names must remain distinct. **Complete Example** ```dotenv STORAGE_VENDOR=oss STORAGE_REGION=oss-cn-hangzhou STORAGE_ACCESS_KEY_ID=your_access_key STORAGE_SECRET_ACCESS_KEY=your_secret_key STORAGE_PUBLIC_BUCKET=fastgpt-public STORAGE_PRIVATE_BUCKET=fastgpt-private STORAGE_OSS_ENDPOINT=oss-cn-hangzhou.aliyuncs.com STORAGE_OSS_CNAME=false STORAGE_OSS_SECURE=false STORAGE_OSS_INTERNAL=false ``` ### Tencent Cloud COS > * [CORS Configuration](https://cloud.tencent.com/document/product/436/13318) * `STORAGE_COS_PROTOCOL` Options: `https:`, `http:` — don't forget the `:`. If your custom domain doesn't have a certificate, don't use `https:` * `STORAGE_COS_USE_ACCELERATE` \[Optional] Enable global acceleration domain. Default: false. If true, the bucket must have global acceleration enabled. * `STORAGE_COS_CNAME_DOMAIN` \[Optional] Custom domain, e.g., `your-domain.com` * `STORAGE_COS_PROXY` \[Optional] Proxy server, e.g., `http://localhost:7897` COS bucket names must include the account App ID suffix, for example `fastgpt-public-1250000000`. Configure anonymous read only for the public bucket and keep the private bucket private. **Complete Example** ```dotenv STORAGE_VENDOR=cos STORAGE_REGION=ap-shanghai STORAGE_ACCESS_KEY_ID=your_access_key STORAGE_SECRET_ACCESS_KEY=your_secret_key STORAGE_PUBLIC_BUCKET=fastgpt-public STORAGE_PRIVATE_BUCKET=fastgpt-private STORAGE_COS_PROTOCOL=http: STORAGE_COS_USE_ACCELERATE=false STORAGE_COS_CNAME_DOMAIN= STORAGE_COS_PROXY= ``` ### Cloudflare R2 R2 uses the S3-compatible API. Set `STORAGE_REGION` to `auto` and use the account-level S3 endpoint from Cloudflare as `STORAGE_S3_ENDPOINT`. FastGPT does not rewrite R2 presigned URLs through `STORAGE_S3_CDN_ENDPOINT`; private objects should normally use the default `short-proxy` download mode. `STORAGE_R2_PUBLIC_ENDPOINT` is required for public objects. Set it to the HTTPS custom domain (or another public HTTPS domain bound to the bucket). This is separate from the R2 S3 API endpoint and must not contain query parameters. For production, use a custom domain instead of the rate-limited `r2.dev` development URL. Create both R2 buckets in advance; FastGPT checks that production buckets exist at startup and does not create them automatically. ```dotenv STORAGE_VENDOR=r2 STORAGE_REGION=auto STORAGE_S3_ENDPOINT=https://.r2.cloudflarestorage.com STORAGE_R2_PUBLIC_ENDPOINT=https://assets.example.com STORAGE_ACCESS_KEY_ID= STORAGE_SECRET_ACCESS_KEY= STORAGE_PUBLIC_BUCKET= STORAGE_PRIVATE_BUCKET= STORAGE_S3_FORCE_PATH_STYLE=false ``` file: ./content/self-host/config/object-storage.mdx meta: { "title": "对象存储配置", "description": "如何通过环境变量配置并连接个各厂商的对象存储" } import { Alert } from '@/components/docs/Alert'; import FastGPTLink from '@/components/docs/linkFastGPT'; ## 对象存储服务配置介绍 这里提供了 FastGPT 目前支持的对象存储厂商,包括自部署的 MinIO、AWS S3、Cloudflare R2、阿里云 OSS 和腾讯云 COS 的环境变量配置说明 FastGPT 支持 MinIO、AWS S3、Alibaba Cloud OSS、Tencent Cloud COS 和 Cloudflare R2。除 MinIO 本地开发外,建议提前创建 `STORAGE_PUBLIC_BUCKET` 和 `STORAGE_PRIVATE_BUCKET`,并确保 FastGPT 使用的 Access Key 对两个桶都有读写权限。 ## 访问模式说明 * 上传固定走 FastGPT 后端代理。 * 对外下载地址固定为 FastGPT 短链,不再直接返回对象存储预签名长链接。 * `STORAGE_DOWNLOAD_URL_MODE` 支持两种模式,默认值为 `short-proxy`: * `short-proxy`:FastGPT 校验短链并代理文件流,无需配置公网对象存储地址。 * `short-redirect`:FastGPT 校验短链后 302 到短时效对象存储/CDN 地址,文件流量不经过 FastGPT。 * 自部署 MinIO 使用 `short-redirect` 时必须配置 `STORAGE_EXTERNAL_ENDPOINT`。 ## 提供商配置 ### MinIO > MinIO 对 AWS S3 协议支持比较完整,适合本地开发和自部署场景。理论上任何对 AWS S3 协议的支持程度至少和 MinIO 相当的对象存储服务也可以使用,比如 SeaweedFS、RustFS。 * `STORAGE_S3_ENDPOINT` 内网连接地址,可以是容器 ID 连接,比如 `http://fastgpt-minio:9000` * `STORAGE_EXTERNAL_ENDPOINT` 一个**服务器**和**客户端**均可访问到存储桶的地址,可以是固定的宿主机 IP 或者域名,注意不要填写成 127.0.0.1 或者 localhost 等本地回环地址(因为容器里无法使用)。该变量不会自动改变下载模式。 * `STORAGE_S3_CDN_ENDPOINT`【可选】`short-redirect` 临时下载地址使用的 CDN 地址。该变量不会改变默认下载模式,且配置时必须同时配置 `STORAGE_EXTERNAL_ENDPOINT`。上传仍走 FastGPT 后端代理,不会使用 CDN。 * `STORAGE_S3_FORCE_PATH_STYLE`【可选】虚拟主机风格路由或路径路由风格,其中如果厂商填写了 `minio` 的话,该值被固定为 `true` * `STORAGE_S3_MAX_RETRIES`【可选】请求最大尝试次数,默认为 3 次 **完整示例** > 如果使用的是 Sealos 的对象存储服务请将 `STORAGE_VENDOR` 填写为 `minio` ```dotenv STORAGE_VENDOR=minio STORAGE_REGION=us-east-1 STORAGE_ACCESS_KEY_ID=your_access_key STORAGE_SECRET_ACCESS_KEY=your_secret_key STORAGE_PUBLIC_BUCKET=fastgpt-public STORAGE_PRIVATE_BUCKET=fastgpt-private STORAGE_S3_ENDPOINT=http://127.0.0.1:9000 STORAGE_S3_FORCE_PATH_STYLE=true STORAGE_S3_MAX_RETRIES=3 ``` ### AWS S3 AWS S3 与 MinIO 使用同一套 S3 兼容变量。生产环境建议提前创建 public/private 两个 bucket,并为 public bucket 配置公开读取策略或 CloudFront/自定义域名。 ```dotenv STORAGE_VENDOR=aws-s3 STORAGE_REGION=ap-southeast-1 STORAGE_ACCESS_KEY_ID=your_access_key STORAGE_SECRET_ACCESS_KEY=your_secret_key STORAGE_PUBLIC_BUCKET=fastgpt-public STORAGE_PRIVATE_BUCKET=fastgpt-private STORAGE_S3_ENDPOINT=https://s3.ap-southeast-1.amazonaws.com STORAGE_S3_FORCE_PATH_STYLE=false STORAGE_S3_MAX_RETRIES=3 ``` ### 阿里云 OSS > * [跨域配置](https://help.aliyun.com/zh/oss/user-guide/configure-cross-origin-resource-sharing/?spm=5176.8466032.console-base_help.dexternal.1bcd1450Wau6J6#b58400ec36rqf) * `STORAGE_OSS_ENDPOINT` 阿里云对象存储连接主机名,厂商提供的默认值一般都是 `{地区}.aliyuncs.com`,如 `oss-cn-hangzhou.aliyuncs.com`;注意,如果配置了自定义域名的话也填在这里,比如 `your-domain.com` * `STORAGE_OSS_CNAME` 是否开启自定义域名 * `STORAGE_OSS_SECURE` 是否开启了 TLS,如果域名没有认证证书的话,请关闭该选项 * `STORAGE_OSS_INTERNAL`【可选】是否开启内网访问,如果你的服务也在阿里云的话可以开启并节省流量,默认关闭 OSS 的 public bucket 需要设置为公开读,private bucket 保持私有。两个 bucket 可以使用同一组 Access Key,但不要把两个 bucket 配成同名。 **完整示例** ```dotenv STORAGE_VENDOR=oss STORAGE_REGION=oss-cn-hangzhou STORAGE_ACCESS_KEY_ID=your_access_key STORAGE_SECRET_ACCESS_KEY=your_secret_key STORAGE_PUBLIC_BUCKET=fastgpt-public STORAGE_PRIVATE_BUCKET=fastgpt-private STORAGE_OSS_ENDPOINT=oss-cn-hangzhou.aliyuncs.com STORAGE_OSS_CNAME=false STORAGE_OSS_SECURE=false STORAGE_OSS_INTERNAL=false ``` ### 腾讯云 COS > * [跨域配置](https://cloud.tencent.com/document/product/436/13318) * `STORAGE_COS_PROTOCOL` 枚举可选值 `https:`、`http:`,注意不要忘记 `:`;如果自定义域名没有上传证书的话,请不要设置为 `https:` * `STORAGE_COS_USE_ACCELERATE`【可选】是否启用全球加速域名,默认为 false。若改为 true,需要存储桶开启全球加速功能 * `STORAGE_COS_CNAME_DOMAIN`【可选】自定义域名,如 `your-domain.com` * `STORAGE_COS_PROXY`【可选】代理服务器,如 `http://localhost:7897` COS bucket 名称必须包含账号 App ID 后缀,例如 `fastgpt-public-1250000000`。public bucket 需要配置匿名读,private bucket 保持私有。 **完整示例** ```dotenv STORAGE_VENDOR=cos STORAGE_REGION=ap-shanghai STORAGE_ACCESS_KEY_ID=your_access_key STORAGE_SECRET_ACCESS_KEY=your_secret_key STORAGE_PUBLIC_BUCKET=fastgpt-public STORAGE_PRIVATE_BUCKET=fastgpt-private STORAGE_COS_PROTOCOL=http: STORAGE_COS_USE_ACCELERATE=false STORAGE_COS_CNAME_DOMAIN= STORAGE_COS_PROXY= ``` ### Cloudflare R2 R2 使用 S3 兼容 API。`STORAGE_REGION` 固定填写 `auto`,`STORAGE_S3_ENDPOINT` 填写 Cloudflare 控制台提供的账户级 S3 endpoint。R2 不支持通过 FastGPT 的 `STORAGE_S3_CDN_ENDPOINT` 重写预签名 URL;私有对象仍建议使用默认的 `short-proxy` 下载模式。 `STORAGE_R2_PUBLIC_ENDPOINT` 必须配置为公开 bucket 的自定义域名(或其他已绑定到该 bucket 的公开 HTTPS 域名),用于生成公开文件 URL。该地址不是 R2 S3 API endpoint,也不应包含查询参数。 R2 生产环境建议使用自定义域名,不建议使用受速率限制的 `r2.dev` 公共开发 URL。R2 public/private bucket 都应提前创建;FastGPT 启动时只检查 bucket 是否存在,不会自动创建生产 bucket。 ```dotenv STORAGE_VENDOR=r2 STORAGE_REGION=auto STORAGE_S3_ENDPOINT=https://.r2.cloudflarestorage.com STORAGE_R2_PUBLIC_ENDPOINT=https://assets.example.com STORAGE_ACCESS_KEY_ID= STORAGE_SECRET_ACCESS_KEY= STORAGE_PUBLIC_BUCKET= STORAGE_PRIVATE_BUCKET= STORAGE_S3_FORCE_PATH_STYLE=false ``` file: ./content/self-host/config/remote-debug-suite.en.mdx meta: { "title": "System Plugin Remote Debugging Suite Configuration", "description": "Configure the system plugin remote debugging suite for self-hosted FastGPT deployments" } import { Alert } from '@/components/docs/Alert'; ## When to Use It The system plugin remote debugging suite temporarily connects FastGPT system plugins running on a developer's local machine to a FastGPT test environment. It is intended for system plugin development, integration testing, and acceptance checks, not as a production plugin runtime. The system plugin remote debugging suite is available only in the commercial edition. We recommend using remote debugging in the FastGPT Cloud version first. Self-hosted deployments require you to operate Plugin Server, Connection Gateway, Redis, reverse proxy, TLS, and secret rotation yourself. The default Docker Compose deployment only includes the FastGPT main service and the regular `fastgpt-plugin` runtime. It does not include the public WebSocket setup required by Connection Gateway. For self-hosted deployments, deploy the system plugin remote debugging suite separately. ## Components The remote debug flow includes these components: | Component | Purpose | | -------------------- | --------------------------------------------------------------------------------------- | | FastGPT main service | Provides the UI and APIs for enabling, refreshing, and revoking a debug channel. | | Plugin Server | Manages `connectionKey`, debug source, and forwards debug invocations to Gateway. | | Connection Gateway | Maintains CLI WebSocket connections, sessions, mailboxes, and debug invocation streams. | | Redis | Stores Gateway sessions, source owner leases, and mailbox data. | | `fastgpt-plugin dev` | Runs plugins locally and connects to Gateway through WebSocket. | Main flow: ```mermaid sequenceDiagram participant User as Developer participant FastGPT as FastGPT participant Plugin as Plugin Server participant Gateway as Connection Gateway participant CLI as fastgpt-plugin dev User->>FastGPT: Enable debug channel FastGPT->>Plugin: Create debug channel Plugin-->>FastGPT: connectionKey / connectionUrl / source User->>CLI: fastgpt-plugin dev --connect CLI->>FastGPT: Exchange connectionKey FastGPT->>Plugin: Forward connectionKey exchange Plugin-->>CLI: gatewayUrl / connectToken / source CLI->>Gateway: WebSocket bind FastGPT->>Plugin: Invoke plugin under debug source Plugin->>Gateway: Send plugin-debug.run Gateway->>CLI: Forward debug request CLI-->>Gateway: Return execution result Gateway-->>Plugin: Stream result ``` ## Prerequisites 1. The FastGPT main service can access `fastgpt-plugin`, and `PLUGIN_TOKEN` / `AUTH_TOKEN` are the same on both sides. 2. Your `fastgpt-plugin` version includes remote debugging. Use the plugin version required by your current FastGPT release. 3. The Gateway WebSocket URL must be reachable from the developer's local machine. In production, expose it through HTTPS reverse proxy as `wss://`. 4. The Gateway internal HTTP API should only be reachable from the Plugin Server's private network. 5. The Redis used by Gateway must support Stream. 6. All production secrets must be at least 32 characters and must not use example values, defaults, or weak passwords. ## Deploy Connection Gateway Connection Gateway is maintained in the `fastgpt-plugin` repository. Choose the China Mainland or global image based on your network environment: ```dotenv # China Mainland CONNECTION_GATEWAY_IMAGE=registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin-connection-gateway:8a52896d1d5b866308778871526cfdff9d22c547 # Global CONNECTION_GATEWAY_IMAGE=ghcr.io/labring/fastgpt-plugin-connection-gateway:8a52896d1d5b866308778871526cfdff9d22c547 ``` A minimal setup looks like this: ```yaml services: connection-gateway: image: ${CONNECTION_GATEWAY_IMAGE} restart: unless-stopped environment: NODE_ENV: production REDIS_URL: redis://default:mypassword@fastgpt-redis:6379 AUTH_TOKEN: ${CONNECTION_GATEWAY_AUTH_TOKEN} CONNECTION_GATEWAY_AUTH_TOKEN: ${CONNECTION_GATEWAY_AUTH_TOKEN} JWT_SECRET: ${CONNECTION_GATEWAY_JWT_SECRET} CONNECTION_GATEWAY_PORT: 3000 CONNECTION_GATEWAY_WS_PORT: 3001 CONNECTION_GATEWAY_WS_PATH: /connection-gateway/v1 ports: - '3010:3000' - '3011:3001' ``` Port notes: | Port | Purpose | Exposure requirement | | ------ | ------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------- | | `3010` | Gateway HTTP API, mapped to container port `3000`, including `/health`, `/internal/*`, and `/metrics`. | Public exposure is not required. Plugin Server only needs private network access. | | `3011` | Gateway WebSocket, mapped to container port `3001`, default path `/connection-gateway/v1`. | Must be reachable from the developer's local CLI, usually exposed as a public `wss://` URL through reverse proxy. | | Redis | Stores Gateway sessions, source owner leases, and mailboxes. | Public exposure is not required. The Redis version must support Stream. | ## Configure Plugin Server Add the Gateway-related environment variables to the `fastgpt-plugin` service: ```dotenv # Private HTTP address used by Plugin Server to call Gateway internal APIs CONNECTION_GATEWAY_BASE_URL=http://connection-gateway:3000 # WebSocket address returned to the local CLI; it must be reachable from developer machines CONNECTION_GATEWAY_PUBLIC_URL=wss://debug-gateway.example.com/connection-gateway/v1 # Bearer token used by Plugin Server for Gateway /internal/* and /metrics APIs CONNECTION_GATEWAY_AUTH_TOKEN=replace-with-a-random-token-at-least-32-chars # HMAC secret for Gateway connect tokens; must exactly match Connection Gateway JWT_SECRET=replace-with-a-random-jwt-secret-at-least-32-chars ``` Restart `fastgpt-plugin` after updating the configuration. When `CONNECTION_GATEWAY_BASE_URL` is unset, Plugin Server disables remote debugging. ## Configure FastGPT Main Service The FastGPT main service keeps using the regular plugin configuration: ```dotenv PLUGIN_BASE_URL=http://fastgpt-plugin:3000 PLUGIN_TOKEN=replace-with-the-same-value-as-plugin-auth-token NEXT_PUBLIC_BASE_URL=https://fastgpt.example.com ``` `NEXT_PUBLIC_BASE_URL` affects the generated debug connection link. For public access, set it to the FastGPT URL reachable by the browser. ## Configure Reverse Proxy Expose only the Gateway WebSocket endpoint. Keep the Gateway internal HTTP API private. Nginx example: ```nginx location /connection-gateway/v1 { proxy_pass http://connection-gateway:3001; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_read_timeout 3600s; } ``` Do not expose `/internal/*`, `/metrics`, or the Gateway HTTP port directly to the public internet. ## Developer Connection 1. Enable the debug channel from the FastGPT plugin debug entry and copy the generated connection link. 2. Run this command in the local plugin directory: ```bash fastgpt-plugin dev --connect '' ``` After the connection succeeds, the local CLI reports plugin metadata through Gateway. The local plugins appear in FastGPT under the current debug source. The debug source format is: ```text debug:tmbId:{tmbId} ``` ## Verification 1. Check Gateway health: ```bash curl http://connection-gateway:3000/health ``` 2. Enable the debug channel in FastGPT and confirm the status changes from `enabled` to `connected`. 3. Run `fastgpt-plugin dev` locally and confirm the CLI reports an active WebSocket connection. 4. Select a tool under the debug source in FastGPT and invoke it once. The result should come from the local plugin. ## Security Notes * `CONNECTION_GATEWAY_AUTH_TOKEN`, `JWT_SECRET`, `connectionKey`, and `connectToken` are sensitive. Do not write them to logs, screenshots, or public docs. * `CONNECTION_GATEWAY_AUTH_TOKEN` is only for Plugin Server. The local CLI does not need it and should never receive it. * `connectionKey` is a long-lived debug connection secret. It is returned in plaintext only when the debug channel is enabled or refreshed. Refresh or revoke the debug channel immediately if it leaks. * Debug source invocations use the remote debug path. If the connection or session is missing, the invocation fails instead of falling back to the production plugin runtime. * Multi-replica Gateway deployments must route session deletion requests to the node that owns the WebSocket, or accept that calls fail after the Redis session is deleted. ## FAQ ### The debug channel opens, but the CLI cannot connect Check whether `CONNECTION_GATEWAY_PUBLIC_URL` is reachable from the developer's local machine. The browser and CLI run on the developer's computer, so Docker private hostnames will not work. ### The CLI is connected, but FastGPT shows disconnected Check whether Plugin Server can access `CONNECTION_GATEWAY_BASE_URL`, and confirm that `CONNECTION_GATEWAY_AUTH_TOKEN` matches the Gateway configuration. ### Tool invocation times out after connection Check Gateway Redis, WebSocket upgrade in the reverse proxy, `proxy_read_timeout`, and whether the local CLI is still online. ### connect token validation fails Check whether `JWT_SECRET` is exactly the same in Plugin Server and Connection Gateway. file: ./content/self-host/config/remote-debug-suite.mdx meta: { "title": "系统插件的远程调试功能套件配置", "description": "FastGPT 接入系统插件的远程调试功能套件" } import { Alert } from '@/components/docs/Alert'; ## 适用场景 系统插件的远程调试功能套件用于把开发者本地运行的 FastGPT 系统插件临时接入 FastGPT 测试环境。它适合系统插件开发、联调和验收,不适合作为生产插件运行时。 系统插件的远程调试功能套件仅商业版支持。 优先推荐在 FastGPT 云服务版本中使用远程调试能力。自部署需要额外维护 Plugin Server、Connection Gateway、Redis、反向代理、TLS 和密钥轮换,运维成本更高。 默认的 Docker Compose 部署脚本只包含 FastGPT 主服务和常规 `fastgpt-plugin` 运行环境,不包含 Connection Gateway 的公网 WebSocket 接入配置。自部署环境需要按本文额外部署系统插件的远程调试功能套件。 ## 组件关系 远程调试链路包含以下组件: | 组件 | 作用 | | -------------------- | ----------------------------------------------- | | FastGPT 主服务 | 提供开启、刷新、关闭调试通道的页面和 API。 | | Plugin Server | 管理 `connectionKey`、调试 source,并把调试调用转发给 Gateway。 | | Connection Gateway | 维护 CLI WebSocket 长连接、session、mailbox 和调试调用流转。 | | Redis | 保存 Gateway session、source owner 和 mailbox 数据。 | | `fastgpt-plugin dev` | 在开发者本地运行插件,并通过 WebSocket 连接 Gateway。 | 主路径如下: ```mermaid sequenceDiagram participant User as Developer participant FastGPT as FastGPT participant Plugin as Plugin Server participant Gateway as Connection Gateway participant CLI as fastgpt-plugin dev User->>FastGPT: 开启调试通道 FastGPT->>Plugin: 创建 debug channel Plugin-->>FastGPT: connectionKey / connectionUrl / source User->>CLI: fastgpt-plugin dev --connect CLI->>FastGPT: 兑换 connectionKey FastGPT->>Plugin: 转发 connectionKey exchange Plugin-->>CLI: gatewayUrl / connectToken / source CLI->>Gateway: WebSocket bind FastGPT->>Plugin: 调用 debug source 下的插件 Plugin->>Gateway: 发送 plugin-debug.run Gateway->>CLI: 转发调试请求 CLI-->>Gateway: 返回执行结果 Gateway-->>Plugin: 流式返回结果 ``` ## 部署前提 1. FastGPT 主服务已能正常访问 `fastgpt-plugin`,并且两侧的 `PLUGIN_TOKEN` / `AUTH_TOKEN` 一致。 2. `fastgpt-plugin` 版本需要包含远程调试能力;建议与当前 FastGPT 版本要求的 plugin 版本保持一致。 3. Gateway WebSocket 地址需要从开发者本地可访问,生产建议使用 HTTPS 反向代理暴露为 `wss://`。 4. Gateway internal HTTP API 只允许 Plugin Server 所在内网访问。 5. Gateway 使用的 Redis 必须支持 Stream。 6. 所有生产密钥至少 32 位,且不要使用示例值、默认值或弱口令。 ## 部署 Connection Gateway Connection Gateway 由 `fastgpt-plugin` 仓库维护。部署时按网络环境选择国内版或海外版镜像: ```dotenv # 国内版 CONNECTION_GATEWAY_IMAGE=registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin-connection-gateway:8a52896d1d5b866308778871526cfdff9d22c547 # 海外版 CONNECTION_GATEWAY_IMAGE=ghcr.io/labring/fastgpt-plugin-connection-gateway:8a52896d1d5b866308778871526cfdff9d22c547 ``` 最小配置形态如下: ```yaml services: connection-gateway: image: ${CONNECTION_GATEWAY_IMAGE} restart: unless-stopped environment: NODE_ENV: production REDIS_URL: redis://default:mypassword@fastgpt-redis:6379 AUTH_TOKEN: ${CONNECTION_GATEWAY_AUTH_TOKEN} CONNECTION_GATEWAY_AUTH_TOKEN: ${CONNECTION_GATEWAY_AUTH_TOKEN} JWT_SECRET: ${CONNECTION_GATEWAY_JWT_SECRET} CONNECTION_GATEWAY_PORT: 3000 CONNECTION_GATEWAY_WS_PORT: 3001 CONNECTION_GATEWAY_WS_PATH: /connection-gateway/v1 ports: - '3010:3000' - '3011:3001' ``` 端口说明: | 端口 | 用途 | 暴露要求 | | ------ | -------------------------------------------------------------------- | ------------------------------------------- | | `3010` | Gateway HTTP API,对应容器内 `3000`,包含 `/health`、`/internal/*`、`/metrics`。 | 不需要公网暴露,Plugin Server 可通过内网访问即可。 | | `3011` | Gateway WebSocket,对应容器内 `3001`,默认路径 `/connection-gateway/v1`。 | 需要让开发者本地 CLI 可访问,通常通过反向代理暴露为公网 `wss://` 地址。 | | Redis | Gateway session、source owner 和 mailbox 存储。 | 不需要公网暴露;Redis 版本必须支持 Stream。 | ## 配置 Plugin Server 在 `fastgpt-plugin` 服务中增加 Gateway 相关环境变量: ```dotenv # Plugin Server 调用 Gateway internal HTTP API 的内网地址 CONNECTION_GATEWAY_BASE_URL=http://connection-gateway:3000 # 返回给本地 CLI 的 WebSocket 地址,必须能从开发者本地访问 CONNECTION_GATEWAY_PUBLIC_URL=wss://debug-gateway.example.com/connection-gateway/v1 # Plugin Server 调用 Gateway /internal/* 和 /metrics 的 bearer token CONNECTION_GATEWAY_AUTH_TOKEN=replace-with-a-random-token-at-least-32-chars # Gateway connect token 的 HMAC secret,必须与 Connection Gateway 完全一致 JWT_SECRET=replace-with-a-random-jwt-secret-at-least-32-chars ``` 配置后重启 `fastgpt-plugin`。`CONNECTION_GATEWAY_BASE_URL` 未配置时,Plugin Server 会关闭远程调试能力。 ## 配置 FastGPT 主服务 FastGPT 主服务继续使用常规插件配置: ```dotenv PLUGIN_BASE_URL=http://fastgpt-plugin:3000 PLUGIN_TOKEN=replace-with-the-same-value-as-plugin-auth-token NEXT_PUBLIC_BASE_URL=https://fastgpt.example.com ``` `NEXT_PUBLIC_BASE_URL` 会影响调试连接链接的生成。公网用户访问 FastGPT 时,应配置为浏览器可访问的 FastGPT 地址。 ## 配置反向代理 建议只暴露 Gateway WebSocket 入口,对 Gateway internal HTTP API 保持内网访问。 Nginx 示例: ```nginx location /connection-gateway/v1 { proxy_pass http://connection-gateway:3001; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_read_timeout 3600s; } ``` `/internal/*`、`/metrics` 和 Gateway HTTP 端口不要直接暴露到公网。 ## 开发者连接 1. 在 FastGPT 插件调试入口开启调试通道,复制页面返回的连接链接。 2. 在本地插件目录运行: ```bash fastgpt-plugin dev --connect '' ``` 连接成功后,本地 CLI 会通过 Gateway 上报插件 metadata。FastGPT 工具列表中会出现当前调试 source 下的本地插件。调试 source 的格式为: ```text debug:tmbId:{tmbId} ``` ## 验证 1. 访问 Gateway 健康检查: ```bash curl http://connection-gateway:3000/health ``` 2. 在 FastGPT 页面开启调试通道,确认状态从 `enabled` 变为 `connected`。 3. 运行本地 `fastgpt-plugin dev`,确认 CLI 显示 WebSocket 已连接。 4. 在 FastGPT 中选择调试 source 下的工具并触发一次调用,确认结果由本地插件返回。 ## 安全注意事项 * `CONNECTION_GATEWAY_AUTH_TOKEN`、`JWT_SECRET`、`connectionKey` 和 `connectToken` 都属于敏感信息,禁止写入日志、截图或公开文档。 * `CONNECTION_GATEWAY_AUTH_TOKEN` 只给 Plugin Server 使用,本地 CLI 不需要也不应获取。 * `connectionKey` 是长期调试连接密钥,只在开启或刷新调试通道时明文返回;泄露后应立即刷新或关闭调试通道。 * 调试 source 命中后按远程调试路径处理,断连或 session 不存在时会失败,不会回退到生产插件运行时。 * 多副本 Gateway 部署需要保证 session 删除请求能路由到持有 WebSocket 的节点,或接受 Redis session 删除后后续调用失败。 ## 常见问题 ### 页面可以开启调试,但 CLI 连接失败 检查 `CONNECTION_GATEWAY_PUBLIC_URL` 是否为开发者本地可访问地址。浏览器和 CLI 在开发者电脑上运行,不能使用 Docker 内网域名。 ### CLI 已连接,但 FastGPT 显示 disconnected 检查 Plugin Server 是否能访问 `CONNECTION_GATEWAY_BASE_URL`,并确认 `CONNECTION_GATEWAY_AUTH_TOKEN` 与 Gateway 配置一致。 ### 连接后调用工具超时 检查 Gateway Redis 是否正常、反向代理是否保留 WebSocket upgrade、`proxy_read_timeout` 是否过短,以及本地 CLI 是否仍在线。 ### connect token 校验失败 检查 Plugin Server 和 Connection Gateway 的 `JWT_SECRET` 是否完全一致。 file: ./content/self-host/config/signoz.en.mdx meta: { "title": "Integrate SigNoz Service Monitoring", "description": "FastGPT integration with SigNoz service monitoring" } ## Introduction [SigNoz](https://signoz.io/) is an open-source Application Performance Monitoring (APM) and observability platform that provides comprehensive service monitoring for FastGPT. Built on the OpenTelemetry standard, it collects, processes, and visualizes telemetry data from distributed systems, including tracing, metrics, and logging. **Key Features:** * **Distributed Tracing**: Track the complete call chain of user requests across FastGPT services * **Performance Monitoring**: Monitor key metrics like API response times and throughput * **Error Tracking**: Automatically capture and record system exceptions for troubleshooting * **Log Aggregation**: Centrally collect and manage application logs with structured query support * **Real-time Alerts**: Set alert rules based on metric thresholds to detect anomalies early ## Deploy SigNoz You can use [SigNoz](https://signoz.io/) cloud service or self-host it. Here's how to quickly deploy SigNoz on Sealos. 1. Click the card below to deploy SigNoz with one click. [![](../../../public/imgs/Deploy-on-Sealos.svg)](https://hzh.sealos.run/?uid=fnWRt09fZP\&openapp=system-template%3FtemplateName%3Dsignoz) 2. Enable external access for SigNoz After deployment, click **Details** in P1 to open the app details page, then click **Change** in the top right and enable the external address for port 4318 (skip this step if using internal network). | P1 | P2 | P3 | | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | | ![alt text](../../../public/imgs/image-112.png) | ![alt text](../../../public/imgs/image-110.png) | ![alt text](../../../public/imgs/image-111.png) | 3. Get the SigNoz access address After the change completes, wait for the public address to be ready, copy it, and enter it in FastGPT. If using internal network, copy the internal address for port 4318 directly. ![alt text](../../../public/imgs/image-113.png) ## Configure FastGPT 1. Update FastGPT environment variables **Log level options**: `trace` | `debug` | `info` | `warning` | `error` | `fatal` ```dotenv LOG_ENABLE_CONSOLE=true # Enable console logging LOG_CONSOLE_LEVEL=debug # Minimum log level for console output LOG_ENABLE_OTEL=true # 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 address — don't omit /v1/logs ``` 2. Restart FastGPT ## Verify the Setup Go back to the Sealos app management list, open the SigNoz frontend project, and access its public address to open the dashboard. | | | | ----------------------------------------------- | ----------------------------------------------- | | ![alt text](../../../public/imgs/image-114.png) | ![alt text](../../../public/imgs/image-115.png) | First-time access requires creating an account (data is stored in the local database) — fill in anything. ![alt text](../../../public/imgs/image-116.png) After logging in, if `logs` and `traces` are lit up in the COMPLETED steps on the right side, the configuration is successful. ![alt text](../../../public/imgs/image-117.png) ![alt text](../../../public/imgs/image-118.png) ## Notes 1. Adjust log retention period SigNoz monitoring is very disk-intensive. First, avoid storing FastGPT debug logs in SigNoz. Also consider setting the log retention period to 7 days. If SigNoz data stops growing while memory keeps increasing, the disk is full — expand capacity. ![alt text](../../../public/imgs/image-119.png) file: ./content/self-host/config/signoz.mdx meta: { "title": "Signoz 监控服务", "description": "FastGPT 接入 Signoz 监控服务" } ## 介绍 [SigNoz](https://signoz.io/) 是一款开源的应用性能监控(APM)和可观测性平台,为 FastGPT 提供全面的服务监控能力。它基于 OpenTelemetry 标准,能够收集、处理和可视化分布式系统的遥测数据,包括链路追踪(Tracing)、指标监控(Metrics)和日志分析(Logging)。 **主要功能:** * **链路追踪**:跟踪用户请求在 FastGPT 各个服务间的完整调用链路 * **性能监控**:监控 API 响应时间、吞吐量等关键性能指标 * **错误追踪**:自动捕获和记录系统异常,便于问题排查 * **日志聚合**:集中收集和管理应用日志,支持结构化查询 * **实时告警**:基于指标阈值设置告警规则,及时发现系统异常 ## 部署 Signoz 可以使用 [SigNoz](https://signoz.io/) 官方云服务,或者私有部署,下面介绍在 Sealos 上快速部署 Signoz。 1. 点击下方的卡片,即可一键部署 Signoz。 [![](../../../public/imgs/Deploy-on-Sealos.svg)](https://hzh.sealos.run/?uid=fnWRt09fZP\&openapp=system-template%3FtemplateName%3Dsignoz) 2. 开启 Signoz 外网访问 部署后,可点击 P1 中的详情,进入应用详情页, 然后点击右上角的变更,并开启 4318 端口的外网地址(如果走内网服务,可忽略该步骤)。 | P1 | P2 | P3 | | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | | ![alt text](../../../public/imgs/image-112.png) | ![alt text](../../../public/imgs/image-110.png) | ![alt text](../../../public/imgs/image-111.png) | 3. 获取 Signoz 访问地址 变更完成后,等待公网地址就绪,复制该地址,将其填入 FastGPT 中。如果是走内网服务,可以直接复制 4318 端口的内网地址。 ![alt text](../../../public/imgs/image-113.png) ## 配置 FastGPT 1. 修改 FastGPT 环境变量 **日志等级枚举**: `trace` | `debug` | `info` | `warning` | `error` | `fatal` ```dotenv LOG_ENABLE_CONSOLE=true # 是否开启控制台打印 LOG_CONSOLE_LEVEL=debug # 控制台打印最低日志等级 LOG_ENABLE_OTEL=true # 是否开启 OTEL 日志收集 LOG_OTEL_LEVEL=info # OTEL 日志收集的最低日志等级 LOG_OTEL_SERVICE_NAME=fastgpt-client # 传递给 OTLP 收集器的服务名称 LOG_OTEL_URL=http://localhost:4318/v1/logs # 你的 OTLP 收集器的地址,不要把 /v1/logs 遗漏了 ``` 2. 重启 FastGPT ## 查看效果 返回 Sealos 应用管理列表,点击进入 Signoz 前端项目,并访问其公网地址,进入管理台。 | | | | ----------------------------------------------- | ----------------------------------------------- | | ![alt text](../../../public/imgs/image-114.png) | ![alt text](../../../public/imgs/image-115.png) | 首次注册需要注册一个账号(数据是存储本地数据库),随便填写即可。 ![alt text](../../../public/imgs/image-116.png) 登录进去后,如果看到右侧 COMPLETED 的步骤条中,logs 和 traces 亮起,则说明配置成功。 ![alt text](../../../public/imgs/image-117.png) ![alt text](../../../public/imgs/image-118.png) ## 注意事项 1. 调整日志存储时长 Signoz 监控是一个非常占用磁盘的服务,首先不要把 FastGPT debug 日志也存储进来,另外可以将日志存储时长调整为 7 天。如果突然发现 Signoz 数据不增加了,并且内存一直追加,则说明是磁盘满了,需要扩大容量。 ![alt text](../../../public/imgs/image-119.png) file: ./content/guide/version/commercial.en.mdx meta: { "title": "FastGPT Commercial Edition", "description": "FastGPT Commercial Edition overview" } import { Alert } from '@/components/docs/Alert'; ## Overview FastGPT Commercial Edition is an enhanced version built on top of the Community Edition with additional exclusive features. Simply install the commercial image and configure the internal network address on your existing Community Edition setup to get started. ## Feature Comparison | | Community Edition | Commercial Edition | Cloud Service | | ------------------------------------------------------ | ------------------------------------------------------- | ------------------ | ------------- | | **App Building** | | | | | Workflow orchestration | ✅ | ✅ | ✅ | | Share links and API | ✅ | ✅ | ✅ | | App publishing security config | ❌ | ✅ | ✅ | | Third-party publishing (Lark, WeChat Official Account) | ❌ | ✅ | ✅ | | Run log dashboard | ❌ | ✅ | ✅ | | App evaluation | ❌ | ✅ | ✅ | | Agent and Skill assisted generation | ❌ | ✅ | ✅ | | System tool remote debugging | ❌ | ✅ | ✅ | | **Knowledge Base** | | | | | Knowledge base | ✅ | ✅ | ✅ | | Third-party knowledge base scheduled sync | ❌ | ✅ | ✅ | | Knowledge base index enhancement | ❌ | ✅ | ✅ | | Website sync | ❌ | ✅ | ✅ | | Image knowledge base | ❌ | ✅ | ✅ | | **General Features** | | | | | Multi-model configuration | ✅ | ✅ | ✅ | | Model log dashboard | ✅ | ✅ | ✅ | | Model content moderation | ❌ | ✅ | ✅ | | **Enterprise Features** | | | | | Custom branding | ❌ | ✅ | In design | | Multi-tenancy & billing | ❌ | ✅ | ✅ | | Team spaces & permissions | ❌ | ✅ | ✅ | | Admin dashboard | ❌ | ✅ | Not needed | | SSO login | ❌ | ✅ | In design | | Commercial license | [View open source license](./opensource/license.en.mdx) | Full | Full | ## Pricing FastGPT Commercial Edition offers 3 pricing models based on deployment type. Below are the common details for each. If you have further questions, [contact us](https://fael3z0zfze.feishu.cn/share/base/form/shrcnjJWtKqjOI9NbQTzhNyzljc?prefill_S=doc\&hide_S=1). **Included with all plans** 1. SaaS commercial license — use for any commercial purpose during the license period. 2. Free initial deployment assistance. 3. Priority support ticket handling. **Plan-specific features** | Deployment Type | Included Features | Time to Launch | Starting Price | | --------------------------------- | ------------------------------------------------------------------------------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | | Sealos Fully Managed | 1. Free upgrades during license period.
2. No ops or database management needed. | Half day | Starting at ¥10,000/month (3-month minimum)
or
Starting at ¥120,000/year
8C32G resources; additional resources billed separately. | | Sealos Fully Managed (Multi-node) | 1. Free upgrades during license period.
2. No ops or database management needed. | Half day | Starting at ¥22,000/month (3-month minimum)
or
Starting at ¥264,000/year
32C128G resources; additional resources billed separately. | | Self-hosted | 1. Free upgrade support for 6 versions. | Within 14 days | [Contact us for pricing](https://fael3z0zfze.feishu.cn/share/base/form/shrcnjJWtKqjOI9NbQTzhNyzljc?prefill_S=doc\&hide_S=1) | * "6 versions of upgrade support" means the FastGPT team assists with 6 upgrades — not that the software stops working after 6 versions. Most upgrades are straightforward enough to handle yourself. - Fully managed is ideal for teams without dedicated ops staff — just focus on your business. - Self-hosted gives you full control with deployment on your own servers. - Single-node is suitable for small to mid-sized teams providing internal services; you'll manage database backups yourself. - High-availability is designed for public-facing services, including visual monitoring, replicas, load balancing, and automated database backups. ## Contact Us Fill out the [inquiry form](https://fael3z0zfze.feishu.cn/share/base/form/shrcnjJWtKqjOI9NbQTzhNyzljc?prefill_S=doc\&hide_S=1) and we'll get back to you shortly. ## Technical Support ### App Customization We can build custom workflow orchestrations tailored to your needs, delivered as a complete app configuration. Pricing is negotiable based on scope. ### Technical Services (Custom Development, Maintenance, Migration, Third-party Integration) ¥2,000 – ¥3,000 per person per day ### Upgrade Fees Most upgrades just require pulling the new image and running the initialization script — no extra steps needed. For cross-version or complex upgrades, follow the documentation to upgrade yourself, or pay for support at the standard technical service rate. ## FAQ ### How is delivery handled? Full application = Community Edition image + Commercial Edition image We provide a Commercial Edition image that requires a License to start. ### How does custom development work? You can modify the Community Edition source code, but the Commercial Edition image cannot be modified. Since the full version = Community Edition + Commercial Edition image, you can customize part of the codebase. However, if you fork the code, you'll need to handle code merges yourself during future upgrades. ### Sealos Usage Costs Sealos cloud services use pay-as-you-go billing. Here's the pricing table: ![alt text](/imgs/image-58.png) ## Admin Dashboard Screenshots | | | | | ------------------------------- | ------------------------------- | ------------------------------- | | ![alt text](/imgs/image-55.png) | ![alt text](/imgs/image-56.png) | ![alt text](/imgs/image-57.png) | file: ./content/guide/version/commercial.mdx meta: { "title": "FastGPT 商业版", "description": "FastGPT 商业版相关说明" } import { Alert } from '@/components/docs/Alert'; ## 简介 FastGPT 商业版是基于 FastGPT 社区版的增强版本,增加了一些独有的功能。只需安装一个商业版镜像,并在社区版基础上填写对应的内网地址,即可快速使用商业版。 ## 功能差异 | | 社区版 | 商业版 | 云服务版 | | ------------------ | ---------------------------------- | --- | ---- | | **应用构建** | | | | | 工作流编排 | ✅ | ✅ | ✅ | | 分享链接和 API | ✅ | ✅ | ✅ | | 应用发布安全配置 | ❌ | ✅ | ✅ | | 第三方应用发布(飞书、公众号) | ❌ | ✅ | ✅ | | 运行日志看板 | ❌ | ✅ | ✅ | | 应用评测 | ❌ | ✅ | ✅ | | Agent 与 Skill 辅助生成 | ❌ | ✅ | ✅ | | 系统工具远程调试 | ❌ | ✅ | ✅ | | **知识库** | | | | | 知识库 | ✅ | ✅ | ✅ | | 第三方知识库定时同步 | ❌ | ✅ | ✅ | | 知识库索引增强 | ❌ | ✅ | ✅ | | web 站点同步 | ❌ | ✅ | ✅ | | 图片知识库 | ❌ | ✅ | ✅ | | **通用功能** | | | | | 多模型配置 | ✅ | ✅ | ✅ | | 模型日志看板 | ✅ | ✅ | ✅ | | 模型内容审核 | ❌ | ✅ | ✅ | | **企业级功能** | | | | | 自定义版权信息 | ❌ | ✅ | 设计中 | | 多租户与支付 | ❌ | ✅ | ✅ | | 团队空间 & 权限 | ❌ | ✅ | ✅ | | 管理后台 | ❌ | ✅ | 不需要 | | SSO 登录 | ❌ | ✅ | 设计中 | | 商业授权 | [查看开源协议](./opensource/license.mdx) | 完整 | 完整 | ## 商业版软件价格 FastGPT 商业版软件根据不同的部署方式,分为 3 类收费模式。下面列举各种部署方式一些常规内容,如仍有问题,可[联系咨询](https://fael3z0zfze.feishu.cn/share/base/form/shrcnjJWtKqjOI9NbQTzhNyzljc?prefill_S=doc\&hide_S=1) **共有服务** 1. SaaS 商业授权许可 - 在商业版有效期内,可提供任意形式的商业服务。 2. 首次免费帮助部署。 3. 优先问题工单处理。 **特有服务** | 部署方式 | 特有服务 | 上线时长 | 标品价格 | | --------------- | ------------------------------- | ----- | ----------------------------------------------------------------------------------------------------------------- | | Sealos 全托管 | 1. 有效期内免费升级。
2. 免运维服务&数据库。 | 半天 | 10000 元起/月(3 个月起)

120000 元起/年
8C32G 资源,额外资源另外收费。 | | Sealos 全托管(多节点) | 1. 有效期内免费升级。
2. 免运维服务&数据库。 | 半天 | 22000 元起/月(3 个月起)

264000 元起/年
32C128G 资源,额外资源另外收费。 | | 自有服务器部署 | 1. 6 个版本免费升级支持。 | 14 天内 | 具体价格和优惠可[联系咨询](https://fael3z0zfze.feishu.cn/share/base/form/shrcnjJWtKqjOI9NbQTzhNyzljc?prefill_S=doc\&hide_S=1) | * 6 个版本的升级服务不是指只能用 6 个版本,而是指依赖 FastGPT 团队提供的升级服务。大部分时候,建议自行升级,也不麻烦。- 全托管版本适合技术人员紧缺的团队,仅需关注业务推动,无需关心服务是否正常运行。- 自有服务器部署版可以完全部署在自己服务器中。- 单机版适合中小团队对内提供服务,需要自己维护数据库备份等。- 高可用版适合对外提供在线服务,包含可视化监控、多副本、负载均衡、数据库自动备份等生产环境的基础设施。 ## 联系方式 请填写[咨询问卷](https://fael3z0zfze.feishu.cn/share/base/form/shrcnjJWtKqjOI9NbQTzhNyzljc?prefill_S=doc\&hide_S=1),我们会尽快与您联系。 ## 技术支持 ### 应用定制 根据需求,定制实现某个需求的编排功能,最终会交付一个应用编排。可根据实际情况商讨。 ### 技术服务费(定开、维护、迁移、三方接入等) 2000 \~ 3000 元/人/天 ### 更新升级费用 大部分更新升级,重新拉镜像,然后执行一下初始化脚本就可以了,不需要执行额外操作。 跨版本更新或复杂更新可参考文档自行更新;或付费支持,标准与技术服务费一致。 ## QA ### 如何交付? 完整版应用 = 社区版镜像 + 商业版镜像 我们会提供一个商业版镜像给你使用,该镜像需要一个 License 启动。 ### 二次开发如何操作? 可以修改社区版部分代码,不支持修改商业版镜像。完整版本=社区版+商业版镜像,所以是可以修改部分内容的。但是如果二开了,后续则需要自己进行代码合并升级。 ### Sealos 运行费用 Sealos 云服务属于按量计费,下面是它的价格表: ![alt text](/imgs/image-58.png) ## 管理后台部分截图 | | | | | ------------------------------- | ------------------------------- | ------------------------------- | | ![alt text](/imgs/image-55.png) | ![alt text](/imgs/image-56.png) | ![alt text](/imgs/image-57.png) | file: ./content/self-host/custom-models/bge-rerank.en.mdx meta: { "title": "Integrating bge-rerank Reranking Model", "description": "Integrating bge-rerank reranking model with FastGPT" } ## Recommended Configuration by Model | Model Name | RAM | VRAM | Disk Space | Start Command | | ------------------ | ----- | ----- | ---------- | ------------- | | bge-reranker-base | >=4GB | >=4GB | >=8GB | python app.py | | bge-reranker-large | >=8GB | >=8GB | >=8GB | python app.py | | bge-reranker-v2-m3 | >=8GB | >=8GB | >=8GB | python app.py | ## Source Code Deployment ### 1. Environment Setup * Python 3.9 or 3.10 * CUDA 11.7 * Network access to download models ### 2. Download Code Code repositories for the 3 models: 1. [https://github.com/labring/FastGPT/tree/main/plugins/model/rerank-bge/bge-reranker-base](https://github.com/labring/FastGPT/tree/main/plugins/model/rerank-bge/bge-reranker-base) 2. [https://github.com/labring/FastGPT/tree/main/plugins/model/rerank-bge/bge-reranker-large](https://github.com/labring/FastGPT/tree/main/plugins/model/rerank-bge/bge-reranker-large) 3. [https://github.com/labring/FastGPT/tree/main/plugins/model/rerank-bge/bge-reranker-v2-m3](https://github.com/labring/FastGPT/tree/main/plugins/model/rerank-bge/bge-reranker-v2-m3) ### 3. Install Dependencies ```sh pip install -r requirements.txt ``` ### 4. Download Models HuggingFace repositories for the 3 models: 1. [https://huggingface.co/BAAI/bge-reranker-base](https://huggingface.co/BAAI/bge-reranker-base) 2. [https://huggingface.co/BAAI/bge-reranker-large](https://huggingface.co/BAAI/bge-reranker-large) 3. [https://huggingface.co/BAAI/bge-reranker-v2-m3](https://huggingface.co/BAAI/bge-reranker-v2-m3) Clone the model into the corresponding code directory. Directory structure: ``` bge-reranker-base/ app.py Dockerfile requirements.txt ``` ### 5. Run ```bash python app.py ``` On successful startup, you should see an address like this: ![](../../../public/imgs/rerank1.png) > `http://0.0.0.0:6006` is the connection address. ## Docker Deployment **Image names:** 1. registry.cn-hangzhou.aliyuncs.com/fastgpt/bge-rerank-base:v0.1 (4 GB+) 2. registry.cn-hangzhou.aliyuncs.com/fastgpt/bge-rerank-large:v0.1 (5 GB+) 3. registry.cn-hangzhou.aliyuncs.com/fastgpt/bge-rerank-v2-m3:v0.1 (5 GB+) **Port** 6006 **Environment Variables** ``` ACCESS_TOKEN=your_access_token (used in request header: Authorization: Bearer ${ACCESS_TOKEN}) ``` **Run Command Example** ```sh # auth token set to mytoken docker run -d --name reranker -p 6006:6006 -e ACCESS_TOKEN=mytoken --gpus all registry.cn-hangzhou.aliyuncs.com/fastgpt/bge-rerank-base:v0.1 ``` **docker-compose.yml Example** ``` version: "3" services: reranker: image: registry.cn-hangzhou.aliyuncs.com/fastgpt/bge-rerank-base:v0.1 container_name: reranker # GPU runtime. If the host doesn't have GPU drivers installed, comment out the deploy section. deploy: resources: reservations: devices: - driver: nvidia count: all capabilities: [gpu] ports: - 6006:6006 environment: - ACCESS_TOKEN=mytoken ``` ## Integrate with FastGPT 1. Open the FastGPT model configuration and add a new reranking model. 2. Fill in the model configuration form: set the Model ID to `bge-reranker-base` and the address to `{{host}}/v1/rerank`, where host is your deployed domain or IP:Port. ![alt text](../../../public/imgs/image-102.png) ## FAQ ### 403 Error The custom request token in FastGPT does not match the ACCESS\_TOKEN environment variable. ### Docker reports `Bus error (core dumped)` Try adding the `shm_size` option to your `docker-compose.yml` to increase the shared memory size in the container. ``` ... services: reranker: ... container_name: reranker shm_size: '2gb' ... ``` file: ./content/self-host/custom-models/bge-rerank.mdx meta: { "title": "接入 bge-rerank 重排模型", "description": "接入 bge-rerank 重排模型" } ## 不同模型推荐配置 推荐配置如下: | 模型名 | 内存 | 显存 | 硬盘空间 | 启动命令 | | ------------------ | ----- | ----- | ----- | ------------- | | bge-reranker-base | >=4GB | >=4GB | >=8GB | python app.py | | bge-reranker-large | >=8GB | >=8GB | >=8GB | python app.py | | bge-reranker-v2-m3 | >=8GB | >=8GB | >=8GB | python app.py | ## 源码部署 ### 1. 安装环境 * Python 3.9, 3.10 * CUDA 11.7 * 科学上网环境 ### 2. 下载代码 3 个模型代码分别为: 1. [https://github.com/labring/FastGPT/tree/main/plugins/model/rerank-bge/bge-reranker-base](https://github.com/labring/FastGPT/tree/main/plugins/model/rerank-bge/bge-reranker-base) 2. [https://github.com/labring/FastGPT/tree/main/plugins/model/rerank-bge/bge-reranker-large](https://github.com/labring/FastGPT/tree/main/plugins/model/rerank-bge/bge-reranker-large) 3. [https://github.com/labring/FastGPT/tree/main/plugins/model/rerank-bge/bge-reranker-v2-m3](https://github.com/labring/FastGPT/tree/main/plugins/model/rerank-bge/bge-reranker-v2-m3) ### 3. 安装依赖 ```sh pip install -r requirements.txt ``` ### 4. 下载模型 3个模型的 huggingface 仓库地址如下: 1. [https://huggingface.co/BAAI/bge-reranker-base](https://huggingface.co/BAAI/bge-reranker-base) 2. [https://huggingface.co/BAAI/bge-reranker-large](https://huggingface.co/BAAI/bge-reranker-large) 3. [https://huggingface.co/BAAI/bge-reranker-v2-m3](https://huggingface.co/BAAI/bge-reranker-v2-m3) 在对应代码目录下 clone 模型。目录结构: ``` bge-reranker-base/ app.py Dockerfile requirements.txt ``` ### 5. 运行代码 ```bash python app.py ``` 启动成功后应该会显示如下地址: ![](../../../public/imgs/rerank1.png) > 这里的 `http://0.0.0.0:6006` 就是连接地址。 ## docker 部署 **镜像名分别为:** 1. registry.cn-hangzhou.aliyuncs.com/fastgpt/bge-rerank-base:v0.1 (4 GB+) 2. registry.cn-hangzhou.aliyuncs.com/fastgpt/bge-rerank-large:v0.1 (5 GB+) 3. registry.cn-hangzhou.aliyuncs.com/fastgpt/bge-rerank-v2-m3:v0.1 (5 GB+) **端口** 6006 **环境变量** ``` ACCESS_TOKEN=访问安全凭证,请求时,Authorization: Bearer ${ACCESS_TOKEN} ``` **运行命令示例** ```sh # auth token 为mytoken docker run -d --name reranker -p 6006:6006 -e ACCESS_TOKEN=mytoken --gpus all registry.cn-hangzhou.aliyuncs.com/fastgpt/bge-rerank-base:v0.1 ``` **docker-compose.yml示例** ``` version: "3" services: reranker: image: registry.cn-hangzhou.aliyuncs.com/fastgpt/bge-rerank-base:v0.1 container_name: reranker # GPU运行环境,如果宿主机未安装,将deploy配置隐藏即可 deploy: resources: reservations: devices: - driver: nvidia count: all capabilities: [gpu] ports: - 6006:6006 environment: - ACCESS_TOKEN=mytoken ``` ## 接入 FastGPT 1. 打开 FastGPT 模型配置,新增一个重排模型。 2. 填写模型配置表单:模型 ID 为`bge-reranker-base`,地址填写`{{host}}/v1/rerank`,host 为你部署的域名/IP:Port。 ![alt text](../../../public/imgs/image-102.png) ## QA ### 403报错 FastGPT中,自定义请求 Token 和环境变量的 ACCESS\_TOKEN 不一致。 ### Docker 运行提示 `Bus error (core dumped)` 尝试增加 `docker-compose.yml` 配置项 `shm_size` ,以增加容器中的共享内存目录大小。 ``` ... services: reranker: ... container_name: reranker shm_size: '2gb' ... ``` file: ./content/self-host/custom-models/chatglm2-m3e.en.mdx meta: { "title": "Integrating ChatGLM2 and M3E Models", "description": "Integrating private ChatGLM2 and m3e-large models with FastGPT" } ## Introduction FastGPT uses OpenAI's LLM and embedding models by default. For private deployment, you can use ChatGLM2 and m3e-large as replacements. The following method was contributed by community user @不做了睡大觉. This image bundles both M3E-Large and ChatGLM2-6B models, ready to use out of the box. ## Deploy the Image * Image: `stawky/chatglm2-m3e:latest` * China mirror: `registry.cn-hangzhou.aliyuncs.com/fastgpt_docker/chatglm2-m3e:latest` * Port: 6006 ``` # Set the security token (used as the channel key in OneAPI) Default: sk-aaabbbcccdddeeefffggghhhiiijjjkkk You can also set it via the environment variable: sk-key. Refer to Docker documentation for how to pass environment variables. ``` ## Connect to OneAPI Documentation: [One API](../config/model/intro.en.mdx) Add a channel for chatglm2 and m3e-large respectively, with the following parameters: ![](../../../public/imgs/model-m3e1.png) Here, m3e is used as the embedding model and chatglm2 as the language model. ## Test curl examples: ```bash curl --location --request POST 'https://domain/v1/embeddings' \ --header 'Authorization: Bearer sk-aaabbbcccdddeeefffggghhhiiijjjkkk' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "m3e", "input": ["What is FastGPT"] }' ``` ```bash curl --location --request POST 'https://domain/v1/chat/completions' \ --header 'Authorization: Bearer sk-aaabbbcccdddeeefffggghhhiiijjjkkk' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "chatglm2", "messages": [{"role": "user", "content": "Hello!"}] }' ``` Set Authorization to sk-aaabbbcccdddeeefffggghhhiiijjjkkk. The model field should match the custom model name you entered in One API. ## Integrate with FastGPT Edit the config.json file. Add chatglm2 to `llmModels` and M3E to `vectorModels`: ```json "llmModels": [ // Other chat models { "model": "chatglm2", "name": "chatglm2", "maxToken": 8000, "price": 0, "quoteMaxToken": 4000, "maxTemperature": 1.2, "defaultSystemChatPrompt": "" } ], "vectorModels": [ { "model": "text-embedding-ada-002", "name": "Embedding-2", "price": 0.2, "defaultToken": 500, "maxToken": 3000 }, { "model": "m3e", "name": "M3E (for testing)", "price": 0.1, "defaultToken": 500, "maxToken": 1800 } ], ``` ## Usage **M3E model:** 1. Select the M3E model when creating a Knowledge Base. Note: once selected, the embedding model for the Knowledge Base cannot be changed. ![](../../../public/imgs/model-m3e2.png) 2. Import data 3. Test search ![](../../../public/imgs/model-m3e3.png) 4. Bind the Knowledge Base to an app Note: an app can only bind Knowledge Bases that use the same embedding model -- cross-model binding is not supported. You may also need to adjust the similarity threshold, as different embedding models produce different similarity (distance) scores. Test and tune accordingly. ![](../../../public/imgs/model-m3e4.png) **ChatGLM2 model:** Simply select chatglm2 as the model. file: ./content/self-host/custom-models/chatglm2-m3e.mdx meta: { "title": "接入 ChatGLM2-m3e 模型", "description": " 将 FastGPT 接入私有化模型 ChatGLM2和m3e-large" } ## 前言 FastGPT 默认使用了 OpenAI 的 LLM 模型和向量模型,如果想要私有化部署的话,可以使用 ChatGLM2 和 m3e-large 模型。以下是由用户@不做了睡大觉 提供的接入方法。该镜像直接集成了 M3E-Large 和 ChatGLM2-6B 模型,可以直接使用。 ## 部署镜像 * 镜像名: `stawky/chatglm2-m3e:latest` * 国内镜像名: `registry.cn-hangzhou.aliyuncs.com/fastgpt_docker/chatglm2-m3e:latest` * 端口号: 6006 ``` # 设置安全凭证(即 AI Proxy 中的渠道密钥) 默认值:sk-aaabbbcccdddeeefffggghhhiiijjjkkk 也可以通过环境变量引入:sk-key。有关docker环境变量引入的方法请自寻教程,此处不再赘述。 ``` ## 接入 AI Proxy 文档链接:[AI Proxy](../config/model/intro.mdx) 为 chatglm2 和 m3e-large 各添加一个渠道,参数如下: ![](../../../public/imgs/model-m3e1.png) 这里我填入 m3e 作为向量模型,chatglm2 作为语言模型 ## 测试 curl 例子: ```bash curl --location --request POST 'https://domain/v1/embeddings' \ --header 'Authorization: Bearer sk-aaabbbcccdddeeefffggghhhiiijjjkkk' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "m3e", "input": ["laf是什么"] }' ``` ```bash curl --location --request POST 'https://domain/v1/chat/completions' \ --header 'Authorization: Bearer sk-aaabbbcccdddeeefffggghhhiiijjjkkk' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "chatglm2", "messages": [{"role": "user", "content": "Hello!"}] }' ``` Authorization 为 sk-aaabbbcccdddeeefffggghhhiiijjjkkk。model 为刚刚在 One API 填写的自定义模型。 ## 接入 FastGPT 修改 config.json 配置文件,在 llmModels 中加入 chatglm2, 在 vectorModels 中加入 M3E 模型: ```json "llmModels": [ //其他对话模型 { "model": "chatglm2", "name": "chatglm2", "maxToken": 8000, "price": 0, "quoteMaxToken": 4000, "maxTemperature": 1.2, "defaultSystemChatPrompt": "" } ], "vectorModels": [ { "model": "text-embedding-ada-002", "name": "Embedding-2", "price": 0.2, "defaultToken": 500, "maxToken": 3000 }, { "model": "m3e", "name": "M3E(测试使用)", "price": 0.1, "defaultToken": 500, "maxToken": 1800 } ], ``` ## 测试使用 M3E 模型的使用方法如下: 1. 创建知识库时候选择 M3E 模型。 注意,一旦选择后,知识库将无法修改向量模型。 ![](../../../public/imgs/model-m3e2.png) 2. 导入数据 3. 搜索测试 ![](../../../public/imgs/model-m3e3.png) 4. 应用绑定知识库 注意,应用只能绑定同一个向量模型的知识库,不能跨模型绑定。并且,需要注意调整相似度,不同向量模型的相似度(距离)会有所区别,需要自行测试实验。 ![](../../../public/imgs/model-m3e4.png) chatglm2 模型的使用方法如下: 模型选择 chatglm2 即可 file: ./content/self-host/custom-models/chatglm2.en.mdx meta: { "title": "Integrating ChatGLM2-6B", "description": "Integrating the private ChatGLM2-6B model with FastGPT" } import { Alert } from '@/components/docs/Alert'; ## Introduction FastGPT lets you use your own OpenAI API KEY to quickly call OpenAI APIs. It currently integrates GPT-3.5, GPT-4, and embedding models for building Knowledge Bases. However, for data security reasons, you may not want to send all data to cloud-based LLMs. So how do you connect a private model to FastGPT? This guide walks through integrating Tsinghua's ChatGLM2 as an example. ## ChatGLM2-6B Overview ChatGLM2-6B is the second-generation version of the open-source bilingual (Chinese-English) chat model ChatGLM-6B. For details, see the [ChatGLM2-6B project page](https://github.com/THUDM/ChatGLM2-6B). Note: ChatGLM2-6B weights are fully open for academic research. Commercial use requires official written permission. This tutorial only demonstrates one integration method and does not grant any license. ## Recommended Configuration According to official data, generating 8192 tokens requires 12.8GB VRAM at FP16, 8.1GB at int8, and 5.1GB at int4. Quantization slightly affects performance, but not significantly. Recommended configurations: | Type | RAM | VRAM | Disk Space | Start Command | | ---- | ------ | ------ | ---------- | ------------------------ | | fp16 | >=16GB | >=16GB | >=25GB | python openai\_api.py 16 | | int8 | >=16GB | >=9GB | >=25GB | python openai\_api.py 8 | | int4 | >=16GB | >=6GB | >=25GB | python openai\_api.py 4 | ## Deployment ### Environment Requirements * Python 3.8.10 * CUDA 11.8 * Network access to download models ### Source Code Deployment 1. Set up the environment as described above; 2. Download the [Python file](https://github.com/labring/FastGPT/blob/main/plugins/model/llm-ChatGLM2/openai_api.py) 3. Run `pip install -r requirements.txt`; 4. Open the Python file and configure the token in the `verify_token` method -- this adds a layer of authentication to prevent unauthorized access; 5. Run `python openai_api.py --model_name 16`. Choose the number based on the configuration table above. Wait for the model to download and load. If you encounter errors, try asking GPT for help. On successful startup, you should see an address like this: ![](../../../public/imgs/chatglm2.png) > `http://0.0.0.0:6006` is the connection address. ### Docker Deployment **Image and Port** * Image: `stawky/chatglm2:latest` * China mirror: `registry.cn-hangzhou.aliyuncs.com/fastgpt_docker/chatglm2:latest` * Port: 6006 ``` # Set the security token (used as the channel key in OneAPI) Default: sk-aaabbbcccdddeeefffggghhhiiijjjkkk You can also set it via the environment variable: sk-key. Refer to Docker documentation for how to pass environment variables. ``` ## Connect to One API Add a channel for chatglm2 with the following parameters: ![](../../../public/imgs/model-m3e1.png) Here, chatglm2 is used as the language model. ## Test curl example: ```bash curl --location --request POST 'https://domain/v1/chat/completions' \ --header 'Authorization: Bearer sk-aaabbbcccdddeeefffggghhhiiijjjkkk' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "chatglm2", "messages": [{"role": "user", "content": "Hello!"}] }' ``` Set Authorization to sk-aaabbbcccdddeeefffggghhhiiijjjkkk. The model field should match the custom model name you entered in One API. ## Integrate with FastGPT Edit the config.json file and add chatglm2 to `llmModels`: ```json "llmModels": [ // Existing models { "model": "chatglm2", "name": "chatglm2", "maxContext": 4000, "maxResponse": 4000, "quoteMaxToken": 2000, "maxTemperature": 1, "vision": false, "defaultSystemChatPrompt": "" } ] ``` ## Usage Simply select chatglm2 as the model. file: ./content/self-host/custom-models/chatglm2.mdx meta: { "title": "接入 ChatGLM2-6B", "description": " 将 FastGPT 接入私有化模型 ChatGLM2-6B" } import { Alert } from '@/components/docs/Alert'; ## 前言 FastGPT 允许你使用自己的 OpenAI API KEY 来快速调用 OpenAI 接口,目前集成了 GPT-3.5, GPT-4 和 embedding,可构建自己的知识库。但考虑到数据安全的问题,我们并不能将所有的数据都交付给云端大模型。 那么如何在 FastGPT 上接入私有化模型呢?本文就以清华的 ChatGLM2 为例,为各位讲解如何在 FastGPT 中接入私有化模型。 ## ChatGLM2-6B 简介 ChatGLM2-6B 是开源中英双语对话模型 ChatGLM-6B 的第二代版本,具体介绍可参阅 [ChatGLM2-6B 项目主页](https://github.com/THUDM/ChatGLM2-6B)。 注意,ChatGLM2-6B 权重对学术研究完全开放,在获得官方的书面许可后,亦允许商业使用。本教程只是介绍了一种用法,无权给予任何授权! ## 推荐配置 依据官方数据,同样是生成 8192 长度,量化等级为 FP16 要占用 12.8GB 显存、int8 为 8.1GB 显存、int4 为 5.1GB 显存,量化后会稍微影响性能,但不多。 因此推荐配置如下: | 类型 | 内存 | 显存 | 硬盘空间 | 启动命令 | | ---- | ------ | ------ | ------ | ------------------------ | | fp16 | >=16GB | >=16GB | >=25GB | python openai\_api.py 16 | | int8 | >=16GB | >=9GB | >=25GB | python openai\_api.py 8 | | int4 | >=16GB | >=6GB | >=25GB | python openai\_api.py 4 | ## 部署 ### 环境要求 * Python 3.8.10 * CUDA 11.8 * 科学上网环境 ### 源码部署 1. 根据上面的环境配置配置好环境,具体教程自行 GPT; 2. 下载 [python 文件](https://github.com/labring/FastGPT/blob/main/plugins/model/llm-ChatGLM2/openai_api.py) 3. 在命令行输入命令 `pip install -r requirements.txt`; 4. 打开你需要启动的 py 文件,在代码的 `verify_token` 方法中配置 token,这里的 token 只是加一层验证,防止接口被人盗用; 5. 执行命令 `python openai_api.py --model_name 16`。这里的数字根据上面的配置进行选择。 然后等待模型下载,直到模型加载完毕为止。如果出现报错先问 GPT。 启动成功后应该会显示如下地址: ![](../../../public/imgs/chatglm2.png) > 这里的 `http://0.0.0.0:6006` 就是连接地址。 ### docker 部署 **镜像和端口** * 镜像名: `stawky/chatglm2:latest` * 国内镜像名: `registry.cn-hangzhou.aliyuncs.com/fastgpt_docker/chatglm2:latest` * 端口号: 6006 ``` # 设置安全凭证(即oneapi中的渠道密钥) 默认值:sk-aaabbbcccdddeeefffggghhhiiijjjkkk 也可以通过环境变量引入:sk-key。有关docker环境变量引入的方法请自寻教程,此处不再赘述。 ``` ## 接入 One API 为 chatglm2 添加一个渠道,参数如下: ![](../../../public/imgs/model-m3e1.png) 这里我填入 chatglm2 作为语言模型 ## 测试 curl 例子: ```bash curl --location --request POST 'https://domain/v1/chat/completions' \ --header 'Authorization: Bearer sk-aaabbbcccdddeeefffggghhhiiijjjkkk' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "chatglm2", "messages": [{"role": "user", "content": "Hello!"}] }' ``` Authorization 为 sk-aaabbbcccdddeeefffggghhhiiijjjkkk。model 为刚刚在 One API 填写的自定义模型。 ## 接入 FastGPT 修改 config.json 配置文件,在 llmModels 中加入 chatglm2 模型: ```json "llmModels": [ //已有模型 { "model": "chatglm2", "name": "chatglm2", "maxContext": 4000, "maxResponse": 4000, "quoteMaxToken": 2000, "maxTemperature": 1, "vision": false, "defaultSystemChatPrompt": "" } ] ``` ## 测试使用 chatglm2 模型的使用方法如下: 模型选择 chatglm2 即可 file: ./content/self-host/custom-models/m3e.en.mdx meta: { "title": "Integrating M3E Embedding Model", "description": "Integrating the private M3E embedding model with FastGPT" } ## Introduction FastGPT uses OpenAI's embedding model by default. For private deployment, you can replace it with the M3E embedding model. M3E is a lightweight model with low resource requirements -- it can even run on CPU. The following tutorial is based on an image provided by community contributor "睡大觉". ## Deploy the Image Image: `stawky/m3e-large-api:latest` China mirror: `registry.cn-hangzhou.aliyuncs.com/fastgpt_docker/m3e-large-api:latest` Port: 6008 Environment variables: ``` # Set the security token (used as the channel key in OneAPI) Default: sk-aaabbbcccdddeeefffggghhhiiijjjkkk You can also set it via the environment variable: sk-key. Refer to Docker documentation for how to pass environment variables. ``` ## Connect to One API Add a channel with the following parameters: ![](../../../public/imgs/model-m3e1.png) ## Test curl example: ```bash curl --location --request POST 'https://domain/v1/embeddings' \ --header 'Authorization: Bearer xxxx' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "m3e", "input": ["What is FastGPT"] }' ``` Set Authorization to your sk-key. The model field should match the custom model name you entered in One API. ## Integrate with FastGPT Edit the config.json file and add the M3E model to `vectorModels`: ```json "vectorModels": [ { "model": "text-embedding-ada-002", "name": "Embedding-2", "price": 0.2, "defaultToken": 500, "maxToken": 3000 }, { "model": "m3e", "name": "M3E (for testing)", "price": 0.1, "defaultToken": 500, "maxToken": 1800 } ] ``` ## Usage 1. Select the M3E model when creating a Knowledge Base. Note: once selected, the embedding model for the Knowledge Base cannot be changed. ![](../../../public/imgs/model-m3e2.png) 2. Import data 3. Test search ![](../../../public/imgs/model-m3e3.png) 4. Bind the Knowledge Base to an app Note: an app can only bind Knowledge Bases that use the same embedding model -- cross-model binding is not supported. You may also need to adjust the similarity threshold, as different embedding models produce different similarity (distance) scores. Test and tune accordingly. ![](../../../public/imgs/model-m3e4.png) file: ./content/self-host/custom-models/m3e.mdx meta: { "title": "接入 M3E 向量模型", "description": " 将 FastGPT 接入私有化模型 M3E" } ## 前言 FastGPT 默认使用了 openai 的 embedding 向量模型,如果你想私有部署的话,可以使用 M3E 向量模型进行替换。M3E 向量模型属于小模型,资源使用不高,CPU 也可以运行。下面教程是基于 “睡大觉” 同学提供的一个的镜像。 ## 部署镜像 镜像名: `stawky/m3e-large-api:latest`\ 国内镜像: `registry.cn-hangzhou.aliyuncs.com/fastgpt_docker/m3e-large-api:latest` 端口号: 6008 环境变量: ``` # 设置安全凭证(即oneapi中的渠道密钥) 默认值:sk-aaabbbcccdddeeefffggghhhiiijjjkkk 也可以通过环境变量引入:sk-key。有关docker环境变量引入的方法请自寻教程,此处不再赘述。 ``` ## 接入 One API 添加一个渠道,参数如下: ![](../../../public/imgs/model-m3e1.png) ## 测试 curl 例子: ```bash curl --location --request POST 'https://domain/v1/embeddings' \ --header 'Authorization: Bearer xxxx' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "m3e", "input": ["laf是什么"] }' ``` Authorization 为 sk-key。model 为刚刚在 One API 填写的自定义模型。 ## 接入 FastGPT 修改 config.json 配置文件,在 vectorModels 中加入 M3E 模型: ```json "vectorModels": [ { "model": "text-embedding-ada-002", "name": "Embedding-2", "price": 0.2, "defaultToken": 500, "maxToken": 3000 }, { "model": "m3e", "name": "M3E(测试使用)", "price": 0.1, "defaultToken": 500, "maxToken": 1800 } ] ``` ## 测试使用 1. 创建知识库时候选择 M3E 模型。 注意,一旦选择后,知识库将无法修改向量模型。 ![](../../../public/imgs/model-m3e2.png) 2. 导入数据 3. 搜索测试 ![](../../../public/imgs/model-m3e3.png) 4. 应用绑定知识库 注意,应用只能绑定同一个向量模型的知识库,不能跨模型绑定。并且,需要注意调整相似度,不同向量模型的相似度(距离)会有所区别,需要自行测试实验。 ![](../../../public/imgs/model-m3e4.png) file: ./content/self-host/custom-models/marker.en.mdx meta: { "title": "Integrating Marker PDF Parsing", "description": "Use Marker to parse PDF documents with image extraction and layout recognition" } ## Background PDF is a relatively complex file format. FastGPT's built-in PDF parser relies on the pdfjs library, which uses logical parsing and cannot effectively handle complex PDF files. When parsing PDFs containing images, tables, formulas, or other non-plain-text content, the results are often poor. There are several PDF parsing solutions available. [Marker](https://github.com/VikParuchuri/marker) uses the Surya model for vision-based parsing, effectively extracting images, tables, formulas, and other complex content. Starting from `FastGPT v4.9.0`, community edition users can add the `systemEnv.customPdfParse` configuration in `config.json` to use Marker for PDF parsing. Commercial edition users can configure this directly in the Admin panel via the form. You need to pull the latest Marker image, as the API format has changed. ## Tutorial ### 1. Install Marker Refer to the [Marker installation guide](https://github.com/labring/FastGPT/tree/main/plugins/model/pdf-marker) to install the Marker model. The bundled API is already compatible with FastGPT's custom parsing service. Quick Docker installation: ```dockerfile docker pull crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.2 docker run --gpus all -itd -p 7231:7232 --name model_pdf_v2 -e PROCESSES_PER_GPU="2" crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.2 ``` ### 2. Add FastGPT Configuration ```json { xxx "systemEnv": { xxx "customPdfParse": { "url": "http://xxxx.com/v2/parse/file", // Custom PDF parsing service URL for Marker v0.2 "key": "", // Custom PDF parsing service key "doc2xKey": "", // doc2x service key "price": 0 // PDF parsing service price } } } ``` Restart the service after making changes. ### 3. Test Upload a PDF file through the Knowledge Base and enable the `Enhanced PDF Parsing` option. ![alt text](../../../public/imgs/marker2.png) After uploading, you should see the following logs (LOG\_LEVEL must be set to info or debug): ``` [Info] 2024-12-05 15:04:42 Parsing files from an external service [Info] 2024-12-05 15:07:08 Custom file parsing is complete, time: 1316ms ``` You'll notice that PDFs parsed by Marker include image links: ![alt text](../../../public/imgs/image-10.png) Similarly, in apps you can enable `Enhanced PDF Parsing` in the file upload settings. ![alt text](../../../public/imgs/marker3.png) ## Results Using Tsinghua's [ChatDev Communicative Agents for Software Develop.pdf](https://arxiv.org/abs/2307.07924) as an example: | | | | | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | | ![alt text](../../../public/imgs/image-11.png) | ![alt text](../../../public/imgs/image-12.png) | ![alt text](../../../public/imgs/image-13.png) | | ![alt text](../../../public/imgs/image-14.png) | ![alt text](../../../public/imgs/image-15.png) | ![alt text](../../../public/imgs/image-16.png) | The top row shows chunked results; the bottom row shows the original PDF. Images, formulas, and tables are all extracted effectively. Note that [Marker](https://github.com/VikParuchuri/marker) is licensed under `GPL-3.0 license`. Please ensure compliance with the license when using it. ## Legacy Marker Usage For FastGPT versions before V4.9.0, you can use the following method for Marker parsing. Install and run the Marker service: ```dockerfile docker pull crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.1 docker run --gpus all -itd -p 7231:7231 --name model_pdf_v1 -e PROCESSES_PER_GPU="2" crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.1 ``` Then modify the FastGPT environment variables: ``` CUSTOM_READ_FILE_URL=http://xxxx.com/v1/parse/file CUSTOM_READ_FILE_EXTENSION=pdf ``` * CUSTOM\_READ\_FILE\_URL - The custom parsing service URL. Replace the host with your parsing service address; the path must remain unchanged. * CUSTOM\_READ\_FILE\_EXTENSION - Supported file extensions. Use commas to separate multiple file types. file: ./content/self-host/custom-models/marker.mdx meta: { "title": "接入 Marker PDF 文档解析", "description": "使用 Marker 解析 PDF 文档,可实现图片提取和布局识别" } ## 背景 PDF 是一个相对复杂的文件格式,在 FastGPT 内置的 pdf 解析器中,依赖的是 pdfjs 库解析,该库基于逻辑解析,无法有效的理解复杂的 pdf 文件。所以我们在解析 pdf 时候,如果遇到图片、表格、公式等非简单文本内容,会发现解析效果不佳。 市面上目前有多种解析 PDF 的方法,比如使用 [Marker](https://github.com/VikParuchuri/marker),该项目使用了 Surya 模型,基于视觉解析,可以有效提取图片、表格、公式等复杂内容。 在 `FastGPT v4.9.0` 版本中,社区版用户可以在`config.json`文件中添加`systemEnv.customPdfParse`配置,来使用 Marker 解析 PDF 文件。商业版用户直接在 Admin 后台根据表单指引填写即可。需重新拉取 Marker 镜像,接口格式已变动。 ## 使用教程 ### 1. 安装 Marker 参考文档 [Marker 安装教程](https://github.com/labring/FastGPT/tree/main/plugins/model/pdf-marker),安装 Marker 模型。封装的 API 已经适配了 FastGPT 自定义解析服务。 这里介绍快速 Docker 安装的方法: ```dockerfile docker pull crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.2 docker run --gpus all -itd -p 7231:7232 --name model_pdf_v2 -e PROCESSES_PER_GPU="2" crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.2 ``` ### 2. 添加 FastGPT 文件配置 ```json { xxx "systemEnv": { xxx "customPdfParse": { "url": "http://xxxx.com/v2/parse/file", // 自定义 PDF 解析服务地址 marker v0.2 "key": "", // 自定义 PDF 解析服务密钥 "doc2xKey": "", // doc2x 服务密钥 "price": 0 // PDF 解析服务价格 } } } ``` 需要重启服务。 ### 3. 测试效果 通过知识库上传一个 pdf 文件,并勾选上 `PDF 增强解析`。 ![alt text](../../../public/imgs/marker2.png) 确认上传后,可以在日志中看到 LOG (LOG\_LEVEL需要设置 info 或者 debug): ``` [Info] 2024-12-05 15:04:42 Parsing files from an external service [Info] 2024-12-05 15:07:08 Custom file parsing is complete, time: 1316ms ``` 然后你就可以发现,通过 Marker 解析出来的 pdf 会携带图片链接: ![alt text](../../../public/imgs/image-10.png) 同样的,在应用中,你可以在文件上传配置里,勾选上 `PDF 增强解析`。 ![alt text](../../../public/imgs/marker3.png) ## 效果展示 以清华的 [ChatDev Communicative Agents for Software Develop.pdf](https://arxiv.org/abs/2307.07924) 为例,展示 Marker 解析的效果: | | | | | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | | ![alt text](../../../public/imgs/image-11.png) | ![alt text](../../../public/imgs/image-12.png) | ![alt text](../../../public/imgs/image-13.png) | | ![alt text](../../../public/imgs/image-14.png) | ![alt text](../../../public/imgs/image-15.png) | ![alt text](../../../public/imgs/image-16.png) | 上图是分块后的结果,下图是 pdf 原文。整体图片、公式、表格都可以提取出来,效果还是杠杠的。 不过要注意的是,[Marker](https://github.com/VikParuchuri/marker) 的协议是`GPL-3.0 license`,请在遵守协议的前提下使用。 ## 旧版 Marker 使用方法 FastGPT V4.9.0 版本之前,可以用以下方式,试用 Marker 解析服务。 安装和运行 Marker 服务: ```dockerfile docker pull crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.1 docker run --gpus all -itd -p 7231:7231 --name model_pdf_v1 -e PROCESSES_PER_GPU="2" crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.1 ``` 并修改 FastGPT 环境变量: ``` CUSTOM_READ_FILE_URL=http://xxxx.com/v1/parse/file CUSTOM_READ_FILE_EXTENSION=pdf ``` * CUSTOM\_READ\_FILE\_URL - 自定义解析服务的地址, host改成解析服务的访问地址,path 不能变动。 * CUSTOM\_READ\_FILE\_EXTENSION - 支持的文件后缀,多个文件类型,可用逗号隔开。 file: ./content/self-host/custom-models/mineru.en.mdx meta: { "title": "Integrating MinerU PDF Parsing", "description": "Use MinerU to parse PDF documents with image extraction, layout recognition, table recognition, and formula recognition" } ## Background PDF is a relatively complex file format. FastGPT's built-in PDF parser relies on the pdfjs library, which uses logical parsing and cannot effectively handle complex PDF files. When parsing PDFs containing images, tables, formulas, or other non-plain-text content, the results are often poor. There are several PDF parsing solutions available. [MinerU](https://github.com/opendatalab/MinerU) uses YOLO, PaddleOCR, and table recognition models for vision-based parsing, effectively extracting images, tables, formulas, and other complex content. Community edition users can add the `systemEnv.customPdfParse` configuration in `config.json` to use MinerU for PDF parsing. Commercial edition users can configure this directly in the Admin panel via the form -- details are covered in the tutorial below. ## Tutorial Hardware requirements: 16GB+ GPU VRAM, minimum 16GB+ RAM (32GB+ recommended). See the [official page](https://github.com/opendatalab/MinerU) for other requirements. ### 1. Install MinerU Quick Docker installation: Pull the fastgpt-mineru image --> Create and start the parsing service container --> Add the deployed URL to the FastGPT configuration file ```dockerfile docker pull crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/fastgpt_ck/mineru:v1 docker run --gpus all -itd -p 7231:8001 --name mode_pdf_minerU crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/fastgpt_ck/mineru:v1 ``` This MinerU integration uses pipeline mode with built-in parallelization inside the Docker container. It creates multiple processes based on the number of GPUs to handle uploaded PDFs concurrently. ### 2. Add FastGPT Configuration ```json { xxx "systemEnv": { xxx "customPdfParse": { "url": "http://xxxx.com/v2/parse/file", // Custom PDF parsing service URL for MinerU "key": "", // Custom PDF parsing service key "doc2xKey": "", // doc2x service key "price": 0 // PDF parsing service price } } } ``` For the commercial edition, configure as shown below: ![alt text](../../../public/imgs/mineru6.png) **Note:** Services added via the configuration file require a restart to take effect. ### 3. Test Upload a PDF file through the Knowledge Base and enable the `Enhanced PDF Parsing` option. ![alt text](../../../public/imgs/mineru1.png) After uploading, you should see the following logs (LOG\_LEVEL must be set to info or debug): ``` [Info] 2024-12-05 15:04:42 Parsing files from an external service [Info] 2024-12-05 15:07:08 Custom file parsing is complete, time: 1316ms ``` Similarly, in apps you can enable `Enhanced PDF Parsing` in the file upload settings. ![alt text](../../../public/imgs/mineru2.png) ## Results Using Tsinghua's [ChatDev Communicative Agents for Software Develop.pdf](https://arxiv.org/abs/2307.07924) as an example: | | | | | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | | ![alt text](../../../public/imgs/mineru3-1.png) | ![alt text](../../../public/imgs/mineru4-1.png) | ![alt text](../../../public/imgs/mineru5-1.png) | | ![alt text](../../../public/imgs/mineru3.png) | ![alt text](../../../public/imgs/mineru4.png) | ![alt text](../../../public/imgs/mineru5.png) | The top row shows chunked results; the bottom row shows the original PDF. Images, formulas, and OCR handwriting are all extracted effectively. Note that [MinerU](https://github.com/opendatalab/MinerU) is licensed under `GPL-3.0 license`. Please ensure compliance with the license when using it. file: ./content/self-host/custom-models/mineru.mdx meta: { "title": "接入 MinerU PDF 文档解析", "description": "使用 MinerU 解析 PDF 文档,可实现图片提取、布局识别、表格识别和公式识别" } ## 背景 PDF 是一个相对复杂的文件格式,在 FastGPT 内置的 pdf 解析器中,依赖的是 pdfjs 库解析,该库基于逻辑解析,无法有效的理解复杂的 pdf 文件。所以我们在解析 pdf 时候,如果遇到图片、表格、公式等非简单文本内容,会发现解析效果不佳。 市面上目前有多种解析 PDF 的方法,比如使用 [MinerU](https://github.com/opendatalab/MinerU),该项目使用了 YOLO、PaddleOCR以及表格识别等模型,基于视觉解析,可以有效提取图片、表格、公式等复杂内容。 社区版用户可以在`config.json`文件中添加`systemEnv.customPdfParse`配置,来使用 MinerU 解析 PDF 文件。商业版用户直接在 Admin 后台根据表单指引填写即可,使用教程中会详细解释。 ## 使用教程 硬件需求:16g+ 的gpu显存推理卡,最小 16GB+, 推荐 32GB+的内存,其他要求查看[官网](https://github.com/opendatalab/MinerU) ### 1. 安装 MinerU 这里介绍快速 Docker 安装的方法: 拉取fastgpt-mineru镜像 ---> 创建容器启动解析服务 ---> 把部署好的url地址接入到fastgpt配置文件中 ```dockerfile docker pull crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/fastgpt_ck/mineru:v1 docker run --gpus all -itd -p 7231:8001 --name mode_pdf_minerU crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/fastgpt_ck/mineru:v1 ``` 这里的mineru接入的是pipeline模式,并且在docker内部进行了并行化,会根据gpu数量创建多个进程来同时处理上传的pdf数据 ### 2. 添加 FastGPT 文件配置 ```json { xxx "systemEnv": { xxx "customPdfParse": { "url": "http://xxxx.com/v2/parse/file", // 自定义 PDF 解析服务地址 MinerU "key": "", // 自定义 PDF 解析服务密钥 "doc2xKey": "", // doc2x 服务密钥 "price": 0 // PDF 解析服务价格 } } } ``` 商业版请按下图配置 ![alt text](../../../public/imgs/mineru6.png) **注意:** 通过配置文件添加的服务需要重启服务。 ### 3. 测试效果 通过知识库上传一个 pdf 文件,并勾选上 `PDF 增强解析`。 ![alt text](../../../public/imgs/mineru1.png) 确认上传后,可以在日志中看到 LOG (LOG\_LEVEL需要设置 info 或者 debug): ``` [Info] 2024-12-05 15:04:42 Parsing files from an external service [Info] 2024-12-05 15:07:08 Custom file parsing is complete, time: 1316ms ``` 同样的,在应用中,你可以在文件上传配置里,勾选上 `PDF 增强解析`。 ![alt text](../../../public/imgs/mineru2.png) ## 效果展示 以清华的 [ChatDev Communicative Agents for Software Develop.pdf](https://arxiv.org/abs/2307.07924) 为例,展示 MinerU 解析的效果: | | | | | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | | ![alt text](../../../public/imgs/mineru3-1.png) | ![alt text](../../../public/imgs/mineru4-1.png) | ![alt text](../../../public/imgs/mineru5-1.png) | | ![alt text](../../../public/imgs/mineru3.png) | ![alt text](../../../public/imgs/mineru4.png) | ![alt text](../../../public/imgs/mineru5.png) | 上图是分块后的结果,下图是 pdf 原文。整体图片、公式、ocr手写体都可以提取出来,效果还是可以的。 不过要注意的是,[MinerU](https://github.com/opendatalab/MinerU) 的协议是`GPL-3.0 license`,请在遵守协议的前提下使用。 file: ./content/self-host/custom-models/ollama.en.mdx meta: { "title": "Integrating Local Models with Ollama", "description": "Deploy your own models using Ollama" } [Ollama](https://ollama.com/) is an open-source AI model deployment tool focused on simplifying the deployment and usage of large language models. It supports one-click download and running of various LLMs. ## Installing Ollama Ollama supports multiple installation methods, but Docker is recommended. If you install Ollama directly on your host machine, you'll need to figure out how to let the FastGPT Docker container access Ollama on the host, which can be tricky. ### Docker Installation (Recommended) Use Ollama's official Docker image for one-click installation and startup (make sure Docker is installed on your machine): ```bash docker pull ollama/ollama docker run --rm -d --name ollama -p 11434:11434 ollama/ollama ``` If your FastGPT is deployed in Docker, make sure the Ollama container is on the same network as FastGPT. Otherwise, FastGPT may not be able to access it: ```bash docker run --rm -d --name ollama --network (your FastGPT container network) -p 11434:11434 ollama/ollama ``` ### Host Installation If you prefer not to use Docker, you can install directly on the host machine. #### MacOS If you're on macOS with Homebrew installed: ```bash brew install ollama ollama serve # Start the service after installation ``` #### Linux On Linux, you can use a package manager. For Ubuntu: ```bash curl https://ollama.com/install.sh | sh # Downloads and runs the official install script ollama serve # Start the service after installation ``` #### Windows On Windows, download the installer from the Ollama official website. Run the installer and follow the wizard. After installation, start the service in Command Prompt or PowerShell: ```bash ollama serve # After installation, visit http://localhost:11434 in your browser to verify Ollama is running ``` #### Additional Notes If you installed Ollama as a host application (not via Docker), make sure Ollama listens on 0.0.0.0. ##### 1. Linux If Ollama runs as a systemd service, edit the service file with `sudo systemctl edit ollama.service`. Add `Environment="OLLAMA_HOST=0.0.0.0"` under the \[Service] section. Save and exit, then run `sudo systemctl daemon-reload` and `sudo systemctl restart ollama` to apply. ##### 2. MacOS Open a terminal and run `launchctl setenv ollama_host "0.0.0.0"`, then restart the Ollama application. ##### 3. Windows Open "Edit system environment variables" from the Start menu or search bar. In "System Properties", click "Environment Variables". Under "System variables", click "New" and create a variable named OLLAMA\_HOST with value 0.0.0.0. Click "OK" to save, then restart Ollama from the Start menu. ### Pull Model Images After installing Ollama, no models are available locally -- you need to pull them: ```bash # For Docker deployment, enter the container first: docker exec -it [Ollama container name] /bin/sh ollama pull [model name] ``` ![](../../../public/imgs/Ollama-pull.png) ### Test Communication After installation, verify connectivity by entering the FastGPT container and trying to reach Ollama: ```bash docker exec -it [FastGPT container name] /bin/sh curl http://XXX.XXX.XXX.XXX:11434 # Container: "http://[container name]:[port]", Host: "http://[host IP]:[port]" (host IP cannot be localhost) ``` If you see that the Ollama service is running, communication is working. ## Integrating Ollama with FastGPT ### 1. Check Available Models First, check which models Ollama has: ```bash # For Docker-deployed Ollama: docker exec -it [Ollama container name] /bin/sh ollama ls ``` ![](../../../public/imgs/Ollama-models1.png) ### 2. AI Proxy Integration If you're using FastGPT's default configuration from [here](../deploy/docker.en.mdx), AI Proxy is enabled by default. ![](../../../public/imgs/Ollama-aiproxy1.png) Make sure your FastGPT can access the Ollama container. If not, refer to the [installation section](#installing-ollama) above -- check whether the host isn't listening on 0.0.0.0 or the containers aren't on the same network. ![](../../../public/imgs/Ollama-aiproxy2.png) In FastGPT, go to Account -> Model Providers -> Model Configuration -> Add Model. Make sure the model ID matches the model name in OneAPI. See details [here](../config/model/intro.en.mdx). ![](../../../public/imgs/Ollama-models2.png) ![](../../../public/imgs/Ollama-models3.png) Run FastGPT, then go to Account -> Model Providers -> Model Channels -> Add Channel. Select Ollama as the channel type, add your pulled model, and fill in the proxy address. For container-deployed Ollama, the address is [http://address:port](http://address:port). Note: container deployment uses "http\://\[container name]:\[port]", host installation uses "http\://\[host IP]:\[port]" (host IP cannot be localhost). ![](../../../public/imgs/Ollama-aiproxy3.png) Create an app in the workspace and select the model you added. The model name shown is the alias you set. Note: the same model cannot be added multiple times -- the system uses the alias from the most recent addition. ![](../../../public/imgs/Ollama-models4.png) ### 3. OneAPI Integration If you want to use OneAPI, pull the OneAPI image and run it on the same network as FastGPT: ```bash # Pull the OneAPI image docker pull intel/oneapi-hpckit # Run the container on the FastGPT network docker run -it --network [FastGPT network] --name container_name intel/oneapi-hpckit /bin/bash ``` In the OneAPI page, add a new channel with type Ollama. Enter your Ollama model name (must match exactly), then fill in the Ollama proxy address below -- default is [http://address:port](http://address:port), without /v1. Test the channel after adding. This example uses Docker-deployed Ollama; for host-installed Ollama, use http\://\[host IP]:\[port]. ![](../../../public/imgs/Ollama-oneapi1.png) After adding the channel, click Token -> Add Token, fill in the name, and configure as needed. ![](../../../public/imgs/Ollama-oneapi2.png) Edit the FastGPT docker-compose.yml file: comment out AI Proxy, set OPENAI\_BASE\_URL to your OneAPI address (default [http://address:port/v1](http://address:port/v1) -- /v1 is required), and set KEY to your OneAPI token. ![](../../../public/imgs/Ollama-oneapi3.png) Then [jump to section 5](#5-model-addition-and-usage) to add and use models. ### 4. Direct Integration If you don't want to use AI Proxy or OneAPI, you can connect directly. Edit the FastGPT docker-compose.yml: comment out AI Proxy code, set OPENAI\_BASE\_URL to your Ollama address (default [http://address:port/v1](http://address:port/v1) -- /v1 is required), and set KEY to any value (Ollama has no authentication by default; if you've enabled it, use the correct key). Everything else is the same as the OneAPI approach -- just add your model in FastGPT. This example uses Docker-deployed Ollama; for host-installed Ollama, use http\://\[host IP]:\[port]. ![](../../../public/imgs/Ollama-direct1.png) After completing the setup, [click here](#5-model-addition-and-usage) to add and use models. ### 5. Model Addition and Usage In FastGPT, go to Account -> Model Providers -> Model Configuration -> Add Model. Make sure the model ID matches the model name in OneAPI. ![](../../../public/imgs/Ollama-models2.png) ![](../../../public/imgs/Ollama-models3.png) Create an app in the workspace and select the model you added. The model name shown is the alias you set. Note: the same model cannot be added multiple times -- the system uses the alias from the most recent addition. ![](../../../public/imgs/Ollama-models4.png) ### 6. Additional Notes For the Ollama proxy addresses above: host-installed Ollama uses "http\://\[host IP]:\[port]", container-deployed Ollama uses "http\://\[container name]:\[port]". file: ./content/self-host/custom-models/ollama.mdx meta: { "title": "使用 Ollama 接入本地模型 ", "description": " 采用 Ollama 部署自己的模型" } [Ollama](https://ollama.com/) 是一个开源的AI大模型部署工具,专注于简化大语言模型的部署和使用,支持一键下载和运行各种大模型。 ## 安装 Ollama Ollama 本身支持多种安装方式,但是推荐使用 Docker 拉取镜像部署。如果是个人设备上安装了 Ollama 后续需要解决如何让 Docker 中 FastGPT 容器访问宿主机 Ollama的问题,较为麻烦。 ### Docker 安装(推荐) 你可以使用 Ollama 官方的 Docker 镜像来一键安装和启动 Ollama 服务(确保你的机器上已经安装了 Docker),命令如下: ```bash docker pull ollama/ollama docker run --rm -d --name ollama -p 11434:11434 ollama/ollama ``` 如果你的 FastGPT 是在 Docker 中进行部署的,建议在拉取 Ollama 镜像时保证和 FastGPT 镜像处于同一网络,否则可能出现 FastGPT 无法访问的问题,命令如下: ```bash docker run --rm -d --name ollama --network (你的 Fastgpt 容器所在网络) -p 11434:11434 ollama/ollama ``` ### 主机安装 如果你不想使用 Docker ,也可以采用主机安装,以下是主机安装的一些方式。 #### MacOS 如果你使用的是 macOS,且系统中已经安装了 Homebrew 包管理器,可通过以下命令来安装 Ollama: ```bash brew install ollama ollama serve #安装完成后,使用该命令启动服务 ``` #### Linux 在 Linux 系统上,你可以借助包管理器来安装 Ollama。以 Ubuntu 为例,在终端执行以下命令: ```bash curl https://ollama.com/install.sh | sh #此命令会从官方网站下载并执行安装脚本。 ollama serve #安装完成后,同样启动服务 ``` #### Windows 在 Windows 系统中,你可以从 Ollama 官方网站 下载 Windows 版本的安装程序。下载完成后,运行安装程序,按照安装向导的提示完成安装。安装完成后,在命令提示符或 PowerShell 中启动服务: ```bash ollama serve #安装完成并启动服务后,你可以在浏览器中访问 http://localhost:11434 来验证 Ollama 是否安装成功。 ``` #### 补充说明 如果你是采用的主机应用 Ollama 而不是镜像,需要确保你的 Ollama 可以监听0.0.0.0。 ##### 1. Linxu 系统 如果 Ollama 作为 systemd 服务运行,打开终端,编辑 Ollama 的 systemd 服务文件,使用命令sudo systemctl edit ollama.service,在\[Service]部分添加Environment="OLLAMA\_HOST=0.0.0.0"。保存并退出编辑器,然后执行sudo systemctl daemon - reload和sudo systemctl restart ollama使配置生效。 ##### 2. MacOS 系统 打开终端,使用launchctl setenv ollama\_host "0.0.0.0"命令设置环境变量,然后重启 Ollama 应用程序以使更改生效。 ##### 3. Windows 系统 通过 “开始” 菜单或搜索栏打开 “编辑系统环境变量”,在 “系统属性” 窗口中点击 “环境变量”,在 “系统变量” 部分点击 “新建”,创建一个名为OLLAMA\_HOST的变量,变量值设置为0.0.0.0,点击 “确定” 保存更改,最后从 “开始” 菜单重启 Ollama 应用程序。 ### Ollama 拉取模型镜像 在安装 Ollama 后,本地是没有模型镜像的,需要自己去拉取 Ollama 中的模型镜像。命令如下: ```bash # Docker 部署需要先进容器,命令为: docker exec -it [ Ollama 容器名 ] /bin/sh ollama pull [模型名] ``` ![](../../../public/imgs/Ollama-pull.png) ### 测试通信 在安装完成后,需要进行检测测试,首先进入 FastGPT 所在的容器,尝试访问自己的 Ollama ,命令如下: ```bash docker exec -it [ FastGPT 所在的容器名 ] /bin/sh curl http://XXX.XXX.XXX.XXX:11434 #容器部署地址为“http://[容器名]:[端口]”,主机安装地址为"http://[主机IP]:[端口]",主机IP不可为localhost ``` 看到访问显示自己的 Ollama 服务以及启动,说明可以正常通信。 ## 将 Ollama 接入 FastGPT ### 1. 查看 Ollama 所拥有的模型 首先采用下述命令查看 Ollama 中所拥有的模型, ```bash # Docker 部署 Ollama,需要此命令 docker exec -it [ Ollama 容器名 ] /bin/sh ollama ls ``` ![](../../../public/imgs/Ollama-models1.png) ### 2. AI Proxy 接入 如果你采用的是 FastGPT 中的默认配置文件部署[这里](../deploy/docker.mdx),即默认采用 AI Proxy 进行启动。 ![](../../../public/imgs/Ollama-aiproxy1.png) 以及在确保你的 FastGPT 可以直接访问 Ollama 容器的情况下,无法访问,参考上文[点此跳转](#安装-ollama)的安装过程,检测是不是主机不能监测0.0.0.0,或者容器不在同一个网络。 ![](../../../public/imgs/Ollama-aiproxy2.png) 在 FastGPT 中点击账号->模型提供商->模型配置->新增模型,添加自己的模型即可,添加模型时需要保证模型ID和 OneAPI 中的模型名称一致。详细参考[这里](../config/model/intro.mdx) ![](../../../public/imgs/Ollama-models2.png) ![](../../../public/imgs/Ollama-models3.png) 运行 FastGPT ,在页面中选择账号->模型提供商->模型渠道->新增渠道。之后,在渠道选择中选择 Ollama ,然后加入自己拉取的模型,填入代理地址,如果是容器中安装 Ollama ,代理地址为[http://地址:端口,补充:容器部署地址为“http://\[容器名\]:\[端口\]”,主机安装地址为"http://\[主机IP\]:\[端口\]",主机IP不可为localhost](http://地址:端口,补充:容器部署地址为“http://\[容器名]:\[端口]”,主机安装地址为"http://\[主机IP]:\[端口]",主机IP不可为localhost) ![](../../../public/imgs/Ollama-aiproxy3.png) 在工作台中创建一个应用,选择自己之前添加的模型,此处模型名称为自己当时设置的别名。注:同一个模型无法多次添加,系统会采取最新添加时设置的别名。 ![](../../../public/imgs/Ollama-models4.png) ### 3. OneAPI 接入 如果你想使用 OneAPI ,首先需要拉取 OneAPI 镜像,然后将其在 FastGPT 容器的网络中运行。具体命令如下: ```bash # 拉取 oneAPI 镜像 docker pull intel/oneapi-hpckit # 运行容器并指定自定义网络和容器名 docker run -it --network [ FastGPT 网络 ] --name 容器名 intel/oneapi-hpckit /bin/bash ``` 进入 OneAPI 页面,添加新的渠道,类型选择 Ollama ,在模型中填入自己 Ollama 中的模型,需要保证添加的模型名称和 Ollama 中一致,再在下方填入自己的 Ollama 代理地址,默认[http://地址:端口,不需要填写/v1。添加成功后在](http://地址:端口,不需要填写/v1。添加成功后在) OneAPI 进行渠道测试,测试成功则说明添加成功。此处演示采用的是 Docker 部署 Ollama 的效果,主机 Ollama需要修改代理地址为http\://\[主机IP]:\[端口] ![](../../../public/imgs/Ollama-oneapi1.png) 渠道添加成功后,点击令牌,点击添加令牌,填写名称,修改配置。 ![](../../../public/imgs/Ollama-oneapi2.png) 修改部署 FastGPT 的 docker-compose.yml 文件,在其中将 AI Proxy 的使用注释,在 OPENAI\_BASE\_URL 中加入自己的 OneAPI 开放地址,默认是[http://地址:端口/v1,v1必须填写。KEY](http://地址:端口/v1,v1必须填写。KEY) 中填写自己在 OneAPI 的令牌。 ![](../../../public/imgs/Ollama-oneapi3.png) [直接跳转5](#5-模型添加和使用)添加模型,并使用。 ### 4. 直接接入 如果你既不想使用 AI Proxy,也不想使用 OneAPI,也可以选择直接接入,修改部署 FastGPT 的 docker-compose.yml 文件,在其中将 AI Proxy 的使用注释,采用和 OneAPI 的类似配置。注释掉 AIProxy 相关代码,在OPENAI\_BASE\_URL中加入自己的 Ollama 开放地址,默认是[http://地址:端口/v1,强调:v1必须填写。在KEY中随便填入,因为](http://地址:端口/v1,强调:v1必须填写。在KEY中随便填入,因为) Ollama 默认没有鉴权,如果开启鉴权,请自行填写。其他操作和在 OneAPI 中加入 Ollama 一致,只需在 FastGPT 中加入自己的模型即可使用。此处演示采用的是 Docker 部署 Ollama 的效果,主机 Ollama需要修改代理地址为http\://\[主机IP]:\[端口] ![](../../../public/imgs/Ollama-direct1.png) 完成后[点击这里](#5-模型添加和使用)进行模型添加并使用。 ### 5. 模型添加和使用 在 FastGPT 中点击账号->模型提供商->模型配置->新增模型,添加自己的模型即可,添加模型时需要保证模型ID和 OneAPI 中的模型名称一致。 ![](../../../public/imgs/Ollama-models2.png) ![](../../../public/imgs/Ollama-models3.png) 在工作台中创建一个应用,选择自己之前添加的模型,此处模型名称为自己当时设置的别名。注:同一个模型无法多次添加,系统会采取最新添加时设置的别名。 ![](../../../public/imgs/Ollama-models4.png) ### 6. 补充 上述接入 Ollama 的代理地址中,主机安装 Ollama 的地址为“http\://\[主机IP]:\[端口]”,容器部署 Ollama 地址为“http\://\[容器名]:\[端口]” file: ./content/self-host/custom-models/xinference.en.mdx meta: { "title": "Integrating Local Models with Xinference", "description": "One-stop local LLM private deployment" } [Xinference](https://github.com/xorbitsai/inference) is an open-source model inference platform. Beyond LLMs, it can also deploy Embedding and ReRank models, which are critical for enterprise-grade RAG. Xinference also provides advanced features like Function Calling and supports distributed deployment, meaning it can scale horizontally as your application usage grows. ## Installing Xinference Xinference supports multiple inference engines as backends for different deployment scenarios. Below we introduce these backends by use case. ### 1. Server If you're deploying LLMs on a Linux or Windows server, you can choose Transformers or vLLM as Xinference's inference backend: * [Transformers](https://huggingface.co/docs/transformers/index): By integrating Hugging Face's Transformers library, Xinference can quickly adopt the most cutting-edge NLP models, including LLMs. * [vLLM](https://vllm.ai/): An open-source library developed by UC Berkeley for efficiently serving LLMs. It introduces the PagedAttention algorithm for improved memory management of attention keys and values. Throughput can reach 24x that of Transformers, making vLLM suitable for production environments with high-concurrency access. If your server has an NVIDIA GPU, refer to [this article for CUDA installation instructions](https://xorbits.cn/blogs/langchain-streamlit-doc-chat) to maximize GPU acceleration with Xinference. #### Docker Deployment Use Xinference's official Docker image for one-click installation and startup (make sure Docker is installed): ```bash docker run -p 9997:9997 --gpus all xprobe/xinference:latest xinference-local -H 0.0.0.0 ``` #### Direct Deployment First, prepare a Python 3.9+ environment. We recommend installing conda first, then creating a Python 3.11 environment: ```bash conda create --name py311 python=3.11 conda activate py311 ``` Install Xinference with Transformers and vLLM as inference backends: ```bash pip install "xinference[transformers]" pip install "xinference[vllm]" pip install "xinference[transformers,vllm]" # Install both ``` PyPI automatically installs PyTorch with Transformers and vLLM, but the auto-installed CUDA version may not match your environment. If so, manually install per PyTorch's [installation guide](https://pytorch.org/get-started/locally/). Start the Xinference service: ```bash xinference-local -H 0.0.0.0 ``` Xinference starts locally on port 9997 by default. With the `-H 0.0.0.0` parameter, non-local clients can access the service via the machine's IP address. ### 2. Personal Devices To deploy LLMs on your MacBook or personal computer, we recommend CTransformers as Xinference's inference backend. CTransformers is a C++ implementation of Transformers using GGML. [GGML](https://ggml.ai/) is a C++ library that enables LLMs to [run on consumer hardware](https://github.com/ggerganov/llama.cpp/discussions/205). Its key feature is model quantization -- reducing weight precision to lower resource requirements. For example, representing a high-precision float (like 0.0001) requires more space than a low-precision one (like 0.1). Since LLMs must be loaded into memory for inference, you need sufficient disk space for storage and enough RAM for execution. GGML supports many quantization strategies, each offering different efficiency-performance trade-offs. Install CTransformers as Xinference's backend: ```bash pip install xinference pip install ctransformers ``` Since GGML is a C++ library, Xinference uses `llama-cpp-python` for language bindings. Different hardware platforms require different compilation parameters: * Apple Metal (MPS): `CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python` * Nvidia GPU: `CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python` * AMD GPU: `CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python` After installation, run `xinference-local` to start the Xinference service on your Mac. ## Creating and Deploying Models (Qwen-14B Example) ### 1. Launch via WebUI After starting Xinference, open `http://127.0.0.1:9997` in your browser to access the Xinference Web UI. Go to the "Launch Model" tab, search for qwen-chat, select the launch parameters, then click the rocket button in the lower left of the model card to deploy. The default Model UID is qwen-chat (used to access the model later). ![](../../../public/imgs/xinference-launch-model.png) On first launch, Xinference downloads model parameters from HuggingFace, which takes a few minutes. Model files are cached locally for subsequent launches. Xinference also supports downloading from other sources like [modelscope](https://inference.readthedocs.io/en/latest/models/sources/sources.html). ### 2. Launch via Command Line You can also use Xinference's CLI to launch models. The default Model UID is qwen-chat. ```bash xinference launch -n qwen-chat -s 14 -f pytorch ``` Beyond WebUI and CLI, Xinference also provides Python SDK and RESTful API. For more details, see the [Xinference documentation](https://inference.readthedocs.io/en/latest/getting_started/index.html). ## Integrate Local Models with One API For One API deployment and setup, refer to [here](../config/model/intro.en.mdx). Add a channel for qwen1.5-chat. Set the Base URL to the Xinference service endpoint and register qwen-chat (the model's UID). ![](../../../public/imgs/one-api-add-xinference-models.jpg) Test with this command: ```bash curl --location --request POST 'https://[oneapi_url]/v1/chat/completions' \ --header 'Authorization: Bearer [oneapi_token]' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "qwen-chat", "messages": [{"role": "user", "content": "Hello!"}] }' ``` Replace \[oneapi\_url] with your One API address and \[oneapi\_token] with your One API token. The model field should match the custom model name you entered in One API. ## Integrate Local Models with FastGPT Add the qwen-chat model to the `llmModels` section of FastGPT's `config.json`: ```json ... "llmModels": [ { "model": "qwen-chat", // Model name (matches the channel model name in OneAPI) "name": "Qwen", // Display name "avatar": "/imgs/model/Qwen.svg", // Model logo "maxContext": 125000, // Max context length "maxResponse": 4000, // Max response length "quoteMaxToken": 120000, // Max quote content tokens "maxTemperature": 1.2, // Max temperature "charsPointsPrice": 0, // n points/1k tokens (Commercial Edition) "censor": false, // Enable content moderation (Commercial Edition) "vision": true, // Supports image input "toolChoice": true, // Supports tool choice (used in classification, extraction, tool calling) "functionCall": false, // Supports function calling (used in classification, extraction, tool calling. toolChoice takes priority; if false, falls back to functionCall; if still false, uses prompt mode) "customCQPrompt": "", // Custom classification prompt (for models without tool/function calling support) "customExtractPrompt": "", // Custom content extraction prompt "defaultSystemChatPrompt": "", // Default system prompt for conversations "defaultConfig": {} // Default config sent with API requests (e.g., GLM4's top_p) } ], ... ``` Restart FastGPT to select the Qwen model in app configuration: ## ![](../../../public/imgs/fastgpt-list-models.png) * Reference: [FastGPT + Xinference: One-Stop Local LLM Private Deployment and Application Development](https://xorbits.cn/blogs/fastgpt-weather-chat) file: ./content/self-host/custom-models/xinference.mdx meta: { "title": "使用 Xinference 接入本地模型", "description": "一站式本地 LLM 私有化部署" } [Xinference](https://github.com/xorbitsai/inference) 是一款开源模型推理平台,除了支持 LLM,它还可以部署 Embedding 和 ReRank 模型,这在企业级 RAG 构建中非常关键。同时,Xinference 还提供 Function Calling 等高级功能。还支持分布式部署,也就是说,随着未来应用调用量的增长,它可以进行水平扩展。 ## 安装 Xinference Xinference 支持多种推理引擎作为后端,以满足不同场景下部署大模型的需要,下面会分使用场景来介绍一下这三种推理后端,以及他们的使用方法。 ### 1. 服务器 如果你的目标是在一台 Linux 或者 Window 服务器上部署大模型,可以选择 Transformers 或 vLLM 作为 Xinference 的推理后端: * [Transformers](https://huggingface.co/docs/transformers/index):通过集成 Huggingface 的 Transformers 库作为后端,Xinference 可以最快地 集成当今自然语言处理(NLP)领域的最前沿模型(自然也包括 LLM)。 * [vLLM](https://vllm.ai/): vLLM 是由加州大学伯克利分校开发的一个开源库,专为高效服务大型语言模型(LLM)而设计。它引入了 PagedAttention 算法, 通过有效管理注意力键和值来改善内存管理,吞吐量能够达到 Transformers 的 24 倍,因此 vLLM 适合在生产环境中使用,应对高并发的用户访问。 假设你服务器配备 NVIDIA 显卡,可以参考[这篇文章中的指令来安装 CUDA](https://xorbits.cn/blogs/langchain-streamlit-doc-chat),从而让 Xinference 最大限度地利用显卡的加速功能。 #### Docker 部署 你可以使用 Xinference 官方的 Docker 镜像来一键安装和启动 Xinference 服务(确保你的机器上已经安装了 Docker),命令如下: ```bash docker run -p 9997:9997 --gpus all xprobe/xinference:latest xinference-local -H 0.0.0.0 ``` #### 直接部署 首先我们需要准备一个 3.9 以上的 Python 环境运行来 Xinference,建议先根据 conda 官网文档安装 conda。 然后使用以下命令来创建 3.11 的 Python 环境: ```bash conda create --name py311 python=3.11 conda activate py311 ``` 以下两条命令在安装 Xinference 时,将安装 Transformers 和 vLLM 作为 Xinference 的推理引擎后端: ```bash pip install "xinference[transformers]" pip install "xinference[vllm]" pip install "xinference[transformers,vllm]" # 同时安装 ``` PyPi 在 安装 Transformers 和 vLLM 时会自动安装 PyTorch,但自动安装的 CUDA 版本可能与你的环境不匹配,此时你可以根据 PyTorch 官网中的[安装指南](https://pytorch.org/get-started/locally/)来手动安装。 只需要输入如下命令,就可以在服务上启动 Xinference 服务: ```bash xinference-local -H 0.0.0.0 ``` Xinference 默认会在本地启动服务,端口默认为 9997。因为这里配置了-H 0.0.0.0参数,非本地客户端也可以通过机器的 IP 地址来访问 Xinference 服务。 ### 2. 个人设备 如果你想在自己的 Macbook 或者个人电脑上部署大模型,推荐安装 CTransformers 作为 Xinference 的推理后端。CTransformers 是用 GGML 实现的 C++ 版本 Transformers。 [GGML](https://ggml.ai/) 是一个能让大语言模型在[消费级硬件上运行](https://github.com/ggerganov/llama.cpp/discussions/205)的 C++ 库。 GGML 最大的特色在于模型量化。量化一个大语言模型其实就是降低权重表示精度的过程,从而减少使用模型所需的资源。 例如,表示一个高精度浮点数(例如 0.0001)比表示一个低精度浮点数(例如 0.1)需要更多空间。由于 LLM 在推理时需要加载到内存中的,因此你需要花费硬盘空间来存储它们,并且在执行期间有足够大的 RAM 来加载它们,GGML 支持许多不同的量化策略,每种策略在效率和性能之间提供不同的权衡。 通过以下命令来安装 CTransformers 作为 Xinference 的推理后端: ```bash pip install xinference pip install ctransformers ``` 因为 GGML 是一个 C++ 库,Xinference 通过 `llama-cpp-python` 这个库来实现语言绑定。对于不同的硬件平台,我们需要使用不同的编译参数来安装: * Apple Metal(MPS):`CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python` * Nvidia GPU:`CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python` * AMD GPU:`CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python` 安装后只需要输入 `xinference-local`,就可以在你的 Mac 上启动 Xinference 服务。 ## 创建并部署模型(以 Qwen-14B 模型为例) ### 1. WebUI 方式启动模型 Xinference 启动之后,在浏览器中输入: `http://127.0.0.1:9997`,我们可以访问到本地 Xinference 的 Web UI。 打开“Launch Model”标签,搜索到 qwen-chat,选择模型启动的相关参数,然后点击模型卡片左下方的小火箭🚀按钮,就可以部署该模型到 Xinference。 默认 Model UID 是 qwen-chat(后续通过将通过这个 ID 来访问模型)。 ![](../../../public/imgs/xinference-launch-model.png) 当你第一次启动 Qwen 模型时,Xinference 会从 HuggingFace 下载模型参数,大概需要几分钟的时间。Xinference 将模型文件缓存在本地,这样之后启动时就不需要重新下载了。 Xinference 还支持从其他模型站点下载模型文件,例如 [modelscope](https://inference.readthedocs.io/en/latest/models/sources/sources.html)。 ### 2. 命令行方式启动模型 我们也可以使用 Xinference 的命令行工具来启动模型,默认 Model UID 是 qwen-chat(后续通过将通过这个 ID 来访问模型)。 ```bash xinference launch -n qwen-chat -s 14 -f pytorch ``` 除了 WebUI 和命令行工具, Xinference 还提供了 Python SDK 和 RESTful API 等多种交互方式, 更多用法可以参考 [Xinference 官方文档](https://inference.readthedocs.io/en/latest/getting_started/index.html)。 ## 将本地模型接入 One API One API 的部署和接入请参考[这里](../config/model/intro.mdx)。 为 qwen1.5-chat 添加一个渠道,这里的 Base URL 需要填 Xinference 服务的端点,并且注册 qwen-chat (模型的 UID) 。 ![](../../../public/imgs/one-api-add-xinference-models.jpg) 可以使用以下命令进行测试: ```bash curl --location --request POST 'https://[oneapi_url]/v1/chat/completions' \ --header 'Authorization: Bearer [oneapi_token]' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "qwen-chat", "messages": [{"role": "user", "content": "Hello!"}] }' ``` 将 \[oneapi\_url] 替换为你的 One API 地址,\[oneapi\_token] 替换为你的 One API 令牌。model 为刚刚在 One API 填写的自定义模型。 ## 将本地模型接入 FastGPT 修改 FastGPT 的 `config.json` 配置文件的 llmModels 部分加入 qwen-chat 模型: ```json ... "llmModels": [ { "model": "qwen-chat", // 模型名(对应OneAPI中渠道的模型名) "name": "Qwen", // 模型别名 "avatar": "/imgs/model/Qwen.svg", // 模型的logo "maxContext": 125000, // 最大上下文 "maxResponse": 4000, // 最大回复 "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) } ], ... ``` 然后重启 FastGPT 就可以在应用配置中选择 Qwen 模型进行对话: ## ![](../../../public/imgs/fastgpt-list-models.png) * 参考:[FastGPT + Xinference:一站式本地 LLM 私有化部署和应用开发](https://xorbits.cn/blogs/fastgpt-weather-chat) file: ./content/self-host/design/dataset.en.mdx meta: { "title": "Dataset Design", "description": "FastGPT dataset file and data design" } ## Relationship Between Files and Data In FastGPT, files are stored using MongoDB's GridFS, while the actual data is stored in PostgreSQL. Each row in PG has a `file_id` column that references the corresponding file. For backward compatibility and to support manual input and annotated data, `file_id` has some special values: * manual: Manually entered data * mark: Manually annotated data Note: `file_id` is only written at data insertion time and cannot be modified afterward. ## File Import Process 1. Upload the file to MongoDB GridFS and obtain a `file_id`. The file is marked as `unused` at this point. 2. The browser parses the file to extract text and chunks. 3. Each chunk is tagged with the `file_id`. 4. Click upload: the file status changes to `used`, and the data is pushed to the mongo `training` collection to await processing. 5. The training thread pulls data from mongo, generates vectors, and inserts them into PG. file: ./content/self-host/design/dataset.mdx meta: { "title": "数据集", "description": "FastGPT 数据集中文件与数据的设计方案" } ## 文件与数据的关系 在 FastGPT 中,文件会通过 MongoDB 的 FS 存储,而具体的数据会通过 PostgreSQL 存储,PG 中的数据会有一列 file\_id,关联对应的文件。考虑到旧版本的兼容,以及手动输入、标注数据等,我们给 file\_id 增加了一些特殊的值,如下: * manual: 手动输入 * mark: 手动标注的数据 注意,file\_id 仅在插入数据时会写入,变更时无法修改。 ## 文件导入流程 1. 上传文件到 MongoDB 的 FS 中,获取 file\_id,此时文件标记为 `unused` 状态 2. 浏览器解析文件,获取对应的文本和 chunk 3. 给每个 chunk 打上 file\_id 4. 点击上传数据:将文件的状态改为 `used`,并将数据推送到 mongo `training` 表中等待训练 5. 由训练线程从 mongo 中取数据,并在获取向量后插入到 pg。 file: ./content/self-host/migration/docker_db.en.mdx meta: { "title": "Docker Database Migration (Simple Method)", "description": "FastGPT Docker database backup and migration" } ## 1. Stop Services ```bash docker-compose down ``` ## 2. Copy Directories Docker-deployed databases mount local directories into containers via volumes. To migrate, simply copy these directories. `PG data`: pg/data `Mongo data`: mongo/data Just copy the entire pg and mongo directories to the new location. file: ./content/self-host/migration/docker_db.mdx meta: { "title": "Docker 数据库迁移(无脑操作)", "description": "FastGPT Docker 数据库备份和迁移" } ## 1. 停止服务 ```bash docker-compose down ``` ## 2. Copy文件夹 Docker 部署数据库都会通过 volume 挂载本地的目录进入容器,如果要迁移,直接复制这些目录即可。 `PG 数据`: pg/data `Mongo 数据`: mongo/data 直接把pg 和 mongo目录全部复制走即可。 file: ./content/self-host/migration/docker_mongo.en.mdx meta: { "title": "Docker MongoDB Migration (Dump Mode)", "description": "FastGPT Docker MongoDB migration" } ## Author [https://github.com/samqin123](https://github.com/samqin123) [Related PR -- open this to discuss with the author](https://github.com/labring/FastGPT/pull/1426) ## Overview How to use mongodump to migrate FastGPT's MongoDB from Environment A to Environment B. Prerequisites: * Environment A: Your existing FastGPT deployment (e.g., on Alibaba Cloud) that needs to be migrated. * Environment B: The new FastGPT deployment (e.g., on Tencent Cloud, or a NAS like Synology/QNAP). Note: NAS deployments may require MongoDB 4.2 or 4.4, while cloud deployments support the default FastGPT MongoDB version. * Environment C: Your local machine, used as a staging area to hold files and coordinate the transfer. ## 1. Prepare: Access Docker MongoDB \[Environment A] ``` docker exec -it mongo sh mongo -u 'username' -p 'password' >> show dbs ``` Confirm you can see the fastgpt database and note the database name for export. ##### Preparation: Create a temporary directory for import/export on both the container and the host, e.g., data/backup \[Environment A + Environment C]. #### Create the directory in \[Environment A] for the dump operation Enter the FastGPT Docker container: ``` docker exec -it fastgpt sh mkdir -p /data/backup ``` Once created, exported MongoDB data will appear in the `data/backup` directory under your local FastGPT installation folder (auto-synced via volume mount). If it doesn't sync automatically, you can manually create the directory and use `docker cp` to copy files out (this rarely happens). #### Then set up the \[Environment C] host directory for syncing uploaded files into the container. Navigate to the FastGPT directory, go into the mongo folder, and create a backup subdirectory: ``` mkdir -p /fastgpt/data/backup ``` Also create a directory in the new \[Environment B]: ``` mkdir -p /fastgpt/mongobackup ``` \###2. Export Data from \[Environment A] Enter Environment A and use mongodump to export the MongoDB database. #### 2.1 Export Run mongodump to export data files to the temporary directory (data/backup). \[The export path is set to /data/backup in the command. Since the FastGPT config already has data persistence set up, the exported files will sync to the host's fastgpt/mongo/data/backup directory.] Single command to export (run on the host, no need to enter the container): ``` docker exec -it mongo bash -c "mongodump --db fastgpt -u 'username' -p 'password' --authenticationDatabase admin --out /data/backup" ``` You can also enter the container and combine directory creation with the export: ``` 1.docker exec -it fastgpt sh 2.mkdir -p /data/backup 3. mongodump --host 127.0.0.1:27017 --db fastgpt -u "username" -p "password" --authenticationDatabase admin --out /data/backup ``` ##### Fallback: if files don't auto-sync, manually copy them to the host \[Environment A]: ``` docker cp mongo:/data/backup [local-fastgpt-dir]:/fastgpt/data/backup> ``` 2.2 For beginners, it's recommended to compress the directory and download it to your local staging environment \[A -> C] for verification. This ensures you have a backup and can check file counts. Experienced users can transfer directly to the new server \[A -> B]. 2.2.1 Navigate to the \[Environment A] source system's local fastgpt/mongo/data directory: ``` cd /usr/fastgpt/mongo/data ``` Compress the files: ``` tar -czvf ../fastgpt-mongo-backup-$(date +%Y-%m-%d).tar.gz ./ ``` Download the archive to your local machine \[A -> C] for verification. Experienced users can sync directly to Environment B's fastgpt data directory. ``` scp -i /Users/path/[your-pem-file] root@[cloud-server-ip]:/usr/fastgpt/mongo/fastgptbackup-2024-05-03.tar.gz /[local-path]/Downloads/fastgpt ``` Experienced users can transfer directly to the new environment: ``` scp -i /Users/path/[your-pem-file] root@[old-server-ip]:/usr/fastgpt/mongo/fastgptbackup-2024-05-03.tar.gz root@[new-server-ip]:/Downloads/fastgpt2 ``` 2.2 \[Environment C] Verify the archive is complete. If not, re-export. Cross-environment scp transfers can occasionally lose data. After downloading the archive to Environment C, extract it to a custom directory, e.g., user/fastgpt/mongobackup/data: ``` tar -xvzf fastgptbackup-2024-05-03.tar.gz -C user/fastgpt/mongobackup/data ``` The extracted files should be .bson files. Verify the file count matches the source. If they don't match, the new FastGPT environment will have no data after import. image If everything looks good, upload the archive to Environment B's designated directory (e.g., /fastgpt/mongobackup). Do not place it in fastgpt/data/ -- that directory will be cleared later, and having extra files there will cause import errors. ``` scp -rfv [local-path]/Downloads/fastgpt/fastgptbackup-2024-05-03.tar.gz root@[new-server-ip]:/Downloads/fastgpt/backup ``` ## 3. Import and Restore ### 3.1. Extract the archive on the new FastGPT environment ``` tar -xvzf fastgptbackup-2024-05-03.tar.gz -C user/fastgpt/mongobackup/data ``` Verify the file count again against your earlier check. Experienced users can use tar to verify archive integrity. The above steps are for beginners to facilitate comparison. ### 3.2 Manually copy files into the new FastGPT Docker container \[Environment C] Since the files aren't in the data/ directory, they won't auto-sync into the container. Also ensure the container's data directory is clean, or the import will fail. ``` docker cp user/fastgpt/mongobackup/data mongo:/tmp/backup ``` ### 3.3 Initialize docker compose -- run it once to create the new mongo/data persistence directory If the mongo/db directory isn't freshly initialized, mongorestore may fail. If you encounter errors, try initializing mongo. Commands: ``` cd /fastgpt-install-dir/mongo/data rm -rf * ``` 4. Restore with mongorestore \[Environment C] Run this from the host to import in one command (you can also run it inside the container): ``` docker exec -it mongo mongorestore -u "username" -p "password" --authenticationDatabase admin /tmp/backup/ --db fastgpt ``` image Note: if the imported file count seems too low, the import likely failed. A failed import means you can log in to FastGPT but see no data. 5. Restart containers \[Environment C] ``` docker compose restart docker logs -f mongo # Strongly recommended: check mongo logs before logging in. If mongo has errors, the web UI will also show errors. ``` If mongo starts normally, you should see output like this (not "mongo is restarting" -- that indicates an error): iShot_2024-05-09_19 21 26 Error state: iShot_2024-05-09_19 23 13 6. After starting the FastGPT container, log in to the web UI. If all your original data is displayed, the migration was successful. iShot_2024-05-09_19 23 51 file: ./content/self-host/migration/docker_mongo.mdx meta: { "title": "Docker Mongo迁移(dump模式)", "description": "FastGPT Docker Mongo迁移" } ## 作者 [https://github.com/samqin123](https://github.com/samqin123) [相关PR。有问题可打开这里与作者交流](https://github.com/labring/FastGPT/pull/1426) ## 介绍 如何使用Mongodump来完成从A环境到B环境的Fastgpt的mongodb迁移 前提说明: A环境:我在阿里云上部署的fastgpt,现在需要迁移到B环境。 B环境:是新环境比如腾讯云新部署的fastgpt,更特殊一点的是,NAS(群晖或者QNAP)部署了fastgpt,mongo必须改成4.2或者4.4版本(其实云端更方便,支持fastgpt mongo默认版本) C环境:妥善考虑,用本地电脑作为C环境过渡,保存相关文件并分离操作 ‍ ## 1. 环境准备:进入 docker mongo 【A环境】 ``` docker exec -it mongo sh mongo -u 'username' -p 'password' >> show dbs ``` 看到fastgpt数据库,以及其它几个,确定下导出数据库名称 准备: 检查数据库,容器和宿主机都创建一下 backup 目录 【A环境 + C环境】 ##### 准备: 检查数据库,容器和宿主机都创建一下"数据导出导入"临时目录 ,比如data/backup 【A环境建目录 + C环境建目录用于同步到容器中】 #### 先在【A环境】创建文件目录,用于dump导出操作 容器:(先进入fastgpt docker容器) ``` docker exec -it fastgpt sh mkdir -p /data/backup ``` 建好后,未来导出mongo的数据,会在A环境本地fastgpt的安装目录/Data/下看到自动同步好的目录,数据会在data\backup中,然后可以衔接后续的压缩和下载转移动作。如果没有同步到本地,也可以手动建一下,配合docker cp 把文件拷到本地用(基本不会发生) #### 然后,【C环境】宿主机目录类似操作,用于把上传的文件自动同步到C环境部署的fastgpt容器里。 到fastgpt目录,进入mongo目录,有data目录,下面建backup ``` mkdir -p /fastgpt/data/backup ``` 准备好后,后续上传 ``` ### 新fastgpt环境【B】中也需要建一个,比如/fastgpt/mongobackup目录,注意不要在fastgpt/data目录下建立目录 ``` mkdir -p /fastgpt/mongobackup ``` ###2. 正题开始,从fastgpt老环境【A】中导出数据 进入A环境,使用mongodump 导出mongo数据库。 #### 2.1 导出 可以使用mongodump在源头容器中导出数据文件, 导出路径为上面指定临时目录,即"data\backup" [导出的文件在代码中指定为/data/backup,因为fastgpt配置文件已经建立了data的持久化,所以会同步到容器所在环境本地fast/mongo/data应该就能看到这个导出的目录:backup,里面有文件] 一行指令导出代码,在服务器本地环境运行,不需要进入容器。 ``` docker exec -it mongo bash -c "mongodump --db fastgpt -u 'username' -p 'password' --authenticationDatabase admin --out /data/backup" ``` 也可以进入环境,熟手可以结合建目录,一次性完成建导出目录,以及使用mongodump导出数据到该目录 ``` 1.docker exec -it fastgpt sh 2.mkdir -p /data/backup 3. mongodump --host 127.0.0.1:27017 --db fastgpt -u "username" -p "password" --authenticationDatabase admin --out /data/backup ‍ ##### 补充:万一没自动同步,也可以将mongodump导出的文件,手工导出到宿主机【A环境】,备用指令如下: ```` docker cp mongo:/data/backup [A环境本地fastgpt目录]:/fastgpt/data/backup> ‍``` 2.2 对新手,建议稳妥起见,压缩这个文件目录,并将压缩文件下载到本地过渡环境【A环境 -> C环境】;原因是因为留存一份,并且检查文件数量是否一致。 熟手可以直接复制到新部署服务器(腾讯云或者NAS)【A环境-> B环境】 2.2.1 先进入 【A环境】源头系统的本地环境 fastgpt/mongo/data 目录 ```` cd /usr/fastgpt/mongo/data ``` #执行,压缩文件命令 ``` tar -czvf ../fastgpt-mongo-backup-$(date +%Y-%m-%d).tar.gz ./ 【A环境】 ``` #接下来,把压缩包下载到本地 【A环境-> C环境】,以便于检查和留存版本。熟手,直接将该压缩包同步到B环境中新fastgpt目录data目录下备用。 ``` scp -i /Users/path/\[user.pem换成你自己的pem文件链接] root@\[fastgpt所在云服务器地址]:/usr/fastgpt/mongo/fastgptbackup-2024-05-03.tar.gz /\[本地电脑路径]/Downloads/fastgpt ``` 熟手直接换成新环境地址 ​ ``` scp -i /Users/path/\[user.pem换成你自己的pem文件链接] root@\[老环境fastgpt服务器地址]:/usr/fastgpt/mongo/fastgptbackup-2024-05-03.tar.gz root@\[新环境fastgpt服务器地址]:/Downloads/fastgpt2 ``` 2.2 【C环境】检查压缩文件是否完整,如果不完整,重新导出。事实上,我也出现过问题,因为跨环境scp会出现丢数据的情况。 压缩数据包导入到C环境本地后,可以考虑在宿主机目录解压缩,放在一个自定义目录比如. [ user/fastgpt/mongobackup/data] ``` tar -xvzf fastgptbackup-2024-05-03.tar.gz -C user/fastgpt/mongobackup/data ``` 解压缩后里面是bson文件,这里可以检查下,压缩文件数量是否一致。如果不一致,后续启动新环境的fastgpt容器,也不会有任何数据。 image 如果没问题,准备进入下一步,将压缩包文件上传到B环境,也就是新fastgpt环境里的指定目录,比如/fastgpt/mongobackup, 注意不要放到fastgpt/data目录下,因为下面会先清空一次这个目录,否则导入会报错。 ``` scp -rfv \[本地电脑路径]/Downloads/fastgpt/fastgptbackup-2024-05-03.tar.gz root@\[新环境fastgpt服务器地址]:/Downloads/fastgpt/backup ``` ## 3 导入恢复: 实际恢复和导入步骤 ### 3.1. 进入新fastgpt本地环境的安装目录后,找到迁移的压缩文件包fastgptbackup-2024-05-03.tar.gz,解压缩到指定目录 ``` tar -xvzf fastgptbackup-2024-05-03.tar.gz -C user/fastgpt/mongobackup/data ``` 再次核对文件数量,和上面对比一下。 熟手可以用tar指令检查文件完整性,上面是给新手准备的,便于比对核查。 ### 3.2 手动上传新fastgpt docker容器里备用 【C环境】 说明:因为没有放在data里,所以不会自动同步到容器里。而且要确保容器的data目录被清理干净,否则导入时会报错。 ``` docker cp user/fastgpt/mongobackup/data mongo:/tmp/backup ‍\`\`\` ### 3.3 建议初始化一次docker compose ,运行后建立新的 mongo/data 持久化目录 如果不是初始化的 mongo/db 目录, mongorestore 导入可能会报错。如果报错,建议尝试初始化mongo。 操作指令 ``` cd /fastgpt安装目录/mongo/data rm -rf * ``` ‍ 4.恢复: mongorestore 恢复 【C环境】 简单一点,退回到本地环境,用 docker 命令一键导入,当然你也可以在容器里操作 ``` docker exec -it mongo mongorestore -u "username" -p "password" --authenticationDatabase admin /tmp/backup/ --db fastgpt ``` image 注意:导入文件数量量级太少,大概率是没导入成功的表现。如果导入不成功,新环境fastgpt可以登入,但是一片空白。 5.重启容器 【C环境】 ``` docker compose restart docker logs -f mongo **强烈建议先检查mongo运行情况,在去做登录动作,如果mongo报错,访问web也会报错" ``` 如果mongo启动正常,显示的是类似这样的,而不是 "mongo is restarting",后者就是错误 iShot_2024-05-09_19 21 26 报错情况 iShot_2024-05-09_19 23 13 6. 启动fastgpt容器服务后,登录新fastgpt web,能看到原来的数据库内容完整显示,说明已经导入系统了。 iShot_2024-05-09_19 23 51 file: ./content/self-host/deploy/docker.en.mdx meta: { "title": "Deploy with Docker Compose", "description": "Quickly deploy FastGPT using Docker Compose" } import { Alert } from '@/components/docs/Alert'; import { CurrentOriginCodeBlockUpdater } from '@/components/docs/CurrentOriginCodeBlockUpdater'; ## Prerequisites 1. Basic networking knowledge: ports, firewalls, etc. 2. Docker and Docker Compose basics ## Deployment Architecture ![](../../../public/imgs/sealos-fastgpt.webp) * MongoDB: Stores all data except vectors * PostgreSQL/Milvus/Oceanbase/SeekDB: Stores vector data * AIProxy: Aggregates various AI APIs with multi-model support (for any model issues, test with OneAPI first) ## Recommended Specs ### PgVector Version Very lightweight, suitable for knowledge base indexes under 50 million. | Environment | Minimum (Single Node) | Recommended | | ---------------------------------- | --------------------- | ------------ | | Testing (reduce compute processes) | 2c4g | 2c8g | | 1M vector groups | 4c8g 50GB | 4c16g 50GB | | 5M vector groups | 8c32g 200GB | 16c64g 200GB | ### Milvus Version Better performance for 100M+ vectors. [View Milvus official recommended specs](https://milvus.io/docs/prerequisite-docker.md) | Environment | Minimum (Single Node) | Recommended | | ---------------- | --------------------- | ----------- | | Testing | 2c8g | 4c16g | | 1M vector groups | Not tested | | | 5M vector groups | | | ### Zilliz Cloud Version Zilliz Cloud is built by the Milvus team — a fully managed SaaS vector database with better performance than Milvus and SLA guarantees. [Try Zilliz Cloud](https://zilliz.com.cn/). Since the vector database runs in the cloud, no local resources are needed. ### SeekDB Version SeekDB is a high-performance vector database based on MySQL protocol, fully compatible with OceanBase, supporting efficient vector retrieval. | Environment | Minimum (Single Node) | Recommended | | ---------------------------------- | --------------------- | ------------ | | Testing (reduce compute processes) | 2c4g | 2c8g | | 1M vector groups | 4c8g 50GB | 4c16g 50GB | | 5M vector groups | 8c32g 200GB | 16c64g 200GB | SeekDB uses MySQL protocol, fully compatible with OceanBase: * Supports 1536-dimensional vector retrieval * Built-in HNSW index algorithm * Batch insert and query optimization * Automatic retry and connection pool management ## Preparation ### Prepare Docker Environment ```bash # Install Docker curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun systemctl enable --now docker # Install docker-compose curl -L https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose # Verify installation docker -v docker compose -v # If it fails, search online for solutions ``` We recommend [Orbstack](https://orbstack.dev/). Install via Homebrew: ```bash brew install orbstack ``` Or [download the installer](https://orbstack.dev/download) directly. We recommend storing source code and data in the Linux filesystem when binding to Linux containers, not the Windows filesystem. You can [install Docker Desktop with WSL 2 backend on Windows](https://docs.docker.com/desktop/wsl/). Or [install the command-line version of Docker directly in WSL 2](https://nickjanetakis.com/blog/install-docker-in-wsl-2-without-docker-desktop). ## Start Deployment ### 1. Get Configuration Files #### Method 1: Deploy with an AI Agent Copy the following content to your Coding Agent: ```text Refer to https://doc.fastgpt.cn/deploy/SKILL.md and deploy FastGPT with Docker for me. ``` #### Method 2: Interactive Script Deployment Run in Linux/MacOS/Windows WSL. The script guides you through selecting deployment environment, vector database version, IP address, etc. ```bash FASTGPT_DEPLOY_BASE_URL=https://doc.fastgpt.cn bash <(curl -fsSL https://doc.fastgpt.cn/deploy/install.sh) ``` If the documentation site uses a custom domain, an internal domain, or a local address, set `FASTGPT_DEPLOY_BASE_URL` to choose the download source. You can provide either the site root or a URL ending in `/deploy`; the script downloads YAML and `config.json` from that source: ```bash FASTGPT_DEPLOY_BASE_URL=https://doc.fastgpt.cn bash <(curl -fsSL https://doc.fastgpt.cn/deploy/install.sh) ``` Non-interactive mode also requires `FASTGPT_FE_DOMAIN`, the full URL users use to access FastGPT, such as `https://fastgpt.example.com`, and `FASTGPT_SANDBOX_PROXY_URL`, the Sandbox WebSocket URL, such as `wss://sandbox-proxy.example.com`. Version 4.16 also requires `FASTGPT_SANDBOX_PREVIEW_PROXY_URL` for the HTTP preview URL. In interactive mode, the script prompts for the addresses required by each version; 4.15 prompts only for the WebSocket URL. The script automatically: * Downloads `docker-compose.yml`. * Guides you through selecting externally accessible S3 and MCP addresses, then writes them into the config files. * Generates a random `root` login password, service tokens, app keys, and component passwords, then writes them into `docker-compose.yml`. * Detects the host Docker socket path and updates the mount path in `docker-compose.yml` when needed. After the script finishes, the terminal prints the generated `root` login password. Keep the generated `docker-compose.yml` safe. For future upgrades, start from this file so you do not lose the generated passwords and keys. To use an existing local `docker-compose.yml` file, for example when testing a version that has not been published to the docs site yet, choose `本地 docker-compose.yml` (local docker-compose.yml) in the deployment version step and enter the local file path. You can also pass the path with an environment variable: ```bash FASTGPT_LOCAL_COMPOSE_PATH=/path/to/docker-compose.yml bash <(curl -fsSL https://doc.fastgpt.cn/deploy/install.sh) ``` #### Method 3: Manual Download If you need to pin deployment to a specific `docker-compose.yml` file, we recommend downloading both `docker-compose.yml` and `install.sh`, then using the script's local compose mode to generate the final config. This keeps the script's random credential generation, S3/MCP address updates, and Docker socket detection. 1. Download the required `docker-compose.yml` file to the server, for example: ```bash curl -fsSL https://doc.fastgpt.cn/deploy/docker/v4.15/cn/docker-compose.pg.yml -o docker-compose.source.yml ```
Click to view docker-compose config file download links for different databases * **Pgvector** * China mirror (Alibaba Cloud): [docker-compose.pg.yml](/deploy/docker/v4.15/cn/docker-compose.pg.yml) * Global mirror (dockerhub, ghcr): [docker-compose.pg.yml](/deploy/docker/v4.15/global/docker-compose.pg.yml) * **Oceanbase** * China mirror (Alibaba Cloud): [docker-compose.oceanbase.yml](/deploy/docker/v4.15/cn/docker-compose.oceanbase.yml) * Global mirror (dockerhub, ghcr): [docker-compose.oceanbase.yml](/deploy/docker/v4.15/global/docker-compose.oceanbase.yml) * **Milvus** * China mirror (Alibaba Cloud): [docker-compose.milvus.yml](/deploy/docker/v4.15/cn/docker-compose.milvus.yml) * Global mirror (dockerhub, ghcr): [docker-compose.milvus.yml](/deploy/docker/v4.15/global/docker-compose.milvus.yml) * **Zilliz** * China mirror (Alibaba Cloud): [docker-compose.zilliz.yml](/deploy/docker/v4.15/cn/docker-compose.zilliz.yml) * Global mirror (dockerhub, ghcr): [docker-compose.zilliz.yml](/deploy/docker/v4.15/global/docker-compose.zilliz.yml) * **SeekDB** * China mirror (Alibaba Cloud): [docker-compose.seekdb.yml](/deploy/docker/v4.15/cn/docker-compose.seekdb.yml) * Global mirror (dockerhub, ghcr): [docker-compose.seekdb.yml](/deploy/docker/v4.15/global/docker-compose.seekdb.yml)
2. Download `install.sh` to the server: ```bash curl -fsSL https://doc.fastgpt.cn/deploy/install.sh -o install.sh ``` 3. Run `install.sh` with the local compose file to generate the final deployment config: ```bash FASTGPT_LOCAL_COMPOSE_PATH=./docker-compose.source.yml bash install.sh ``` The script copies this compose file to the final `docker-compose.yml`, then generates login passwords and credentials, and writes the S3/MCP addresses. After generation, log in with the root password printed in the terminal. For a fully offline environment, prepare `docker-compose.yml` and `install.sh` in advance. If the script cannot run, manually update `DEFAULT_ROOT_PSW`, service tokens, database passwords, and S3/MCP addresses. #### Deploy with a Custom Image Registry If you use an internal Harbor, private registry, or image mirror, download `docker-compose.yml` first, replace all `image:` values with your own registry addresses, and then use local compose mode: ```bash FASTGPT_LOCAL_COMPOSE_PATH=./docker-compose.yml bash install.sh ``` If Agent/Skill Sandbox is enabled, also replace the sandbox-related images in the Compose file and update `AGENT_SANDBOX_SEALOS_IMAGE` or `AGENT_SANDBOX_OPENSANDBOX_IMAGE` so the sandbox provider can pull the matching images. See [OpenSandbox Configuration](../config/sandbox/opensandbox) for details. ### 2. Modify Environment Variables You must set `FE_DOMAIN` in `fastgpt-app` to the full URL users use to access FastGPT, such as `https://fastgpt.example.com`. It must include a scheme, host, and optional port; do not leave it empty or use an internal container address. When Agent/Skill Sandbox is enabled, also configure: * `AGENT_SANDBOX_PROXY_URL`: the browser-accessible Sandbox Proxy WebSocket URL using `ws://` or `wss://`, such as `wss://sandbox-proxy.example.com`, pointing to port 3006. * Version 4.16 additionally requires `AGENT_SANDBOX_PREVIEW_PROXY_URL`: the browser-accessible HTTP(S) URL for sandbox file previews, such as `https://sandbox-proxy.example.com`, also pointing to port 3006. The interactive install script prompts for these addresses before the final confirmation. For `Zilliz version`, you also need credentials — see [Deploy Zilliz Version: Get Account and Credentials](#deploy-zilliz-version-get-account-and-credentials). Other versions can skip to the next step. ### 3. Open External Ports / Configure Domain These ports must be accessible: 1. Port 3000 (FastGPT main service) 2. Port 9000 (S3 service) 3. Port 3003 (FastGPT SSE MCP server service) 4. Port 3006 (FastGPT Agent Sandbox Proxy service) ### 4. Start Containers Run in the same directory as docker-compose.yml. Ensure `docker-compose` version is 2.17+, or automated commands may fail. ```bash # Pre-pull all service and sandbox runtime images docker compose --profile prepull pull # Start containers docker compose up -d ``` ### 5. Access FastGPT Access FastGPT via the port/domain opened in step 3. Login username is `root`, password is the `DEFAULT_ROOT_PSW` set in `docker-compose.yml` environment variables. If you deploy with the interactive script, it randomly generates `DEFAULT_ROOT_PSW` and prints the login password when it finishes. If you deploy manually, change the default password in `docker-compose.yml` before starting the service. Each container restart automatically updates the root user's password based on `DEFAULT_ROOT_PSW`. ### 6. Configure Models * After first login, the system prompts that `Language Model` and `Index Model` are not configured and automatically redirects to the model configuration page. At least these two model types are required. * If the redirect doesn't happen, go to `Account - Model Providers` to configure models. [View tutorial](../config/model/intro.en.mdx) * Known issue: after first entering the system, the browser tab may become unresponsive. Close the tab and reopen it. ### 7. Install System Plugins as Needed Starting from V4.14.0, the fastgpt-plugin image only provides the runtime environment without pre-installed system plugins. All FastGPT systems must manually install system plugins. * Install via the plugin marketplace — by default it fetches from the public FastGPT Marketplace. * If your FastGPT can't access the marketplace, visit [FastGPT Plugin Marketplace](https://marketplace.fastgpt.cn/), download .pkg files, and import them via file upload. * You can also sort tools, set default installations, and manage tags. ![alt text](../../../public/imgs/image-121.png) ## FAQ ### FastGPT and FastGPT-plugin Version Compatibility | FastGPT-plugin Version | FastGPT Main Service | | ---------------------- | --------------------- | | 1.x | 4.15.x | | 0.6.x | >= 4.14.11, \< 4.15.0 | | 0.5.x | >= 4.14.6, \< 4.14.11 | | \< 0.5.0 | \< 4.14.6 | ### S3 Connection Issues Check the `STORAGE_EXTERNAL_ENDPOINT` variable — it must be accessible by both the client and FastGPT service. **Important:** > Don't use `127.0.0.1` or `localhost` or other loopback addresses. Use the host machine's local IP when deploying with Docker, but set it to a static IP; or use a fixed domain name. This prevents 403 errors caused by URL mismatches when signing object storage URLs. > > See [Object Storage Configuration & Common Issues](../config/object-storage.en.mdx) ### Browser Unresponsive After Login Can't click anything, refresh doesn't help. Close the tab and reopen it. ### Mongo Replica Set Auto-Initialization Failed The latest docker-compose examples have fully automated Mongo replica set initialization. Tested on Ubuntu 20/22, CentOS 7, WSL2, macOS, and Windows. If it still won't start, the CPU likely doesn't support AVX instructions — switch to Mongo 4.x. To manually initialize the replica set: 1. Create a mongo key in the terminal: ```bash openssl rand -base64 756 > ./mongodb.key chmod 600 ./mongodb.key # Change key permissions — some systems use admin, others use root chown 999:root ./mongodb.key ``` 2. Modify docker-compose.yml to mount the key: ```yml mongo: # image: mongo:5.0.18 # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18 # Alibaba Cloud container_name: mongo ports: - 27017:27017 networks: - fastgpt command: mongod --keyFile /data/mongodb.key --replSet rs0 environment: # Default username and password, only effective on first run - MONGO_INITDB_ROOT_USERNAME=myusername - MONGO_INITDB_ROOT_PASSWORD=mypassword volumes: - ./mongo/data:/data/db - ./mongodb.key:/data/mongodb.key ``` 3. Restart services: ```bash docker compose down docker compose up -d ``` 4. Enter the container and initialize the replica set: ```bash # Check if mongo container is running docker ps # Enter container docker exec -it mongo bash # Connect to database (use your Mongo username and password) mongo -u myusername -p mypassword --authenticationDatabase admin # Initialize replica set. For external access, add directConnection=true to the Mongo connection parameters rs.initiate({ _id: "rs0", members: [ { _id: 0, host: "mongo:27017" } ] }) # Check status — if it shows rs0 status, it's running successfully rs.status() ``` ### How to Change API Address and Key By default, OneAPI connection address and key are configured. Modify the environment variables in the fastgpt container in `docker-compose.yml`: `OPENAI_BASE_URL` (API endpoint, must include /v1) `CHAT_API_KEY` (API credentials) After modifying, restart: ```bash docker compose down docker compose up -d ``` ### How to Update Versions? 1. Check the [update documentation](../upgrading/upgrade-intruction.en.mdx) to confirm the target version — avoid skipping versions. 2. Change the image tag to the target version 3. Run these commands to pull and restart: ```bash docker compose up -d ``` 4. Run initialization scripts (if any) ### How to Customize Environment Variables? Edit the `environment` section of `fastgpt-app` in `docker-compose.yml`, then run `docker compose up -d` to restart the container. For details, see [Environment Variables](../config/env.en.mdx). ### How to Check if Environment Variables Loaded 1. `docker exec -it fastgpt sh` to enter the container. 2. Run `env` to view all environment variables. ### Why Can't I Connect to Local Model Images `docker-compose.yml` uses bridge mode to create the `fastgpt` network. To access other images via 0.0.0.0 or image name, add those images to the same network. ### How to Resolve Port Conflicts? Docker-compose port format: `mapped_port:running_port`. In bridge mode, container running ports don't conflict, but mapped ports can. Change the mapped port to a different value. If `container1` needs to connect to `container2`, use `container2:running_port`. (Brush up on Docker basics as needed) ### relation "modeldata" does not exist PG database not connected or initialization failed — check logs. FastGPT initializes tables on each PG connection. Errors will appear in the logs. 1. Check if the database container started normally 2. For non-Docker deployments, manually install the pg vector extension 3. Check fastgpt logs for related errors ### Illegal instruction Possible causes: 1. ARM architecture — use the official Mongo image: mongo:5.0.18 2. CPU doesn't support AVX — switch to mongo4.x. Change the mongo image to: mongo:4.4.29 ### Operation `auth_codes.findOne()` buffering timed out after 10000ms Mongo connection failed — check mongo's running status and **logs**. Possible causes: 1. Mongo service didn't start (some CPUs don't support AVX — switch to mongo4.x, find the latest 4.x on Docker Hub, update the image version, and rerun) 2. Database connection environment variables are wrong (username/password, check host and port — for non-container network connections, use public IP and add directConnection=true) 3. Replica set startup failed, causing the container to keep restarting 4. `Illegal instruction.... Waiting for MongoDB to start`: CPU doesn't support AVX — switch to mongo4.x ### First Deployment: Root User Shows Unregistered Logs will show error messages. Most likely Mongo replica set mode wasn't started. ### Can't Export Knowledge Base / Can't Use Voice Input or Playback SSL certificate not configured — some features require it. ### Login Shows Network Error Caused by service initialization errors triggering a restart. * 90% of cases: incorrect config file causing JSON parsing errors * The rest: usually because the vector database can't connect ### How to Change Password Modify `DEFAULT_ROOT_PSW` in `docker-compose.yml` and restart — the password auto-updates. ### Deploy Zilliz Version: Get Account and Credentials Open [Zilliz Cloud](https://zilliz.com.cn/), create an instance, and get the credentials. ![zilliz\_key](../../../public/imgs/zilliz_key.png) 1. Set `MILVUS_ADDRESS` and `MILVUS_TOKEN` to match Zilliz's `Public Endpoint` and `Api key`. Remember to add your IP to the whitelist. file: ./content/self-host/deploy/docker.mdx meta: { "title": "Docker Compose 部署", "description": "使用 Docker Compose 快速部署 FastGPT" } import { Alert } from '@/components/docs/Alert'; import { CurrentOriginCodeBlockUpdater } from '@/components/docs/CurrentOriginCodeBlockUpdater'; ## 前置知识 1. 基础的网络知识:端口,防火墙…… 2. Docker 和 Docker Compose 基础知识 ## 部署架构图 ![](../../../public/imgs/sealos-fastgpt.webp) * MongoDB:用于存储除了向量外的各类数据 * PostgreSQL/Milvus/Oceanbase/SeekDB:存储向量数据 * AIProxy: 聚合各类 AI API,支持多模型调用(任何模型问题,先自行通过 OneAPI 测试校验) ## 推荐配置 ### PgVector 版本 非常轻量,适合知识库索引量在 5000 万以下。 | 环境 | 最低配置(单节点) | 推荐配置 | | ---------------- | ----------- | ------------ | | 测试(可以把计算进程设置少一些) | 2c4g | 2c8g | | 100w 组向量 | 4c8g 50GB | 4c16g 50GB | | 500w 组向量 | 8c32g 200GB | 16c64g 200GB | ### Milvus 版本 对于亿级以上向量性能更优秀。 [点击查看 Milvus 官方推荐配置](https://milvus.io/docs/prerequisite-docker.md) | 环境 | 最低配置(单节点) | 推荐配置 | | -------- | --------- | ----- | | 测试 | 2c8g | 4c16g | | 100w 组向量 | 未测试 | | | 500w 组向量 | | | ### zilliz cloud 版本 Zilliz Cloud 由 Milvus 原厂打造,是全托管的 SaaS 向量数据库服务,性能优于 Milvus 并提供 SLA,点击使用 [Zilliz Cloud](https://zilliz.com.cn/)。 由于向量库使用了 Cloud,无需占用本地资源,无需太关注。 ### SeekDB 版本 SeekDB 是基于 MySQL 协议的高性能向量数据库,与 OceanBase 协议完全兼容,支持高效的向量检索。 | 环境 | 最低配置(单节点) | 推荐配置 | | ---------------- | ----------- | ------------ | | 测试(可以把计算进程设置少一些) | 2c4g | 2c8g | | 100w 组向量 | 4c8g 50GB | 4c16g 50GB | | 500w 组向量 | 8c32g 200GB | 16c64g 200GB | SeekDB 使用 MySQL 协议,与 OceanBase 完全兼容: * 支持 1536 维向量检索 * 内置 HNSW 索引算法 * 提供批量插入和查询优化 * 自动重试和连接池管理 ## 前置工作 ### 准备 Docker-compose 环境 ```bash # 安装 Docker curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun systemctl enable --now docker # 安装 docker-compose curl -L https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose # 验证安装 docker -v docker compose -v # 如失效,自行百度~ ``` 推荐直接使用 [Orbstack](https://orbstack.dev/)。可直接通过 Homebrew 来安装: ```bash brew install orbstack ``` 或者直接[下载安装包](https://orbstack.dev/download)进行安装。 我们建议将源代码和其他数据绑定到 Linux 容器中时,将其存储在 Linux 文件系统中,而不是 Windows 文件系统中。 可以选择直接[使用 WSL 2 后端在 Windows 中安装 Docker Desktop](https://docs.docker.com/desktop/wsl/)。 也可以直接[在 WSL 2 中安装命令行版本的 Docker](https://nickjanetakis.com/blog/install-docker-in-wsl-2-without-docker-desktop)。 ## 开始部署 ### 1. 获取配置文件 #### 方法一:使用 AI Agent 代部署 将以下内容复制给你的 Coding Agent: ```text 参考 https://doc.fastgpt.cn/deploy/SKILL.md 帮我部署 FastGPT Docker 版本。 ``` #### 方法二:使用交互式脚本部署 需要在 Linux/MacOS/Windows WSL 环境下执行,引导用户选择部署环境、向量库版本,IP 地址等。 ```bash FASTGPT_DEPLOY_BASE_URL=https://doc.fastgpt.cn bash <(curl -fsSL https://doc.fastgpt.cn/deploy/install.sh) ``` 非交互模式还必须通过 `FASTGPT_FE_DOMAIN` 指定用户访问 FastGPT 的完整地址,例如 `https://fastgpt.example.com`,并通过 `FASTGPT_SANDBOX_PROXY_URL` 指定沙盒 WebSocket 地址,例如 `wss://sandbox-proxy.example.com`。4.16 还需要通过 `FASTGPT_SANDBOX_PREVIEW_PROXY_URL` 指定 HTTP 预览地址。交互模式下脚本会按版本询问这些地址;4.15 只询问 WebSocket 地址。 脚本会自动完成以下操作: * 下载 `docker-compose.yml`。 * 引导选择 S3 与 MCP 的外部访问地址,并写入配置文件。 * 随机生成 `root` 登录密码、服务间 Token、应用密钥和组件密码,并写入 `docker-compose.yml`。 * 自动检测宿主机 Docker socket 路径,必要时替换 `docker-compose.yml` 中的挂载路径。 执行完成后,终端会输出本次生成的 `root` 登录密码,请妥善保存生成后的 `docker-compose.yml`。后续升级时建议基于该文件调整,不要直接丢失已生成的密码和密钥。 #### 方法三:手动下载部署 如果需要固定使用某个 `docker-compose.yml` 文件,推荐先手动下载 `docker-compose.yml` 和 `install.sh`,再通过 `install.sh` 的本地 compose 模式生成最终配置。这样仍然可以复用脚本里的随机密码、S3/MCP 地址写入、Docker socket 检测等能力。 1. 下载所需的 `docker-compose.yml` 文件到服务器,例如: ```bash curl -fsSL https://doc.fastgpt.cn/deploy/docker/v4.15/cn/docker-compose.pg.yml -o docker-compose.source.yml ```
点击展开查看不同数据库的 docker-compose 配置文件下载地址 * **Pgvector** * 中国大陆地区镜像源(阿里云):[docker-compose.pg.yml](/deploy/docker/v4.15/cn/docker-compose.pg.yml) * 全球镜像源(dockerhub, ghcr):[docker-compose.pg.yml](/deploy/docker/v4.15/global/docker-compose.pg.yml) * **Oceanbase** * 中国大陆地区镜像源(阿里云):[docker-compose.oceanbase.yml](/deploy/docker/v4.15/cn/docker-compose.oceanbase.yml) * 全球镜像源(dockerhub, ghcr):[docker-compose.oceanbase.yml](/deploy/docker/v4.15/global/docker-compose.oceanbase.yml) * **Milvus** * 中国大陆地区镜像源(阿里云):[docker-compose.milvus.yml](/deploy/docker/v4.15/cn/docker-compose.milvus.yml) * 全球镜像源(dockerhub, ghcr):[docker-compose.milvus.yml](/deploy/docker/v4.15/global/docker-compose.milvus.yml) * **Zilliz** * 中国大陆地区镜像源(阿里云):[docker-compose.zilliz.yml](/deploy/docker/v4.15/cn/docker-compose.zilliz.yml) * 全球镜像源(dockerhub, ghcr):[docker-compose.zilliz.yml](/deploy/docker/v4.15/global/docker-compose.zilliz.yml) * **SeekDB** * 中国大陆地区镜像源(阿里云):[docker-compose.seekdb.yml](/deploy/docker/v4.15/cn/docker-compose.seekdb.yml) * 全球镜像源(dockerhub, ghcr):[docker-compose.seekdb.yml](/deploy/docker/v4.15/global/docker-compose.seekdb.yml)
2. 下载 `install.sh` 到服务器: ```bash curl -fsSL https://doc.fastgpt.cn/deploy/install.sh -o install.sh ``` 3. 使用 `install.sh` 读取本地 compose 文件并生成最终部署配置: ```bash FASTGPT_LOCAL_COMPOSE_PATH=./docker-compose.source.yml bash install.sh ``` 脚本会复制该 compose 文件为最终的 `docker-compose.yml`,并继续随机生成登录密码和各类凭证、写入 S3/MCP 地址。生成完成后,按终端输出的 root 密码登录。 完全离线环境下,需要同时准备 `docker-compose.yml` 和 `install.sh`。如果无法运行脚本,则需要手动修改 `DEFAULT_ROOT_PSW`、服务 Token、数据库密码、S3/MCP 地址等配置。 #### 自定义镜像源部署 如果需要使用企业内网 Harbor、私有 Registry 或自建镜像加速源,可以先下载 `docker-compose.yml`,把所有 `image:` 改成自己的镜像地址,再走本地 compose 模式: ```bash FASTGPT_LOCAL_COMPOSE_PATH=./docker-compose.yml bash install.sh ``` 如果启用 Agent/Skill 沙盒,还需要同步替换 Compose 文件中的沙盒相关镜像,以及 `AGENT_SANDBOX_SEALOS_IMAGE` 或 `AGENT_SANDBOX_OPENSANDBOX_IMAGE`,确保沙盒 provider 可以拉取对应镜像。具体配置见 [OpenSandbox 配置](../config/sandbox/opensandbox)。 ### 2. 修改环境变量 必须填写 `fastgpt-app` 中的 `FE_DOMAIN`,设置为用户实际访问 FastGPT 的完整地址,例如 `https://fastgpt.example.com`。该地址由协议、主机和可选端口组成,不能留空,也不要填写容器内部地址。 启用 Agent/Skill 沙盒时还必须配置: * `AGENT_SANDBOX_PROXY_URL`:浏览器访问 Sandbox Proxy 的 WebSocket 地址,使用 `ws://` 或 `wss://`,例如 `wss://sandbox-proxy.example.com`,需要指向 3006 端口。 * 4.16 版本额外配置 `AGENT_SANDBOX_PREVIEW_PROXY_URL`:浏览器访问沙盒文件预览的 HTTP(S) 地址,例如 `https://sandbox-proxy.example.com`,同样需要指向 3006 端口。 使用交互式安装脚本时,脚本会在确认部署前询问这些地址。 对于 `Zilliz 版本` 还需要获取密钥,参考 [部署 Zilliz 版本获取账号和密钥](#部署-zilliz-版本获取账号和密钥), 其他版本可直接下一步。 ### 3. 开放外网端口/配置域名 以下端口必须被访问到: 1. 3000 端口(FastGPT 主服务) 2. 9000 端口(S3 服务) 3. 3003 端口(FastGPT SSE MCP server 服务) 4. 3006 端口(FastGPT Agent Sandbox Proxy 服务) ### 4. 启动容器 在 docker-compose.yml 同级目录下执行。请确保 `docker-compose` 版本最好在 2.17 以上,否则可能无法执行自动化命令。 ```bash # 预拉取所有服务及沙盒运行时镜像 docker compose --profile prepull pull # 启动容器 docker compose up -d ``` ### 5. 访问 FastGPT 可通过第三步开放的端口/域名访问 FastGPT。登录用户名为 `root`,密码为 `docker-compose.yml` 环境变量里设置的 `DEFAULT_ROOT_PSW`。 如果使用交互式脚本部署,脚本会随机生成 `DEFAULT_ROOT_PSW`,并在执行完成后输出本次登录密码;如果手动下载部署,请自行修改 `docker-compose.yml` 中的默认密码后再启动服务。每次重启容器,都会按 `DEFAULT_ROOT_PSW` 自动更新 root 用户密码。 ### 6. 配置模型 * 首次登录 FastGPT 后,系统会提示未配置 `语言模型` 和 `索引模型`,并自动跳转模型配置页面。系统必须至少有这两类模型才能正常使用。 * 如果系统未正常跳转,可以在 `账号-模型提供商` 页面,进行模型配置。[点击查看相关教程](../config/model/intro.mdx) * 目前已知可能问题:首次进入系统后,整个浏览器 tab 无法响应。此时需要删除该 tab,重新打开一次即可。 ### 7. 按需安装系统插件 从 V4.14.0 版本开始,fastgpt-plugin 镜像仅提供运行环境,不再预装系统插件,所有 FastGPT 系统需手动安装系统插件。 * 通过插件市场安装,默认会向公开的 FastGPT Marketplace 获取数据进行安装。 * 如果你的 FastGPT 无法访问插件市场,则可以手动访问 [FastGPT 插件市场](https://marketplace.fastgpt.cn/),先下载 .pkg 文件,再通过文件导入的方式安装到系统里。 * 除了安装外,还可对工具进行排序、默认安装、标签管理等。 ![alt text](../../../public/imgs/image-121.png) ## FAQ ### FastGPT 和 FastGPT-plugin 版本对应 | FastGPT-plugin 版本 | FastGPT 主服务 | | ----------------- | --------------------- | | 1.x | 4.15.x | | 0.6.x | >= 4.14.11, \< 4.15.0 | | 0.5.x | >= 4.14.6, \< 4.14.11 | | \< 0.5.0 | \< 4.14.6 | ### S3 无法正常连接 检查 `STORAGE_EXTERNAL_ENDPOINT` 变量,需设置成客户端和 FastGPT 服务均可访问的地址。 **重要:** > 填入的地址不可为 `127.0.0.1` 或者 `localhost` 等本地回环地址,可填 Docker 部署时的宿主机本地 IP,但是需要把宿主机固定为静态 IP;或者统一为一个固定域名;目的是为了避免对象存储签名 URL 时,签发与上传的 URL 不一致导致的 403 错误。 > > 具体查看 [对象存储配置及常见问题](../config/object-storage.mdx) ### 登录系统后,浏览器无法响应 无法点击任何内容,刷新也无效。此时需要删除该 tab,重新打开一次即可。 ### Mongo 副本集自动初始化失败 最新的 docker-compose 示例优化 Mongo 副本集初始化,实现了全自动。目前在 unbuntu20,22 centos7, wsl2, mac, window 均通过测试。仍无法正常启动,大部分是因为 cpu 不支持 AVX 指令集,可以切换 Mongo4.x 版本。 如果是由于,无法自动初始化副本集合,可以手动初始化副本集: 1. 终端中执行下面命令,创建 mongo 密钥: ```bash openssl rand -base64 756 > ./mongodb.key chmod 600 ./mongodb.key # 修改密钥权限,部分系统是admin,部分是root chown 999:root ./mongodb.key ``` 2. 修改 docker-compose.yml,挂载密钥 ```yml mongo: # image: mongo:5.0.18 # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18 # 阿里云 container_name: mongo ports: - 27017:27017 networks: - fastgpt command: mongod --keyFile /data/mongodb.key --replSet rs0 environment: # 默认的用户名和密码,只有首次允许有效 - MONGO_INITDB_ROOT_USERNAME=myusername - MONGO_INITDB_ROOT_PASSWORD=mypassword volumes: - ./mongo/data:/data/db - ./mongodb.key:/data/mongodb.key ``` 3. 重启服务 ```bash docker compose down docker compose up -d ``` 4. 进入容器执行副本集合初始化 ```bash # 查看 mongo 容器是否正常运行 docker ps # 进入容器 docker exec -it mongo bash # 连接数据库(这里要填Mongo的用户名和密码) mongo -u myusername -p mypassword --authenticationDatabase admin # 初始化副本集。如果需要外网访问,mongo:27017 。如果需要外网访问,需要增加Mongo连接参数:directConnection=true rs.initiate({ _id: "rs0", members: [ { _id: 0, host: "mongo:27017" } ] }) # 检查状态。如果提示 rs0 状态,则代表运行成功 rs.status() ``` ### 如何修改 API 地址和密钥 默认是写了 OneAPi 的连接地址和密钥,可以通过修改 `docker-compose.yml` 中,fastgpt 容器的环境变量实现。 `OPENAI_BASE_URL`(API 接口的地址,需要加/v1)`CHAT_API_KEY`(API 接口的凭证)。 修改完后重启: ```bash docker compose down docker compose up -d ``` ### 如何更新版本? 1. 查看[更新文档](../upgrading/upgrade-intruction.mdx),确认要升级的版本,避免跨版本升级。 2. 修改镜像 tag 到指定版本 3. 执行下面命令会自动拉取镜像: ```bash docker compose up -d ``` 4. 执行初始化脚本(如果有) ### 如何自定义环境变量? 修改 `docker-compose.yml` 中 `fastgpt-app` 的 `environment` 配置,并执行 `docker compose up -d` 重启容器。具体配置参考[环境变量说明](../config/env.mdx)。 ### 如何检查环境变量是否正常加载 1. `docker exec -it fastgpt sh` 进入 FastGPT 容器。 2. 直接输入 `env` 命令查看所有环境变量。 ### 为什么无法连接 `本地模型` 镜像 `docker-compose.yml` 中使用了桥接的模式建立了 `fastgpt` 网络,如想通过 0.0.0.0 或镜像名访问其它镜像,需将其它镜像也加入到网络中。 ### 端口冲突怎么解决? docker-compose 端口定义为:`映射端口:运行端口`。 桥接模式下,容器运行端口不会有冲突,但是会有映射端口冲突,只需将映射端口修改成不同端口即可。 如果 `容器1` 需要连接 `容器2`,使用 `容器2:运行端口` 来进行连接即可。 (自行补习 docker 基本知识) ### relation "modeldata" does not exist PG 数据库没有连接上/初始化失败,可以查看日志。FastGPT 会在每次连接上 PG 时进行表初始化,如果报错会有对应日志。 1. 检查数据库容器是否正常启动 2. 非 docker 部署的,需要手动安装 pg vector 插件 3. 查看 fastgpt 日志,有没有相关报错 ### Illegal instruction 可能原因: 1. arm 架构。需要使用 Mongo 官方镜像:mongo:5.0.18 2. cpu 不支持 AVX,无法用 mongo5,需要换成 mongo4.x。把 mongo 的 image 换成: mongo:4.4.29 ### Operation `auth_codes.findOne()` buffering timed out after 10000ms mongo 连接失败,查看 mongo 的运行状态**对应日志**。 可能原因: 1. mongo 服务有没有起来(有些 cpu 不支持 AVX,无法用 mongo5,需要换成 mongo4.x,可以 docker hub 找个最新的 4.x,修改镜像版本,重新运行) 2. 连接数据库的环境变量填写错误(账号密码,注意 host 和 port,非容器网络连接,需要用公网 ip 并加上 directConnection=true) 3. 副本集启动失败。导致容器一直重启。 4. `Illegal instruction.... Waiting for MongoDB to start` : cpu 不支持 AVX,无法用 mongo5,需要换成 mongo4.x ### 首次部署,root 用户提示未注册 日志会有错误提示。大概率是没有启动 Mongo 副本集模式。 ### 无法导出知识库、无法使用语音输入/播报 没配置 SSL 证书,无权使用部分功能。 ### 登录提示 Network Error 由于服务初始化错误,系统重启导致。 * 90%是由于配置文件写不对,导致 JSON 解析报错 * 剩下的基本是因为向量数据库连不上 ### 如何修改密码 修改 `docker-compose.yml` 文件中 `DEFAULT_ROOT_PSW` 并重启即可,密码会自动更新。 ### 部署 Zilliz 版本,获取账号和密钥 打开 [Zilliz Cloud](https://zilliz.com.cn/) , 创建实例并获取相关秘钥。 ![zilliz\_key](../../../public/imgs/zilliz_key.png) 1. 修改 `MILVUS_ADDRESS` 和 `MILVUS_TOKEN` 链接参数,分别对应 `zilliz` 的 `Public Endpoint` 和 `Api key`,记得把自己 ip 加入白名单。 file: ./content/self-host/deploy/sealos.en.mdx meta: { "title": "Deploy with Sealos", "description": "One-click FastGPT deployment using Sealos" } import { Alert } from '@/components/docs/Alert'; ## Deployment Architecture ![](../../../public/imgs/sealos-fastgpt.webp) ## Multi-Model Support FastGPT uses the one-api project to manage model pools, supporting OpenAI, Azure, mainstream domestic models, and local models. See: [Quick OneAPI Deployment on Sealos](../config/model/intro.en.mdx) ## One-Click Deployment With Sealos, you don't need to purchase servers or domains. It supports high concurrency and dynamic scaling, and databases use KubeBlocks with far better I/O performance than simple Docker container deployments. Choose a region below based on your needs. ### Singapore Region Singapore servers are overseas with direct access to OpenAI, but users in mainland China need a VPN. International pricing is slightly higher. Click below to deploy 👇 Deploy on Sealos ### Beijing Region The Beijing region is hosted by Volcano Engine. Users in mainland China get stable access, but it can't reach OpenAI or other overseas services. Pricing is about 1/4 of the Singapore region. Click below to deploy 👇 Deploy on Sealos ### 1. Start Deployment Since databases need to be deployed, wait 2–4 minutes after deployment before accessing. The default uses minimal resources, so the first access may be slow. Follow the prompts to enter `root_password` and the `openai`/`oneapi` address and key. ![](../../../public/imgs/sealos1.png) After clicking deploy, you'll be redirected to the app management page. Click the details button on the right side of the `fastgpt` main app (named fastgpt-xxxx), as shown below. ![](../../../public/imgs/sealos-deploy1.jpg) After clicking details, you'll see the FastGPT deployment management page. Click the link in the external access address to open the FastGPT service. To bind a custom domain or modify deployment parameters, click **Change** in the top right and follow Sealos' instructions. ![](../../../public/imgs/sealos2.png) ### 2. Log In Username: `root` Password: the `root_password` you set during one-click deployment ### 3. Configure Models ### 4. Configure Models You must configure at least one model set, or the system won't work properly. [View model configuration tutorial](../config/model/intro.en.mdx) ## Pricing Sealos uses pay-as-you-go billing based on allocated CPU, memory, and disk. For specific pricing, open the **Cost Center** in the Sealos control panel. ## Using Sealos ### Overview FastGPT Commercial Edition includes 2 apps (fastgpt, fastgpt-plus) and 2 databases. When using multiple API keys, install OneAPI (1 app and 1 database), totaling 3 apps and 3 databases. ![](../../../public/imgs/onSealos1.png) Click details on the right to view each app's information. ### Modifying Config Files and Environment Variables In Sealos, open **App Launchpad** to see deployed FastGPT apps, and open **Database** to see corresponding databases. In **App Launchpad**, select FastGPT, click **Change**, and you'll see environment variables and config files. ![](../../../public/imgs/fastgptonsealos1.png) On Sealos, FastGPT runs 1 service and 2 databases. When pausing or deleting, handle the databases together. (You can start them during the day and pause at night to save costs.) ### How to Update/Upgrade FastGPT [Upgrade script documentation](../upgrading/upgrade-intruction.en.mdx) — read the docs first to determine which version to upgrade to. Do not skip versions. For example, if you're on version 4.5 and want to upgrade to 4.5.1: change the image version to v4.5.1, run the upgrade script, wait for completion, then continue upgrading. If the target version doesn't require initialization, skip it. Upgrade steps: 1. Check the [update documentation](../upgrading/upgrade-intruction.en.mdx) to confirm the target version — avoid skipping versions. 2. Open Sealos app management 3. There are 2 apps: fastgpt, fastgpt-pro 4. Click the 3 dots on the right side of the app, then **Change**. Or click details, then **Change** in the top right. 5. Modify the image version number ![](../../../public/imgs/onsealos2.png) 6. Click **Change/Restart** to automatically pull the latest image and update 7. Run the initialization script for the corresponding version (if applicable) ### How to Get the FastGPT Access Link Open the corresponding app and click the external access address. ![](../../../public/imgs/onsealos3.png) ### Configure a Custom Domain Click **Change** on the app -> **Custom Domain** -> enter domain -> configure domain CNAME -> confirm -> confirm change. ![](../../../public/imgs/onsealos4.png) ### How to Modify Environment Variables Open Sealos app management -> find the app -> **Change** -> edit environment variables -> click confirm change in the top right. ![](../../../public/imgs/onsealos5.png) [Environment Variables](../config/env.en.mdx) ### Modify Site Name and Favicon Add these environment variables to the app: ``` SYSTEM_NAME=FastGPT SYSTEM_DESCRIPTION= SYSTEM_FAVICON=/favicon.ico HOME_URL=/dashboard/agent ``` SYSTEM\_FAVICON can be a URL. ![](../../../public/imgs/onsealos6.png) ### Mount a Logo Currently, the browser logo can't be fully replaced — only SVG is supported. Full replacement will be available after visual customization is implemented. Add a mounted file with path: `/app/projects/app/public/icon/logo.svg`, with the SVG content as the value. ![](../../../public/imgs/onsealos7.png) ![](../../../public/imgs/onsealos8.png) ### Commercial Edition Config File ``` { "license": "", "system": { "title": "" // System name } } ``` ### Using OneAPI [See OneAPI usage guide](../config/model/intro.en.mdx) file: ./content/self-host/deploy/sealos.mdx meta: { "title": "Sealos 部署", "description": "使用 Sealos 一键部署 FastGPT" } import { Alert } from '@/components/docs/Alert'; ## 部署架构图 ![](../../../public/imgs/sealos-fastgpt.webp) ## 多模型支持 FastGPT 使用了 one-api 项目来管理模型池,其可以兼容 OpenAI、Azure、国内主流模型和本地模型等。 可参考:[Sealos 快速部署 OneAPI](../config/model/intro.mdx) ## 一键部署 使用 Sealos 服务,无需采购服务器、无需域名,支持高并发 & 动态伸缩,并且数据库应用采用 kubeblocks 的数据库,在 IO 性能方面,远超于简单的 Docker 容器部署。可以根据需求,再下面两个区域选择部署。 ### 新加坡区 新加披区的服务器在国外,可以直接访问 OpenAI,但国内用户需要梯子才可以正常访问新加坡区。国际区价格稍贵,点击下面按键即可部署👇 Deploy on Sealos ### 北京区 北京区服务提供商为火山云,国内用户可以稳定访问,但无法访问 OpenAI 等境外服务,价格约为新加坡区的 1/4。点击下面按键即可部署👇 Deploy on Sealos ### 1. 开始部署 由于需要部署数据库,部署完后需要等待 2\~4 分钟才能正常访问。默认用了最低配置,首次访问时会有些慢。 根据提示,输入 `root_password`,和 `openai` / `oneapi` 的地址和密钥。 ![](../../../public/imgs/sealos1.png) 点击部署后,会跳转到应用管理页面。可以点击 `fastgpt` 主应用右侧的详情按键(名字为 fastgpt-xxxx),如下图所示。 ![](../../../public/imgs/sealos-deploy1.jpg) 点击详情后,会跳转到 fastgpt 的部署管理页面,点击外网访问地址中的链接,即可打开 fastgpt 服务。 如需绑定自定义域名、修改部署参数,可以点击右上角变更,根据 sealos 的指引完成。 ![](../../../public/imgs/sealos2.png) ### 2. 登录 用户名:`root` 密码是刚刚一键部署时设置的 `root_password` ### 3. 配置模型 ### 4. 配置模型 务必先配置至少一组模型,否则系统无法正常使用。 [点击查看模型配置教程](../config/model/intro.mdx) ## 收费 Sealos 采用按量计费的方式,也就是申请了多少 cpu、内存、磁盘,就按该申请量进行计费。具体的计费标准,可以打开 `sealos` 控制面板中的 `费用中心` 进行查看。 ## Sealos 使用 ### 简介 FastGPT 商业版共包含了 2 个应用(fastgpt, fastgpt-plus)和 2 个数据库,使用多 API Key 时候需要安装 OneAPI(一个应用和一个数据库),总计 3 个应用和 3 个数据库。 ![](../../../public/imgs/onSealos1.png) 点击右侧的详情,可以查看对应应用的详细信息。 ### 修改配置文件和环境变量 在 Sealos 中,你可以打开 `应用管理`(App Launchpad)看到部署的 FastGPT,可以打开 `数据库`(Database)看到对应的数据库。 在 `应用管理` 中,选中 FastGPT,点击变更,可以看到对应的环境变量和配置文件。 ![](../../../public/imgs/fastgptonsealos1.png) 在 Sealos 上,FastGPT 一共运行了 1 个服务和 2 个数据库,如暂停和删除请注意数据库一同操作。(你可以白天启动,晚上暂停它们,省钱大法) ### 如何更新/升级 FastGPT [升级脚本文档](../upgrading/upgrade-intruction.mdx)先看下文档,看下需要升级哪个版本。注意,不要跨版本升级。 例如,目前是 4.5 版本,要升级到 4.5.1,就先把镜像版本改成 v4.5.1,执行一下升级脚本,等待完成后再继续升级。如果目标版本不需要执行初始化,则可以跳过。 升级步骤: 1. 查看[更新文档](../upgrading/upgrade-intruction.mdx),确认要升级的版本,避免跨版本升级。 2. 打开 sealos 的应用管理 3. 有 2 个应用 fastgpt、fastgpt-pro 4. 点击对应应用右边 3 个点,变更。或者点详情后右上角的变更。 5. 修改镜像的版本号 ![](../../../public/imgs/onsealos2.png) 6. 点击变更/重启,会自动拉取最新镜像进行更新 7. 执行对应版本的初始化脚本(如果有) ### 如何获取 FastGPT 访问链接 打开对应的应用,点击外网访问地址。 ![](../../../public/imgs/onsealos3.png) ### 配置自定义域名 点击对应应用的变更 ->点击自定义域名 ->填写域名 -> 操作域名 Cname -> 确认 -> 确认变。 ![](../../../public/imgs/onsealos4.png) ### 如何修改环境变量 打开 Sealos 的应用管理 -> 找到对应的应用 -> 变更 -> 修改环境变量 -> 点击右上角确认变。 ![](../../../public/imgs/onsealos5.png) [环境变量说明](../config/env.mdx) ### 修改站点名称以及 favicon 修改应用的环境变量,增加 ``` SYSTEM_NAME=FastGPT SYSTEM_DESCRIPTION= SYSTEM_FAVICON=/favicon.ico HOME_URL=/dashboard/agent ``` SYSTEM\_FAVICON 可以是一个网络地址 ![](../../../public/imgs/onsealos6.png) ### 挂载 logo 目前暂时无法把浏览器上的 logo 替换。仅支持 svg,待后续可视化做了后可以全部替换。新增一个挂载文件,文件名为:/app/projects/app/public/icon/logo.svg,值为 svg 对应的值。 ![](../../../public/imgs/onsealos7.png) ![](../../../public/imgs/onsealos8.png) ### 商业版镜像配置文件 ``` { "license": "", "system": { "title": "" // 系统名称 } } ``` ### One API 使用 [参考 OneAPI 使用步骤](../config/model/intro.mdx) file: ./content/self-host/troubleshooting/attention.en.mdx meta: { "title": "Troubleshooting Notes", "description": "FastGPT usage notes" } # Troubleshooting Notes If you encounter issues while using FastGPT, follow the steps below to troubleshoot and resolve them. ## 1. Check Version and Upgrade Many known issues are fixed in newer releases. Before reporting a problem, verify your version first: * **Check version:** View the current running version on the FastGPT homepage or in the admin panel. * **Upgrade recommendation:** If you are not on the latest version, follow the [Upgrade Guide](../upgrading/upgrade-intruction) to update to the latest stable release. ## 2. Troubleshooting Steps If the issue still exists after upgrading, check in this order: * **Check logs:** Review Docker container logs or server logs and locate the specific error stack. * **Clear cache:** Clear browser cache or retry in incognito mode. * **Environment check:** Ensure MongoDB and PostgreSQL/Milvus connections are healthy and API keys are valid. ## 3. Prevent Spoofed Client IPs Behind a Reverse Proxy FastGPT reads the client IP for IP rate limiting, share-link IP allowlists, chat log IP records, and IP geolocation. If your self-hosted FastGPT is behind Nginx, a load balancer, an Ingress controller, or a CDN, make sure clients cannot spoof `X-Forwarded-For` or `X-Real-IP` headers. Recommended setup: * **Overwrite incoming IP headers in Nginx:** the last reverse proxy should not pass through a user-supplied `X-Forwarded-For` header. It should overwrite the header with the real connection source. * **Enable trusted proxy validation in FastGPT:** trust forwarded IP headers only when they come from Nginx, the load balancer, or the Ingress controller. * **Restrict direct access to FastGPT:** firewall or security group rules should allow only the reverse proxy to access the FastGPT service port. FastGPT environment variable example: ```dotenv TRUSTED_PROXY_ENABLE=true TRUSTED_PROXY_IPS=172.18.0.0/16 ``` `TRUSTED_PROXY_IPS` should contain the previous-hop proxy IP or CIDR that FastGPT sees directly, such as the Docker subnet for the Nginx container, the Ingress Controller private address, or the load balancer origin address. Do not use a trust-all CIDR such as `0.0.0.0/0` because it would trust every source, and do not add normal client networks to the trusted list. For a single Nginx layer exposed directly to users, use: ```nginx server { listen 80; server_name fastgpt.example.com; location / { proxy_pass http://fastgpt:3000; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } ``` If a CDN or load balancer is in front of Nginx, configure Nginx to trust only those upstream egress IPs first. Then forward the restored client IP to FastGPT: ```nginx server { listen 80; server_name fastgpt.example.com; # Add only your CDN or load balancer egress IP/CIDR ranges. Do not trust every source. set_real_ip_from 10.0.0.0/8; set_real_ip_from 172.16.0.0/12; real_ip_header X-Forwarded-For; real_ip_recursive on; location / { proxy_pass http://fastgpt:3000; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } ``` If your CDN uses a dedicated real-IP header, use that header in `real_ip_header` and set `set_real_ip_from` to the official egress IP ranges published by the CDN. Cloudflare uses `CF-Connecting-IP` as one example. After updating Nginx, run: ```bash nginx -t && nginx -s reload ``` You can verify the setup with spoofed headers: ```bash curl -H 'X-Forwarded-For: 6.6.6.6' -H 'X-Real-IP: 6.6.6.6' https://fastgpt.example.com ``` If the configuration is correct, FastGPT should still record and validate the real client IP, not the spoofed value `6.6.6.6` from the request. ## 4. Contact Technical Support If the issue still cannot be resolved, contact us through: * **Community feedback:** Search for similar issues in GitHub Issues or community channels. * **Provide details:** When contacting support, include: * Full version number currently in use. * Detailed issue description with reproduction steps. * Related system error logs or screenshots. file: ./content/self-host/troubleshooting/attention.mdx meta: { "title": "排查注意", "description": "FastGPT注意事项" } # 注意事项 在使用 FastGPT 过程中遇到问题时,请参考以下步骤进行排查和解决。 ## 1. 版本检查与升级 很多已知问题已在最新版本中得到修复。在反馈问题前,请务必确认您的版本情况: * **检查版本**:在 FastGPT 首页或管理后台查看当前运行的版本号。 * **升级建议**:如果当前不是最新版本,建议先参考 [更新指南](../upgrading/upgrade-intruction) 升级至最新稳定版。 ## 2. 问题排查步骤 若升级后问题依然存在,请按以下顺序排查: * **查看日志**:检查 Docker 容器或服务器日志,寻找具体的错误报错信息(Error Stack)。 * **清理缓存**:尝试清理浏览器缓存或使用无痕模式重新访问。 * **环境检查**:确认数据库(MongoDB, PostgreSQL/Milvus)连接是否正常,以及 API 密钥是否有效。 ## 3. 反向代理客户端 IP 防伪造 FastGPT 会在 IP 限流、分享链接 IP 白名单、对话日志 IP 记录、IP 属地展示等场景读取客户端 IP。自部署时如果 FastGPT 前面有 Nginx、负载均衡、Ingress 或 CDN,需要避免客户端伪造 `X-Forwarded-For` 或 `X-Real-IP` 请求头。 推荐同时完成以下配置: * **Nginx 覆盖外部传入的 IP 请求头**:最后一层反向代理不要透传用户原始 `X-Forwarded-For`,而是用真实连接来源覆盖。 * **FastGPT 开启可信代理校验**:只信任来自 Nginx、负载均衡或 Ingress 的转发头,不信任普通客户端直连请求里的 IP 头。 * **限制 FastGPT 端口暴露范围**:防火墙或安全组只允许反向代理访问 FastGPT 服务端口,避免用户绕过 Nginx 直连 FastGPT。 FastGPT 环境变量示例: ```dotenv TRUSTED_PROXY_ENABLE=true TRUSTED_PROXY_IPS=172.18.0.0/16 ``` `TRUSTED_PROXY_IPS` 需要填写 FastGPT 直接看到的上一跳代理 IP 或 CIDR,例如 Nginx 容器所在 Docker 网段、Ingress Controller 内网地址或负载均衡回源地址。不要填写 `0.0.0.0/0`,也不要把普通客户端网段加入可信列表。 单层 Nginx 直接对外时,可参考: ```nginx server { listen 80; server_name fastgpt.example.com; location / { proxy_pass http://fastgpt:3000; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } ``` 如果 Nginx 前面还有 CDN 或负载均衡,需要先让 Nginx 只信任这些上游的出口 IP,再把还原后的真实客户端 IP 转发给 FastGPT: ```nginx server { listen 80; server_name fastgpt.example.com; # 只填写你的 CDN 或负载均衡出口 IP/CIDR,不要信任所有来源。 set_real_ip_from 10.0.0.0/8; set_real_ip_from 172.16.0.0/12; real_ip_header X-Forwarded-For; real_ip_recursive on; location / { proxy_pass http://fastgpt:3000; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } ``` 如果 CDN 使用专用真实 IP 头,例如 `CF-Connecting-IP`,需要把 `real_ip_header` 改成对应头名,并把 `set_real_ip_from` 配置为该 CDN 官方公布的出口 IP 段。 修改完成后,执行: ```bash nginx -t && nginx -s reload ``` 可以用伪造头验证配置是否生效: ```bash curl -H 'X-Forwarded-For: 6.6.6.6' -H 'X-Real-IP: 6.6.6.6' https://fastgpt.example.com ``` 如果配置正确,FastGPT 记录和校验的仍应是真实客户端 IP,而不是 `6.6.6.6`。 ## 4. 联系技术支持 若以上步骤均无法解决您的问题,请通过以下方式联系我们: * **社区反馈**:在 GitHub Issues 或相关社群中搜索类似问题。 * **提供信息**:联系技术人员时,请务必提供: * 当前使用的完整版本号。 * 问题的详细描述(包括复现步骤)。 * 相关的系统错误日志或截图。 file: ./content/self-host/troubleshooting/faq.en.mdx meta: { "title": "General Troubleshooting", "description": "FastGPT Self-Hosting General Troubleshooting" } ### Frontend Page Crash 1. 90% of cases are due to incorrect model configuration: ensure that at least one model is enabled for each category; check if some `object` parameters in the model are abnormal (arrays and objects). If empty, try giving an empty array or empty object. 2. A small part is due to browser compatibility issues. Since the project contains some high-level syntax, lower version browsers may not be compatible. You can provide specific operation steps and error information in the console to the issue. 3. Turn off the browser translation function. If the browser has translation enabled, it may cause the page to crash. *** ### If deployed via sealos, are there no limitations of local deployment? ![](../../../public/imgs/faq1.png) This is the length limit of the indexing model. It is the same regardless of the deployment method, but the configuration of different indexing models is different, and parameters can be modified in the background. *** ### How to mount the Mini Program configuration file Mount the verification file to the specified location: /app/projects/app/public/xxxx.txt Then restart. For example: ![](../../../public/imgs/faq2.png) *** ### Database port 3306 is occupied, service startup failed ![](../../../public/imgs/faq3.png) Change the port mapping to 3307 or similar, for example 3307:3306. *** ### Can it run purely locally? Yes. You need to prepare the vector model and LLM model. *** ### Other models cannot perform question classification/content extraction 1. Check the logs. If it prompts JSON invalid, not support tool, etc., it means that the model does not support tool calling or function calling. You need to set `toolChoice=false` and `functionCall=false`, and it will default to the prompt mode. Currently, the built-in prompts are only tested for commercial model APIs. Question classification is basically usable, but content extraction is not very good. 2. If the configuration is normal and there are no error logs, it means that the prompt may not be suitable for the model. You can customize the prompt by modifying `customCQPrompt`. *** ### Page Crash 1. Turn off translation. 2. Check if the configuration file is loaded normally. If it is not loaded normally, system information will be missing, and it will cause a null pointer in some operations. * 95% of cases are incorrect configuration files. It will prompt xxx undefined. * Prompt `URI malformed`, please Issue feedback specific operations and pages, this is due to special string encoding parsing errors. 3. Some api incompatibility issues (rare). *** ### After enabling content completion, the response speed becomes slow 1. Question completion requires a round of AI generation. 2. 3\~5 rounds of queries will be performed. If the database performance is insufficient, there will be a significant impact. *** ### Normal reply in the page, API error The page uses stream=true mode, so the API also needs to set stream=true for testing. Some model interfaces (mostly domestic) are a bit garbage in non-Stream compatibility. Same as the previous question, curl test. *** ### Knowledge base indexing has no progress/indexing is very slow First look at the log error information. There are several situations: 1. Can verify, but indexing has no progress: vector model (vectorModels) is not configured. 2. Cannot verify, nor index: API call failed. Maybe not connected to OneAPI or OpenAI. 3. Has progress, but very slow: api key is not good, OpenAI free account, only 3 times or 60 times a minute. 200 times a day limit. *** ### Connection error Network exception. Domestic servers cannot request OpenAI, check whether the connection with the AI model is normal. Or FastGPT cannot request OneAPI (not in the same network). *** ### How to change the root password Modify the `DEFAULT_ROOT_PSW` environment variable, and then restart FastGPT. *** file: ./content/self-host/troubleshooting/faq.mdx meta: { "title": "通用问题排查", "description": "FastGPT 私有部署常见问题排查方式" } ### 前端页面崩溃 1. 90% 情况是模型配置不正确:确保每类模型都至少有一个启用;检查模型中一些 `对象` 参数是否异常(数组和对象),如果为空,可以尝试给个空数组或空对象。 2. 少部分是由于浏览器兼容问题,由于项目中包含一些高阶语法,可能低版本浏览器不兼容,可以将具体操作步骤和控制台中错误信息提供 issue。 3. 关闭浏览器翻译功能,如果浏览器开启了翻译,可能会导致页面崩溃。 *** ### 通过 sealos 部署的话,是否没有本地部署的一些限制? ![](../../../public/imgs/faq1.png) 这是索引模型的长度限制,通过任何方式部署都一样的,但不同索引模型的配置不一样,可以在后台修改参数。 *** ### 怎么挂载小程序配置文件 将验证文件,挂载到指定位置:/app/projects/app/public/xxxx.txt 然后重启。例如: ![](../../../public/imgs/faq2.png) *** ### 数据库 3306 端口被占用了,启动服务失败 ![](../../../public/imgs/faq3.png) 把端口映射改成 3307 之类的,例如 3307:3306。 *** ### 能否纯本地运行 可以。需要准备好向量模型和 LLM 模型。 *** ### 其他模型没法进行问题分类/内容提取 1. 看日志。如果提示 JSON invalid,not support tool 之类的,说明该模型不支持工具调用或函数调用,需要设置 `toolChoice=false` 和 `functionCall=false`,就会默认走提示词模式。目前内置提示词仅针对了商业模型 API 进行测试。问题分类基本可用,内容提取不太行。 2. 如果已经配置正常,并且没有错误日志,则说明可能提示词不太适合该模型,可以通过修改 `customCQPrompt` 来自定义提示词。 *** ### 页面崩溃 1. 关闭翻译 2. 检查配置文件是否正常加载,如果没有正常加载会导致缺失系统信息,在某些操作下会导致空指针。 * 95%情况是配置文件不对。会提示 xxx undefined * 提示 `URI malformed`,请 Issue 反馈具体操作和页面,这是由于特殊字符串编码解析报错。 3. 某些 API 不兼容问题(较少) *** ### 开启内容补全后,响应速度变慢 1. 问题补全需要经过一轮 AI 生成。 2. 会进行 3\~5 轮的查询,如果数据库性能不足,会有明显影响。 *** ### 页面中可以正常回复,API 报错 页面中是用 stream=true 模式,所以 API 也需要设置 stream=true 来进行测试。部分模型接口(国产居多)非 Stream 的兼容有点垃圾。和上一个问题一样,curl 测试。 *** ### 知识库索引没有进度/索引很慢 先看日志报错信息。有以下几种情况: 1. 可以对话,但是索引没有进度:没有配置向量模型(vectorModels) 2. 不能对话,也不能索引:API 调用失败。可能是没连上 OneAPI 或 OpenAI 3. 有进度,但是非常慢:API key 不行,OpenAI 的免费号,一分钟只有 3 次还是 60 次。一天上限 200 次。 *** ### Connection error 网络异常。国内服务器无法请求 OpenAI,自行检查与 AI 模型的连接是否正常。 或者是 FastGPT 请求不到 OneAPI(没放同一个网络) *** ### 修改了 vectorModels 但是没有生效 1. 重启容器,确保模型配置已经加载(可以在日志或者新建知识库时候看到新模型) 2. 记得刷新一次浏览器。 3. 如果是已经创建的知识库,需要删除重建。向量模型是创建时候绑定的,不会动态更新。 *** ### 如何修改 root 密码 修改环境变量中的 `DEFAULT_ROOT_PSW`,然后重启 FastGPT。 *** file: ./content/self-host/troubleshooting/methods.en.mdx meta: { "title": "Troubleshooting Methods", "description": "FastGPT Self-Hosting Common Troubleshooting Methods" } ## 1. Troubleshooting Methods You can first look for [Issue](https://github.com/labring/FastGPT/issues), or raise a new Issue. For private deployment errors, be sure to provide detailed operation steps, logs, and screenshots, otherwise it is difficult to troubleshoot. ### (1) Get Backend Errors 1. `docker ps -a` View the running status of all containers, check if they are all running. If there is an abnormality, try `docker logs container_name` to view the corresponding log. 2. If the containers are running normally, `docker logs container_name` to view the error log. *** ### (2) Frontend Errors When a frontend error occurs, the page will crash and prompt to check the console log. You can open the browser console and view the log in `console`. You can also click the hyperlink of the corresponding log, which will prompt to the specific error file. You can provide these detailed error information to facilitate troubleshooting. *** file: ./content/self-host/troubleshooting/methods.mdx meta: { "title": "错误排查方式", "description": "FastGPT 私有部署常见问题排查方式" } ## 一、错误排查方式 可以先找找[Issue](https://github.com/labring/FastGPT/issues),或新提 Issue,私有部署错误,务必提供详细的操作步骤、日志、截图,否则很难排查。 ### (1)获取后端错误 1. `docker ps -a` 查看所有容器运行状态,检查是否全部 running,如有异常,尝试`docker logs 容器名`查看对应日志。 2. 容器都运行正常的,`docker logs 容器名` 查看报错日志 *** ### (2)前端错误 前端报错时,页面会出现崩溃,并提示检查控制台日志。可以打开浏览器控制台,并查看`console`中的 log 日志。还可以点击对应 log 的超链接,会提示到具体错误文件,可以把这些详细错误信息提供,方便排查。 *** file: ./content/self-host/troubleshooting/model-errors.en.mdx meta: { "title": "Model Troubleshooting", "description": "FastGPT Self-Hosting Model Troubleshooting" } ### (1) How to check model availability issues 1. For privately deployed models, first confirm whether the deployed model is normal. 2. Directly test whether the upstream model is running normally through CURL request (cloud model or private model are both tested). 3. Request OneAPI through CURL request to test whether the model is normal. 4. Use the model for testing in FastGPT. Here are a few test CURL examples: ```bash curl https://api.openai.com/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -d '{ "model": "gpt-4o", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hello!" } ] }' ``` ```bash curl https://api.openai.com/v1/embeddings \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": "The food was delicious and the waiter...", "model": "text-embedding-ada-002", "encoding_format": "float" }' ``` ```bash curl --location --request POST 'https://xxxx.com/api/v1/rerank' \ --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "bge-rerank-m3", "query": "Who is the director", "documents": [ "Who are you?\nI am the assistant of the movie 'Suzume'" ] }' ``` ```bash curl https://api.openai.com/v1/audio/speech \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "tts-1", "input": "The quick brown fox jumped over the lazy dog.", "voice": "alloy" }' \ --output speech.mp3 ``` ```bash curl https://api.openai.com/v1/audio/transcriptions \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: multipart/form-data" \ -F file="@/path/to/file/audio.mp3" \ -F model="whisper-1" ``` *** ### (2) Error - Model response is empty/Model error This error is due to the fact that under stream mode, oneapi directly ended the stream request and did not return any content. Version 4.8.10 added error logs. When an error occurs, the actual Body parameters sent will be printed in the log. You can copy the parameters and send a request test to oneapi through curl. Since oneapi cannot correctly capture errors in stream mode, sometimes you can set `stream=false` to get the exact error. Possible error issues: 1. Domestic models hit risk control. 2. Unsupported model parameters: only keep messages and necessary parameters for testing, delete other parameters for testing. *** ### (3) "Current group upstream load is saturated, please try again later" If you encounter this error (e.g. `request id:xxx`) in the logs or response, this is typically an OneAPI channel issue. Try switching to a different model or a different relay provider. *** ### (4) "Connection Error" in logs when using the API Most likely the API key is pointing to OpenAI's endpoint, but the server is deployed in mainland China and can't reach overseas endpoints. Use a relay service or reverse proxy to resolve the connectivity issue. *** ### (5) Enable image indexing reports 400 You need to correctly configure the OCR model in `Admin` -> `System Configuration`. file: ./content/self-host/troubleshooting/model-errors.mdx meta: { "title": "模型问题排查", "description": "FastGPT 私有部署模型问题排查" } ### (1)如何检查模型可用性问题 1. 私有部署模型,先确认部署的模型是否正常。 2. 通过 CURL 请求,直接测试上游模型是否正常运行(云端模型或私有模型均进行测试) 3. 通过 CURL 请求,请求 OneAPI 去测试模型是否正常。 4. 在 FastGPT 中使用该模型进行测试。 下面是几个测试 CURL 示例: ```bash curl https://api.openai.com/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -d '{ "model": "gpt-4o", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hello!" } ] }' ``` ```bash curl https://api.openai.com/v1/embeddings \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": "The food was delicious and the waiter...", "model": "text-embedding-ada-002", "encoding_format": "float" }' ``` ```bash curl --location --request POST 'https://xxxx.com/api/v1/rerank' \ --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "bge-rerank-m3", "query": "导演是谁", "documents": [ "你是谁?\n我是电影《铃芽之旅》助手" ] }' ``` ```bash curl https://api.openai.com/v1/audio/speech \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "tts-1", "input": "The quick brown fox jumped over the lazy dog.", "voice": "alloy" }' \ --output speech.mp3 ``` ```bash curl https://api.openai.com/v1/audio/transcriptions \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: multipart/form-data" \ -F file="@/path/to/file/audio.mp3" \ -F model="whisper-1" ``` *** ### (2)报错 - 模型响应为空/模型报错 该错误是由于 stream 模式下,oneapi 直接结束了流请求,并且未返回任何内容导致。 4.8.10 版本新增了错误日志,报错时,会在日志中打印出实际发送的 Body 参数,可以复制该参数后,通过 curl 向 oneapi 发起请求测试。 由于 oneapi 在 stream 模式下,无法正确捕获错误,有时候可以设置成 `stream=false` 来获取到精确的错误。 可能的报错问题: 1. 国内模型命中风控 2. 不支持的模型参数:只保留 messages 和必要参数来测试,删除其他参数测试。 3. 参数不符合模型要求:例如有的模型 temperature 不支持 0,有些不支持两位小数。max\_tokens 超出,上下文超长等。 4. 模型部署有问题,stream 模式不兼容。 测试示例如下,可复制报错日志中的请求体进行测试: ```bash curl --location --request POST 'https://api.openai.com/v1/chat/completions' \ --header 'Authorization: Bearer sk-xxxx' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "xxx", "temperature": 0.01, "max_tokens": 1000, "stream": true, "messages": [ { "role": "user", "content": " 你是饿" } ] }' ``` *** ### (3)如何测试模型是否支持工具调用 需要模型提供商和 oneapi 同时支持工具调用才可使用,测试方法如下: ##### 1. 通过 `curl` 向 `oneapi` 发起第一轮 stream 模式的 tool 测试。 ```bash curl --location --request POST 'https://oneapi.xxx/v1/chat/completions' \ --header 'Authorization: Bearer sk-xxxx' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5", "temperature": 0.01, "max_tokens": 8000, "stream": true, "messages": [ { "role": "user", "content": "几点了" } ], "tools": [ { "type": "function", "function": { "name": "hCVbIY", "description": "获取用户当前时区的时间。", "parameters": { "type": "object", "properties": {}, "required": [] } } } ], "tool_choice": "auto" }' ``` ##### 2. 检查响应参数 如果能正常调用工具,会返回对应 `tool_calls` 参数。 ```json { "id": "chatcmpl-A7kwo1rZ3OHYSeIFgfWYxu8X2koN3", "object": "chat.completion.chunk", "created": 1726412126, "model": "gpt-5", "system_fingerprint": "fp_483d39d857", "choices": [ { "index": 0, "id": "call_0n24eiFk8OUyIyrdEbLdirU7", "type": "function", "function": { "name": "mEYIcFl84rYC", "arguments": "" } } ], "refusal": null }, "logprobs": null, "finish_reason": null } ], "usage": null } ``` ##### 3. 通过 `curl` 向 `oneapi` 发起第二轮 stream 模式的 tool 测试。 第二轮请求是把工具结果发送给模型。发起后会得到模型回答的结果。 ```bash curl --location --request POST 'https://oneapi.xxxx/v1/chat/completions' \ --header 'Authorization: Bearer sk-xxx' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5", "temperature": 0.01, "max_tokens": 8000, "stream": true, "messages": [ { "role": "user", "content": "几点了" }, { "role": "assistant", "tool_calls": [ { "id": "kDia9S19c4RO", "type": "function", "function": { "name": "hCVbIY", "arguments": "{}" } } ] }, { "tool_call_id": "kDia9S19c4RO", "role": "tool", "name": "hCVbIY", "content": "{\n \"time\": \"2024-09-14 22:59:21 Sunday\"\n}" } ], "tools": [ { "type": "function", "function": { "name": "hCVbIY", "description": "获取用户当前时区的时间。", "parameters": { "type": "object", "properties": {}, "required": [] } } } ], "tool_choice": "auto" }' ``` *** ### (4)向量检索得分大于 1 由于模型没有归一化导致的。目前仅支持归一化的模型。 *** ### (5) 当前分组上游负载已饱和,请稍后再试 如果在日志或请求中遇到此错误(如 `request id:xxx`),这通常是 OneAPI 渠道的问题,可以换个模型使用或者换一家中转站。 *** ### (6) 使用API时在日志中报错 Connection Error 大概率是 API Key 填写了 OpenAI 的地址,但是部署的服务器在国内,不能访问海外的 API。可以使用中转或者反代的手段解决访问不到的问题。 *** ### (7) 开启图片索引报 400 需在 `Admin` -> `系统配置` 中正确配置 OCR 模型。 file: ./content/self-host/troubleshooting/s3-issues.en.mdx meta: { "title": "S3 Issues Troubleshooting", "description": "FastGPT Self-Hosting Common S3 Issues Troubleshooting" } ## 1. Log shows ERR level "Failed to ensure external public/private bucket exists", resulting in inability to connect to object storage ### 1.1 Error Stack Display * error: Error: getaddrinfo ENOTFOUND Example * ![](../../../public/imgs/faq4.png) ### Possible Errors * STORAGE\_S3\_FORCE\_PATH\_STYLE configuration error ### Solution * Turn on the STORAGE\_S3\_FORCE\_PATH\_STYLE option to `true`, otherwise the client cannot find the target service *** ## 2. Upload conversation file / knowledge base file error Example * ![](../../../public/imgs/faq5.png) ### 2.1 SignatureDoesNotMatched * Signature inconsistency, mostly due to Nginx configuration error ### Possible Errors * Necessary request headers (such as Headers, Host) were not passed during Nginx forwarding ### Solution * Configure proxy\_set\_header Host $http\_host, do not set to $host, Nginx's $host built-in variable will remove the port, set to $http\_host *** file: ./content/self-host/troubleshooting/s3-issues.mdx meta: { "title": "存储桶问题排查", "description": "FastGPT 私有部署存储桶问题排查方式" } ## 1. 日志出现 ERR 等级的 “Failed to ensure external public/private bucket exists”,导致无法连接上对象存储 ### 1.1 错误栈显示 * error: Error: getaddrinfo ENOTFOUND 示例 * ![](../../../public/imgs/faq4.png) ### 可能的错误 * STORAGE\_S3\_FORCE\_PATH\_STYLE 配置错误 ### 解决 * 将 STORAGE\_S3\_FORCE\_PATH\_STYLE 选项开启为 `true`,否则客户端无法找到目标服务 *** ## 2. 上传对话文件 / 知识库文件报错 示例 * ![](../../../public/imgs/faq5.png) ### 2.1 SignatureDoesNotMatched * 签名不一致,大部分情况是因为 Nginx 配置错误 ### 可能的错误 * Nginx 转发时未透传必要的请求头(如 Headers、Host) ### 解决 * 配置 proxy\_set\_header Host $http\_host,不要设置成 $host,Nginx 的 $host内置变量会把端口去掉,要设置成 $http\_host *** file: ./content/self-host/upgrading/upgrade-intruction.en.mdx meta: { "title": "Upgrade Guide", "description": "FastGPT version upgrade guide" } Upgrading FastGPT involves two steps: 1. Update the image 2. Run the upgrade initialization script ## Image Names **GitHub Container Registry** * FastGPT main image: ghcr.io/labring/fastgpt:latest * Plugin image: ghcr.io/labring/fastgpt-plugin * Code sandbox image: ghcr.io/labring/fastgpt-sandbox * MCP SSE server image: ghcr.io/labring/fastgpt-mcp\_server * Commercial edition image: ghcr.io/c121914yu/fastgpt-pro:latest **Alibaba Cloud** * FastGPT main image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt * Plugin image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin * Code sandbox image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox * MCP SSE server image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp\_server * Commercial edition image: ghcr:registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-pro An image consists of the image name and a `Tag`. For example, registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.6.1 refers to the `4.6.3` version image. Check Docker Hub or the GitHub repository for details. ## Updating Images on Sealos 1. Open [Sealos Cloud](https://cloud.sealos.io?uid=fnWRt09fZP) and find App Management on the desktop. ![](../../../public/imgs/updateImageSealos1.jpg) 2. Select the corresponding app - click the three dots on the right - Update. ![](../../../public/imgs/updateImageSealos2.png) 3. Update the image - Confirm changes. If you need to modify the configuration file, scroll down to the `Configuration File` section to make changes. ![](../../../public/imgs/updateImageSealos3.png) ## Updating Images with Docker Compose Simply modify the `image:` field in the `yml` file, then run: ```bash docker-compose pull docker-compose up -d ``` ## Running the Upgrade Initialization Script After updating the images, check the version notes in the documentation. Versions that require an upgrade script are typically labeled with "includes upgrade script". Open the corresponding documentation and follow the instructions to run the **upgrade script** -- in most cases, you just need to send a `POST` request. ## FAQ ### Why do I need to run an upgrade script? When there are significant changes to the database schema that cannot be handled through default values, or when the migration logic is complex, an upgrade script is used to update certain database fields. Following the initialization steps carefully will not cause any data loss. However, if the data volume is large, the initialization may take a while, during which the service may be temporarily unavailable. ### What is `{{host}}`? `{{}}` denotes a variable. `{{host}}` refers to a variable named "host", which is your server's domain name or IP address. On Sealos, you can find your domain name as shown below: ![](../../../public/imgs/updateImageSealos4.png) ### How to get the rootkey You can find it in the `environment` section of your `docker-compose.yml` file -- it's the value of `ROOT_KEY`. On Sealos, you can find it in the environment variables panel shown in the image above. ### How to upgrade across multiple versions Back up your data first! You can upgrade to the latest version and then run all the upgrade scripts in order. However, for stability, we recommend upgrading one version at a time. For example, if your current version is 4.4.7 and you need to upgrade to 4.6: 1. Update the image to 4.5, run the upgrade script 2. Update the image to 4.5.1, run the upgrade script 3. Update the image to 4.5.2, run the upgrade script 4. Update the image to 4.6, run the upgrade script 5. ..... Upgrade one version at a time. file: ./content/self-host/upgrading/upgrade-intruction.mdx meta: { "title": "版本&升级说明", "description": "FastGPT 版本&升级说明" } ## 版本说明 从 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 后缀的稳定版本,以确保稳定性,官方会单独发布修复版本并确保不会引入新功能。 ## 升级说明 FastGPT 升级通常包括两个步骤: 1. 修改镜像名 2. 执行升级初始化脚本 ## 镜像名 **git版** * FastGPT 主镜像: ghcr.io/labring/fastgpt:latest * Plugin 镜像: ghcr.io/labring/fastgpt-plugin * 代码沙箱镜像: ghcr.io/labring/fastgpt-code-sandbox * MCP SSE setver 镜像: ghcr.io/labring/fastgpt-mcp\_server * 商业版镜像: ghcr.io/c121914yu/fastgpt-pro:latest **阿里云** * FastGPT 主镜像: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt * Plugin 镜像: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin * 代码沙箱镜像: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-code-sandbox * MCP SSE setver 镜像: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp\_server * 商业版镜像: ghcr:registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-pro 镜像由镜像名和`Tag`组成,例如: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.6.1 代表`4.6.3`版本镜像,具体可以看 docker hub, github 仓库。 ## Sealos 修改镜像 1. 打开 [Sealos Cloud](https://cloud.sealos.io?uid=fnWRt09fZP), 找到桌面上的应用管理 ![](../../../public/imgs/updateImageSealos1.jpg) 2. 选择对应的应用 - 点击右边三个点 - 变更 ![](../../../public/imgs/updateImageSealos2.png) 3. 修改镜像 - 确认变更 如果要修改配置文件,可以拉到下面的`配置文件`进行修改。 ![](../../../public/imgs/updateImageSealos3.png) ## Docker-Compose 修改镜像 直接修改`yml`文件中的`image: `即可。随后执行: ```bash docker-compose pull docker-compose up -d ``` ## 执行升级初始化脚本 镜像更新完后,可以查看文档中的`版本介绍`,通常需要执行升级脚本的版本都会标明`包含升级脚本`,打开对应的文档,参考说明执行**升级脚本**即可,大部分时候都是需要发送一个`POST`请求。 ## QA ### 为什么需要执行升级脚本 数据表出现大幅度变更,无法通过设置默认值,或复杂度较高时,会通过升级脚本来更新部分数据表字段。 严格按初始化步骤进行操作,不会造成旧数据丢失。但在初始化过程中,如果数据量大,需要初始化的时间较长,这段时间可能会造成服务无法正常使用。 ### `{{host}}` 是什么 `{{}}` 代表变量, `{{host}}`代表一个名为 host 的变量。指的是你服务器的域名或 IP。 Sealos 中,你可以在下图中找到你的域名: ![](../../../public/imgs/updateImageSealos4.png) ### 如何获取 rootkey 从`docker-compose.yml`中的`environment`中获取,对应的是`ROOT_KEY`的值。 sealos 中可以从上图左侧的环境变量中获取。 ### 如何跨版本升级!! 先进行数据备份!!! 可以升级至最新版本,然后将所有升级脚本的版本都执行一遍。不过为了稳定,建议逐一版本升级。例如,当前版本是4.4.7,需要升级到4.6。 1. 修改镜像到4.5,执行升级脚本 2. 修改镜像到4.5.1,执行升级脚本 3. 修改镜像到4.5.2,执行升级脚本 4. 修改镜像到4.6,执行升级脚本 5. ..... 逐一升级 file: ./content/guide/build/agentv2/debug.en.mdx meta: { "title": "Assisted Generation and Debugging", "description": "Detailed guide to generating Prompts via the AI Helper Bot and testing and debugging the Agent using the Chat Preview window and runtime details." } ## Assisted generation An AI Helper Bot optimized for Agent V2 is integrated under the "Assisted generation" tab. ![AI Helper Bot](/imgs/agent_helper_bot.png) ### 1. Smart Analysis and Scheme Optimization The AI Helper Bot automatically reads the current model, datasets, and candidate tools configured in your left panel. You only need to describe your expectations in natural language (e.g., "I want an assistant that analyzes sales data uploaded in Excel and generates visual charts"), and the Helper Bot will automatically: * **Generate and Refine Structured System Prompts**, setting reasonable boundaries and execution rules. * **Recommend the Most Suitable Tools** or virtual machine commands for the task. * **Suggest Relevant Datasets** to supplement domain background knowledge. ### 2. Automatic Apply Once the Helper Bot generates the optimized scheme, the system will automatically write back the recommended prompts, tool list, associated datasets, and sandbox toggles to the left configuration panel. The entire process is fully automated without requiring manual clicks, streamlining the setup workflow. *** ## Chat Preview The "Chat Preview" tab provides a real-time conversational testing environment, allowing you to interact with the Agent as a real user and verify the application's effectiveness before publishing. ### 1. General Debugging Regardless of whether the virtual machine is enabled, you can use the following general debugging features: ![General Debugging](/imgs/agent_chat_debug.png) * **Restart**: Click the "Restart" button in the upper right corner of the chat preview window to clear the current chat history and state, allowing you to start a fresh round of testing. * **Bubble Action Bar and Runtime Details**: Below each generated AI chat bubble, a row of auxiliary debugging tools is provided: * **Copy**: Click to copy the text content of this AI response. * **Read Aloud**: Click to convert the response text into speech and play it back. * **Mark**: Allows developers to mark the question and expected answer, saving it to a designated dataset to correct and guide the model's future responses. * **Retry**: Triggers the AI to regenerate the response for the last user input. * **Runtime Details**: Click to expand the tree-structured decision-making chain. This logs the complete LLM reasoning process, internal plan updates, and tool execution logs. It also shows the unique Request ID, model model, response duration, and precise points consumption for performance auditing and cost control. * **Response Duration** (e.g., `34.07 s`): Displays the total time in seconds spent from sending the request to receiving the full response. * **Plan Card**: If the Agent initiates planning for a complex task, the chat interface will stream a visual "Plan Card." Color-coded steps and animations indicate the progress of each step (In Progress, Completed, Pending, Blocked). If a step is blocked, the card displays the cause of the blockage, helping you optimize your System Prompt or troubleshoot tool configurations. ![Plan Card](/imgs/agent_plan_card.png) ### 2. Virtual Machine Debugging For details on using the virtual machine sandbox for file management, dependency installations, and self-correcting debugging workflows, please refer to [Virtual Machine](./vm#virtual-machine-debugging). file: ./content/guide/build/agentv2/debug.mdx meta: { "title": "辅助生成与调试", "description": "详细介绍如何通过 AI 助手辅助生成 Prompt,以及如何利用调试预览窗口、运行详情等功能测试与排查 Agent。" } ## 辅助生成 在“辅助生成”选项卡中,内置了针对 Agent V2 优化的 AI 协作助手,目前感知的范围有限,仍处于优化阶段,仅商业版开放。 ![辅助生成小助手](/imgs/agent_helper_bot.png) ### 1. 智能分析与方案优化 AI 协作助手能够综合读取您当前在左侧面板配置的模型、知识库及候选工具。您只需在对话框中以自然语言输入您的期望(例如:“我想要一个能够分析用户上传的 Excel 销售数据并直接生成可视化图表的助理”),协作助手将自动: * **润色并生成结构化的 System Prompt**,设定合理的约束与引导规则。 * **智能筛选并推荐**适合当前任务的外部工具(Tools)或虚拟机命令。 * **推荐适配的知识库**以补充背景知识。 ### 2. 配置自动应用 当协作助手根据您的诉求生成最佳方案后,系统会自动将推荐的提示词、工具列表、关联的知识库以及虚拟机开关状态,直接同步并填充到左侧的配置面板中。整个过程完全自动化,无需任何手动点击与二次配置,极大地简化了应用搭建流程。 *** ## 调试预览 “调试预览”选项卡提供了一个实时的应用对话测试环境,让您能够像真实用户一样与 Agent 进行交互,在发布前验证应用效果。 ### 1. 通用调试 无论是否启用虚拟机,您都可以使用以下通用调试功能: ![通用调试](/imgs/agent_chat_debug.png) * **重开对话**:点击调试窗口右上角的“重开对话”按钮,可以一键清空当前的聊天历史,方便您从头开始重新测试。 * **气泡操作栏与运行详情**:在每次对话生成的 AI 气泡下方,提供了一排辅助调试按钮: * **复制**:点击可一键复制该条 AI 回复的文本内容。 * **朗读**:点击可将该条回复文本转化为语音进行播放。 * **标注**:允许开发者对该条对话的问答数据进行标注并保存至指定的知识库中,通过设定预期回答来纠错并引导模型在后续对话中给出更符合预期的回复。 * **重试**:让 AI 针对上一条用户输入重新生成一遍回复。 * **运行详情**:点击可展开树状的决策链路视图。这里完整记录了本次交互中 AI 的思考历程、内部参数动作和工具调用日志,并展示了单次请求的请求 Id、模型型号及精准的积分消耗,便于性能审计与成本核算。 * **响应耗时**(如 `34.07 s`):直观展示该次交互从发送请求到完全响应所耗费的秒数。 * **步骤规划卡片**:如果 AI 面对复杂任务启动了任务规划,对话中会实时流式渲染“计划步骤卡片”(Plan Card),并通过颜色(进行中、已完成、待处理、已阻塞)直观体现执行节点。若遇到阻塞,您可以根据卡片上的阻塞原因来优化您的 System Prompt 或排查工具配置。 ![步骤规划卡片](/imgs/agent_plan_card.png) ### 2. 虚拟机调试 关于如何使用虚拟机进行调试、查看文件、文件注入以及运行状态查看等专属能力,请参考 [虚拟机](./vm#虚拟机调试)。 file: ./content/guide/build/agentv2/settings.en.mdx meta: { "title": "Configuration Panel", "description": "Detailed configuration guide for LLM parameters, virtual machine environment, and skill integration in Chat Agent V2." } The Configuration Panel is used to configure and bind all the core capabilities and execution environments required by your Agent. ![Configuration Panel](/imgs/agent_settings_panel.png) *** ## AI Configuration & Virtual Machine * **AI Model**: Choose the dialogue model and configure parameters, for more general LLM parameters, refer to [AI Settings](../general/ai_settings). * **Prompt**: Define the core persona, objectives, and specific rules for the Agent. The editor supports rich text, and you can type `@` to quickly reference and bind tools, etc. | | | | :-------------------------------------------------------: | :---------------------------------------------------------------: | | ![@ Tool Quick Binding](/imgs/agent_prompt_editor_at.png) | ![Rich Text Prompt Editor](/imgs/agent_prompt_editor_mention.png) | * **Virtual Machine**: Once enabled, the system assigns a dedicated Linux sandbox environment for each session, supporting code execution, file operations, and startup command configuration. For architecture and debugging details, refer to [Virtual Machine](./vm). For startup script details and execution limits, see [Virtual Machine Lifecycle](./vm#virtual-machine-lifecycle). *** ## Associate SKILL & Tools * **Associated SKILLs**: Select and bind published SKILL packages from the skill library. The entrypoint script in the SKILL package will execute automatically when the VM spins up. If you associate SKILLs without enabling the VM sandbox, a warning "Virtual Machine Not Ready" will be displayed. To learn how to write and package custom SKILLs, please refer to [Development & Debugging](../skill/development). ![Virtual Machine Not Ready Warning](/imgs/agent_skill_vm_not_ready.png) * **Tools**: You can choose to bind system built-in tools (e.g., search engines, charts), custom tools created by yourself or the team (including HTTP/MCP tools), or created applications. ![Tools](/imgs/agent_integrate_tools.png) *** ## Knowledge Base & File Uploads * **Knowledge Base**: Associate specific corporate documents and adjust search settings (Hybrid Search, Re-ranking, etc.). It also supports configuring team member authorization permissions. * **File Uploads**: Toggle file uploads for end-users, permitting images, audio, video, or custom file extensions. File upload capabilities automatically adapt based on the multimodal features of the selected LLM. For detailed configurations, see [File Input](../general/fileInput). file: ./content/guide/build/agentv2/settings.mdx meta: { "title": "专项配置", "description": "详细介绍对话 Agent V2 中提示词、虚拟机与技能的专项配置。" } 专项配置用于调整 Agent 的核心指令、运行环境与技能扩展能力。 ![配置面板](/imgs/agent_settings_panel.png) *** ## 提示词 提示词用于定义 Agent 的核心人设、工作目标和具体规则。编辑器支持富文本,并支持通过 `@` 快速唤起并绑定部分工具等上下文能力。 | | | | :---------------------------------------------: | :------------------------------------------------: | | ![提示词 @ 快速绑定](/imgs/agent_prompt_editor_at.png) | ![提示词富文本编辑](/imgs/agent_prompt_editor_mention.png) | 如果需要配置对话大模型、回复长度、推理内容展示等通用模型参数,请参考 [AI 配置说明](../general/ai_settings)。 *** ## 虚拟机 虚拟机开启后,系统会为每个独立会话在后台分配一个专属的 Linux 沙盒运行环境,支持执行代码、读写文件及配置启动脚本等。 具体设计与联调操作请参考 [虚拟机](./vm),启动脚本去重与执行细节请参考 [虚拟机生命周期](./vm#虚拟机生命周期)。 *** ## 技能 技能配置用于选择已发布的技能插件包。技能自带的入口脚本会随虚拟机拉起自动执行。 如果未开启虚拟机但关联了技能,系统会展示“虚拟机未就绪”的警告。若需了解如何自定义编写与打包技能,请参考 [开发与调试](../skill/development)。 ![虚拟机未就绪警告](/imgs/agent_skill_vm_not_ready.png) file: ./content/guide/build/agentv2/vm.en.mdx meta: { "title": "Virtual Machine", "description": "Understand the core concepts, runtime design, and debugging workflow for the Agent V2 Virtual Machine (Computer Sandbox)." } import { Alert } from '@/components/docs/Alert'; ![Virtual Machine Sandbox](/imgs/agent_vm_intro.png) In FastGPT Agent V2, the **Virtual Machine** is a dedicated, physically isolated, and secure lightweight Linux running sandbox environment provisioned for each chat session. It equips the Agent with real-world computation, code execution, and file read/write capabilities, allowing the AI to not only "think" but also execute code to solve complex tasks like a human programmer. *** ## What is Virtual Machine When you toggle the "Enable Computer" option, the system dynamically provisions and binds a dedicated sandbox container for each individual chat session in the background. ![Enable Computer](/imgs/agent_vm_enable.png) With the virtual machine, the Agent can: * **Execute Dynamic Code**: Run Python, Node.js, or Shell scripts via the code executor to perform complex calculations and data manipulations. * **Read and Write Local Files**: Create, modify, and read files in the isolated `/workspace` directory, including generating charts or processing uploaded CSV/Excel sheets. * **Customize the Environment & Startup Script**: Dynamically customize the runtime environment by binding SKILL packages, or configuring custom [Startup Scripts](#virtual-machine-lifecycle) (which automatically execute specified Shell initialization commands, such as installing dependencies or setting environment variables, after the VM spins up but before the AI workflow starts). *** ## Virtual Machine Design To balance security, latency, and resource footprint across high-concurrency and multi-tenant environments, the system features the following core designs: ### 1. Session-Level Isolation and Lifecycle Management * The virtual machine is tightly coupled with the user's chat session. Different users and sessions run in entirely isolated environments. * The system utilizes a keepalive mechanism to sustain active containers. When a session remains idle for too long (exceeding the configurable timeout, typically a few minutes), the container is automatically collected and destroyed to release host resources. ### 2. Session Persistence The virtual machine remains active throughout the duration of a chat session. Dependencies downloaded, temporary files written, or environment variables set in the previous turns remain accessible in subsequent turns. ### 3. Security Constraints & Escape Prevention * Strict resource quotas (CPU, Memory, Disk IO) and network firewall policies are applied to the sandbox to prevent malicious resource exhaustion or internal network access. * All executed commands are encoded in Base64 and decoded securely inside the container to prevent Command Injection risks from string concatenations. ### 4. Instant Sandbox Reconstruction Clicking "Restart" during testing will thoroughly destroy the current virtual machine. The next request will provision and initialize a clean, brand-new container to prevent historical files from contaminating the session. *** ## Virtual Machine Debugging When you enable the **Computer** option in the left configuration panel, the Chat Preview window will automatically unlock the following sandbox-exclusive debugging features: ### Virtual Machine File Manager Shortcut entries to the VM file manager are provided at the top of the chat window and below chat bubbles that involve VM operations. Clicking them pops up a modal to browse, edit, upload, or download files (such as charts, code, and HTML previews) inside the container, achieving a closed debugging loop. | | | | :------------------------------------------------------------: | :--------------------------------------------------------------: | | ![Virtual Machine File Bubble](/imgs/agent_vm_file_bubble.png) | ![Virtual Machine File Manager](/imgs/agent_vm_file_manager.png) | ### Automatic Dialog File Injection Any files you upload via the chat input box (such as CSV or Excel sheets) are automatically downloaded and written into the VM's `user_files/` directory before execution, allowing the AI to read and process them as local files via code. ### Code Execution and Self-Correction The virtual machine provides a real execution environment. If code fails due to missing dependencies or syntax errors, the error logs are real-time fed back to the LLM, enabling the AI to self-correct and re-run within multi-turn planning. ### Pre-emptive Initialization and State Persistence With the Computer option enabled, the system automatically spins up and prepares the sandbox environment before each chat session starts. All files, dependencies, and execution states are persisted across chat steps to support continuous multi-turn debugging. ### Real-time Startup Status Tracking During testing, the chat bubble header streams real-time VM provisioning updates, allowing you to audit the startup progress and duration. ### Complete Sandbox Reconstruction upon Reset Clicking the "Restart" button resets the test session, and the next interaction will provision and initialize a clean, brand-new VM container to prevent historical file contamination. *** ## Virtual Machine Lifecycle When the **Computer** option is enabled, you can configure a **Startup Script** to automatically execute shell commands right after the sandbox environment spins up and before the AI workflow officially starts. This is commonly used for configuring environment variables, modifying software package sources, or installing Python packages (`pip`) and system-level utilities. ### Script Configuration & Lifecycle Under the "Computer Configuration" section of the Agent Configuration Panel, you can write standard Shell commands directly inside the **Startup script (sh)** code editor. ![Startup Script Editor](/imgs/agent_startup_script_editor.png) #### Script Execution Sequence and Scope When a new session starts or the virtual machine is reconstructed, the system executes the scripts sequentially in the background: 1. **Application Startup Script**: The custom Shell script configured in your Agent panel. It executes inside the virtual machine's working directory (usually `/workspace`) to prepare specific dependencies and runtime environments required by this application. 2. **Skill Entrypoint**: If your Agent is associated with skills, the [initialization entrypoint script](../skill/initialization) (e.g., `entrypoint.sh`) bundled inside the published skill package will be extracted and executed in the skill's deployment directory right after the application startup script completes. **Transactional Skill Deployment**: During skill deployment, packages are first extracted to a temporary folder (e.g., `.tmp--`). Upon successful decompression, the folder is atomically renamed to the formal version directory to prevent corrupted partial extractions. #### Lifecycle Flowchart ![Lifecycle Flowchart](/imgs/sandbox_lifecycle_flow_en.jpg) ### Status Deduplication To prevent latency from running commands repeatedly during subsequent turns (such as reinstalling packages via `pip`), the system employs an efficient **status deduplication mechanism**: * **Execution State Record**: The system maintains an execution state file inside the sandbox at `~/.fastgpt/agent-skill-entrypoints/state.json`. * **Hash-based Deduplication (Application Startup Script)**: For your custom "Startup script (sh)", the system computes a **SHA-256 hash value** based on the script text and compares it with the executed hashes in `state.json`. If the script remains unmodified, the system **automatically skips execution** on subsequent requests, ensuring fast starts. The script will only run again if you edit its content or click "Clear Chat" to completely rebuild the sandbox. * **Version ID-based Deduplication (Skill Entrypoint)**: Associated skills are deduplicated using their immutable skill **Version ID**. Since published skill versions are read-only, the entrypoint script executes only once during the sandbox's cold start as long as the bound version remains unchanged. * **State Lifecycle**: The deduplication state is managed along with the virtual machine instance. When the virtual machine is rebuilt (due to clicking "Clear Chat" or system reclamation), a fresh environment is allocated, and all scripts will run again during the next cold start. ### Execution Constraints & Fault Tolerance To ensure sandbox stability and responsiveness, the startup script is subject to the following system rules: * **Character Length Limit**: Due to front-end validation and input constraints, the startup script supports a maximum of **16,384 characters (approx. 16KB)**. Any script exceeding this limit is truncated on save. For complex initialization logic, write it inside a separate skill entrypoint or fetch and execute remote scripts. * **Timeout Protection**: Script execution is protected by a timeout limit controlled by the environment variable `AGENT_SANDBOX_ENTRYPOINT_TIMEOUT_SECONDS`, with a **default timeout of 30 seconds** (clamped between 1 and 600 seconds). The process is forcefully terminated if execution exceeds this duration. * **Non-blocking Workflow**: If your startup script errors out (exits with a non-zero code), times out, or fails to read/write the state file, the system **will not block** the main chat workflow. The AI continues executing subsequent workflow nodes or tools, though it may hit runtime exceptions later if critical dependencies are missing. You can troubleshoot these errors in the preview logs or through the Computer File Manager. * **Log Truncation**: Combined standard output (stdout) and standard error (stderr) logs for the startup script are capped at approximately **8KB**. When logged to the system, output is truncated to 4,000 characters to prevent excessive resource utilization. file: ./content/guide/build/agentv2/vm.mdx meta: { "title": "虚拟机", "description": "深入了解 Agent V2 虚拟机(沙箱)的核心概念、运行设计与联调指南。" } import { Alert } from '@/components/docs/Alert'; ![虚拟机运行环境](/imgs/agent_vm_intro.png) 在 FastGPT Agent V2 中,**虚拟机** 是专为每个会话分配的、物理隔离且安全的轻量级 Linux 运行沙盒环境。它为 Agent 提供了真实的计算、代码执行和文件读写操作能力,使得 AI 不仅仅能“思考”,还能像人类程序员一样通过实际运行代码来解决复杂任务。 *** ## 什么是虚拟机 每当用户开启“启用虚拟机”选项,系统都会在后台为每一个对话会话(Session)动态预置并绑定一个专用的沙箱容器。 ![启用虚拟机](/imgs/agent_vm_enable.png) 有了虚拟机,Agent 可以: * **执行动态代码**:通过代码执行器运行 Python、Node.js 甚至 Shell 脚本,自主进行复杂计算或数据处理。 * **读写本地文件**:在独立的 `/workspace` 目录下创建、修改和读取文件,包括生成图表、处理上传的 CSV/Excel 电子表格等。 * **环境自定义与启动脚本**:通过关联 SKILL 包,或配置自定义的 [启动脚本](#虚拟机生命周期)(在虚拟机拉起后且 AI 正式开始前自动在后台执行的 Shell 命令,用于安装特定软件源、Python 依赖包或系统级工具等),动态准备专属于您应用的运行环境。 *** ## 虚拟机设计 为了在多并发和多租户场景下兼顾安全性、响应速度与资源消耗,系统在底层采用了以下核心设计: ### 1. 会话级隔离与生命周期管理 * 虚拟机与用户的对话会话(Session)强绑定。不同用户、不同会话之间的运行环境完全物理隔离。(注意,未来版本将会改至用户级别隔离,从而减少资源消耗) * 系统通过心跳(Keepalive)机制维持活动容器的存活。当会话长时间闲置(如超过数分钟无新请求)时,系统会自动回收并销毁该虚拟机实例以释放服务器资源。 ### 2. 状态存续(Session Persistence) 在同一个会话的生命周期内,虚拟机是持续存活的。这意味着上一轮对话中下载的依赖、写入的临时文件以及配置的环境变量,在下一轮对话中依然有效,支持多轮交互的连续性。 ### 3. 安全防逃逸与限制 * 沙盒环境采用了严格的资源配额限制(CPU、内存、磁盘 IO)和网络防火墙策略,防止恶意脚本消耗宿主机资源或访问内部网络。 * 所有执行的命令均通过 base64 编码在容器内安全解码运行,规避了 Shell 拼接造成的命令注入风险。 ### 4. 一键快速重建 当用户在调试中点击“重开对话”或重新建立会话时,系统将彻底销毁当前的旧虚拟机,并为下一次请求分配一个纯净、全新的隔离容器,确保环境干净不被污染。 *** ## 虚拟机使用 当您在左侧配置面板中**启用了虚拟机**时,调试预览窗口将自动激活以下沙盒专属调试能力: ### 虚拟机文件管理器 调试窗口顶部以及涉及虚拟机操作的对话气泡下方会提供“虚拟机文件管理器”入口。点击可弹出管理器弹窗,实时浏览、编辑、上传或下载容器内的文件(如图表、临时代码、HTML 预览等),实现调试闭环。 | | | | :----------------------------------------: | :------------------------------------------: | | ![虚拟机文件气泡](/imgs/agent_vm_file_bubble.png) | ![虚拟机文件管理器](/imgs/agent_vm_file_manager.png) | ### 对话上传文件自动注入 对话输入框中上传的所有测试文件,会在对话开始前自动同步注入到虚拟机的 `user_files/` 目录下,使得 AI 可以通过代码以本地路径直接读取和处理这些文件。 ### 代码执行与自我纠错 虚拟机提供了真实的代码运行环境。若代码由于依赖缺失或语法错误执行失败,报错信息会实时回传给大模型,AI 能够在多步规划中尝试自我修正并重新运行,实现闭环纠错调试。 ### 前置拉起与状态存续 开启虚拟机后,系统会在每次对话启动前自动前置拉起并准备好沙盒环境。环境内的文件、依赖和运行状态在当前会话内跨步骤持久保留,支持连续的上下文联调。 ### 启动状态实时展示 在对话调试过程中,气泡上方会流式展示虚拟机的创建与启动状态,方便感知沙箱所处阶段与启动耗时。 ### 重置对话重建沙箱 点击“重开对话”按钮重置测试时,下一次交互会重新拉起并初始化一个干净、全新的虚拟机容器,避免历史测试生成的文件污染新一轮的调试。 *** ## 虚拟机生命周期 在启用虚拟机后,您可以通过配置 **启动脚本**,在沙盒环境拉起后、AI 工作流正式开始执行前,自动执行指定的 Shell 命令。这通常用于配置环境变量、更换软件源、安装 Python 依赖(pip)或系统级工具等。 ### 脚本配置与生命周期 在 Agent 配置面板的“虚拟机配置”中,您可以直接在 **启动脚本(sh)** 的代码编辑器中编写您的 Shell 脚本。 ![启动脚本编辑器](/imgs/agent_startup_script_editor.png) #### 脚本执行顺序与范围 当一个新会话启动或虚拟机重新拉起时,系统会按顺序在后台执行相应的脚本: 1. **应用启动脚本**:即您在配置面板中自定义的 Shell 脚本。该脚本会在虚拟机的工作目录(通常为 `/workspace`)下执行,用于准备当前应用所需的特定运行依赖和环境。 2. **技能入口脚本(Skill Entrypoint)**:若您的 Agent 关联了技能(Skills),技能发布包中自带的[初始化脚本](../skill/initialization)(如 `entrypoint.sh`)会在上述“应用启动脚本”执行完毕后,在每个技能包自身的部署目录下自动执行。 **技能包部署的原子性保障**:技能包在解压部署时,会先在临时目录(如 `.tmp--`)中解压,解压完全成功后,再以原子操作整体替换为正式版本目录,有效避免解压失败导致出现损坏的半截目录。 #### 生命周期流程图 ![生命周期流程图](/imgs/sandbox_lifecycle_flow_zh.jpg) ### 状态去重 为了避免每次对话交互(热启动)时重复执行命令(例如重复通过 `pip install` 安装依赖包)带来等待延迟,系统设计了高效的 **状态去重机制**: * **运行状态记录**:系统在虚拟机内部维护了一个状态文件:`~/.fastgpt/agent-skill-entrypoints/state.json`。 * **哈希去重(应用启动脚本)**:对于您手动编写的“应用启动脚本”,系统会计算其文本内容的 **SHA-256 哈希特征值(Hash)**,并与 `state.json` 中已执行过的哈希值进行对比。如果脚本内容没有任何修改,系统在后续交互中将 **自动跳过执行**,确保实现快速启动;仅当您修改了脚本内容,或在调试预览中点击了“重开对话”触发沙盒彻底重建时,脚本才会重新执行。 * **版本 ID 去重(技能入口脚本)**:关联技能对应的入口脚本则基于 **技能版本 ID** 进行比对去重。因为发布的技能版本是不可变的,只要绑定的技能版本未改变,其入口脚本也仅会在沙箱首次冷启动时执行一次。 * **状态的生命周期**:去重状态随虚拟机实例生命周期进行管理。当虚拟机重建(点击“重开对话”或闲置被系统回收)时,由于分配的是全新环境,所有的脚本都将在首次冷启动时重新执行。 ### 执行限制与容错机制 为保障沙箱的稳定运行与响应时效,虚拟机启动脚本在运行时受以下系统规则约束: * **字符长度限制**:由于前端校验与输入限制,虚拟机启动脚本最大支持 **16,384 个字符(约 16KB)**。超出此长度的脚本在保存时会被自动截断。对于复杂的初始化逻辑,建议编写在单独的技能入口脚本中,或在启动脚本中拉取远程脚本执行。 * **超时终止限制**:脚本执行存在超时保护限制,由系统环境变量 `AGENT_SANDBOX_ENTRYPOINT_TIMEOUT_SECONDS` 控制,**默认超时时间为 30 秒**(限制在 1 秒到 600 秒之间)。如果超过该时间脚本仍未执行完毕,系统将强制终止该进程。 * **非阻塞主流程**:即使您的启动脚本在执行时报错(退出状态码非 0)、超时终止,或是状态文件读写发生异常,系统也**不会阻断主对话流程**。AI 依然会继续执行后续的工作流或工具调用,但可能会因缺少特定依赖而在代码运行时抛出异常。您可以在调试预览的日志或虚拟机文件管理器中排查此类问题。 * **日志长度截断**:启动脚本标准输出(stdout)和标准错误(stderr)的最大日志输出量限制在 **8KB** 左右。在系统记录日志时,日志内容将被截断至 4,000 个字符,以防止过大的日志输出占用过多的系统与网络资源。 file: ./content/guide/build/general/ai_settings.en.mdx meta: { "title": "AI Settings", "description": "FastGPT AI settings explained" } import { Alert } from '@/components/docs/Alert'; AI settings control how AI Chat nodes behave in apps and Workflows, including model selection, response length, multimodal recognition, response format, and reasoning display. This guide explains what each option in the settings modal means and how to choose values for common scenarios. ## Where to Find It In the app editor, find the **AI Settings** section, select an AI model, and click the settings button on the right side of the model selector to open the AI settings modal. In a Workflow, click the AI model configuration for the **AI Chat** node. You can open the same settings modal from the settings button on the right. If you do not have specific requirements, selecting a suitable AI model and keeping the other settings at their defaults is usually enough. | | | | | ------------------------------- | ------------------------------- | ------------------------------- | | ![alt text](/imgs/image-51.png) | ![alt text](/imgs/image-52.png) | ![alt text](/imgs/image-53.png) | ## Why Some Options May Be Hidden Not every option is always shown. The modal only displays settings supported by the selected model. For example, if a model does not support multimodal recognition, multimodal options are hidden. If a model does not support reasoning settings, those options are hidden as well. ## Basic Settings ### AI Model Select the AI model used by the current app or node. Different models vary in response quality, cost, context length, tool calling capability, and multimodal capability. The model section displays several types of information: * **Credit cost**: A reference cost for model calls. Input content and model output are usually priced separately. * **Max context**: The amount of content the model can reference in one request. A larger context window is better for long documents and long conversations. * **Tool calling**: If supported, the model can use selected app tools to query data, run calculations, or call external capabilities. * **Multimodal capability**: If the model supports image, audio, or video input, you can enable the corresponding multimodal recognition capability in AI Settings. Different models may support different media types. Use the capabilities shown in the settings modal as the source of truth. ### Max Histories Controls how many previous conversation rounds the AI can reference when answering. Higher values make it easier for the AI to use earlier context, but they also add more content to the request, which may increase cost and slow down responses. Lower values may prevent the model from using useful prior context. If you do not have a specific requirement, use the default value. Customer support and Knowledge Base Q\&A apps usually only need a small number of history rounds. ### Max Tokens Controls the maximum length of a single AI response. When enabled, use the slider to limit response length. If the value is too low, the response may be cut off early. A higher value allows the model to generate more complete answers, but may also increase cost. Use a lower value for concise answers. Use a higher value when generating plans, articles, or longer explanations. ### Temperature Controls how stable the response is. Lower values produce more stable responses and are better for customer support, Knowledge Base Q\&A, and scenarios with clear rules. Higher values produce more varied responses and are better for writing, brainstorming, and creative content. Common choices: * Customer support and Knowledge Base Q\&A: use a lower value. * Copywriting, stories, and creative suggestions: use a higher value. * If unsure: keep the default. ### Top\_p Top\_p also controls response randomness, with some overlap with temperature. In most cases, avoid adjusting temperature and Top\_p at the same time. If temperature already gives the result you want, keep Top\_p disabled or at its default. ### Stop Stops the AI response when specified content appears. Most chat scenarios do not need this setting. Use it only when the model should stop after outputting a fixed marker. Separate multiple stop strings with `|`, for example: `end|stop`. ### Response Format Controls the format of the AI response. For regular chat, customer support, and Knowledge Base Q\&A, keep the default. Change this only when a later step needs to read the response in a fixed format. If you select `json_schema`, you also need to provide the corresponding schema. This option is suitable when the model must return content in a fixed structure. ### Multimodal Recognition If the selected model is configured with multimodal capability, this setting controls whether the AI can read images, audio, or video from user input. The available types depend on the model itself. If a model only supports images, only image recognition can be enabled. If it supports images, audio, or video, you can select the needed types. When enabled, the AI Chat node converts matching uploaded files, or matching media links in the user's question, into model-readable input before sending the request. For example: * Image recognition: for screenshots, table images, product images, posters, and similar image content. * Audio recognition: for models that can understand uploaded audio content. * Video recognition: for models that can understand uploaded video content. Keep these limits in mind: 1. Even after a type is enabled, the request is filtered again by the actual model capability before it is sent. Unsupported media types are not sent to the model. 2. Media links in the user's question are only parsed when "Extract multimodal files from links" is enabled. Currently, extraction is attempted only when the user's question is under 500 characters, with at most 4 media links processed at a time. 3. Regular document files are not sent directly to the LLM as multimodal input. Documents still need to be parsed into text first. 4. Multimodal recognition depends on the model's own capability. If the modal says the model does not support multimodal recognition, switch to a model that supports the needed media type. ### Hide AI Output When enabled, AI-generated content is not shown directly to the user, but it can still be passed to downstream nodes through the AI response output. For example, the AI can first organize an internal result, and the next node can rewrite it into the final response. ## Reasoning Settings Some models can generate reasoning content before the final answer. When you select one of these models, the modal shows reasoning settings. ### Reasoning Effort Controls how much reasoning the model performs. * **Default**: Use the model's default behavior. * **None**: Try to answer directly. This is suitable for simple questions. * **Minimal / Low / Medium / High / Extra high**: Use stronger reasoning for more complex questions. Reasoning effort follows OpenAI's `reasoning_effort` convention, with ai-proxy adapting it to the parameter format required by each model provider. For the full rules, see [ai-proxy reasoning compatibility](https://github.com/labring/aiproxy/blob/main/docs/REASONING_COMPATIBILITY.md).
OpenAI-Compatible Enum and Default Budget Mapping | FastGPT option | OpenAI-compatible value | Default budget | | -------------- | ----------------------------------------- | --------------------- | | Default | Do not explicitly send `reasoning_effort` | Use the model default | | None | `none` | `0` | | Minimal | `minimal` | `1024` | | Low | `low` | `2048` | | Medium | `medium` | `8192` | | High | `high` | `16384` | | Extra high | `xhigh` | `32768` | If an upstream provider only supports a token budget instead of discrete effort levels, ai-proxy uses the table above to convert effort to budget. When normalizing budget back to effort, `<=0` maps to `none`, `1-1024` maps to `minimal`, `1025-4096` maps to `low`, `4097-12288` maps to `medium`, `12289-24576` maps to `high`, and anything higher maps to `xhigh`.
OpenAI / OpenAI Responses | Target format | Output field | Mapping | | ------------------------- | ------------------ | ------------------------------------------------- | | OpenAI Chat / Completions | `reasoning_effort` | Writes `none/minimal/low/medium/high/xhigh` as-is | | OpenAI Responses | `reasoning.effort` | Writes `none/minimal/low/medium/high/xhigh` as-is | OpenAI Chat / Completions only parses `reasoning_effort`. When Gemini, Claude, or other request formats are converted to an OpenAI-compatible format, they are first normalized to this field.
Google Gemini Gemini native requests are parsed from `generationConfig.thinkingConfig`, including `thinkingLevel`, `thinkingBudget`, and `includeThoughts`. When writing to Gemini upstreams, ai-proxy chooses either `thinkingLevel` or `thinkingBudget` based on the model family. | OpenAI-compatible value | Gemini 3+ Pro | Gemini 3+ non-Pro | gemini-2.5-pro | gemini-2.5-flash | gemini-2.5-flash-lite | | ----------------------- | -------------------- | ----------------------- | ---------------------- | ---------------------- | ---------------------- | | `none` | `thinkingLevel=low` | `thinkingLevel=minimal` | `thinkingBudget=128` | `thinkingBudget=0` | `thinkingBudget=0` | | `minimal` | `thinkingLevel=low` | `thinkingLevel=minimal` | `thinkingBudget=1024` | `thinkingBudget=1024` | `thinkingBudget=1024` | | `low` | `thinkingLevel=low` | `thinkingLevel=low` | `thinkingBudget=2048` | `thinkingBudget=2048` | `thinkingBudget=2048` | | `medium` | `thinkingLevel=low` | `thinkingLevel=medium` | `thinkingBudget=8192` | `thinkingBudget=8192` | `thinkingBudget=8192` | | `high` | `thinkingLevel=high` | `thinkingLevel=high` | `thinkingBudget=16384` | `thinkingBudget=16384` | `thinkingBudget=16384` | | `xhigh` | `thinkingLevel=high` | `thinkingLevel=high` | `thinkingBudget=32768` | `thinkingBudget=24576` | `thinkingBudget=24576` | Gemini 2.5 models clamp the budget to the model's supported range. Some Gemini models cannot fully disable thinking, so `none` falls back to the minimum supported level or budget.
Claude / Anthropic / Bedrock / Vertex AI Claude native requests are parsed from `thinking` and `output_config`. When writing to Anthropic, AWS Bedrock Claude, or Vertex AI Claude, the payload still follows Claude's thinking format. | OpenAI-compatible value | Legacy / budget mode | Adaptive mode | | ----------------------- | ---------------------------------------------- | ---------------------------------------------------------------------- | | `none` | `thinking.type=disabled` | `thinking.type=disabled`; may be removed for some adaptive-only models | | `minimal` | `thinking.type=enabled`, `budget_tokens=1024` | `thinking.type=adaptive`, `output_config.effort=low` | | `low` | `thinking.type=enabled`, `budget_tokens=2048` | `thinking.type=adaptive`, `output_config.effort=low` | | `medium` | `thinking.type=enabled`, `budget_tokens=8192` | `thinking.type=adaptive`, `output_config.effort=medium` | | `high` | `thinking.type=enabled`, `budget_tokens=16384` | `thinking.type=adaptive`, `output_config.effort=high` | | `xhigh` | `thinking.type=enabled`, `budget_tokens=32768` | `thinking.type=adaptive`, `output_config.effort=max` | Budget mode ensures `budget_tokens < max_tokens` and raises too-small budgets to the minimum accepted by the upstream provider.
Ali DashScope / Qwen / QwQ / GLM / Kimi-Compatible Models | OpenAI-compatible value | Models with `thinking_budget` support | Models without budget support | | ----------------------- | ------------------------------------------------- | ----------------------------- | | `none` | `enable_thinking=false`; remove `thinking_budget` | `enable_thinking=false` | | `minimal` | `enable_thinking=true`, `thinking_budget=1024` | `enable_thinking=true` | | `low` | `enable_thinking=true`, `thinking_budget=2048` | `enable_thinking=true` | | `medium` | `enable_thinking=true`, `thinking_budget=8192` | `enable_thinking=true` | | `high` | `enable_thinking=true`, `thinking_budget=16384` | `enable_thinking=true` | | `xhigh` | `enable_thinking=true`, `thinking_budget=32768` | `enable_thinking=true` | ai-proxy currently treats `qwen3-*`, `qwq-*`, and Ali-compatible models whose names contain `glm` or `kimi` as supporting `thinking_budget`. Non-streaming `qwen3-*` requests are forced to disable thinking, while `qwq-*` requests are forced to streaming mode.
Zhipu / DeepSeek / Doubao / Moonshot Kimi These providers currently preserve only the on/off meaning. They do not preserve budget or fine-grained effort levels. | Provider | OpenAI-compatible value | Upstream field | | --------------------------------------------- | ------------------------------- | --------------------------------------------------- | | Zhipu / DeepSeek / Doubao | `none` | `thinking.type=disabled` | | Zhipu / DeepSeek / Doubao | `minimal/low/medium/high/xhigh` | `thinking.type=enabled` | | Moonshot / Kimi models with switch support | `none` | `thinking.type=disabled`; remove `reasoning_effort` | | Moonshot / Kimi models with switch support | `minimal/low/medium/high/xhigh` | `thinking.type=enabled`; remove `reasoning_effort` | | Moonshot / Kimi models without switch support | Any value | Remove `reasoning_effort` and omit `thinking` | For Moonshot / Kimi, whether `thinking.type` can be written depends on the actual upstream model name after channel mapping.
Some models may not fully support every reasoning option. If an error occurs after switching the option, change it back to Default. ### Hide AI Reasoning When enabled, users only see the final answer and do not see the AI's reasoning process. During app debugging, you can temporarily disable this option to inspect the model's intermediate reasoning. file: ./content/guide/build/general/ai_settings.mdx meta: { "title": "AI 配置说明", "description": "FastGPT AI 配置说明" } import { Alert } from '@/components/docs/Alert'; AI 配置用于调整应用或工作流中 AI 对话节点的模型、回复长度、多模态识别、回复格式和思考展示等行为。本文主要介绍配置弹窗中的各项含义,以及常见场景下的选择方式。 ## 配置入口 在应用编辑页中,找到 **AI 配置** 区域,选择 AI 模型后,点击模型选择框右侧的设置按钮,即可打开 AI 配置弹窗。 在工作流中,点击 **AI 对话** 节点的 AI 模型配置项,也可以通过右侧设置按钮打开同一个配置弹窗。 如果暂时没有特殊要求,通常只需要选择合适的 AI 模型,其他参数保持默认即可。 | | | | | ------------------------------- | ------------------------------- | ------------------------------- | | ![alt text](/imgs/image-51.png) | ![alt text](/imgs/image-52.png) | ![alt text](/imgs/image-53.png) | ## 配置会不会都显示? 不会。弹窗会根据当前模型的能力显示可用配置。例如,模型不支持多模态识别时,不会提供多模态识别选项;模型不支持思考配置时,也不会显示对应选项。 ## 基础配置 ### AI 模型 用于选择当前应用或节点使用的 AI 模型。不同模型在回答能力、价格、可处理内容长度、工具调用能力、多模态能力等方面会有差异。 模型下面会显示几类信息: * **积分价格**:模型调用时的积分消耗参考,通常会区分输入内容和模型回复。 * **最大上下文**:模型单次请求可参考的内容长度。数值越大,越适合长文档、长对话等场景。 * **工具调用**:如果显示支持,说明该模型可以配合应用中选择的工具完成查询、计算或外部能力调用。 * **多模态能力**:如果模型支持图片、音频或视频输入,可以在 AI 配置中开启对应的多模态识别能力。不同模型支持的媒体类型可能不同,具体以配置弹窗中显示的能力为准。 ### 记忆轮数 控制 AI 回答时最多参考前面多少轮聊天。 数值越大,AI 越容易参考更早的对话,但也会带入更多内容,可能增加消耗并影响响应速度。数值过小,则可能无法利用前文信息。 如果没有明确需求,建议先使用默认值。客服、知识库问答类应用通常保留少量历史轮数即可。 ### 回复上限 控制 AI 一次最多回答多长。 打开后,可以通过滑块限制模型回复长度。设置过低时,回复可能被提前截断;设置较高时,模型可以生成更完整的内容,但也可能增加消耗。 如果希望回答简短,可以适当调低;如果需要生成方案、文章或较长说明,可以适当调高。 ### 温度 控制回答的稳定程度。 数值较低时,回答更稳定,更适合客服、知识库问答、规则明确的场景。数值较高时,回答更发散,更适合写作、头脑风暴、创意内容等场景。 常见选择: * 客服、知识库问答:建议偏低。 * 文案、故事、创意建议:可以适当调高。 * 不确定时:建议保持默认。 ### Top\_p Top\_p 也是控制回复随机性的参数,作用和温度有一定重叠。 通常不建议同时调整温度和 Top\_p。如果已经通过温度获得了期望效果,可以保持 Top\_p 关闭或默认。 ### 停止序列 当 AI 回复中出现指定内容时,会停止继续输出。 普通聊天一般不需要设置。只有在需要模型输出到某个固定标记就结束时才使用。多个停止词可以用 `|` 分隔,例如:`结束|stop`。 ### 回复格式 控制 AI 的回答格式。 普通聊天、客服问答、知识库问答通常保持默认即可。只有当后续流程需要读取固定格式的内容时,才需要修改该配置。 如果选择 `json_schema`,还需要填写对应的格式要求。该选项适合需要模型按固定结构返回内容的场景。 ### 多模态识别 如果当前模型配置了多模态能力,这里可以控制 AI 是否读取用户输入中的图片、音频或视频内容。 可选择的类型取决于模型本身的能力。模型只支持图片时,只能开启图片识别;模型同时支持图片、音频或视频时,可以按需选择对应类型。 打开后,AI 对话节点会在请求模型前,将用户上传的对应类型文件,或用户问题中的对应媒体链接,转换为模型可识别的输入。例如: * 图片识别:用于识别截图、表格图片、商品图、海报等图片内容。 * 音频识别:用于让支持音频输入的模型理解用户上传的音频内容。 * 视频识别:用于让支持视频输入的模型理解用户上传的视频内容。 需要注意: 1. 即使开启了某类识别,请求发送前也会再次根据模型能力过滤,不支持的类型不会发送给模型。 2. 用户问题中的媒体链接需要开启“提取链接中的多模态文件”后才会尝试解析。当前仅在用户问题少于 500 字时尝试提取,且一次最多处理 4 个媒体链接。 3. 普通文档文件不会作为多模态输入直接发送给 LLM,文档内容仍需要通过文件解析转成文本。 4. 多模态识别依赖模型本身能力。如果弹窗里显示“该模型不支持多模态识别”,需要换成支持对应多模态输入的模型。 ### 隐藏 AI 输出 打开后,AI 生成的内容不会直接展示给用户,但仍然可以通过 AI 回复输出交给后续节点继续处理。例如先让 AI 整理内部结果,再由下一个节点改写成最终回复。 ## 思考配置 部分模型支持先生成思考过程,再输出最终回答。选择这类模型时,弹窗会显示思考配置。 ### 思考配置 用于控制模型的思考强度。 * **默认**:使用模型默认配置。 * **不思考**:尽量直接回答,适合简单问题。 * **极简思考 / 轻量思考 / 标准思考 / 深度思考 / 极致思考**:问题越复杂,可以选择更高的思考强度。 思考强度配置对齐 OpenAI 规范中的 `reasoning_effort`,并通过 ai-proxy 适配不同模型平台的参数格式。完整规则可参考 [ai-proxy reasoning compatibility](https://github.com/labring/aiproxy/blob/main/docs/REASONING_COMPATIBILITY.zh.md)。
OpenAI 兼容枚举与默认 budget 映射 | FastGPT 选项 | OpenAI 兼容值 | 默认 budget | | ---------- | ------------------------ | --------- | | 默认 | 不显式传递 `reasoning_effort` | 使用模型默认值 | | 不思考 | `none` | `0` | | 极简思考 | `minimal` | `1024` | | 轻量思考 | `low` | `2048` | | 标准思考 | `medium` | `8192` | | 深度思考 | `high` | `16384` | | 极致思考 | `xhigh` | `32768` | 如果某个平台只支持 token budget,不支持离散档位,ai-proxy 会按上表把 effort 转成 budget。反向归一化时,`<=0` 会被视为 `none`,`1~1024` 视为 `minimal`,`1025~4096` 视为 `low`,`4097~12288` 视为 `medium`,`12289~24576` 视为 `high`,更高则视为 `xhigh`。
OpenAI / OpenAI Responses | 目标格式 | 写入字段 | 映射方式 | | ------------------------- | ------------------ | ----------------------------------------- | | OpenAI Chat / Completions | `reasoning_effort` | `none/minimal/low/medium/high/xhigh` 原样写入 | | OpenAI Responses | `reasoning.effort` | `none/minimal/low/medium/high/xhigh` 原样写入 | OpenAI Chat / Completions 模式只解析 `reasoning_effort`。当 Gemini、Claude 等请求被转换为 OpenAI 兼容格式时,也会先归一化为该字段。
Google Gemini Gemini 原生请求会从 `generationConfig.thinkingConfig` 中解析 `thinkingLevel`、`thinkingBudget` 和 `includeThoughts`。写给 Gemini 上游时,ai-proxy 会根据模型系列选择 `thinkingLevel` 或 `thinkingBudget`。 | OpenAI 兼容值 | Gemini 3+ Pro | Gemini 3+ 非 Pro | gemini-2.5-pro | gemini-2.5-flash | gemini-2.5-flash-lite | | ---------- | -------------------- | ----------------------- | ---------------------- | ---------------------- | ---------------------- | | `none` | `thinkingLevel=low` | `thinkingLevel=minimal` | `thinkingBudget=128` | `thinkingBudget=0` | `thinkingBudget=0` | | `minimal` | `thinkingLevel=low` | `thinkingLevel=minimal` | `thinkingBudget=1024` | `thinkingBudget=1024` | `thinkingBudget=1024` | | `low` | `thinkingLevel=low` | `thinkingLevel=low` | `thinkingBudget=2048` | `thinkingBudget=2048` | `thinkingBudget=2048` | | `medium` | `thinkingLevel=low` | `thinkingLevel=medium` | `thinkingBudget=8192` | `thinkingBudget=8192` | `thinkingBudget=8192` | | `high` | `thinkingLevel=high` | `thinkingLevel=high` | `thinkingBudget=16384` | `thinkingBudget=16384` | `thinkingBudget=16384` | | `xhigh` | `thinkingLevel=high` | `thinkingLevel=high` | `thinkingBudget=32768` | `thinkingBudget=24576` | `thinkingBudget=24576` | Gemini 2.5 系列会按模型允许范围 clamp budget。部分 Gemini 模型不能真正关闭 thinking,`none` 会退化为模型允许的最小 level 或 budget。
Claude / Anthropic / Bedrock / Vertex AI Claude 原生请求会解析 `thinking` 和 `output_config`。写给 Anthropic 官方、AWS Bedrock Claude 或 Vertex AI Claude 时,字段形态仍遵循 Claude 的 thinking 规则。 | OpenAI 兼容值 | 旧式 / budget 模式 | adaptive 模式 | | ---------- | ----------------------------------------------- | -------------------------------------------------------- | | `none` | `thinking.type=disabled` | `thinking.type=disabled`,部分 adaptive-only 模型可能移除该字段 | | `minimal` | `thinking.type=enabled` , `budget_tokens=1024` | `thinking.type=adaptive` , `output_config.effort=low` | | `low` | `thinking.type=enabled` , `budget_tokens=2048` | `thinking.type=adaptive` , `output_config.effort=low` | | `medium` | `thinking.type=enabled` , `budget_tokens=8192` | `thinking.type=adaptive` , `output_config.effort=medium` | | `high` | `thinking.type=enabled` , `budget_tokens=16384` | `thinking.type=adaptive` , `output_config.effort=high` | | `xhigh` | `thinking.type=enabled` , `budget_tokens=32768` | `thinking.type=adaptive` , `output_config.effort=max` | budget 模式会保证 `budget_tokens < max_tokens`,并把过小的 budget 提升到上游可接受的最小值。
Ali DashScope / Qwen / QwQ / GLM / Kimi 兼容模型 | OpenAI 兼容值 | 支持 `thinking_budget` 的模型 | 不支持 budget 的模型 | | ---------- | ------------------------------------------------ | ----------------------- | | `none` | `enable_thinking=false`,移除 `thinking_budget` | `enable_thinking=false` | | `minimal` | `enable_thinking=true` , `thinking_budget=1024` | `enable_thinking=true` | | `low` | `enable_thinking=true` , `thinking_budget=2048` | `enable_thinking=true` | | `medium` | `enable_thinking=true` , `thinking_budget=8192` | `enable_thinking=true` | | `high` | `enable_thinking=true` , `thinking_budget=16384` | `enable_thinking=true` | | `xhigh` | `enable_thinking=true` , `thinking_budget=32768` | `enable_thinking=true` | 当前 ai-proxy 会把 `qwen3-*`、`qwq-*`、模型名包含 `glm` 或 `kimi` 的 Ali-compatible 模型视为支持 `thinking_budget`。`qwen3-*` 非流式请求会被强制关闭 thinking,`qwq-*` 请求会被强制改为流式。
Zhipu / DeepSeek / Doubao / Moonshot Kimi 这些平台当前主要保留开关语义,不保留 budget 或细粒度 effort。 | 平台 | OpenAI 兼容值 | 写给上游的字段 | | ------------------------- | ------------------------------- | ----------------------------------------------- | | Zhipu / DeepSeek / Doubao | `none` | `thinking.type=disabled` | | Zhipu / DeepSeek / Doubao | `minimal/low/medium/high/xhigh` | `thinking.type=enabled` | | Moonshot / Kimi 支持开关的模型 | `none` | `thinking.type=disabled`,并移除 `reasoning_effort` | | Moonshot / Kimi 支持开关的模型 | `minimal/low/medium/high/xhigh` | `thinking.type=enabled`,并移除 `reasoning_effort` | | Moonshot / Kimi 不支持开关的模型 | 任意值 | 移除 `reasoning_effort`,不发送 `thinking` | Moonshot / Kimi 是否能写入 `thinking.type` 取决于渠道映射后的实际上游模型名。
部分模型不一定完全支持所有思考选项。如果切换后出现报错,可以改回默认选项。 ### 隐藏 AI 思考 打开后,用户只会看到最终回答,看不到 AI 的思考过程。调试应用时,可以临时关闭该开关,观察模型的中间思考内容。 file: ./content/guide/build/general/chat_input_guide.en.mdx meta: { "title": "Chat Input Guide", "description": "FastGPT chat input guide" } ![](/imgs/questionGuide.png) ## What is Custom Question Guidance? You can preset questions for your app. As users type, the system dynamically searches these questions based on their input and displays them as suggestions, helping users ask questions faster. You can configure the question list directly in FastGPT or provide a custom API endpoint. ## Custom Question List API The endpoint must be accessible from the user's browser. **Request:** ```bash curl --location --request GET 'http://localhost:3000/api/core/chat/inputGuide/query?appId=663c75302caf8315b1c00194&searchKey=you' ``` Where `appId` is the application ID and `searchKey` is the search keyword (max 50 characters). **Response** ```json { "code": 200, "statusText": "", "message": "", "data": [ "it's you", "who are you", "you're great", "hello there", "who are you!", "hello" ] } ``` `data` is an array of matched questions. Return at most 5 results. **Parameters:** * appId - Application ID * searchKey - Search keyword file: ./content/guide/build/general/chat_input_guide.mdx meta: { "title": "对话问题引导", "description": "FastGPT 对话问题引导" } ![](/imgs/questionGuide.png) ## 什么是自定义问题引导 你可以为你的应用提前预设一些问题,用户在输入时,会根据输入的内容,动态搜索这些问题作为提示,从而引导用户更快的进行提问。 你可以直接在 FastGPT 中配置词库,或者提供自定义词库接口。 ## 自定义词库接口 需要保证这个接口可以被用户浏览器访问,需要注意允许跨域。 **请求:** ```bash curl --location --request GET 'http://localhost:3000/api/core/chat/inputGuide/query?appId=663c75302caf8315b1c00194&searchKey=你' ``` 其中 `appId` 为应用 ID,`searchKey` 为搜索关键字,最多是 50 个字符。 **响应** ```json { "code": 200, "statusText": "", "message": "", "data": ["是你", "你是谁呀", "你好好呀", "你好呀", "你是谁!", "你好"] } ``` data 是一个数组,包含了搜索到的问题,最多只需要返回 5 个问题。 **参数说明:** * appId - 应用 ID * searchKey - 搜索关键字 file: ./content/guide/build/general/fileInput.en.mdx meta: { "title": "File Input", "description": "FastGPT file input feature overview" } Starting from version 4.8.9, FastGPT supports configuring file uploads in both `Basic Mode` and `Workflows`. This guide covers how to use file input and explains the difference between document parsing and multimodal file handling. ## Using in Basic Mode When file upload is enabled in Basic Mode, it uses tool-calling mode — the model decides whether to read the file content. Find the file upload option on the left panel and click the `Enable`/`Disable` toggle to open the configuration dialog. ![Enable file upload](/imgs/fileinpu-1.png) Once enabled, a file selection icon appears in the chat input area. Click it to select files for upload. ![Enable file upload](/imgs/fileinpu-2.png) **Behavior** Starting from version 4.8.13, Basic Mode forces file parsing and injects the content into the system prompt, preventing cases where the model skips reading the file during multi-turn conversations. ## Using in Workflows In Workflows, find the `File Input` option in the system configuration panel and click the `Enable`/`Disable` toggle to open the configuration dialog. ![Enable file upload](/imgs/fileinpu-4.jpg) There are many ways to use files in Workflows. The simplest approach, shown below, connects document parsing via tool calling — achieving the same result as Basic Mode. | | | | ---------------------- | ---------------------- | | ![](/imgs/image-5.png) | ![](/imgs/image-6.png) | You can also use Workflows to extract or analyze document content, then pass the results to HTTP requests or other modules to build a document processing pipeline. ![Document parsing](/imgs/image-7.png) ## How Document Parsing Works Unlike multimodal recognition, LLMs currently cannot parse regular documents directly. All document "understanding" is achieved by converting documents to text and injecting it into the prompt. The following FAQs explain how this works — understanding the mechanics helps you use document parsing more effectively in Workflows. ### How are uploaded files stored in the database? In FastGPT's chat history, messages with role=user store their value in this structure: ```ts type UserChatItemValueItemType = { type: 'text' | 'file'; text?: { content: string; }; file?: { type: 'image' | 'audio' | 'video' | 'file'; name?: string; key?: string; url: string; }; }; ``` Uploaded files are stored as URLs — parsed document content is not stored. ### How are images, audio, and video handled? The document parsing node does not parse multimodal files such as images, audio, or video. These files should be handled by an LLM that supports the corresponding multimodal capability, with multimodal recognition enabled in [AI Settings](./ai_settings). In practice, file input has two different handling paths: 1. Document parsing: handles document files such as PDF, Word, Excel, Markdown, and HTML, converts their content to text, and provides that text to the AI. 2. Multimodal recognition: handles media files such as images, audio, and video. FastGPT converts them into model-readable input, and a model with the corresponding capability reads them. ### How does the document parsing node work? The document parsing node accepts an `array` input (file URLs) and outputs a `string` (the parsed content). * The node only parses URLs with document-type file extensions. If you upload both documents and multimodal files, multimodal files are ignored. * **The document parsing node only processes files from the current workflow run, not files from chat history.** * How multiple documents are concatenated: Multiple files are concatenated using the following template — filename + content, separated by `\n******\n`: ``` File: ${filename} ${content} ``` ### How to use document parsing in AI nodes AI nodes (AI Chat / Tool Calling) have a document URL input that lets you reference document addresses directly. It accepts an `Array` input. The URLs are parsed and injected into a system message using this prompt template: ``` Use the content in as reference for this conversation: {{quote}} ``` # Changes to File Upload in Version 4.8.13 There are some differences from version 4.8.9. We've maintained backward compatibility to avoid breaking existing workflows, but please update your workflows to follow the new rules as soon as possible — compatibility code will be removed in future versions. 1. Basic Mode now forces file parsing instead of letting the model decide, ensuring documents are always referenced. 2. Document parsing: no longer parses files from chat history. 3. Tool Calling: supports direct document reference selection — no need to attach a document parsing tool. Automatically parses files from chat history. 4. AI Chat: supports direct document reference selection — no need to go through the document parsing node. Automatically parses files from chat history. 5. Standalone plugin execution: no longer supports global files. Plugin inputs now support file-type configuration as a replacement for global file upload. 6. **Workflow calling plugins: uploaded files are no longer automatically passed to plugins. You must manually specify the variable for plugin input.** 7. **Workflow calling sub-workflows: uploaded files are no longer automatically passed to sub-workflows. You can manually select which file URLs to pass.** file: ./content/guide/build/general/fileInput.mdx meta: { "title": "文件输入功能介绍", "description": "FastGPT 文件输入功能介绍" } 从 4.8.9 版本起,FastGPT 支持在 `简易模式` 和 `工作流` 中,配置用户上传文件功能。下面先简单介绍下如何使用文件输入功能,最后介绍文档解析和多模态文件处理的区别。 ## 简易模式中使用 简易模式打开文件上传后,会使用工具调用模式,也就是由模型自行决策,是否需要读取文件内容。 可以找到左侧文件上传的配置项,点击其右侧的 `开启` / `关闭` 按键,即可打开配置弹窗。 ![打开文件上传](/imgs/fileinpu-1.png) 随后,你的调试对话框中,就会出现一个文件选择的 icon,可以点击文件选择 icon,选择你需要上传的文件。 ![打开文件上传](/imgs/fileinpu-2.png) **工作模式** 从 4.8.13 版本起,简易模式的文件读取将会强制解析文件并放入 system 提示词中,避免连续对话时,模型有时候不会主动调用读取文件的工具。 ## 工作流中使用 工作流中,可以在系统配置中,找到 `文件输入` 配置项,点击其右侧的 `开启` / `关闭` 按键,即可打开配置弹窗。 ![打开文件上传](/imgs/fileinpu-4.jpg) 在工作流中,使用文件的方式很多,最简单的就是类似下图中,直接通过工具调用接入文档解析,实现和简易模式一样的效果。 | | | | ---------------------- | ---------------------- | | ![](/imgs/image-5.png) | ![](/imgs/image-6.png) | 当然,你也可以在工作流中,对文档进行内容提取、内容分析等,然后将分析的结果传递给 HTTP 或者其他模块,从而实现文件处理的 SOP。 ![文档解析](/imgs/image-7.png) ## 文档解析工作原理 不同于多模态识别,LLM 模型目前没有支持直接解析普通文档的能力,所有的文档“理解”都是通过文档转文字后拼接 prompt 实现。这里通过几个 FAQ 来解释文档解析的工作原理,理解文档解析的原理,可以更好的在工作流中使用文档解析功能。 ### 上传的文件如何存储在数据库中 FastGPT 的对话记录存储结构中,role=user 的消息,value 值会按以下结构存储: ```ts type UserChatItemValueItemType = { type: 'text' | 'file'; text?: { content: string; }; file?: { type: 'image' | 'audio' | 'video' | 'file'; name?: string; key?: string; url: string; }; }; ``` 也就是说,上传的文件都会以 URL 的形式存储在库中,并不会存储 `解析后的文档内容`。 ### 图片、音频、视频如何处理 文档解析节点不会解析图片、音频、视频等多模态文件。这类文件需要交给支持对应多模态能力的 LLM 处理,并在 [AI 配置说明](./ai_settings) 中开启多模态识别。 因此,文件输入中要区分两类处理方式: 1. 文档解析:处理 PDF、Word、Excel、Markdown、HTML 等文档文件,将内容转成文本后提供给 AI。 2. 多模态识别:处理图片、音频、视频等媒体文件,FastGPT 会将其转换为模型可接收的输入,再由支持对应能力的模型读取。 ### 文档解析节点如何工作 文档解析依赖文档解析节点,这个节点会接收一个 `array` 类型的输入,对应的是文件输入的 URL;输出的是一个 `string`,对应的是文档解析后的内容。 * 在文档解析节点中,只会解析 `文档` 类型的 URL,它是通过文件 URL 解析出来的 `文件后缀` 去判断的。如果你同时选择了文档和多模态文件,多模态文件会被忽略。 * **文档解析节点,只会解析本轮工作流接收的文件,不会解析历史记录的文件。** * 多个文档内容如何拼接的 按下列的模板,对多个文件进行拼接,即文件名+文件内容的形式组成一个字符串,不同文档之间通过分隔符:`\n******\n` 进行分割。 ``` File: ${filename} ${content} ``` ### AI 节点中如何使用文档解析 在 AI 节点(AI 对话/工具调用)中,新增了一个文档链接的输入,可以直接引用文档的地址,从而实现文档内容的引用。 它接收一个 `Array` 类型的输入,最终这些 URL 会被解析,并进行提示词拼接,放置在 role=system 的消息中。提示词模板如下: ``` 将 中的内容作为本次对话的参考: {{quote}} ``` # 4.8.13 版本起,关于文件上传的更新 由于与 4.8.9 版本有些差异,尽管我们做了向下兼容,避免工作流立即不可用。但是请尽快的按新版本规则进行调整工作流,后续将会去除兼容性代码。 1. 简易模式中,将会强制进行文件解析,不再由模型决策是否解析,保证每次都能参考文档。 2. 文档解析:不再解析历史记录中的文件。 3. 工具调用:支持直接选择文档引用,不需要再挂载文档解析工具。会自动解析历史记录中的文件。 4. AI 对话:支持直接选择文档引用,不需要进过文档解析节点。会自动解析历史记录中的文件。 5. 插件单独运行:不再支持全局文件;插件输入支持配置文件类型,可以取代全局文件上传。 6. **工作流调用插件:不再自动传递工作流上传的文件到插件,需要手动给插件输入指定变量。** 7. **工作流调用工作流:不再自动传递工作流上传的文件到子工作流,可以手动选择需要传递的文件链接。** file: ./content/guide/build/general/voiceInput.en.mdx meta: { "title": "Voice Input", "description": "FastGPT voice input configuration" } Voice Input lets users record speech in the chat UI and automatically convert it to text. It is useful on mobile devices, in customer support workflows, and in scenarios where typing is inconvenient. ## Configuration Entry In the app editor, find **Voice Input** and click the settings button on the right to open the voice input configuration dialog. | | | | ---------------------------------------------------------- | ------------------------------------------------------------- | | ![Voice input entry](../../../../public/imgs/image-29.png) | ![Voice input settings](../../../../public/imgs/image-28.png) | ## Enable Voice Input After Voice Input is enabled, the chat input box shows a voice recording entry. Users can click it to start recording, and FastGPT converts the recording to text after it finishes. If the browser or current environment does not support voice recording, the frontend will show a voice input unsupported message. ## Auto Send When **Auto Send** is enabled, FastGPT automatically sends the recognized text after recording finishes. Users do not need to click the send button manually. If users should review the recognized text before sending, keep Auto Send disabled. ## Auto Voice Response When **Auto Voice Response** is enabled, questions sent through voice input will also receive AI responses that play automatically as audio. This requires voice playback to be enabled. If voice playback is not enabled, the AI still returns a text response, but audio will not play automatically. ## Recommendations * Enable Voice Input for mobile or on-site scenarios to improve input efficiency. * For scenarios that require high recognition accuracy, disable Auto Send so users can verify the recognized text first. * For continuous voice interactions, enable both Auto Send and Auto Voice Response. file: ./content/guide/build/general/voiceInput.mdx meta: { "title": "语音输入", "description": "FastGPT 语音输入配置说明" } 语音输入支持用户在前台对话中进行语音录入,并自动识别转换为文字。该能力适合移动端、客服、现场记录等不方便打字的场景。 ## 配置入口 在应用编辑页中,找到 **语音输入** 配置项,点击右侧的设置按钮,即可打开语音输入配置弹窗。 | | | | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-29.png) | ![alt text](../../../../public/imgs/image-28.png) | ## 开启语音输入 开启后,前台对话输入框中会显示语音录入入口。用户点击后可以开始录音,录音完成后系统会将语音识别为文字。 如果浏览器或当前环境不支持语音录入,前台会提示浏览器不支持语音输入。 ## 自动发送 开启 **自动发送** 后,用户完成语音录入并识别为文字后,系统会自动发送该内容,不需要用户再手动点击发送按钮。 如果希望用户在发送前检查识别结果,可以关闭自动发送,让用户确认文字内容后再发送。 ## 自动语音回复 开启 **自动语音回复** 后,通过语音输入发送的问题,AI 的回复也会自动以语音形式播放。 该能力需要同时开启语音播报配置。若未开启语音播报,AI 仍会正常生成文字回复,但不会自动播放语音。 ## 使用建议 * 面向移动端或现场场景的应用,可以开启语音输入提升输入效率。 * 对识别准确性要求较高的场景,建议关闭自动发送,让用户先确认识别文本。 * 需要连续语音交互时,可以同时开启自动发送和自动语音回复。 file: ./content/guide/build/general/welcomeText.en.mdx meta: { "title": "Welcome Text", "description": "FastGPT welcome text configuration" } Welcome Text is the initial message sent automatically before each new conversation starts. Use it to introduce what the app can do, clarify the question scope, or provide common entry points. ## Configuration Entry In the app editor, find **Welcome Text** and click the settings button on the right to edit the content. ![Welcome text settings](../../../../public/imgs/image-2.png) ## Markdown Support Welcome Text supports standard Markdown syntax, including headings, lists, links, and bold text. This helps users quickly understand what the app can help with. ## Quick Questions Welcome Text supports the special `[Quick Question]` format. FastGPT displays these items as clickable buttons, and users can send the preset question with one click. Example: ```md Hello, I can help you look up product information and support policies. [How do I request support?] [What scenarios does this product support?] [Recommend a starter plan] ``` When users start a new conversation, they will see the welcome message and quick question buttons. After a user clicks a quick question, FastGPT sends that question as the user's message. ![Quick questions in chat](../../../../public/imgs/image-27.png) ## Recommendations * Keep the welcome text short and clear, focusing on what the app can solve. * Use quick questions for common scenarios, and avoid adding too many options. * If the app requires a specific input format, include an example in the welcome text. file: ./content/guide/build/general/welcomeText.mdx meta: { "title": "对话开场白", "description": "FastGPT 对话开场白配置说明" } 对话开场白是每次新对话开始前由系统自动发送的欢迎词,适合用于介绍应用能力、说明提问范围,或提供常用入口。 ## 配置入口 在应用编辑页中,找到 **对话开场白** 配置项,点击右侧的设置按钮,即可编辑开场白内容。 ![alt text](../../../../public/imgs/image-2.png) ## Markdown 支持 开场白支持标准 Markdown 语法,可以使用标题、列表、链接、加粗等格式,让用户进入对话后快速理解当前应用可以处理的问题。 ## 快捷问题 开场白支持使用 `[快捷问题]` 特殊格式。配置后,界面会将对应内容展示为可点击按钮,用户点击后即可直接发送预设问题。 例如: ```md 你好,我可以帮你查询产品信息和售后政策。 [如何申请售后?] [产品支持哪些使用场景?] [帮我推荐一个入门方案] ``` 用户进入新对话后,会看到欢迎词和快捷问题按钮。点击快捷问题按钮后,系统会把该问题作为用户输入发送到对话中。 ![alt text](../../../../public/imgs/image-27.png) ## 使用建议 * 开场白应简短明确,优先说明应用能解决什么问题。 * 快捷问题建议覆盖高频场景,避免一次配置过多导致用户难以选择。 * 如果应用依赖固定格式输入,可以在开场白中给出示例。 file: ./content/guide/build/publish/dingtalk.en.mdx meta: { "title": "DingTalk Bot Integration", "description": "FastGPT DingTalk Bot Integration Tutorial" } Starting from version 4.8.16, FastGPT commercial edition supports direct DingTalk bot integration without additional APIs. ## 1. Create a DingTalk Internal Enterprise App 1. Create an internal enterprise app in the [DingTalk Developer Console](https://open-dev.dingtalk.com/fe/app). ![Image 1](/imgs/dingtalk-bot-1.png) 2. Obtain the **Client ID** and **Client Secret**. ![Image 2](/imgs/dingtalk-bot-2.png) ## 2. Add a Publishing Channel in FastGPT In FastGPT, select the app you want to integrate. On the **Publishing Channels** page, create a new DingTalk bot publishing channel. Enter the **Client ID** and **Client Secret** obtained earlier into the configuration dialog. ![Image 3](/imgs/dingtalk-bot-3.png) After creation, click the **Request URL** button and copy the callback address. ## 3. Add **Bot** Capability to the App In the DingTalk Developer Console, click **Add App Capability** on the left sidebar, and add the **Bot** capability to the internal enterprise app you just created. ![Image 4](/imgs/dingtalk-bot-4.png) ## 4. Configure Bot Callback Address Click the **Bot** capability on the left sidebar, then set the **Message Receiving Mode** at the bottom to **HTTP Mode**, and paste the FastGPT callback address you copied earlier as the message receiving address. ![Image 5](/imgs/dingtalk-bot-5.png) After debugging, click **Publish**. ## 5. Publish the App After the bot is published, you still need to publish the app version on the **Version Management and Publishing** page. ![Image 6](/imgs/dingtalk-bot-6.png) Click **Create New Version**, set the version number and description, then click save to publish. ![Image 7](/imgs/dingtalk-bot-7.png) Once the app is published, you can use the bot within your DingTalk enterprise. You can chat with the bot privately, or add the bot to a group and `@mention the bot` to start a conversation. ![Image 8](/imgs/dingtalk-bot-8.png) ## FAQ ### How to start a new chat history To reset your chat history, send a `Reset` message to the bot (case-sensitive), and the bot will start a new chat history. file: ./content/guide/build/publish/dingtalk.mdx meta: { "title": "接入钉钉机器人教程", "description": "FastGPT 接入钉钉机器人教程" } 从 4.8.16 版本起,FastGPT 商业版支持直接接入钉钉机器人,无需额外的 API。 ## 1. 创建钉钉企业内部应用 1. 在[钉钉开发者后台](https://open-dev.dingtalk.com/fe/app)创建企业内部应用。 ![图片1](/imgs/dingtalk-bot-1.png) 2. 获取**Client ID**和**Client Secret**。 ![图片2](/imgs/dingtalk-bot-2.png) ## 2. 为 FastGPT 添加发布渠道 在 FastGPT 中选择要接入的应用,在**发布渠道**页面,新建一个接入钉钉机器人的发布渠道。 将前面拿到的 **Client ID** 和 **Client Secret** 填入配置弹窗中。 ![图片3](/imgs/dingtalk-bot-3.png) 创建完成后,点击**请求地址**按钮,然后复制回调地址。 ## 3. 为应用添加**机器人**应用能力。 在钉钉开发者后台,点击左侧**添加应用能力**,为刚刚创建的企业内部应用添加 **机器人** 应用能力。 ![图片4](/imgs/dingtalk-bot-4.png) ## 4. 配置机器人回调地址 点击左侧**机器人** 应用能力,然后将底部**消息接受模式**设置为**HTTP模式**,消息接收地址填入前面复制的 FastGPT 的回调地址。 ![图片5](/imgs/dingtalk-bot-5.png) 调试完成后,点击**发布**。 ## 5. 发布应用 机器人发布后,还需要在**版本管理与发布**页面发布应用版本。 ![图片6](/imgs/dingtalk-bot-6.png) 点击**创建新版本**后,设置版本号和版本描述后点击保存发布即可。 ![图片7](/imgs/dingtalk-bot-7.png) 应用发布后,即可在钉钉企业中使用机器人功能,可对机器人私聊。或者在群组添加机器人后`@机器人`,触发对话。 ![图片8](/imgs/dingtalk-bot-8.png) ## FAQ ### 如何新开一个聊天记录 如果你想重置你的聊天记录,可以给机器人发送 `Reset` 消息(注意大小写),机器人会新开一个聊天记录。 file: ./content/guide/build/publish/feishu.en.mdx meta: { "title": "Lark Bot Integration", "description": "FastGPT Lark Bot Integration Tutorial" } Starting from version 4.8.10, FastGPT commercial edition supports direct Lark bot integration without additional APIs. ## 1. Create a Lark App Creating a free test enterprise makes debugging easier. 1. Create a custom enterprise app in the [Lark Open Platform](https://open.feishu.cn/app) developer console. ![Image](/imgs/feishu-bot-1.png) Add a **Bot** capability to the app. ## 2. Create a Publishing Channel in FastGPT In FastGPT, select the app you want to integrate. On the Publishing Channels page, create a new Lark bot publishing channel and fill in the basic information. ![Image](/imgs/feishu-bot-2.png) ## 3. Get App ID and App Secret In the Lark Open Platform developer console, find the App ID and App Secret for the custom enterprise app you just created, and enter them in the FastGPT publishing channel dialog. ![Image](/imgs/feishu-bot-3.png) Enter both parameters in the FastGPT configuration dialog. ![Image](/imgs/feishu-bot-4.png) (Optional) In the Lark Open Platform developer console, go to Events & Callbacks -> Encryption Strategy to get the Encrypt Key, and enter it in the Lark bot integration dialog. ![Image](/imgs/feishu-bot-5.png) The Encrypt Key encrypts communication between Lark servers and FastGPT. If using HTTPS, the Encrypt Key is not needed. If using HTTP, the Encrypt Key is recommended. The Verification Token is generated by default for source verification. However, we use Lark's officially recommended, more secure verification method, so this configuration can be ignored. ## 4. Configure Callback URL After creating the publishing channel, click **Request URL** and copy the corresponding request URL. In the Lark console, click `Events & Callbacks` on the left sidebar, click the edit icon next to `Configure Subscription Method`, and paste the copied request URL into the input field. | | | | | --------------------------------- | --------------------------------- | -------------------------------- | | ![Image](/imgs/feishu-bot-10.jpg) | ![Image](/imgs/feishu-bot-11.jpg) | ![Image](/imgs/feishu-bot-6.png) | ## 5. Configure Bot Callback Events and Permissions * Add the `Receive Message` event On the `Events & Callbacks` page, click `Add Event`. Search for `Receive Message`, or directly search for `im.message.receive_v1`, find the `Receive Message v2.0` event, check it, and click `Confirm Add`. After adding the event, add two permissions: click the corresponding permission, and a popup will prompt you to add permissions. Add the two permissions shown above. | | | | -------------------------------- | -------------------------------- | | ![Image](/imgs/feishu-bot-7.png) | ![Image](/imgs/feishu-bot-8.png) | It is not recommended to enable the two "legacy versions" shown above -- use the new version permissions instead. * If "Read messages users send to the bot in private chats" is enabled, private messages sent to the bot will be forwarded to FastGPT * If "Receive @bot message events in group chats" is enabled, messages @mentioning the bot in group chats will be forwarded to FastGPT * If (not recommended) "Get all messages in groups" is enabled, all group chat messages will be forwarded to FastGPT ## 6. Configure Reply Message Permission In the Lark console, click `Permission Management` on the left sidebar, enter `send message` in the search box, find the `Send messages as the app` permission, and enable it. ![](/imgs/feishu-bot-13.jpg) ## 7. Publish the Bot Click `Version Management & Publishing` on the left side of the Lark console to publish the bot. ![](/imgs/feishu-bot-12.jpg) You can then find your bot in the workspace. Next, add the bot to a group or chat with it privately. ![Image](/imgs/feishu-bot-9.png) ## FAQ ### Sent a message but no response 1. Check if the Lark bot callback URL, permissions, etc. are configured correctly. 2. Check FastGPT chat logs to see if there is a corresponding question record. 3. If there is a record but Lark does not respond, the bot is missing the required permissions. 4. If there is no record, the app may have encountered an error. Try the simplest bot first. (Lark bots cannot accept global variables, files, or image content as input) ### How to start a new chat history Lark bot chat history chatId comes from several sources: 1. Private chat window 2. Individual topics in Lark topic groups 3. In group chats, composed of group ID + personal ID. To reset your chat history, send a `Reset` message to the bot (case-sensitive), and the bot will start a new chat history. file: ./content/guide/build/publish/feishu.mdx meta: { "title": "接入飞书机器人教程", "description": "FastGPT 接入飞书机器人教程" } 从 4.8.10 版本起,FastGPT 商业版支持直接接入飞书机器人,无需额外的 API。 ## 1. 申请飞书应用 开一个免费的测试企业更方便进行调试。 1. 在[飞书开放平台](https://open.feishu.cn/app)的开发者后台申请企业自建应用。 ![图片](/imgs/feishu-bot-1.png) 添加一个**机器人**应用。 ## 2. 在 FastGPT 新建发布渠道 在fastgpt中选择想要接入的应用,在 发布渠道 页面,新建一个接入飞书机器人的发布渠道,填写好基础信息。 ![图片](/imgs/feishu-bot-2.png) ## 3. 获取应用的 App ID, App Secret 两个凭证 在飞书开放平台开发者后台,刚刚创建的企业自建应用中,找到 App ID 和 App Secret,填入 FastGPT 新建发布渠道的对话框里面。 ![图片](/imgs/feishu-bot-3.png) 填入两个参数到 FastGPT 配置弹窗中。 ![图片](/imgs/feishu-bot-4.png) (可选)在飞书开放平台开发者后台,点击事件与回调 -> 加密策略 获取 Encrypt Key,并填入飞书机器人接入的对话框里面 ![图片](/imgs/feishu-bot-5.png) Encrypt Key 用于加密飞书服务器与 FastGPT 之间通信。 建议如果使用 Https 协议,则不需要 Encrypt Key。如果使用 Http 协议通信,则建议使用 Encrypt Key Verification Token 默认生成的这个 Token 用于校验来源。但我们使用飞书官方推荐的另一种更为安全的校验方式,因此可以忽略这个配置项。 ## 4. 配置回调地址 新建好发布渠道后,点击**请求地址**,复制对应的请求地址。 在飞书控制台,点击左侧的 `事件与回调` ,点击`配置订阅方式`旁边的编辑 icon,粘贴刚刚复制的请求地址到输入框中。 | | | | | ------------------------------ | ------------------------------ | ----------------------------- | | ![图片](/imgs/feishu-bot-10.jpg) | ![图片](/imgs/feishu-bot-11.jpg) | ![图片](/imgs/feishu-bot-6.png) | ## 5. 配置机器人回调事件和权限 * 添加 `接收消息` 事件 在`事件与回调`页面,点击`添加事件`。 搜索`接收消息`,或者直接搜索 `im.message.receive_v1` ,找到`接收消息 v2.0`的时间,勾选上并点击`确认添加`。 添加事件后,增加两个权限:点击对应权限,会有弹窗提示添加权限,添加上图两个权限。 | | | | ----------------------------- | ----------------------------- | | ![图片](/imgs/feishu-bot-7.png) | ![图片](/imgs/feishu-bot-8.png) | 不推荐启用上图中的两个“历史版本”,而是使用新版本的权限。 * 若开启 “读取用户发给机器人的单聊消息”, 则单聊发送给机器人的消息将被送到 FastGPT * 若开启 “接收群聊中@机器人消息事件”, 则群聊中@机器人的消息将被送到 FastGPT * 若开启(不推荐开启)“获取群组中所有消息”,则群聊中所有消息都将被送到 FastGPT ## 6. 配置回复消息权限 在飞书控制台,点击左侧的 `权限管理` ,搜索框中输入`发消息`,找到`以应用的身份发消息`的权限,点击开通权限。 ![](/imgs/feishu-bot-13.jpg) ## 7. 发布机器人 点击飞书控制台左侧的`版本管理与发布`,即可发布机器人。 ![](/imgs/feishu-bot-12.jpg) 然后就可以在工作台里找到你的机器人啦。接下来就是把机器人拉进群组,或者单独与它对话。 ![图片](/imgs/feishu-bot-9.png) ## FAQ ### 发送了消息,没响应 1. 检查飞书机器人回调地址、权限等是否正确。 2. 查看 FastGPT 对话日志,是否有对应的提问记录 3. 如果有记录,飞书没回应,则是没给机器人开权限。 4. 如果没记录,则可能是应用运行报错了,可以先试试最简单的机器人。(飞书机器人无法输入全局变量、文件、图片内容) ### 如何新开一个聊天记录 飞书机器人的聊天记录 chatId 包含几种来源: 1. 私聊聊天框 2. 飞书话题群中单个话题 3. 群组聊天中,由群 id+个人id 组成。 如果你想重置你的聊天记录,可以给机器人发送 `Reset` 消息(注意大小写),机器人会新开一个聊天记录。 file: ./content/guide/build/publish/link.en.mdx meta: { "title": "Share Link Publishing", "description": "FastGPT share link publishing" } ## Introduction A share link creates a temporary public URL that lets anyone on the internet use your app. FastGPT creates a temporary identity for each visitor to isolate users from each other. Usage is billed to the team that owns the app, so avoid sharing the link publicly unless intended. ## Usage Flow ### 1. Create a Link Go to `App Details` -> `Publish Channels` -> `Share Link`, then create a new link. Enter a name to create the link. The name is only used for display in the record list. ![alt text](/imgs/image.png) ### 2. Copy the Link Click Start Using to open the share link, then copy and share it as needed. ![alt text](/imgs/image-1.png) ## Parameter Configuration Some parameters are only available in the commercial edition. * Name: The display name of the link record. * Expiration time: The link becomes unavailable after this time. * QPM: The maximum number of requests per minute for each user. * Credit limit: The maximum billable usage generated by this link. * Identity verification: Used to integrate with third-party systems for identity authentication and chat callbacks. * Real-time running status: Whether to show currently running nodes. * View quoted chunks: See the system introduction. * View full quoted content: See the system introduction. * Download/open original source: See the system introduction. ## Share Link Authentication ### Introduction In FastGPT V4.6.4, we changed how share links read data. A `localId` is generated for each user to identify them and pull chat history from the cloud. However, this only works on the same device and browser -- switching devices or clearing browser cache will lose those records. Due to this limitation, we only allow users to pull the last `20` records from the past `30 days`. Share link authentication is designed to quickly and securely integrate FastGPT's chat interface into your existing system with just 2 endpoints. This feature is only available in the commercial edition. ### Usage Guide In the share link configuration, you can optionally fill in the `Identity Verification` field. This is the root URL for a `POST` request. Once configured, share link initialization, chat start, and chat completion will all send requests to specific endpoints under this URL. Below, we use `host` to represent the `identity verification root URL`. Your server only needs to return whether verification succeeded -- no other data is required. The format is as follows: #### Unified Response Format ```jsonc { "success": true, "message": "Error message", "msg": "Same as message, error message", "data": { "uid": "Unique user identifier" // Required } } ``` `FastGPT` checks whether `success` is `true` to decide if the user can proceed. `message` and `msg` are equivalent -- you can return either one. When `success` is not `true`, this error message will be displayed to the user. `uid` is the unique user identifier and must be returned. The ID format must be a string that does not contain `|`, `/`, or `\\` characters, with a length of 255 **bytes** or less. Otherwise, an `Invalid UID` error will be returned. The `uid` is used to pull and save chat history -- see the practical example below. #### Flow Diagram ![](/imgs/sharelink_process.png) ### Configuration Guide #### 1. Configure the Identity Verification URL ![](/imgs/share-setlink.png) Once configured, every time the share link is used, verification and reporting requests will be sent to the corresponding endpoints. You only need to configure the root URL here -- no need to specify the full request path. #### 2. Add an Extra Query Parameter to the Share Link Add an extra parameter `authToken` to the share link URL. For example: Original link: `https://share.fastgpt.io/chat/share?shareId=648aaf5ae121349a16d62192` Full link: `https://share.fastgpt.io/chat/share?shareId=648aaf5ae121349a16d62192&authToken=userid12345` This `authToken` is typically a unique user credential (such as a token) generated by your system. FastGPT will include `token=[authToken]` in the `body` of the verification request. #### 3. Implement the Chat Initialization Verification Endpoint ```bash curl --location --request POST '{{host}}/shareAuth/init' \ --header 'Content-Type: application/json' \ --data-raw '{ "token": "[authToken]" }' ``` ```json { "success": true, "data": { "uid": "Unique user identifier" } } ``` The system will pull chat history for uid `username123` under this share link. ```json { "success": false, "message": "Authentication failed" } ``` #### 4. Implement the Pre-Chat Verification Endpoint ```bash curl --location --request POST '{{host}}/shareAuth/start' \ --header 'Content-Type: application/json' \ --data-raw '{ "token": "[authToken]", "question": "User question", }' ``` ```json { "success": true, "data": { "uid": "Unique user identifier" } } ``` ```json { "success": false, "message": "Authentication failed" } ``` ```json { "success": false, "message": "Content policy violation" } ``` #### 5. Implement the Chat Result Reporting Endpoint (Optional) This endpoint has no required response format. The response data follows the same format as the [chat endpoint](../../../openapi/intro.en.mdx#response), with an additional `token` field. Key fields to note: `totalPoints` (total AI credits consumed), `token` (total token consumption) ```bash curl --location --request POST '{{host}}/shareAuth/finish' \ --header 'Content-Type: application/json' \ --data-raw '{ "token": "[authToken]", "responseData": [ { "moduleName": "core.module.template.Dataset search", "moduleType": "datasetSearchNode", "totalPoints": 1.5278, "query": "导演是谁\n《铃芽之旅》的导演是谁?\n这部电影的导演是谁?\n谁是《铃芽之旅》的导演?", "model": "Embedding-2(旧版,不推荐使用)", "tokens": 1524, "similarity": 0.83, "limit": 400, "searchMode": "embedding", "searchUsingReRank": false, "extensionModel": "FastAI-4k", "extensionResult": "《铃芽之旅》的导演是谁?\n这部电影的导演是谁?\n谁是《铃芽之旅》的导演?", "runningTime": 2.15 }, { "moduleName": "AI 对话", "moduleType": "chatNode", "totalPoints": 0.593, "model": "FastAI-4k", "tokens": 593, "query": "导演是谁", "maxToken": 2000, "quoteList": [ { "id": "65bb346a53698398479a8854", "q": "导演是谁?", "a": "电影《铃芽之旅》的导演是新海诚。", "chunkIndex": 0, "datasetId": "65af9b947916ae0e47c834d2", "collectionId": "65bb345c53698398479a868f", "sourceName": "dataset - 2024-01-23T151114.198.csv", "sourceId": "65bb345b53698398479a868d", "score": [ { "type": "embedding", "value": 0.9377183318138123, "index": 0 }, { "type": "rrf", "value": 0.06557377049180328, "index": 0 } ] } ], "historyPreview": [ { "obj": "Human", "value": "使用 标记中的内容作为本次对话的参考:\n\n\n导演是谁?\n电影《铃芽之旅》的导演是新海诚。\n------\n电影《铃芽之旅》的编剧是谁?22\n新海诚是本片的编剧。\n------\n电影《铃芽之旅》的女主角是谁?\n电影的女主角是铃芽。\n------\n电影《铃芽之旅》的制作团队中有哪位著名人士?2\n川村元气是本片的制作团队成员之一。\n------\n你是谁?\n我是电影《铃芽之旅》助手\n------\n电影《铃芽之旅》男主角是谁?\n电影《铃芽之旅》男主角是宗像草太,由松村北斗配音。\n------\n电影《铃芽之旅》的作者新海诚写了一本小说,叫什么名字?\n小说名字叫《铃芽之旅》。\n------\n电影《铃芽之旅》的女主角是谁?\n电影《铃芽之旅》的女主角是岩户铃芽,由原菜乃华配音。\n------\n电影《铃芽之旅》的故事背景是什么?\n日本\n------\n谁担任电影《铃芽之旅》中岩户环的配音?\n深津绘里担任电影《铃芽之旅》中岩户环的配音。\n\n\n回答要求:\n- 如果你不清楚答案,你需要澄清。\n- 避免提及你是从 获取的知识。\n- 保持答案与 中描述的一致。\n- 使用 Markdown 语法优化回答格式。\n- 使用与问题相同的语言回答。\n\n问题:\"\"\"导演是谁\"\"\"" }, { "obj": "AI", "value": "电影《铃芽之旅》的导演是新海诚。" } ], "contextTotalLen": 2, "runningTime": 1.32 } ] }' ``` **Full responseData Field Reference:** ```ts type ResponseType = { moduleType: FlowNodeTypeEnum; // Module type moduleName: string; // Module name moduleLogo?: string; // Logo runningTime?: number; // Running time query?: string; // User question / search query textOutput?: string; // Text output tokens?: number; // Total context tokens model?: string; // Model used contextTotalLen?: number; // Total context length totalPoints?: number; // Total AI credits consumed temperature?: number; // Temperature maxToken?: number; // Model max tokens quoteList?: SearchDataResponseItemType[]; // Citation list historyPreview?: ChatItemMiniType[]; // Context preview (history may be truncated) similarity?: number; // Minimum similarity threshold limit?: number; // Max citation tokens searchMode?: `${DatasetSearchModeEnum}`; // Search mode searchUsingReRank?: boolean; // Whether rerank is used extensionModel?: string; // Query expansion model extensionResult?: string; // Query expansion result extensionTokens?: number; // Query expansion total token length cqList?: ClassifyQuestionAgentItemType[]; // Question classification list cqResult?: string; // Question classification result extractDescription?: string; // Content extraction description extractResult?: Record; // Content extraction result params?: Record; // HTTP module params body?: Record; // HTTP module body headers?: Record; // HTTP module headers httpResult?: Record; // HTTP module result pluginOutput?: Record; // Plugin output pluginDetail?: ChatHistoryItemResType[]; // Plugin details isElseResult?: boolean; // Conditional result }; ``` ### Practical Example We'll use [Laf as the server](https://laf.dev/) to demonstrate how these 3 endpoints work. #### 1. Create 3 Laf Endpoints ![](/imgs/share-auth1.png) In this endpoint, we require `token` to equal `fastgpt` to pass verification. (Not recommended for production -- avoid hardcoding values.) ```ts import cloud from '@lafjs/cloud'; export default async function (ctx: FunctionContext) { const { token } = ctx.body; // Token decoding logic omitted if (token === 'fastgpt') { return { success: true, data: { uid: 'user1' } }; } return { success: false, message: 'Authentication failed' }; } ``` In this endpoint, we require `token` to equal `fastgpt` to pass verification. Additionally, if the question contains a specific character, it returns an error to simulate content moderation. ```ts import cloud from '@lafjs/cloud'; export default async function (ctx: FunctionContext) { const { token, question } = ctx.body; // Token decoding logic omitted if (token !== 'fastgpt') { return { success: false, message: 'Authentication failed' }; } if (question.includes('你')) { return { success: false, message: 'Content policy violation' }; } return { success: true, data: { uid: 'user1' } }; } ``` The result reporting endpoint can handle custom logic as needed. ```ts import cloud from '@lafjs/cloud'; export default async function (ctx: FunctionContext) { const { token, responseData } = ctx.body; const total = responseData.reduce((sum, item) => sum + item.price, 0); const amount = total / 100000; // Database operations omitted return {}; } ``` #### 2. Configure the Verification URL Copy any of the 3 endpoint URLs, e.g. `https://d8dns0.laf.dev/shareAuth/finish`, remove the `/shareAuth/finish` part, and enter the root URL `https://d8dns0.laf.dev` in the `Identity Verification` field. ![](/imgs/share-auth2.jpg) #### 3. Modify the Share Link Parameters Original share link: `https://share.fastgpt.io/chat/share?shareId=64be36376a438af0311e599c` Modified: `https://share.fastgpt.io/chat/share?shareId=64be36376a438af0311e599c&authToken=fastgpt` #### 4. Test the Result 1. Opening the original link or a link where `authToken` does not equal `fastgpt` will show an authentication error. 2. Sending content that contains the filtered character will show a content policy violation error. ### Use Cases This authentication method is typically used to embed the `share link` directly into your application. Before opening the share link in your app, you should append the `authToken` parameter. Beyond integrating with your existing user system, you can also implement a `balance` feature -- deduct user balance via the `result reporting` endpoint and check user balance via the `pre-chat verification` endpoint. file: ./content/guide/build/publish/link.mdx meta: { "title": "免登录窗口发布", "description": "FastGPT 免登录窗口发布" } ## 介绍 免登录窗口可以创建一个临时可访问的地址,任何互联网上的用户可以通过该地址来使用应用。产生的费用产生在应用归属的团队下,所以请注意不要随意分享。 系统会为每个用户生成一个 localId,用于标识用户,从云端拉取对话记录。但是这种方式仅能保障用户在同一设备同一浏览器中使用,如果切换设备或者清空浏览器缓存则会丢失这些记录。这种方式存在一定的风险,因此我们仅允许用户拉取近 `30天` 的 `20条` 记录。 ## 使用流程 ### 1. 创建链接 在 `应用详情` - `发布渠道` - `免登录窗口` 中,创建新链接。 填写名称后即可创建,该名称仅用于记录展示。 ![alt text](/imgs/image.png) ### 2. 复制链接 点击开始使用,即可打开使用链接,复制后即可使用。 ![alt text](/imgs/image-1.png) ## 参数配置 部分参数仅商业版支持配置。 * 名称:仅用于记录该链接的名称,用于展示 * 过期时间:超过该时间后,链接无法使用。 * QPM: 每个用户每分钟最大访问次数。 * 积分上限:该链接产生的最大计费数据。 * 身份验证:便于接入第三方系统进行身份认证和对话回调。 * 实时运行状态:是否展示当前运行的节点。 * 查看引用片段:见系统介绍 * 查看引用全文:见系统介绍 * 下载/打开来源原文:见系统介绍 ## 身份验证说明 分享链接身份验证设计的目的在于,将 FastGPT 的对话框快速、安全的接入到你现有的系统中,仅需 2 个接口即可实现。该功能目前只在商业版中提供。 ### 使用说明 免登录链接配置中,你可以选择填写 `身份验证` 栏。这是一个 `POST` 请求的根地址。在填写该地址后,分享链接的初始化、开始对话以及对话结束都会向该地址的特定接口发送一条请求。下面以 `host` 来表示 `凭身份验证根地址`。服务器接口仅需返回是否校验成功即可,不需要返回其他数据,格式如下: #### 接口统一响应格式 ```jsonc { "success": true, "message": "错误提示", "msg": "同message, 错误提示", "data": { "uid": "用户唯一凭证" // 必须返回 } } ``` `FastGPT` 将会判断 `success` 是否为 `true` 决定是允许用户继续操作。`message` 与 `msg` 是等同的,你可以选择返回其中一个,当 `success` 不为 `true` 时,将会提示这个错误。 `uid` 是用户的唯一凭证,必须返回该 ID 且 ID 的格式为不包含 "|"、"/“、"\\" 字符的、小于等于 255 **字节长度**的字符串,否则会返回 `Invalid UID` 的错误。`uid` 将会用于拉取对话记录以及保存对话记录,可参考下方实践案例。 #### 触发流程 ![](/imgs/sharelink_process.png) ### 配置教程 #### 1. 配置身份校验地址 ![](/imgs/share-setlink.png) 配置校验地址后,在每次分享链接使用时,都会向对应的地址发起校验和上报请求。 这里仅需配置根地址,无需具体到完整请求路径。 #### 2. 分享链接中增加额外 query 在分享链接的地址中,增加一个额外的参数: authToken。例如: 原始的链接:`https://share.fastgpt.io/chat/share?shareId=648aaf5ae121349a16d62192` 完整链接: `https://share.fastgpt.io/chat/share?shareId=648aaf5ae121349a16d62192&authToken=userid12345` 这个 `authToken` 通常是你系统生成的用户唯一凭证(Token 之类的)。FastGPT 会在鉴权接口的 `body` 中携带 token=\[authToken] 的参数。 #### 3. 编写聊天初始化校验接口 ```bash curl --location --request POST '{{host}}/shareAuth/init' \ --header 'Content-Type: application/json' \ --data-raw '{ "token": "[authToken]" }' ``` ```json { "success": true, "data": { "uid": "用户唯一凭证" } } ``` 系统会拉取该分享链接下,uid 为 username123 的对话记录。 ```json { "success": false, "message": "身份错误" } ``` #### 4. 编写对话前校验接口 ```bash curl --location --request POST '{{host}}/shareAuth/start' \ --header 'Content-Type: application/json' \ --data-raw '{ "token": "[authToken]", "question": "用户问题", }' ``` ```json { "success": true, "data": { "uid": "用户唯一凭证" } } ``` ```json { "success": false, "message": "身份验证失败" } ``` ```json { "success": false, "message": "存在违规词" } ``` #### 5. 编写对话结果上报接口(可选) 该接口无规定返回值。 响应值与 [chat 接口格式相同](../../../openapi/intro.mdx#响应),仅多了一个 `token`。 重点关注:`totalPoints` (总消耗 AI 积分),`token` (Token 消耗总数) ```bash curl --location --request POST '{{host}}/shareAuth/finish' \ --header 'Content-Type: application/json' \ --data-raw '{ "token": "[authToken]", "responseData": [ { "moduleName": "core.module.template.Dataset search", "moduleType": "datasetSearchNode", "totalPoints": 1.5278, "query": "导演是谁\n《铃芽之旅》的导演是谁?\n这部电影的导演是谁?\n谁是《铃芽之旅》的导演?", "model": "Embedding-2(旧版,不推荐使用)", "tokens": 1524, "similarity": 0.83, "limit": 400, "searchMode": "embedding", "searchUsingReRank": false, "extensionModel": "FastAI-4k", "extensionResult": "《铃芽之旅》的导演是谁?\n这部电影的导演是谁?\n谁是《铃芽之旅》的导演?", "runningTime": 2.15 }, { "moduleName": "AI 对话", "moduleType": "chatNode", "totalPoints": 0.593, "model": "FastAI-4k", "tokens": 593, "query": "导演是谁", "maxToken": 2000, "quoteList": [ { "id": "65bb346a53698398479a8854", "q": "导演是谁?", "a": "电影《铃芽之旅》的导演是新海诚。", "chunkIndex": 0, "datasetId": "65af9b947916ae0e47c834d2", "collectionId": "65bb345c53698398479a868f", "sourceName": "dataset - 2024-01-23T151114.198.csv", "sourceId": "65bb345b53698398479a868d", "score": [ { "type": "embedding", "value": 0.9377183318138123, "index": 0 }, { "type": "rrf", "value": 0.06557377049180328, "index": 0 } ] } ], "historyPreview": [ { "obj": "Human", "value": "使用 标记中的内容作为本次对话的参考:\n\n\n导演是谁?\n电影《铃芽之旅》的导演是新海诚。\n------\n电影《铃芽之旅》的编剧是谁?22\n新海诚是本片的编剧。\n------\n电影《铃芽之旅》的女主角是谁?\n电影的女主角是铃芽。\n------\n电影《铃芽之旅》的制作团队中有哪位著名人士?2\n川村元气是本片的制作团队成员之一。\n------\n你是谁?\n我是电影《铃芽之旅》助手\n------\n电影《铃芽之旅》男主角是谁?\n电影《铃芽之旅》男主角是宗像草太,由松村北斗配音。\n------\n电影《铃芽之旅》的作者新海诚写了一本小说,叫什么名字?\n小说名字叫《铃芽之旅》。\n------\n电影《铃芽之旅》的女主角是谁?\n电影《铃芽之旅》的女主角是岩户铃芽,由原菜乃华配音。\n------\n电影《铃芽之旅》的故事背景是什么?\n日本\n------\n谁担任电影《铃芽之旅》中岩户环的配音?\n深津绘里担任电影《铃芽之旅》中岩户环的配音。\n\n\n回答要求:\n- 如果你不清楚答案,你需要澄清。\n- 避免提及你是从 获取的知识。\n- 保持答案与 中描述的一致。\n- 使用 Markdown 语法优化回答格式。\n- 使用与问题相同的语言回答。\n\n问题:\"\"\"导演是谁\"\"\"" }, { "obj": "AI", "value": "电影《铃芽之旅》的导演是新海诚。" } ], "contextTotalLen": 2, "runningTime": 1.32 } ] }' ``` **responseData 完整字段说明:** ```ts type ResponseType = { moduleType: FlowNodeTypeEnum; // 模块类型 moduleName: string; // 模块名 moduleLogo?: string; // logo runningTime?: number; // 运行时间 query?: string; // 用户问题/检索词 textOutput?: string; // 文本输出 tokens?: number; // 上下文总Tokens model?: string; // 使用到的模型 contextTotalLen?: number; // 上下文总长度 totalPoints?: number; // 总消耗AI积分 temperature?: number; // 温度 maxToken?: number; // 模型的最大token quoteList?: SearchDataResponseItemType[]; // 引用列表 historyPreview?: ChatItemMiniType[]; // 上下文预览(历史记录会被裁剪) similarity?: number; // 最低相关度 limit?: number; // 引用上限token searchMode?: `${DatasetSearchModeEnum}`; // 搜索模式 searchUsingReRank?: boolean; // 是否使用rerank extensionModel?: string; // 问题扩展模型 extensionResult?: string; // 问题扩展结果 extensionTokens?: number; // 问题扩展总字符长度 cqList?: ClassifyQuestionAgentItemType[]; // 分类问题列表 cqResult?: string; // 分类问题结果 extractDescription?: string; // 内容提取描述 extractResult?: Record; // 内容提取结果 params?: Record; // HTTP模块params body?: Record; // HTTP模块body headers?: Record; // HTTP模块headers httpResult?: Record; // HTTP模块结果 pluginOutput?: Record; // 插件输出 pluginDetail?: ChatHistoryItemResType[]; // 插件详情 isElseResult?: boolean; // 判断器结果 }; ``` ### 实践案例 我们以 [Laf 作为服务器为例](https://laf.dev/),简单展示这 3 个接口的使用方式。 #### 1. 创建 3 个 Laf 接口 ![](/imgs/share-auth1.png) 这个接口中,我们设置了 `token` 必须等于 `fastgpt` 才能通过校验。(实际生产中不建议固定写死) ```ts import cloud from '@lafjs/cloud'; export default async function (ctx: FunctionContext) { const { token } = ctx.body; // 此处省略 token 解码过程 if (token === 'fastgpt') { return { success: true, data: { uid: 'user1' } }; } return { success: false, message: '身份错误' }; } ``` 这个接口中,我们设置了 `token` 必须等于 `fastgpt` 才能通过校验。并且如果问题中包含了 `你` 字,则会报错,用于模拟敏感校验。 ```ts import cloud from '@lafjs/cloud'; export default async function (ctx: FunctionContext) { const { token, question } = ctx.body; // 此处省略 token 解码过程 if (token !== 'fastgpt') { return { success: false, message: '身份错误' }; } if (question.includes('你')) { return { success: false, message: '内容不合规' }; } return { success: true, data: { uid: 'user1' } }; } ``` 结果上报接口可自行进行逻辑处理。 ```ts import cloud from '@lafjs/cloud'; export default async function (ctx: FunctionContext) { const { token, responseData } = ctx.body; const total = responseData.reduce((sum, item) => sum + item.price, 0); const amount = total / 100000; // 省略数据库操作 return {}; } ``` #### 2. 配置校验地址 我们随便复制 3 个地址中一个接口: `https://d8dns0.laf.dev/shareAuth/finish` , 去除 `/shareAuth/finish` 后填入 `身份校验` : `https://d8dns0.laf.dev` ![](/imgs/share-auth2.jpg) #### 3. 修改分享链接参数 源分享链接:`https://share.fastgpt.io/chat/share?shareId=64be36376a438af0311e599c` 修改后:`https://share.fastgpt.io/chat/share?shareId=64be36376a438af0311e599c&authToken=fastgpt` #### 4. 测试效果 1. 打开源链接或者 `authToken` 不等于 `fastgpt` 的链接会提示身份错误。 2. 发送内容中包含你字,会提示内容不合规。 ### 使用场景 这个鉴权方式通常是帮助你直接嵌入 `分享链接` 到你的应用中,在你的应用打开分享链接前,应做 `authToken` 的拼接后再打开。 除了对接已有系统的用户外,你还可以对接 `余额` 功能,通过 `结果上报` 接口扣除用户余额,通过 `对话前校验` 接口检查用户的余额。 file: ./content/guide/build/publish/mcp_server.en.mdx meta: { "title": "MCP Server", "description": "A quick overview of FastGPT MCP Server" } ## What is MCP Server? MCP (Model Context Protocol) was released by Anthropic in early November 2024. It standardizes communication between AI models and external systems, simplifying integration. With OpenAI officially supporting MCP, more and more AI vendors are adopting the protocol. MCP has two main components: Client and Server. The Client is the AI model consumer — it uses MCP Client to give the model the ability to call external systems. The Server provides and runs those external system integrations. FastGPT's MCP Server feature lets you select `multiple` applications built on FastGPT and expose them via MCP protocol for external consumption. Currently, FastGPT's MCP Server uses the SSE transport protocol, with plans to migrate to `HTTP Streamable` in the future. ## Using MCP Server in FastGPT ### 1. Create an MCP Server After logging into FastGPT, open `Workspace` and click `MCP Server` to access the management page. Here you can see all your MCP Servers and the number of applications each one manages. ![Create MCP server](/imgs/mcp_server1.png) You can customize the MCP Server name and select which applications to associate. | | | | -------------------------- | -------------------------- | | ![](/imgs/mcp_server2.png) | ![](/imgs/mcp_server3.png) | ### 2. Get the MCP Server URL After creating an MCP Server, click `Start Using` to get the access URL. | | | | -------------------------- | -------------------------- | | ![](/imgs/mcp_server4.png) | ![](/imgs/mcp_server5.png) | #### 3. Use the MCP Server Use the URL in any MCP-compatible client to call your FastGPT applications — for example, `Cursor` or `Cherry Studio`. Here's how to set it up in Cursor. Open Cursor's settings page and click MCP to enter the MCP configuration page. Click the new MCP Server button to open a JSON configuration file. Paste the `integration script` from step 2 into the `JSON file` and save. Return to Cursor's MCP management page and you'll see your MCP Server listed. Make sure to set it to `enabled`. | | | | | -------------------------- | -------------------------- | -------------------------- | | ![](/imgs/mcp_server6.png) | ![](/imgs/mcp_server7.png) | ![](/imgs/mcp_server8.png) | Open Cursor's chat panel and switch to `Agent` mode — only this mode triggers MCP Server calls. After sending a question about `fastgpt`, you'll see Cursor invoke an MCP tool (described as: query fastgpt knowledge base), which calls the FastGPT application to process the question and return results. | | | | -------------------------- | --------------------------- | | ![](/imgs/mcp_server9.png) | ![](/imgs/mcp_server10.png) | ## Self-Hosted MCP Server Setup Self-hosted FastGPT deployments require version `v4.9.6` or higher to use MCP Server. ### Update docker-compose.yml Add the `fastgpt-mcp-server` service to your `docker-compose.yml`: ```yml fastgpt-mcp-server: container_name: fastgpt-mcp-server image: ghcr.io/labring/fastgpt-mcp_server:latest ports: - 3005:3000 networks: - fastgpt restart: always environment: - FASTGPT_ENDPOINT=http://fastgpt:3000 ``` ### Update FastGPT Container Environment Variables Configure `SSE_MCP_SERVER_PROXY_ENDPOINT` in the FastGPT container. Set it to the client-accessible `fastgpt-mcp-server` URL without a trailing `/`. For example: ```yaml environment: SSE_MCP_SERVER_PROXY_ENDPOINT: https://mcp.fastgpt.cn ``` ### Restart FastGPT Restart FastGPT after changing the environment variable: ```bash docker-compose down docker-compose up -d ``` After restarting, the MCP Server option will appear in the Workspace. file: ./content/guide/build/publish/mcp_server.mdx meta: { "title": "MCP 发布", "description": "快速了解 FastGPT MCP server" } ## MCP server 介绍 MCP 协议(Model Context Protocol),是由 Anthropic 在 2024 年 11 月初发布的协议。它的目的在于统一 AI 模型与外部系统之间的通信方式,从而简化 AI 模型与外部系统之间的通信问题。随着 OpenAI 官宣支持 MCP 协议,越来越多的 AI 厂商开始支持 MCP 协议。 MCP 协议主要包含 Client 和 Server 两部分。简单来说,Client 是使用 AI 模型的一方,它通过 MCP Client 可以给模型提供一些调用外部系统的能能力;Server 是提供外部系统调用的一方,也就是实际运行外部系统的一方。 FastGPT MCP Server 功能允许你选择 `多个` 在 FastGPT 上构建好的应用,以 MCP 协议对外提供调用 FastGPT 应用的能力。 目前 FastGPT 提供的 MCP server 为 SSE 通信协议,未来将会替换成 `HTTP streamable`。 ## FastGPT 使用 MCP server ### 1. 创建 MCP server 登录 FastGPT 后,打开 `工作台`,点击 `MCP server`,即可进入管理页面,这里可以看到你创建的所有 MCP server,以及他们管理的应用数量。 ![创建 MCP server](/imgs/mcp_server1.png) 可以自定义 MCP server 名称和选择关联的应用 | | | | -------------------------- | -------------------------- | | ![](/imgs/mcp_server2.png) | ![](/imgs/mcp_server3.png) | ### 2. 获取 MCP server 地址 创建好 MCP server 后,可以直接点击 `开始使用`,即可获取 MCP server 访问地址。 | | | | -------------------------- | -------------------------- | | ![](/imgs/mcp_server4.png) | ![](/imgs/mcp_server5.png) | #### 3. 使用 MCP server 可以在支持 MCP 协议的客户端使用这些地址,来调用 FastGPT 应用,例如:`Cursor`、`Cherry Studio`。下面以 Cursor 为例,介绍如何使用 MCP server。 打开 Cursor 配置页面,点击 MCP 即可进入 MCP 配置页面,可以点击新建 MCP server 按钮,会跳转到一个 JSON 配置文件,将第二步的 `接入脚本` 复制到 `json 文件` 中,保存文件。 此时返回 Cursor 的 MCP 管理页面,即可看到你创建的 MCP server,记得设成 `enabled` 状态。 | | | | | -------------------------- | -------------------------- | -------------------------- | | ![](/imgs/mcp_server6.png) | ![](/imgs/mcp_server7.png) | ![](/imgs/mcp_server8.png) | 打开 Cursor 的对话框,切换成 `Agent` 模型,只有这个模型,cursor 才会调用 MCP server。\ 发送一个关于 `fastgpt` 的问题后,可以看到,cursor 调用了一个 MCP 工具(描述为:查询 fastgpt 知识库),也就是调用 FastGPT 应用去进行处理该问题,并返回了结果。 | | | | -------------------------- | --------------------------- | | ![](/imgs/mcp_server9.png) | ![](/imgs/mcp_server10.png) | ## 私有化部署 MCP server 问题 私有化部署版本的 FastGPT,需要升级到 `v4.9.6` 及以上版本才可使用 MCP server 功能。 ### 修改 docker-compose.yml 文件 在 `docker-compose.yml` 文件中,加入 `fastgpt-mcp-server` 服务: ```yml fastgpt-mcp-server: container_name: fastgpt-mcp-server image: ghcr.io/labring/fastgpt-mcp_server:latest ports: - 3005:3000 networks: - fastgpt restart: always environment: - FASTGPT_ENDPOINT=http://fastgpt:3000 ``` ### 修改 FastGPT 容器环境变量 在 FastGPT 容器中配置 `SSE_MCP_SERVER_PROXY_ENDPOINT`,值为客户端可访问的 `fastgpt-mcp-server` 地址,末尾不要携带 `/`,例如: ```yaml environment: SSE_MCP_SERVER_PROXY_ENDPOINT: https://mcp.fastgpt.cn ``` ### 重启 FastGPT 容器 修改环境变量后,需要重启 FastGPT 服务。启动后,可以在工作台看到 MCP server 服务选项。 ```bash docker-compose down docker-compose up -d ``` file: ./content/guide/build/publish/official_account.en.mdx meta: { "title": "WeChat Official Account Integration", "description": "FastGPT WeChat Official Account Integration Tutorial" } Starting from version 4.8.10, FastGPT commercial edition supports direct WeChat Official Account integration without additional APIs. **Note: Currently only verified official accounts are supported (both Service Accounts and Subscription Accounts).** ## 1. Create a Publishing Channel in FastGPT In FastGPT, select the app you want to integrate. On the *Publishing Channels* page, create a new WeChat Official Account publishing channel and fill in the basic information. ![Image](/imgs/offiaccount-1.png) ## 2. Get AppID, Secret, and Token ### 1. Log in to the WeChat Official Account Platform and select your account. Open the WeChat Official Account website: [https://mp.weixin.qq.com](https://mp.weixin.qq.com) **Only verified official accounts are supported. Unverified accounts are not currently supported.** Developers can apply for a WeChat Official Account test account from this link for testing. Test accounts work normally but cannot configure AES Key. ![Image](/imgs/offiaccount-2.png) ### 2. Enter the 3 parameters into the FastGPT configuration dialog. ![Image](/imgs/offiaccount-3.png) ## 3. Add FastGPT IP to IP Whitelist ![Image](/imgs/offiaccount-4.png) Self-hosted users can check their own IP address. International edition users (cloud.fastgpt.io) can add the following IP whitelist: ``` 35.240.227.100 34.124.237.188 34.143.240.160 34.87.51.146 34.87.79.202 35.247.163.68 34.87.102.86 35.198.192.104 34.126.163.205 34.124.189.116 34.143.149.171 34.87.173.252 34.142.157.52 34.87.180.104 34.87.20.189 34.87.110.152 34.87.44.74 34.87.152.33 35.197.149.75 35.247.161.35 ``` China Mainland users (fastgpt.cn) can add the following IP whitelist: ``` 47.97.1.240 121.43.105.217 121.41.178.7 121.40.65.187 47.97.59.172 101.37.205.32 120.55.195.90 120.26.229.115 120.55.193.112 47.98.190.173 112.124.41.79 121.196.235.183 121.41.75.88 121.43.108.48 112.124.12.6 121.43.52.222 121.199.162.43 121.199.162.102 120.55.94.163 47.99.59.223 112.124.46.5 121.40.46.247 120.26.145.73 120.26.147.199 121.43.125.163 121.196.228.45 121.43.126.202 120.26.144.37 ``` ## 4. Get AES Key and Select Encryption Mode ![Image](/imgs/offiaccount-5.png) ![Image](/imgs/offiaccount-6.png) 1. Randomly generate an AES Key and enter it into the FastGPT configuration dialog. 2. Select the encryption mode as Secure Mode. ## 5. Get URL 1. Confirm creation in FastGPT and get the URL. ![Image](/imgs/offiaccount-7.png) 2. Enter it in the URL field on the WeChat Official Account Platform, then submit and save. ![Image](/imgs/offiaccount-8.png) ## 6. Enable Server Configuration (Skip if already auto-enabled) ![Image](/imgs/offiaccount-9.png) ## 7. Start Using Now when users send messages to the official account, messages will be forwarded to FastGPT, and conversation results will be returned through the official account. ## FAQ ### How to start a new chat history To reset your chat history, send a `Reset` message to the bot (case-sensitive), and the bot will start a new chat history. file: ./content/guide/build/publish/official_account.mdx meta: { "title": "接入微信公众号教程", "description": "FastGPT 接入微信公众号教程" } 从 4.8.10 版本起,FastGPT 商业版支持直接接入微信公众号,无需额外的 API。 **注意⚠️: 目前只支持通过验证的公众号(服务号和订阅号都可以)** ## 1. 在 FastGPT 新建发布渠道 在 FastGPT 中选择想要接入的应用,在 *发布渠道* 页面,新建一个接入微信公众号的发布渠道,填写好基础信息。 ![图片](/imgs/offiaccount-1.png) ## 2. 获取 AppID 、 Secret和Token ### 1. 登录微信公众平台,选择您的公众号。 打开微信公众号官网:[https://mp.weixin.qq.com](https://mp.weixin.qq.com) **只支持通过验证的公众号,未通过验证的公众号暂不支持。** 开发者可以从这个链接申请微信公众号的测试号进行测试,测试号可以正常使用,但不能配置 AES Key ![图片](/imgs/offiaccount-2.png) ### 2. 把3个参数填入 FastGPT 配置弹窗中。 ![图片](/imgs/offiaccount-3.png) ## 3. 在 IP 白名单中加入 FastGPT 的 IP ![图片](/imgs/offiaccount-4.png) 私有部署的用户可自行查阅自己的 IP 地址。 国际版用户(cloud.fastgpt.io)可以填写下面的 IP 白名单: ``` 35.240.227.100 34.124.237.188 34.143.240.160 34.87.51.146 34.87.79.202 35.247.163.68 34.87.102.86 35.198.192.104 34.126.163.205 34.124.189.116 34.143.149.171 34.87.173.252 34.142.157.52 34.87.180.104 34.87.20.189 34.87.110.152 34.87.44.74 34.87.152.33 35.197.149.75 35.247.161.35 ``` 中国大陆用户(fastgpt.cn)可以填写下面的 IP 白名单: ``` 47.97.1.240 121.43.105.217 121.41.178.7 121.40.65.187 47.97.59.172 101.37.205.32 120.55.195.90 120.26.229.115 120.55.193.112 47.98.190.173 112.124.41.79 121.196.235.183 121.41.75.88 121.43.108.48 112.124.12.6 121.43.52.222 121.199.162.43 121.199.162.102 120.55.94.163 47.99.59.223 112.124.46.5 121.40.46.247 120.26.145.73 120.26.147.199 121.43.125.163 121.196.228.45 121.43.126.202 120.26.144.37 ``` ## 4. 获取AES Key,选择加密方式 ![图片](/imgs/offiaccount-5.png) ![图片](/imgs/offiaccount-6.png) 1. 随机生成AESKey,填入 FastGPT 配置弹窗中。 2. 选择加密方式为安全模式。 ## 5. 获取 URL 1. 在FastGPT确认创建,获取URL。 ![图片](/imgs/offiaccount-7.png) 2. 填入微信公众平台的 URL 处,然后提交保存 ![图片](/imgs/offiaccount-8.png) ## 6. 启用服务器配置(如已自动启用,请忽略) ![图片](/imgs/offiaccount-9.png) ## 7. 开始使用 现在用户向公众号发消息,消息则会被转发到 FastGPT,通过公众号返回对话结果。 ## FAQ ### 如何新开一个聊天记录 如果你想重置你的聊天记录,可以给机器人发送 `Reset` 消息(注意大小写),机器人会新开一个聊天记录。 file: ./content/guide/build/publish/openapi.en.mdx meta: { "title": "Access App via API", "description": "Access FastGPT app via API" } import { Alert } from '@/components/docs/Alert'; In FastGPT, the API entry under Publish Channels shows **API Keys** available to the current signed-in member. API Keys are member credentials for OpenAPI calls and are no longer created as app-scoped keys. When calling this app through `chat/completions`, passing `appId` in the request body is recommended. If a third-party app only supports OpenAI SDK-style key configuration, you can use the `apiKey-appId` compatibility format. For details, [see the OpenAPI Introduction](../../../openapi/intro.en.mdx). ## Get an API Key Go to App -> "Publish Channels" -> "API", then click "New" to create a key. An API Key represents the current signed-in member's OpenAPI credential. Keep your key safe. To copy it again later, use the copy button in the API list. ![](/imgs/fastgpt-api1.jpg) Tip: For security, you can set a quota or expiration time to prevent key abuse. ## Replace Variables in Third-Party Apps ```bash OPENAI_API_BASE_URL: http://localhost:3000/api (replace with your deployed domain) OPENAI_API_KEY = the key obtained in the previous step (passing appId in the request body is recommended; if the third-party app only accepts a key, use the apiKey-appId compatibility format) ``` **[ChatGPT Next Web](https://github.com/Yidadaa/ChatGPT-Next-Web) Example:** ![](/imgs/chatgptnext.png) **[ChatGPT Web](https://github.com/Chanzhaoyu/chatgpt-web) Example:** ![](/imgs/chatgptweb.png) file: ./content/guide/build/publish/openapi.mdx meta: { "title": "通过 API 访问应用", "description": "通过 API 访问 FastGPT 应用" } import { Alert } from '@/components/docs/Alert'; 在 FastGPT 中,发布渠道里的 API 入口展示当前登录成员可用的 **APIKey**。APIKey 是团队成员的开放接口调用凭证,不再按应用创建专属密钥。 调用当前应用的 `chat/completions` 接口时,推荐在请求体传入 `appId`。如果第三方应用只能配置 OpenAI SDK 风格的密钥,也可以使用 `apiKey-appId` 兼容格式。完整说明可以[查看 OpenAPI 介绍](../../../openapi/intro.mdx)。 ## 获取 APIKey 依次选择应用 ->「发布渠道」->「API」,然后点击「新建」创建密钥。 APIKey 代表当前登录成员的开放接口调用凭证。请妥善保管密钥;如需再次复制,可在 API 列表中点击复制按钮。 ![](/imgs/fastgpt-api1.jpg) Tips: 安全起见,你可以设置一个额度或者过期时间,防止 key 被滥用。 ## 替换三方应用的变量 ```bash OPENAI_API_BASE_URL: http://localhost:3000/api (改成自己部署的域名) OPENAI_API_KEY = 上一步获取到的密钥(推荐在请求体传 appId;如第三方应用只能配置密钥,可填 apiKey-appId 兼容格式) ``` **[ChatGPT Next Web](https://github.com/Yidadaa/ChatGPT-Next-Web) 示例:** ![](/imgs/chatgptnext.png) **[ChatGPT Web](https://github.com/Chanzhaoyu/chatgpt-web) 示例:** ![](/imgs/chatgptweb.png) file: ./content/guide/build/publish/wechat.en.mdx meta: { "title": "WeChat Personal Account Integration", "description": "How to integrate FastGPT with a WeChat personal account" } ## 1. Create a Publishing Channel Open your FastGPT Agent, click the tab at the top to switch to **Publishing Channels**, select **WeChat Personal Account**, and click **Create**. ![alt text](/imgs/image-3.png) You can fill in the form fields as needed. ## 2. Scan QR Code to Log In After creating the channel, a new entry will appear. For the first time, you need to scan a QR code to log in. Click **Scan QR Code to Log In** to display the login QR code. ![alt text](/imgs/image-4.png) ![alt text](/imgs/image-17.png) ## 3. Start Chatting Once connected via QR code, a **WeChat ClawBot** will appear in your contacts list. ![alt text](/imgs/image-25.png) Click to open the conversation and start chatting! ![alt text](/imgs/image-26.png) ## FAQ ### How to Reset a Chat Type `Reset` or `/reset` in the input field to clear the chat history. file: ./content/guide/build/publish/wechat.mdx meta: { "title": "接入微信个人号教程", "description": "FastGPT 接入微信个人号教程" } ## 1. 新建发布渠道 进入 FastGPT 搭建好的 Agent,点击顶部的 tab 切换到发布渠道,并选择`微信个人号`,点击新建。 ![alt text](/imgs/image-3.png) 表单内容随便填写即可。 ## 2. 扫码登录 确认创建渠道后,会多出一条记录,首次需要扫码登录,点击扫码登录,即可跳出登录二维码。 ![alt text](/imgs/image-4.png) ![alt text](/imgs/image-17.png) ## 3. 愉快玩耍 扫码连接后,好友列表就会多出一个`微信 ClawBot`的机器人可使用。 ![alt text](/imgs/image-25.png) 点击进入后,即可开始聊天啦! ![alt text](/imgs/image-26.png) ## FAQ ### 微信没找到入口 目前仅支持 IOS 系统,并且需要升级最新版本微信。 ### 如何重置聊天 输入框输入:`Reset`或者`/reset` 即可重置聊天记录。 file: ./content/guide/build/publish/wecom.en.mdx meta: { "title": "WeCom Bot Integration", "description": "FastGPT WeCom Bot Integration Tutorial" } * Starting from version 4.12.4, FastGPT commercial edition supports direct WeCom bot integration without additional APIs. * Starting from version 4.14.4, FastGPT cloud service edition supports WeCom intelligent bot integration through custom domain configuration. ## 1. (Required for Cloud Service Edition) Configure Custom Domain WeCom requires intelligent bot message push addresses to use the enterprise's primary domain, so cloud service edition users must configure a custom domain before using WeCom bots. * [Configure Custom Domain](../../workspace/customDomain.en.mdx) If you are a commercial edition user, continue using your enterprise domain. ## 2. Create an Intelligent Bot ### 2.1 Super Admin Login [Click to open WeCom Admin Console](https://work.weixin.qq.com/) ### 2.2 Find the Intelligent Bot Entry On the "Security & Management" - "Management Tools" page, click "Intelligent Bot" (Note: Only the enterprise creator or super admin has permission to see this entry) ![Image](/imgs/use-cases/external-integration/wecom/1.png) ### 2.3 Select "API Mode Creation" for the Intelligent Bot On the create bot page, scroll down and click "API Mode Creation" ![Image](/imgs/use-cases/external-integration/wecom/2.png) ### 2.4 Get Key Credentials Randomly generate or manually enter Token and Encoding-AESKey, and record them ![Image](/imgs/use-cases/external-integration/wecom/3.png) ### 2.5 Create WeCom Bot Publishing Channel In FastGPT, select the Agent you want to use. On the Publishing Channels page, select "WeCom Bot" and click "Create" ![Image](/imgs/use-cases/external-integration/wecom/4.png) ### 2.6 Configure Publishing Channel Information Configure the publishing channel information. You need to enter the Token and AESKey recorded in step 2.4 (Token and Encoding-AESKey) ![Image](/imgs/use-cases/external-integration/wecom/5.png) ### 2.7 Copy Callback URL After clicking "Confirm", select your configured custom domain, copy the callback URL, and paste it back into the WeCom intelligent bot configuration page. ![Image](/imgs/use-cases/external-integration/wecom/6.png) ## 3. Use the Intelligent Bot In the WeCom platform's "Contacts", you can find the created bot and start sending messages ![Image](/imgs/use-cases/external-integration/wecom/7.png) ## FAQ ### Sent a message but no response 1. Check if the trusted domain is configured correctly. 2. Check if Token and Encoding-AESKey are correct. 3. Check FastGPT chat logs to see if there is a corresponding question record. 4. If there is no record, the app may have encountered an error. Try the simplest bot first. file: ./content/guide/build/publish/wecom.mdx meta: { "title": "接入企微机器人教程", "description": "FastGPT 接入企微机器人教程" } * 从 4.12.4 版本起,FastGPT 商业版支持直接接入企微机器人,无需额外的 API。 * 从 4.14.4 版本起,FastGPT 云服务版支持通过配置自定义域名的方式接入企微智能机器人。 ## 1. (云服务版必须)配置自定义域名 企微要求智能机器人消息推送地址必须使用企业主体域名,因此云服务版本用户必须先配置自定义域名才能使用企微机器人。 * [配置自定义域名](../../workspace/customDomain.mdx) 若您是商业版用户,请继续使用您企业的域名。 ## 2. 创建智能机器人 ### 2.1 超级管理员登录 [点击打开企业微信管理后台](https://work.weixin.qq.com/) ### 2.2 找到智能机器人入口 在"安全与管理" - "管理工具"页面点击"智能机器人" ( 注意: 只有企业创建者或超级管理员才有权限看到这个入口 ) ![图片](/imgs/use-cases/external-integration/wecom/1.png) ### 2.3 选择 “API模式创建” 智能机器人 在创建机器人页面, 下拉, 点击 "API模式创建" ![图片](/imgs/use-cases/external-integration/wecom/2.png) ### 2.4 获取关键密钥 随机生成或者手动输入 Token 和 Encoding-AESKey,并且记录下来 ![图片](/imgs/use-cases/external-integration/wecom/3.png) ### 2.5 创建企微机器人发布渠道 在 FastGPT 中,选择要使用 Agent,在发布渠道页面,选择“企业微信机器人”,点击“创建” ![图片](/imgs/use-cases/external-integration/wecom/4.png) ### 2.6 配置发布渠道信息 配置该发布渠道的信息,需要填入 Token 和 AESKey,也就是第四步中记录下来的 Token 和 Encoding-AESKey ![图片](/imgs/use-cases/external-integration/wecom/5.png) ### 2.7 复制回调地址 点击“确认”后,选择您配置的自定义域名,复制回调地址,填回企微智能机器人配置页中。 ![图片](/imgs/use-cases/external-integration/wecom/6.png) ## 3. 使用智能机器人 在企业微信平台的"通讯录",即可找到创建的机器人,就可以发送消息了 ![图片](/imgs/use-cases/external-integration/wecom/7.png) ## FAQ ### 发送了消息,没响应 1. 检查可信域名是否配置正确。 2. 检查 Token 和 Encoding-AESKey 是否正确。 3. 查看 FastGPT 对话日志,是否有对应的提问记录。 4. 如果没记录,则可能是应用运行报错了,可以先试试最简单的机器人。 file: ./content/guide/build/skill/development.en.mdx meta: { "title": "Development & Debugging", "description": "This guide details how to create or import a skill, and manage files, use the interactive terminal, and perform debug chat in Web IDE." } import { Alert } from '@/components/docs/Alert'; ## 1. Creating & Importing Skills Before writing code, you need to create a development project in the skills list. The platform supports two ways to create or load a skill: ![Creating & Importing Skills](/imgs/create_import_skill.png) ### 1.1 Click the Create Area to Create a Skill Click the "Create" card (the dashed box area with a plus icon) on the page. In the popup, set the skill name, icon, description, and **requirements**. When the system initializes the skill in the background, it takes different approaches based on your input: * **Using Default Template**: If you leave the default "Goal/Process/Requirements" template unchanged, the system will use the built-in basic structure and boilerplate code to generate the skill workspace (without invoking AI models, consuming no points). * **AI-Assisted Generation**: If you input custom functional requirements here (e.g., "help me write a skill that extracts all email addresses from a text"), the system will invoke the **configured default system LLM model** in the background to automatically generate the `SKILL.md` scheme and initialize the code, which will consume points. ### 1.2 Import an Existing Skill ZIP Archive If you have a skill backed up or shared by others, click the "Import Skill" button at the top right of the page and upload the corresponding ZIP archive. The system will automatically unzip it and restore all code files and configurations in the background, allowing you to resume development immediately. *** ## 2. Workspace File Management When you open the skill details page, the system initializes and provisions an isolated run workspace in a secure sandbox container, loading your project via the file tree on the right. ![Workspace File Management](/imgs/workspace_file_management.png) ### 2.1 Multi-file Management You can right-click or use action buttons on the file tree on the right to easily create, delete, rename, and move files or folders to organize your project structure. ### 2.2 Online Code Editing Clicking any file in the tree opens it in the center editor: * **Auto-Save**: The editor automatically saves and syncs your edits to the backend sandbox container as you type. * **Real-Time Workspace Sync**: The file tree automatically monitors and syncs file changes. Whether you edit files, install package dependencies in the terminal, or background processes generate new files, the tree stays updated. * **Change Isolation**: Any code changes made here only take effect instantly in the debugging environment, and will not directly affect live applications. To apply the latest code to production, you must click the "Publish" button to generate an official version. For details, please see [Versions & Publishing](/en/guide/build/skill/version). ### 2.3 Two-way Interactive Terminal The command line terminal at the bottom right connects directly to the backend sandbox: * **Running Commands**: You can enter various command line operations, such as installing required code dependencies online or executing various custom running and debugging scripts. * **Log Feedback**: The terminal streams command execution logs in real time. If code or script execution errors occur, you can view the error messages directly in the terminal output to assist with debugging. *** ## 3. Agent Debug Chat The agent debug panel on the left provides a testing environment, allowing you to test and call your custom skill logic in real time by chatting with the agent: ![Agent Debug Chat](/imgs/agent_debug_chat.png) ### 3.1 Immediate Effect Every time you modify and save your code in the right editor, you don't need to manually compile, build, or redeploy. Simply send a new message in the chat box on the left, and the system will run the latest code in the background, allowing you to see the changes instantly. ### 3.2 Conversational Workspace Modification You can directly chat with the agent to have it help you edit the file contents on the right (including creating, deleting, and modifying files). The file tree and editor on the right will reflect these changes in real time. ### 3.3 Real-time File Export You can click "Export Config" in the top-right menu to package all code and configuration files in the current workspace into a ZIP archive and download it locally for backup or sharing. file: ./content/guide/build/skill/development.mdx meta: { "title": "开发与调试", "description": "详细介绍如何新建或导入技能,并在 Web IDE 中管理文件、使用交互终端以及进行对话调试。" } import { Alert } from '@/components/docs/Alert'; ## 1. 新建与导入技能 在开始编写代码前,你需要先在技能列表中创建一个开发项目。系统支持以下两种方式来创建或载入技能: ![新建与导入技能](/imgs/create_import_skill.png) ### 1.1 点击新建区域创建技能 在页面中点击带有加号的“新建”卡片,在弹出的窗口中设置技能名称、图标、介绍以及**需求描述**。系统在后台初始化该技能时,会根据你的输入采取不同的方式: * **使用默认模板**:如果你保留默认的“目标/流程/要求”模板未作修改,系统将直接使用内置的基础结构和样例代码生成技能工作区(不调用 AI 模型,不产生积分消耗)。 * **AI 辅助生成**:如果你在此输入了具体的功能需求(例如“帮我编写一个从文本中提取所有邮箱地址的技能”),系统在后台会调用**系统配置的默认大语言模型**,根据你的描述自动生成技能方案 `SKILL.md` 并完成代码初始化,这会产生相应的积分消耗。 ### 1.2 导入已有技能 ZIP 压缩包 如果你手头有自己备份或他人分享的技能,可以点击页面右上角的“导入技能”按钮,上传对应的 ZIP 格式技能压缩包,系统会自动解压并在后台还原所有代码文件与配置,让你能够立即在此基础上继续开发。 *** ## 2. 工作区文件管理 当你在后台打开技能详情页时,系统会在安全的沙盒容器中为你初始化并拉起一个独立的运行空间,同时在右侧通过文件树加载你的项目。 ![工作区文件管理](/imgs/workspace_file_management.png) ### 2.1 多文件管理 你可以在右侧的文件树上右键或点击按钮,轻松进行文件的新建、删除、重命名和移动,灵活组织项目的目录结构。 ### 2.2 代码在线编辑 在文件树中点击任意文件即可在中央编辑器中打开并编辑代码: * **自动保存**:编辑器自带自动保存机制,代码修改完成后,系统会自动同步并写入后台沙盒中。 * **实时状态刷新**:无论是你编辑保存、在终端安装依赖包,还是后台进程生成了新文件,右侧的文件树都会实时感知并刷新,自动同步展示最新状态。 * **变更隔离**:此处进行的所有代码修改仅在调试区即时生效,不会直接影响到线上已发布运行的应用。若需应用最新的代码,需要先点击“发布”生成正式版本,具体发布逻辑请详见 [版本与发布](/guide/build/skill/version)。 ### 2.3 终端双向交互 右侧底部的命令行窗口(Terminal)直接连接到后台沙盒: * **运行命令**:你可以在这里输入各种命令行操作,例如在线安装代码所需的依赖包,或是运行各类自定义测试与调试脚本等。 * **日志反馈**:终端会实时输出命令执行的过程和日志。如果代码或脚本运行出错,可以直接通过终端输出的报错信息来辅助定位问题。 *** ## 3. 智能体对话调试 左侧的智能体调试面板提供了一个测试环境,允许你通过与智能体对话来实时测试和调用你编写的技能逻辑: ![智能体对话调试](/imgs/agent_debug_chat.png) ### 3.1 即改即生效 每次你在右侧编辑器中修改并保存代码后,无需手动进行编译、打包或重新部署。只需在左侧调试框中发送下一条消息,系统便会在后台自动运行你最新的代码,让你能够立即看到修改后的效果。 ### 3.2 对话式工作区修改 你可以直接通过与智能体对话,让它帮你编辑右侧的文件内容(包括文件的创建、删除、修改等),右侧的文件树和编辑器会实时同步展示这些变化。 ### 3.3 实时文件导出 你可以点击页面右上角菜单中的“导出配置”,将当前工作区中实时的所有代码与配置文件打包成 ZIP 压缩包下载到本地,方便进行本地备份或分享。 file: ./content/guide/build/skill/initialization.en.mdx meta: { "title": "Initialization Script", "description": "Learn how to configure and execute initialization scripts in skill packages to prepare the skill running environment." } The skill initialization script is an optional pre-execution script provided by the skill developer. After the system successfully deploys and extracts your skill in an application, it automatically runs this script in an isolated virtual machine before executing the actual AI tasks. Through the initialization script, you can automatically install third-party dependencies or perform necessary configurations before the skill code runs. *** ## 1. Skill Script Configuration and Execution Timing To add an initialization script to your skill, simply place a Shell script named `entrypoint.sh` in the root directory of your skill package. ![Skill Initialization Script Example](/imgs/skill_initialization_entrypoint.png) ### Execution Timing 1. **Deployment and Extraction**: When a user runs an application referencing the skill, the system first deploys and extracts the skill package to the virtual machine at `./projects//`. 2. **Script Execution**: The system runs the `entrypoint.sh` script located in the root of the skill directory. *** ## 2. Smart Deduplication Mechanism To prevent running environment initialization scripts repeatedly in subsequent conversations (e.g., executing dependency installation packages on every turn would cause severe latency), FastGPT designs a deduplication mechanism for skill scripts. The execution state is stored in the `~/.fastgpt/agent-skill-entrypoints/state.json` file inside the virtual machine. * **Version ID Deduplication**: Since the code and script content of a specific skill version (`versionId`) are immutable once published, the system tracks the successfully executed `versionId` inside the virtual machine. * **Skipped Execution**: When the same virtual machine instance is reused in subsequent turns, if the corresponding `versionId` has already executed successfully, the system will **skip** running the script, enabling hot starts. * **New Version Trigger**: Whenever a new skill version is published, the system will automatically deploy and run its initialization script upon the next conversation, regardless of whether it is an existing (old) or a new chat window. *** ## 3. Execution Constraints and Fault Tolerance To ensure the smooth execution of the AI workflow, the skill initialization script must adhere to the same execution constraints and fault tolerance rules as the application startup script: * **Execution Constraints and Non-blocking Fault Tolerance**: The timeout protection (default 30 seconds), non-blocking workflow (failures do not block main execution), and 8KB log truncation limits are identical to those of the application startup script. For detailed parameters, please refer to [Application Startup Script Execution Constraints](../agentv2/vm#execution-constraints--fault-tolerance). * **Debug Mode Limitation**: In the skill edit mode, the virtual machine will not automatically execute the `entrypoint.sh` script. To verify the script's behavior, the skill developer can manually execute the commands inside the Workspace Terminal. file: ./content/guide/build/skill/initialization.mdx meta: { "title": "初始化脚本", "description": "了解如何在技能包中配置和执行初始化脚本,准备技能运行环境。" } 技能初始化脚本是技能开发者提供的一个前置脚本。当应用成功部署并解压了您开发的技能后,系统在实际执行 AI 任务前,会在独立的虚拟机环境中自动运行该脚本。 通过初始化脚本,您可以在技能代码执行前,自动安装技能特有的第三方依赖,或进行必要的配置预处理。 *** ## 1. 技能脚本配置与执行时机 要为您的技能添加初始化脚本,只需在技能压缩包的根目录下放置一个名为 `entrypoint.sh` 的 Shell 脚本。 ![技能初始化脚本示例](/imgs/skill_initialization_entrypoint.png) ### 执行时机 1. **技能包部署与解压**:当用户运行引用了该技能的应用时,系统会首先将技能包部署并解压到虚拟机的 `./projects//` 目录下。 2. **执行初始化脚本**:系统会在虚拟机中执行该技能根目录下的 `entrypoint.sh` 脚本。 *** ## 2. 智能去重机制 为了避免在多次对话中重复运行环境初始化脚本(例如重复执行依赖包安装会导致每次对话产生严重的延迟),系统为技能脚本设计了去重机制。 去重状态记录在虚拟机内的 `~/.fastgpt/agent-skill-entrypoints/state.json` 状态文件中。 * **版本 ID 去重**:由于同一个技能版本(`versionId`)的代码和脚本内容在发布后是不可变的,系统会记录当前虚拟机中已成功运行过的技能 `versionId`。 * **跳过执行**:当同一个虚拟机实例在后续对话中被复用时,只要对应的 `versionId` 已经成功执行过,系统就会**直接跳过**该脚本的运行,实现秒级热启动。 * **新版本触发**:只要技能发布了新版本,无论是在旧的对话窗口还是新的对话窗口,在下一次对话触发时,系统都将在重新部署该技能后自动运行该版本的初始化脚本。 *** ## 3. 执行约束与容错机制 为保障 AI 流程的流畅运行,技能初始化脚本需要遵循与应用启动脚本一致的执行限制与容错规则: * **执行约束与非阻断容错**:技能入口脚本的超时时间限制(默认 30 秒)、非阻塞设计(执行报错或超时不阻断主流程)以及 8KB 日志输出截断规则,均与应用启动脚本保持一致。具体细节指标请参考 [应用启动脚本的执行限制](../agentv2/vm#执行限制与容错机制)。 * **调试预览限制**:在技能的编辑模式下,虚拟机不会自动执行技能的 `entrypoint.sh` 脚本。如果需要验证脚本效果,技能开发者可以直接在侧边栏调试区的控制台终端(Workspace Terminal)中手动执行相关命令。 file: ./content/guide/build/skill/integration.en.mdx meta: { "title": "Agent Integration", "description": "How to bind published skills to AI agents and execute them." } import { Alert } from '@/components/docs/Alert'; ## How to Bind a Skill to an Agent? 1. Go to the editing page of the **"Agent"** application where you want to integrate this skill (currently, only Agent applications support direct skill binding; simple apps and workflows do not support it). 2. In the configuration panel on the left, locate the **"Associated Skill"** section. 3. Click the **"Select"** button on the right, and in the popup list, select your published skill. ![Associate Skill & VM](/imgs/associated_skills_vm.png) **Note:** Skill code needs to execute within a secure and isolated environment. Therefore, when you associate a skill, the system will automatically enable the "Virtual Machine" for you; you cannot disable the virtual machine while a skill remains associated. *** ## How Agents Call Skills Once bound, the agent possesses this skill capability: * **Multi-Skill Injection**: An agent can be bound to **multiple different skills** at the same time. When the sandbox (virtual machine) starts, all bound skill codes and configurations are automatically injected and deployed into the sandbox workspace. The skills are isolated from each other and will not conflict. * **Automated Invocation**: **Provided that the LLM used is sufficiently intelligent**, you don't need to manually command the agent to run code. The AI will automatically judge whether to trigger the skill based on your input, and execute it securely in the background sandbox. * **Virtual Machine File View**: You can click the **"Virtual Machine"** button at the bottom of the chat bubble (or the computer icon in the top right corner) to view all the latest files and code status in the virtual machine directly in the popup sidebar. ![Virtual Machine File View](/imgs/agent_chat_vm_files.png) file: ./content/guide/build/skill/integration.mdx meta: { "title": "智能体集成", "description": "如何将发布好的技能绑定到 AI 智能体中并执行。" } import { Alert } from '@/components/docs/Alert'; ## 如何在应用中绑定技能? 1. 进入你想集成该技能的 **“智能体 (Agent)”** 应用编辑页面(目前仅智能体应用支持直接绑定技能,简易应用及工作流暂不支持)。 2. 在左侧的配置面板中,找到 **“关联 Skill”** 配置项。 3. 点击右侧的 **“选择”** 按钮,在弹出的选择窗口中,勾选你已经发布好的正式版本技能。 ![关联 Skill 与虚拟机](/imgs/associated_skills_vm.png) **注意:** 技能代码需要在安全隔离的环境中运行。因此,当你关联技能时,系统会自动为你开启“虚拟机”;并且在已关联技能的状态下,无法关闭虚拟机。 *** ## 智能体如何调用技能? 绑定完成后,智能体即可获得该技能的执行能力: * **多技能安全注入**:一个智能体支持同时绑定**多个不同的技能**。在沙盒(虚拟机)启动时,所有已绑定技能的代码和配置都会被自动注入并部署到沙盒工作区中,各技能间彼此独立、互不冲突。 * **智能自动调用**:**在使用的模型足够智能的前提下**,你无需手动命令智能体运行代码。AI 会根据你的输入,自动判断是否需要调用该技能,并在后台虚拟机中自动安全地执行代码。 * **虚拟机文件查看**:你可以点击聊天气泡底部的 **“虚拟机”** 按钮(或右上角的电脑图标),在弹出的侧边栏中直接查看虚拟机里当前最新的所有文件内容和代码状态。 ![虚拟机文件查看](/imgs/agent_chat_vm_files.png) file: ./content/guide/build/skill/intro.en.mdx meta: { "title": "Introduction", "description": "The concept of AI Agent Skills, and how it is designed and implemented in FastGPT." } import { Alert } from '@/components/docs/Alert'; ## What is an AI Agent "Skill"? Under the latest ecosystem designs of mainstream AI providers, a **"Skill"** is defined as a **persistent, reusable, and modular workflow and capability package**. For example, if you frequently need the AI to audit complex spreadsheets and write analysis reports, you can package the 'audit code' and 'report template' into a Skill. In future chats, you can simply upload your spreadsheet, and the AI will run the skill in the background to compute results and format the report. *** ## Core Design Philosophy: From Tools to Skills In the general cognitive framework of AI Agents, we typically divide capabilities into three layers: * **The Brain (Brain)**: Responsible for reasoning and planning (the LLM itself). * **Tools (Tools)**: Simple execution interfaces (such as sending a web request or running a temporary line of code), resembling the AI's "hands and feet". * **Skills (Skills)**: Providing the complete **"operational knowledge and professional logic"** (Know-how). A skill is typically a modular package encapsulating **instruction markdown (how to do it)** and **executable scripts (actually doing it)**. If a tool is a "screwdriver" in your toolbox, then a skill is a **"furniture assembly guide"**. The AI can automatically grab this guide from its skill library based on the current context, execute the code inside a background sandbox, and complete the complex assembly. *** ## Skills in FastGPT Following the industry-standard design of Skills, FastGPT provides you with a "**dedicated code execution workspace**" featuring the following core designs: ![Skill List](/imgs/skill_list_intro.png) ### 1. Isolated Secure Runtime Sandbox Each created skill during editing runs in a fully isolated, secure sandbox environment (powered by Sealos Devbox, OpenSandbox, etc., in the backend). All operations are restricted within this workspace to ensure safety. ### 2. Instant Hot-Reloading Debugging Provides an online debugging environment integrating a file tree, code editor, and console terminal. Equipped with an agent debug panel on the left supporting hot reloading, allowing you to troubleshoot the skill before publishing. ### 3. Isolation of Production & Debugging Edits in the workspace will only take effect instantly in the "Debug Chat" area. Changes will only be applied to production agents once you click publish and snap a new version, ensuring service stability. ### 4. Auto-Sleep & Seamless Invocation For long-inactive skills, the system automatically shuts down the sandbox and performs cold-archiving to storage. When edit or agent invocation resumes, the sandbox is automatically re-instantiated and restored from the archive in the background. You are only billed when the skill is active, dramatically reducing your runtime costs. file: ./content/guide/build/skill/intro.mdx meta: { "title": "基础介绍", "description": "AI 智能体技能概念,以及它在 FastGPT 中的设计与实现原理。" } import { Alert } from '@/components/docs/Alert'; ## 什么是 AI 智能体的“技能”? 在当前主流 AI 厂商的最新生态设计中,**“技能”(Skills)** 被定义为一种**可持久保存、可复用的模块化专业流程与能力包**。 例如,如果你经常需要 AI 帮你核对两份复杂的财务表格并生成分析,你只需一次性把“计算代码”和“报告模板”放入技能中。在以后的对话中,你直接把表格丢给 AI,它就能自动在后台调用这个技能把数据算准、格式排好。 *** ## 核心设计原理:从工具到技能 在 AI 智能体(Agent)的大众认知中,我们通常将它划分为三个层面: * **大脑 (Brain)**:负责规划和推理,是大模型本身。 * **工具 (Tools)**:提供单纯的“动作接口”(例如:发送一段网络请求、运行一行临时代码),类似于 AI 的“手和脚”。 * **技能 (Skills)**:提供完整的“**做事章法与专业逻辑**”(Know-how)。 一个技能通常是由**说明文档(指明怎么做)**和**逻辑代码(真正去执行)**封装在一起的模块化包。如果工具是工具箱里的“螺丝刀”,那么技能就是一张**“家具组装手册”**,AI 能够自动根据当前对话任务,伸手从它的技能库里拿取这本手册,在后台沙盒中运行代码并完成复杂的装配任务。 *** ## FastGPT 中的技能设计 承袭业界主流的技能(Skills)设计标准,FastGPT 支持你为智能体创建“**专属的独立代码空间**”,具备以下核心设计: ![技能列表](/imgs/skill_list_intro.png) ### 1. 独立的安全运行沙箱 创建出来的每个技能在编辑时都拥有一个完全隔离的安全运行沙箱(后台基于 Sealos Devbox、OpenSandbox 等沙盒服务运行)。所有操作都在此隔离空间内进行,保障技能执行的安全性。 ### 2. 即改即生效的调试环境 提供了一个集成了文件管理、代码编辑器和交互式终端的在线调试环境。左侧配有智能体调试面板,支持“即改即生效”的热重载,方便你在发布前对技能进行充分的调试与排错。 ### 3. 生产与调试环境隔离 在编辑区域直接修改的代码只在“调试区”即时生效。只有点击“发布”生成并保存正式版本后,改动才会正式应用到生产环境的智能体与工作流中。 ### 4. 自动休眠与无感唤醒 针对长期闲置的技能,系统会自动将其从沙盒中清理并冷归档至存储。当需要再次编辑或被智能体调用时,会自动在后台重新拉起沙箱并复原。休眠期间不产生任何运行计费,大幅降低使用成本。 file: ./content/guide/build/skill/version.en.mdx meta: { "title": "Versions & Publishing", "description": "Why you need to publish versions, how to save snapshots, and easy rollback to historical versions." } import { Alert } from '@/components/docs/Alert'; ## Why do you need to "Publish"? Edits in the editor only take effect in the "Debug Chat" panel. To formally apply your changes to your workflows or agents, you must click "Publish" to deploy a formal version. **Note:** The debugging environment is isolated from the production deployment environment. This ensures that when you edit or debug skill code, it will not affect the online agents and workflows currently running. *** ## Saving Version Snapshots 1. Once testing is successful, click the **"Publish"** button in the top right corner of the editor. 2. In the modal, enter the **Version Name** (by default, the current time is prefilled, but you can customize it, e.g., `v1.0.0`). 3. Confirm, and the system will solidify the current code state as an "official version" and publish it. **Note:** During publishing, the system automatically applies the ignore rules specified in the `.gitignore` file at the project root (if not present, a default file ignoring `node_modules`, `.venv`, `dist`, etc., will be created). Only files that are not ignored will be packaged, and you must ensure the total size of these files does not exceed the limit, otherwise publishing may fail. *** ## Version Rollback To restore a previous version: 1. Click the **"Version History"** (clock) icon in the top right corner of the editor to view all published snapshots. 2. Hover over the version you want to restore, and click the **"Switch"** (return arrow) icon to instantly revert both your workspace files and the live production version back to that snapshot. **Note:** Restored versions will not carry files that were ignored by `.gitignore` (for example, local files like `node_modules` or `.venv` that were ignored cannot be recovered via rollback). ![Version History & Rollback](/imgs/version_history_rollback.png) file: ./content/guide/build/skill/version.mdx meta: { "title": "版本与发布", "description": "为什么需要发布版本,如何保存快照,以及历史版本的轻松回滚。" } import { Alert } from '@/components/docs/Alert'; ## 为什么要“发布”? 在编辑器里直接修改的代码只在“调试区”即时生效。如果你想在工作流或者智能体当中正式应用你的改动,必须点击“发布”生成一个正式部署版本。 **注意:** 调试环境与生产部署环境是隔离的。这样可以确保你在调试、改写技能代码时,不会影响线上正在运行的智能体与工作流服务。 *** ## 保存版本快照 1. 调试确认无误后,点击编辑器右上角的 **“发布”** 按钮。 2. 在弹出的窗口中,输入当前版本的**版本名称**(默认会自动填充当前时间作为名称,你也可以自定义修改,例如输入 `v1.0.0`)。 3. 确认后,系统会将当前的代码状态固化为一个“正式版本”发布上线。 **注意:** 发布时,系统会自动应用项目根目录下 `.gitignore` 文件的忽略规则(如不存在,系统会自动创建包含 `node_modules`、`.venv`、`dist` 等默认忽略项的文件)。只有未被忽略的文件才会被打包发布,请确保打包文件总体积未超限,否则可能导致发布失败。 *** ## 历史版本回滚 如果需要恢复到以前的版本: 1. 点击编辑器右上角的 **“版本历史”**(时钟)图标,查看已发布的所有历史快照。 2. 将鼠标悬停在要恢复的历史版本上,点击 **“切换”**(返回箭头)图标,即可一键将工作区文件以及当前线上运行的版本同时切换回该历史版本。 **注意:** 回滚的版本不会携带被 `.gitignore` 忽略的文件(如依赖包 `node_modules`、虚拟环境 `.venv` 等已忽略的本地文件不会被恢复)。 ![版本历史与回退](/imgs/version_history_rollback.png) file: ./content/guide/build/tools/mcp_tools.en.mdx meta: { "title": "MCP Tools", "description": "A quick guide to integrating MCP tools with FastGPT" } Starting from FastGPT v4.9.6, a new application type called MCP Tools has been added. It lets you provide an MCP SSE URL to batch-create tools that models can easily call. Here's how to create MCP tools and have AI use them. ## Create an MCP Tools Collection First, select "New MCP Tools Collection." We'll use the Amap (Gaode Maps) MCP Server as an example: [Amap MCP Server](https://lbs.amap.com/api/mcp-server/create-project-and-key) You'll need an MCP URL, e.g., [https://mcp.amap.com/sse?key=xxx](https://mcp.amap.com/sse?key=xxx) ![Create MCP tools](/imgs/mcp_tools1.png) Enter the URL in the dialog and click Parse. The system will discover and list the available tools. Click Create to finish setting up the MCP tools and collection. ## Test MCP Tools Inside the MCP Tools collection, you can debug each tool individually. ![Test MCP tools](/imgs/mcp_tools3.png) For example, select the maps\_weather tool and click Run to see the weather data for Hangzhou. ## AI Calling Tools ### Call Individual Tools ![Call individual tools](/imgs/mcp_tools4.png) Using maps\_weather and maps\_text\_search as examples, ask the AI two different questions. The AI intelligently selects the appropriate tool, retrieves the needed information, and responds based on the results. | | | | ------------------------- | ------------------------- | | ![](/imgs/mcp_tools5.png) | ![](/imgs/mcp_tools6.png) | ### Call an Entire Tools Collection FastGPT also supports calling an entire MCP Tools collection. The AI automatically picks the right tool to execute. Click the MCP Tools collection to add a collection-type node, then connect it using the Tool Calling node. | | | | ------------------------- | ------------------------- | | ![](/imgs/mcp_tools7.png) | ![](/imgs/mcp_tools8.png) | The AI similarly selects the appropriate tool, retrieves the needed information, and responds based on the results. file: ./content/guide/build/tools/mcp_tools.mdx meta: { "title": "MCP 工具集", "description": "快速了解 MCP 工具接入 FastGPT" } FastGPT v4.9.6 版本开始,新增了 MCP 工具集 这种新的应用类型,允许传入一个 MCP 的 SSE URL 来批量创建可被模型轻松调用的 MCP 工具,下面就来看下如何创建 MCP 工具并且让 AI 调用 ## 创建一个 MCP 工具集 首先选择新建 MCP 工具集,以对接高德地图的 MCP Server 为例,[高德地图 MCP Server](https://lbs.amap.com/api/mcp-server/create-project-and-key) 需要获取到一个 MCP 地址,例 [https://mcp.amap.com/sse?key=xxx](https://mcp.amap.com/sse?key=xxx) ![创建 MCP tools](/imgs/mcp_tools1.png) 然后填入到弹窗中的对应位置,点击后面的解析,会解析出对应的一系列工具 这时再点击创建就能轻松创建 MCP 工具和 MCP 工具集 ## 测试 MCP 工具 进入到 MCP 工具集内部,能够对每个单独的 MCP 工具进行调试 ![测试 MCP tools](/imgs/mcp_tools3.png) 以 maps\_weather 这个查询天气的工具为例,点击运行,可以看到能够获得杭州的具体天气 ## 模型调用工具 ### 调用单个工具 ![调用单个工具](/imgs/mcp_tools4.png) 选中 maps\_weather 和 maps\_text\_search 这两个工具为例,分别问 AI 两个问题,可以看到 AI 智能地调用了相应的工具获得了需要的信息,然后根据获得的信息回答 | | | | ------------------------- | ------------------------- | | ![](/imgs/mcp_tools5.png) | ![](/imgs/mcp_tools6.png) | ### 调用工具集 FastGPT 也支持调用整个 MCP 工具集,AI 会自动选取需要的工具执行, 点击 MCP 工具集,会添加一个工具集类型的节点,使用工具调用节点连接 | | | | ------------------------- | ------------------------- | | ![](/imgs/mcp_tools7.png) | ![](/imgs/mcp_tools8.png) | 可以看到 AI 同样智能调用了相应的工具,获得了需要的信息,然后根据获得的信息回答 file: ./content/guide/build/workflow/intro.en.mdx meta: { "title": "Workflows & Plugins", "description": "A quick overview of FastGPT Workflows and Plugins" } Starting from V4.0, FastGPT adopted a new approach to building AI applications. It uses Flow node orchestration (Workflows) to implement complex processes, improving flexibility and extensibility. This does raise the learning curve — users with development experience will find it easier to pick up. [Watch the video tutorial](https://www.bilibili.com/video/BV1is421u7bQ/) ![](/imgs/flow-intro1.png) ## What is a Node? In programming terms, a node is like a function or API endpoint — think of it as a **step**. By connecting multiple nodes together, you build a step-by-step process that produces the final AI output. Below is the simplest AI conversation, consisting of a Workflow Start node and an AI Chat node. ![](/imgs/flow-intro2.png) Execution flow: 1. The user inputs a question. The \[Workflow Start] node executes and saves the user's question. 2. The \[AI Chat] node executes. It has two required parameters: "Chat History" and "User Question." Chat history defaults to 6 messages, representing the context length. The user question comes from the \[Workflow Start] node. 3. The \[AI Chat] node calls the conversation API with the chat history and user question to generate a response. ### Node Categories Functionally, nodes fall into 2 categories: 1. **System Nodes**: User guidance (configures dialog information) and user question (workflow entry point). 2. **Function Nodes**: Knowledge Base search, AI Chat, and all other nodes. These have inputs and outputs and can be freely combined. ### Node Components Each node has 3 core parts: inputs, outputs, and triggers. ![](/imgs/flow-intro3.png) * AI model, prompt, chat history, user question, and Knowledge Base citation are inputs. Inputs can be manual entries or variable references, which include "global variables" and outputs from any previous node. * New context and AI reply content are outputs. Outputs can be referenced by any subsequent node. * Each node has four "triggers" (top, bottom, left, right) for connections. Connected nodes execute sequentially based on conditions. ## Key Concept — How Workflows Execute FastGPT Workflows start from the \[Workflow Start] node, triggered when the user inputs a question. There is no **fixed exit point** — the workflow ends when all nodes stop running. If no nodes execute in a given cycle, the workflow completes. Let's look at how workflows execute and when each node is triggered. ![](/imgs/flow-intro1.png) As shown above, nodes can "be connected to" and "connect to other nodes." We call incoming connections "predecessor lines" and outgoing connections "successor lines." In the example, the \[Knowledge Base Search] node has one predecessor line on the left and one successor line on the right. The \[AI Chat] node only has a predecessor line on the left. Lines in FastGPT Workflows have these states: * `waiting`: The connected node is waiting to execute. * `active`: The connected node is ready to execute. * `skip`: The connected node should be skipped. Node execution rules: 1. If any predecessor line has `waiting` status, the node waits. 2. If any predecessor line has `active` status, the node executes. 3. If no predecessor lines are `waiting` or `active`, the node is skipped. 4. After execution, successor lines are updated to `active` or `skip`, and predecessor lines reset to `waiting` for the next cycle. Walking through the example: 1. \[Workflow Start] completes and sets its successor line to `active`. 2. \[Knowledge Base Search] sees its predecessor line is `active`, executes, then sets its successor line to `active` and predecessor line to `waiting`. 3. \[AI Chat] sees its predecessor line is `active` and executes. The workflow ends. ## How to Connect Nodes 1. Each node has connection points on all four sides for convenience. Left and top are predecessor connection points; right and bottom are successor connection points. 2. Click the x in the middle of a connection line to delete it. 3. Left-click to select a connection line. ## How to Read Workflows 1. Read from left to right. 2. Start from the **User Question** node, which represents the user sending text to trigger the workflow. 3. Focus on \[AI Chat] and \[Specified Reply] nodes — these are where answers are output. ## FAQ ### How do I merge multiple outputs? 1. Text Processing: can merge strings together. 2. Knowledge Base Search Merge: can combine multiple Knowledge Base search results. 3. Other results: cannot be merged directly. Consider passing them to an `HTTP` node and merging them in your own service. file: ./content/guide/build/workflow/intro.mdx meta: { "title": "工作流&插件", "description": "快速了解 FastGPT 工作流和插件的使用" } FastGPT 从 V4.0 版本开始采用新的交互方式来构建 AI 应用。使用了 Flow 节点编排(工作流)的方式来实现复杂工作流,提高可玩性和扩展性。但同时也提高了上手的门槛,有一定开发背景的用户使用起来会比较容易。 [查看视频教程](https://www.bilibili.com/video/BV1is421u7bQ/) ![](/imgs/flow-intro1.png) ## 什么是节点? 在程序中,节点可以理解为一个个 Function 或者接口。可以理解为它就是一个**步骤**。将多个节点一个个拼接起来,即可一步步的去实现最终的 AI 输出。 如下图,这是一个最简单的 AI 对话。它由用流程开始和 AI 对话节点组成。 ![](/imgs/flow-intro2.png) 执行流程如下: 1. 用户输入问题后,【流程开始】节点执行,用户问题被保存。 2. 【AI 对话】节点执行,此节点有两个必填参数“聊天记录”“用户问题”,聊天记录的值是默认输入的 6 条,表示此模块上下文长度。用户问题选择的是【流程开始】模块中保存的用户问题。 3. 【AI 对话】节点根据传入的聊天记录和用户问题,调用对话接口,从而实现回答。 ### 节点分类 从功能上,节点可以分为 2 类: 1. **系统节点**:用户引导(配置一些对话框信息)、用户问题(流程入口)。 2. **功能节点**:知识库搜索、AI 对话等剩余节点。(这些节点都有输入和输出,可以自由组合)。 ### 节点的组成 每个节点会包含 3 个核心部分:输入、输出和触发器。 ![](/imgs/flow-intro3.png) * AI 模型、提示词、聊天记录、用户问题,知识库引用为输入,节点的输入可以是手动输入也可以是变量引用,变量引用的范围包括“全局变量”和之前任意一个节点的输出。 * 新的上下文和 AI 回复内容为输出,输出可以被之后任意节点变量引用。 * 节点的上下左右有四个“触发器”可以被用来连接,被连接的节点按顺序决定是否执行。 ## 重点 - 工作流是如何运行的 FastGPT 的工作流从【流程开始】节点开始执行,可以理解为从用户输入问题开始,没有**固定的出口**,是以节点运行结束作为出口,如果在一个轮调用中,所有节点都不再运行,则工作流结束。 下面我们来看下,工作流是如何运行的,以及每个节点何时被触发执行。 ![](/imgs/flow-intro1.png) 如上图所示节点会“被连接”也会“连接其他节点”,我们称“被连接”的那根线为前置线,“连接其他节点的线”为后置线。上图例子中【知识库搜索】模块左侧有一根前置线,右侧有一根后置线。而【AI 对话】节点只有左侧一根前置线。 FastGPT 工作流中的线有以下几种状态: * `waiting`:被连接的节点等待执行。 * `active`:被连接的节点可以执行。 * `skip`:被连接的节点不需要执行跳过。 节点执行的原则: 1. 判断前置线中有没有状态为 `waiting` 的,如果有则等待。 2. 判断前置线中状态有没有状态为 `active` 如果有则执行。 3. 如果前置线中状态即没有 `waiting` 也没有 `active` 则认为此节点需要跳过。 4. 节点执行完毕后,需要根据实际情况更改后置线的状态为 `active` 或 `skip` 并且更改前置线状态为 `waiting` 等待下一轮执行。 让我们看一下上面例子的执行过程: 1. 【流程开始】节点执行完毕,更改后置线为 `active`。 2. 【知识库搜索】节点判断前置线状态为 `active` 开始执行,执行完毕后更改后置线状态为 `active` 前置线状态为 `waiting`。 3. 【AI 对话】节点判断前置线状态为 `active` 开始执行,流程执行结束。 ## 如何连接节点 1. 为了方便连接,FastGPT 每个节点的上下左右都有连接点,左和上是前置线连接点,右和下是后置线连接点。 2. 可以点击连接线中间的 x 来删除连接线。 3. 可以左键点击选中连接线 ## 如何阅读? 1. 建议从左往右阅读。 2. 从 **用户问题** 节点开始。用户问题节点,代表的是用户发送了一段文本,触发任务开始。 3. 关注【AI 对话】和【指定回复】节点,这两个节点是输出答案的地方。 ## FAQ ### 想合并多个输出结果怎么实现? 1. 文本加工,可以对字符串进行合并。 2. 知识库搜索合并,可以合并多个知识库搜索结果 3. 其他结果,无法直接合并,可以考虑传入到 `HTTP` 节点中,通过你的业务服务进行合并。 file: ./content/guide/dataset/third-party/api_dataset.en.mdx meta: { "title": "API File Library", "description": "Introduction and usage of the FastGPT API File Library" } import { Alert } from '@/components/docs/Alert'; | | | | ----------------------- | ----------------------- | | ![](/imgs/image-18.png) | ![](/imgs/image-19.png) | ## Background FastGPT supports local file imports, but in many cases users already have an existing document library. Re-importing files would create duplicate storage and complicate management. To address this, FastGPT offers an API File Library that connects to your existing document library through simple API endpoints, with flexible import options. The API File Library lets you integrate your existing document library seamlessly. Implement a few endpoints that conform to FastGPT's API File Library specification, provide the service's baseURL and token when creating a knowledge base, and you can browse and selectively import files directly from the UI. ## How to Use the API File Library When creating a knowledge base, select the API File Library type and configure the key parameters: the baseURL of your file service and the request header for authentication. As long as your endpoints conform to FastGPT's specification, the system will automatically fetch and display the complete file list for selective import. You need to provide three parameters: * baseURL: The base URL of your file service * authorization: The authentication request header, sent as `Authorization: Bearer ` * basePath: Optional, the root directory path to specify the starting position of the file tree ## API Specification Response format: ```ts type ResponseType = { success: boolean; message: string; data: any; } ``` Data types: ```ts // Single file item in the file list type FileListItem = { id: string; parentId: string | null; name: string; type: 'file' | 'folder'; updateTime: Date; createTime: Date; hasChild?: boolean; // Optional, whether it has child nodes, defaults to true for folder type } ``` ### 1. Get File Tree * parentId - Parent ID, optional. If not provided or null, the configured basePath will be used as the root directory * searchKey - Search keyword, optional ```bash curl --location --request POST '{{baseURL}}/v1/file/list' \ --header 'Authorization: Bearer {{authorization}}' \ --header 'Content-Type: application/json' \ --data-raw '{ "parentId": null, "searchKey": "" }' ``` ```json { "success": true, "message": "", "data": [ { "id": "xxxx", "parentId": "xxxx", "type": "file", "name":"test.json", "updateTime":"2024-11-26T03:05:24.759Z", "createTime":"2024-11-26T03:05:24.759Z", "hasChild": false } ] } ``` ### 2. Get Single File Content (Text Content or Access Link) ```bash curl --location --request GET '{{baseURL}}/v1/file/content?id=xx' \ --header 'Authorization: Bearer {{authorization}}' ``` ```json { "success": true, "message": "", "data": { "title": "Document Title", "content": "FastGPT is an LLM-based knowledge base Q&A system with out-of-the-box data processing and model invocation capabilities. It also supports visual workflow orchestration via Flow for complex Q&A scenarios!\n" } } ``` * **title** - File title, optional. Used to display the file name. If not provided, the system will attempt to parse the filename from `previewUrl`. * **content** - The text content of the file, optional. Returns the complete text content of the file directly, which the system will use for indexing and retrieval. * **previewUrl** - The access link to the file, optional. Provides an accessible file URL, and the system will automatically request this address to download the file and extract its content. Supports various file formats (such as PDF, Word, Markdown, etc.). **Important Notes:** * Either `content` or `previewUrl` must be returned, **at least one is required**, otherwise an error will occur. * If both `content` and `previewUrl` are returned, `content` takes priority and the system will use the `content` directly. * When `previewUrl` is returned, the system will access the link to read and parse the document content, and will cache the parsing results to improve performance. ### 3. Get File Read Link (for Viewing the Original) id is the file's ID. ```bash curl --location --request GET '{{baseURL}}/v1/file/read?id=xx' \ --header 'Authorization: Bearer {{authorization}}' ``` ```json { "success": true, "message": "", "data": { "url": "xxxx" } } ``` * url - File access link; opens automatically once retrieved. ### 4. Get File Details id is the file's ID. ```bash curl --location --request GET '{{baseURL}}/v1/file/detail?id=xx' \ --header 'Authorization: Bearer {{authorization}}' ``` ```json { "success": true, "message": "", "data": { "id": "xxxx", "name": "test.json", "parentId": "xxxx", "type": "file", "updateTime": "2024-11-26T03:05:24.759Z", "createTime": "2024-11-26T03:05:24.759Z" } } ``` * id - File ID * name - File name * parentId - Parent ID, null indicates root directory * type - File type, file or folder * updateTime - Update time * createTime - Creation time file: ./content/guide/dataset/third-party/api_dataset.mdx meta: { "title": "API 文件库", "description": "FastGPT API 文件库功能介绍和使用方式" } import { Alert } from '@/components/docs/Alert'; | | | | ----------------------- | ----------------------- | | ![](/imgs/image-18.png) | ![](/imgs/image-19.png) | ## 背景 目前 FastGPT 支持本地文件导入,但是很多时候,用户自身已经有了一套文档库,如果把文件重复导入一遍,会造成二次存储,并且不方便管理。因为 FastGPT 提供了一个 API 文件库的概念,可以通过简单的 API 接口,去拉取已有的文档库,并且可以灵活配置是否导入。 API 文件库能够让用户轻松对接已有的文档库,只需要按照 FastGPT 的 API 文件库规范,提供相应文件接口,然后将服务接口的 baseURL 和 token 填入知识库创建参数中,就能直接在页面上拿到文件库的内容,并选择性导入 ## 如何使用 API 文件库 创建知识库时,选择 API 文件库类型,然后需要配置两个关键参数:文件服务接口的 baseURL 和用于身份验证的请求头信息。只要提供的接口规范符合 FastGPT 的要求,系统就能自动获取并展示完整的文件列表,可以根据需要选择性地将文件导入到知识库中。 你需要提供三个参数: * baseURL: 文件服务接口的 baseURL * authorization: 用于身份验证的请求头信息,实际请求格式为 `Authorization: Bearer ` * basePath: 可选,根目录路径,用于指定文件树的起始位置 ## 接口规范 接口响应格式: ```ts type ResponseType = { success: boolean; message: string; data: any; } ``` 数据类型: ```ts // 文件列表中,单项的文件类型 type FileListItem = { id: string; parentId: string | null; name: string; type: 'file' | 'folder'; updateTime: Date; createTime: Date; hasChild?: boolean; // 可选,是否有子节点,默认 folder 类型为 true } ``` ### 1. 获取文件树 * parentId - 父级 id,可选。如果不传或传 null,则使用配置的 basePath 作为根目录 * searchKey - 检索词,可选 ```bash curl --location --request POST '{{baseURL}}/v1/file/list' \ --header 'Authorization: Bearer {{authorization}}' \ --header 'Content-Type: application/json' \ --data-raw '{ "parentId": null, "searchKey": "" }' ``` ```json { "success": true, "message": "", "data": [ { "id": "xxxx", "parentId": "xxxx", "type": "file", "name":"test.json", "updateTime":"2024-11-26T03:05:24.759Z", "createTime":"2024-11-26T03:05:24.759Z", "hasChild": false } ] } ``` ### 2. 获取单个文件内容(文本内容或访问链接) ```bash curl --location --request GET '{{baseURL}}/v1/file/content?id=xx' \ --header 'Authorization: Bearer {{authorization}}' ``` ```json { "success": true, "message": "", "data": { "title": "文档标题", "content": "FastGPT 是一个基于 LLM 大语言模型的知识库问答系统,提供开箱即用的数据处理、模型调用等能力。同时可以通过 Flow 可视化进行工作流编排,从而实现复杂的问答场景!\n" } } ``` * **title** - 文件标题,可选。用于显示文件名称,如果不提供,系统会尝试从 `previewUrl` 中解析文件名。 * **content** - 文件的文本内容,可选。直接返回文件的完整文本内容,系统会直接使用该内容进行索引和检索。 * **previewUrl** - 文件的访问链接,可选。提供一个可访问的文件 URL,系统会自动请求该地址下载文件并提取内容。支持各种文件格式(如 PDF、Word、Markdown 等)。 **重要说明:** * `content` 和 `previewUrl` 二选一返回,**必须至少返回其中一个**,否则会报错。 * 如果同时返回 `content` 和 `previewUrl`,则 `content` 优先级更高,系统会直接使用 `content` 的内容。 * 返回 `previewUrl` 时,系统会访问该链接进行文档内容读取和解析,并会缓存解析结果以提高性能。 ### 3. 获取文件阅读链接(用于查看原文) id 为文件的 id。 ```bash curl --location --request GET '{{baseURL}}/v1/file/read?id=xx' \ --header 'Authorization: Bearer {{authorization}}' ``` ```json { "success": true, "message": "", "data": { "url": "xxxx" } } ``` * url - 文件访问链接,拿到后会自动打开。 ### 4. 获取文件详情 id 为文件的 id。 ```bash curl --location --request GET '{{baseURL}}/v1/file/detail?id=xx' \ --header 'Authorization: Bearer {{authorization}}' ``` ```json { "success": true, "message": "", "data": { "id": "xxxx", "name": "test.json", "parentId": "xxxx", "type": "file", "updateTime": "2024-11-26T03:05:24.759Z", "createTime": "2024-11-26T03:05:24.759Z" } } ``` * id - 文件 id * name - 文件名称 * parentId - 父级 id,null 表示根目录 * type - 文件类型,file 或 folder * updateTime - 更新时间 * createTime - 创建时间 file: ./content/guide/dataset/third-party/dingtalk_dataset.en.mdx meta: { "title": "DingTalk Knowledge Base", "description": "How to connect DingTalk Knowledge Base to FastGPT" } FastGPT supports connecting DingTalk Knowledge Base through a DingTalk internal enterprise app. When creating the dataset, enter `App Key`, `App Secret`, and `User ID`. After creation, open the dataset detail page, click `Add file`, and select the DingTalk workspace, online documents, or folders to import. Only DingTalk online document text is supported. Binary files such as PDF, Word, Excel, and PPT are not supported. ## 1. Create a DingTalk app ![Create a DingTalk app](/imgs/image-dd3.png) Open the [DingTalk developer app page](https://open-dev.dingtalk.com/fe/app?hash=%23%2Fcorp%2Fapp#/corp/app), then select an internal enterprise app under the target organization. If you do not have an app yet, create an internal enterprise app from `Application Development`. ## 2. Get the FastGPT fields ![Get App Key and App Secret](/imgs/image-dd4.png) | FastGPT field | Where to get it in DingTalk | | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `App Key` | Open `Credentials and Basic Information` in the app detail page, then copy `Client ID (formerly AppKey and SuiteKey)`. | | `App Secret` | Copy `Client Secret (formerly AppSecret and SuiteSecret)` from the same page. | | `User ID` | Ask the organization contact administrator to open DingTalk admin. Path: [oa.dingtalk.com](https://oa.dingtalk.com/) -> `Contacts` -> `Member Management` -> select the operator member -> copy the member `User ID` from the detail page. | Notes: * `App Secret` is sensitive. Do not share it publicly. * `User ID` is not a phone number, display name, or `unionId`. * If the member detail page does not show `User ID`, ask the contact administrator to export the member list from `Contacts`; the exported sheet usually contains member `User ID`. * We recommend using a dedicated DingTalk member as the FastGPT sync account and granting it read-only access to the target workspace. * Workspaces that this member cannot access will not appear in FastGPT. ## 3. Enable DingTalk app permissions ![Enable DingTalk app permissions](/imgs/image-dd5.png) Open `Permissions` in the DingTalk app detail page, then search for and enable: | Permission | Purpose | | --------------------- | ---------------------------------------------------- | | `qyapi_get_member` | Get the operator ID from `User ID`. | | `Wiki.Workspace.Read` | List DingTalk workspaces accessible to the operator. | | `Wiki.Node.Read` | List folders and documents under a workspace. | | `Storage.File.Read` | Read DingTalk online document content. | Save and publish the app configuration after enabling permissions. If an error contains `requiredScopes`, enable the permissions listed there. ## 4. Create a DingTalk dataset in FastGPT 1. Open the FastGPT dataset list and click `New`. 2. Select `DingTalk Knowledge Base` under external document sources. 3. Enter: * `App Key` * `App Secret` * `User ID` 4. Confirm creation. You do not need to select a DingTalk workspace or root directory during creation. ## 5. Add files and sync After creation: 1. Open the dataset detail page. 2. Click `Add file`. 3. Select the target DingTalk workspace. 4. Select online documents or folders to import. 5. Confirm the import. When a folder is selected, FastGPT recursively imports supported online documents under that folder. When DingTalk document content changes, click `Sync` from the imported file menu. FastGPT will read the latest content and update indexes. file: ./content/guide/dataset/third-party/dingtalk_dataset.mdx meta: { "title": "钉钉知识库", "description": "FastGPT 钉钉知识库功能介绍和使用方式" } | | | | -------------------------------- | -------------------------------- | | ![alt text](/imgs/image-dd1.png) | ![alt text](/imgs/image-dd2.png) | FastGPT 支持通过钉钉企业内部应用接入钉钉知识库。创建时只需要填写 `App Key`、`App Secret`、`User ID`,创建完成后进入知识库详情页点击`添加文件`,再选择要导入的钉钉知识库、在线文档或文件夹。 当前仅支持钉钉在线文档文本,不支持 PDF、Word、Excel、PPT 等二进制文件。 ## 1. 创建钉钉应用 ![创建钉钉应用](/imgs/image-dd3.png) 打开 [钉钉开发者后台应用详情](https://open-dev.dingtalk.com/fe/app?hash=%23%2Fcorp%2Fapp#/corp/app),选择目标企业下的企业内部应用。 如果还没有应用,先进入`应用开发`创建一个企业内部应用。 ## 2. 获取 FastGPT 要填写的参数 ![获取 App Key 和 App Secret](/imgs/image-dd4.png) | FastGPT 字段 | 钉钉里去哪里拿 | | ------------ | ------------------------------------------------------------------------------------------------------------------------------- | | `App Key` | 应用详情页左侧进入`凭证与基础信息`,复制`Client ID(原 AppKey 和 SuiteKey)`。 | | `App Secret` | 同一页面复制`Client Secret(原 AppSecret 和 SuiteSecret)`。 | | `User ID` | 由企业通讯录管理员进入钉钉管理后台查看。路径:[oa.dingtalk.com](https://oa.dingtalk.com/) -> `通讯录` -> `成员管理` -> 找到作为操作人的成员 -> 点击成员详情,复制该成员的 `User ID`。 | 注意: * `App Secret` 是密钥,不要公开发送。 * `User ID` 不是手机号、姓名,也不是 `unionId`。 * 如果成员详情页没有展示 `User ID`,让通讯录管理员在`通讯录`里导出成员列表,导出的表格中通常包含成员 `User ID`。 * 建议使用一个专门的钉钉成员作为 FastGPT 同步账号,并给它目标知识库的只读权限。 * 该成员没有权限访问的钉钉知识库,不会出现在 FastGPT 的添加文件列表里。 ## 3. 配置钉钉应用权限 ![配置钉钉应用权限](/imgs/image-dd5.png) 在钉钉应用详情页左侧进入`权限管理`,搜索并开通以下权限: | 权限标识 | 用途 | | --------------------- | --------------------------- | | `qyapi_get_member` | 通过 `User ID` 获取接口需要的操作人 ID。 | | `Wiki.Workspace.Read` | 获取当前操作人可访问的钉钉知识库列表。 | | `Wiki.Node.Read` | 获取知识库下的文件夹和文档列表。 | | `Storage.File.Read` | 读取钉钉在线文档正文。 | 权限配置完成后,保存并发布应用配置。若接口报错中出现 `requiredScopes`,按提示补开对应权限。 ## 4. 在 FastGPT 中创建钉钉知识库 1. 进入 FastGPT 知识库列表,点击`新建`。 2. 选择`第三方知识库`下的`钉钉知识库`。 3. 填写: * `App Key` * `App Secret` * `User ID` 4. 点击确认创建。 ## 5. 添加文件和同步 创建完成后: 1. 进入该知识库详情页。 2. 右上角点击`添加文件`。 3. 选择目标钉钉知识库。 4. 选择要导入的在线文档或文件夹。 5. 确认导入。 选择文件夹时,FastGPT 会递归导入该文件夹下支持的在线文档。 钉钉文档内容更新后,可在已导入文件的更多菜单中点击`同步`,FastGPT 会重新读取最新正文并更新索引。 file: ./content/guide/dataset/third-party/lark_dataset.en.mdx meta: { "title": "Lark Knowledge Base", "description": "Introduction and usage of the FastGPT Lark Knowledge Base" } | | | | ------------------------------- | ------------------------------- | | ![alt text](/imgs/image-39.png) | ![alt text](/imgs/image-40.png) | Starting from FastGPT v4.8.16, commercial edition users can import from Lark knowledge bases. Configure a Lark app's appId and appSecret, then select a **top-level folder in a document space** to import. This feature is currently in beta — some interactions may still need refinement. Due to Lark API limitations, you cannot directly access all document content. Currently, only files in shared space directories are accessible — personal spaces and wiki content are not supported. Only cloud document types are supported for import. ## 1. Create a Lark App Go to the [Lark Open Platform](https://open.feishu.cn/?lang=zh-CN), click **Create App**, select **Custom App**, and fill in the app name. ## 2. Configure App Permissions After creating the app, configure the following **3 permissions**: 1. View the list of cloud documents in a folder 2. View new-format documents 3. View, comment, edit, and manage all files in the cloud space ![alt text](/imgs/image-41.png) ## 3. Get the appId and appSecret ![alt text](/imgs/image-42.png) ## 4. Grant Folder Permissions Refer to the Lark tutorial: [https://open.feishu.cn/document/server-docs/docs/drive-v1/faq#b02e5bfb](https://open.feishu.cn/document/server-docs/docs/drive-v1/faq#b02e5bfb) In summary: 1. Add the app you just created to a group chat 2. Grant directory permissions to that group If your directory already has permissions granted to the "All Members" group, you can skip the steps above and go directly to getting the Folder Token. ![alt text](/imgs/image-43.png) ## 5. Get the Folder Token You can find the Folder Token in the page URL. Make sure not to include the question mark. ![alt text](/imgs/image-44.png) ## 6. Create the Knowledge Base Using the 3 parameters obtained from steps 3 and 5, create a knowledge base. Select the Lark file library type, fill in the parameters, and click Create. ![alt text](/imgs/image-39.png) file: ./content/guide/dataset/third-party/lark_dataset.mdx meta: { "title": "飞书知识库", "description": "FastGPT 飞书知识库功能介绍和使用方式" } | | | | ------------------------------- | ------------------------------- | | ![alt text](/imgs/image-39.png) | ![alt text](/imgs/image-40.png) | FastGPT v4.8.16 版本开始,商业版用户支持飞书知识库导入,用户可以通过配置飞书应用的 appId 和 appSecret,并选中一个**文档空间的顶层文件夹**来导入飞书知识库。目前处于测试阶段,部分交互有待优化。 由于飞书限制,无法直接获取所有文档内容,目前仅可以获取共享空间下文件目录的内容,无法获取个人空间和知识库里的内容。 目前只支持导入云文档类型的内容。 ## 1. 创建飞书应用 打开 [飞书开放平台](https://open.feishu.cn/?lang=zh-CN),点击**创建应用**,选择**自建应用**,然后填写应用名称。 ## 2. 配置应用权限 创建应用后,进入应用可以配置相关权限,这里需要增加**3个权限**: 1. 获取云空间文件夹下的云文档清单 2. 查看新版文档 3. 查看、评论、编辑和管理云空间中所有文件 ![alt text](/imgs/image-41.png) ## 3. 获取 appId 和 appSecret ![alt text](/imgs/image-42.png) ## 4. 给 Folder 增加权限 可参考飞书教程: [https://open.feishu.cn/document/server-docs/docs/drive-v1/faq#b02e5bfb](https://open.feishu.cn/document/server-docs/docs/drive-v1/faq#b02e5bfb) 大致总结为: 1. 把刚刚创建的应用拉入一个群里 2. 给这个群增加目录权限 如果你的目录已经给全员组增加权限了,则可以跳过上面步骤,直接获取 Folder Token。 ![alt text](/imgs/image-43.png) ## 5. 获取 Folder Token 可以页面路径上获取 Folder Token,注意不要把问号复制进来。 ![alt text](/imgs/image-44.png) ## 6. 创建知识库 根据 3 和 5 获取到的 3 个参数,创建知识库,选择飞书文件库类型,然后填入对应的参数,点击创建。 ![alt text](/imgs/image-39.png) file: ./content/guide/dataset/third-party/third_dataset.en.mdx meta: { "title": "Third-Party Knowledge Base Development", "description": "How to integrate a third-party knowledge base with FastGPT", "sidebarTag": "DEV" } import { Alert } from '@/components/docs/Alert'; There are many document libraries available online, such as Lark, Yuque, and others. Different FastGPT users may use different document libraries. FastGPT has built-in support for Lark and Yuque, but if you need to integrate other document libraries, follow this guide. ## Unified API Specification To provide a unified interface for different document libraries, FastGPT defines a standard API specification with 4 endpoints. See the [API File Library endpoints](./api_dataset.en.mdx). All built-in document libraries are extensions of the standard API File Library. Refer to the code in `FastGPT/packages/service/core/dataset/apiDataset/yuqueDataset/api.ts` to build extensions for other document libraries. You need to implement 4 endpoints: 1. Get file list 2. Get file content / file link 3. Get original file preview URL 4. Get file detail information ## Building a Third-Party File Library For this walkthrough, we'll use adding a Lark Knowledge Dataset (FeishuKnowledgeDataset) as an example. ### 1. Add Third-Party Document Library Parameters First, go to `FastGPT\packages\global\core\dataset\apiDataset.d.ts` in the FastGPT project and add the third-party document library server type. Design the fields based on your needs. For example, the Yuque knowledge base requires `userId` and `token` for authentication. ```ts export type YuqueServer = { userId: string; token?: string; basePath?: string; }; ``` If the document library supports a `root directory` selection feature, add a `basePath` field. [See the root directory feature](./third_dataset.en.mdx#adding-the-configuration-form) ![](/imgs/thirddataset-1.png) ### 2. Create the Hook File Each third-party document library uses a Hook pattern to maintain a set of API endpoints. The Hook contains 5 functions to implement. * Create a folder for your document library under `FastGPT\packages\service\core\dataset\apiDataset\`, then create an `api.ts` file inside it * In `api.ts`, define the following 5 functions: * `listFiles`: Get the file list * `getFileContent`: Get file content / file link * `getFileDetail`: Get file detail information * `getFilePreviewUrl`: Get the original file preview URL * `getFileId`: Get the original file's real ID ### 3. Add the Knowledge Base Type In `FastGPT\packages\global\core\dataset\type.d.ts`, import your new knowledge base type. ![](/imgs/thirddataset-2.png) ### 4. Add Knowledge Base Data Retrieval In `FastGPT\packages\global\core\dataset\apiDataset\utils.ts`, add the following content. ![](/imgs/thirddataset-3.png) ### 5. Add Knowledge Base Invocation Method In `FastGPT\packages\service\core\dataset\apiDataset\index.ts`, add the following content. ![](/imgs/thirddataset-4.png) ## Adding the Frontend Add your i18n translations in `FastGPT\packages\web\i18n\zh-CN\dataset.json`, `FastGPT\packages\web\i18n\en\dataset.json`, and `FastGPT\packages\web\i18n\zh-Hant\dataset.json`. Using Chinese translations as an example, you'll generally need the following: ![](/imgs/thirddataset-5.png) In `FastGPT\packages\service\support\user/audit\util.ts`, add the following to support i18n translation retrieval. ![](/imgs/thirddataset-6.png) The i18n translation content is stored in `FastGPT\packages\web\i18n\zh-Hant\account_team.json`, `FastGPT\packages\web\i18n\zh-CN\account_team.json`, and `FastGPT\packages\web\i18n\en\account_team.json`. The field format is `dataset.XXX_dataset`. For example, for the Lark knowledge base, the field value is `dataset.feishu_knowledge_dataset`. Add your knowledge base icons under `FastGPT\packages\web\components\common\Icon\icons\core\dataset\`. You need two icons: `Outline` (monochrome) and `Color` (colored), as shown below. ![](/imgs/thirddataset-7.png) In `FastGPT\packages\web\components\common\Icon\constants.ts`, register your icons. The `import` path points to where the icons are stored. ![](/imgs/thirddataset-8.png) In `FastGPT\packages\global\core\dataset\constants.ts`, add your knowledge base type to both `DatasetTypeEnum` and `ApiDatasetTypeMap`. | | | | ----------------------------- | ------------------------------ | | ![](/imgs/thirddataset-9.png) | ![](/imgs/thirddataset-10.png) | The `courseUrl` field links to the relevant documentation — add it if available. Documentation goes in `FastGPT/document/content/guide/build/workflow/nodes/knowledge_base_search_merge.mdx`. The `label` value is the knowledge base name you added via i18n translations. `icon` and `avatar` are the two icons you added earlier. In `FastGPT\projects\app\src\pages\dataset\list\index.tsx`, add the following. This file handles the menu that appears when clicking the "New" button on the knowledge base list page. Your knowledge base must be added here to be creatable. ![](/imgs/thirddataset-11.png) In `FastGPT\projects\app\src\pageComponents\dataset\detail\Info\index.tsx`, add the following. This configuration corresponds to the UI shown below. | | | | ------------------------------ | ------------------------------ | | ![](/imgs/thirddataset-12.png) | ![](/imgs/thirddataset-13.png) | ## Adding the Configuration Form In `FastGPT\projects\app\src\pageComponents\dataset\ApiDatasetForm.tsx`, add the following. This file handles the field input form when creating a knowledge base. | | | | | ------------------------------ | ------------------------------ | ------------------------------ | | ![](/imgs/thirddataset-14.png) | ![](/imgs/thirddataset-15.png) | ![](/imgs/thirddataset-16.png) | The two components added in the code render the root directory selector, corresponding to the `getFileDetail` API method. If your knowledge base doesn't support this, you can omit them. ``` {renderBaseUrlSelector()} // Renders the `Base URL` field {renderDirectoryModal()} // The `Select Root Directory` modal that appears when clicking `Select` (see image) ``` | | | | ------------------------------ | ------------------------------ | | ![](/imgs/thirddataset-17.png) | ![](/imgs/thirddataset-18.png) | If the knowledge base needs root directory support, also add the following in the `ApiDatasetForm` file. ### 1. Parse the Knowledge Base Type Parse your knowledge base type from `apiDatasetServer`, as shown: ![](/imgs/thirddataset-19.png) ### 2. Add Root Directory Selection Logic and `parentId` Assignment Add root directory selection logic to ensure the user has filled in all required fields for the API methods, such as the Token. ![](/imgs/thirddataset-20.png) ### 3. Add Field Validation and Assignment Logic Verify that all required fields are present before calling the API, and assign the root directory value to the corresponding field after selection. ![](/imgs/thirddataset-21.png) ## Tips After creating the knowledge base, we recommend running a full test of all knowledge base features to check for issues. If you encounter problems that aren't covered in this documentation, it's likely that some configuration was missed. Do a global search for `YuqueServer` and `yuqueServer` to verify that your type has been added everywhere it's needed. file: ./content/guide/dataset/third-party/third_dataset.mdx meta: { "title": "第三方知识库开发", "description": "本节详细介绍如何在FastGPT上自己接入第三方知识库", "sidebarTag": "DEV" } import { Alert } from '@/components/docs/Alert'; 目前,互联网上拥有各种各样的文档库,例如飞书,语雀等等。 FastGPT 的不同用户可能使用的文档库不同,目前 FastGPT 内置了飞书、语雀文档库,如果需要接入其他文档库,可以参考本节内容。 ## 统一的接口规范 为了实现对不同文档库的统一接入,FastGPT 对第三方文档库进行了接口的规范,共包含 4 个接口内容,可以[查看 API 文件库接口](./api_dataset.mdx)。 所有内置的文档库,都是基于标准的 API 文件库进行扩展。可以参考`FastGPT/packages/service/core/dataset/apiDataset/yuqueDataset/api.ts`中的代码,进行其他文档库的扩展。一共需要完成 4 个接口开发: 1. 获取文件列表 2. 获取文件内容/文件链接 3. 获取原文预览地址 4. 获取文件详情信息 ## 开始一个第三方文件库 为了方便讲解,这里以添加飞书知识库( FeishuKnowledgeDataset )为例。 ### 1. 添加第三方文档库参数 首先,要进入 FastGPT 项目路径下的`FastGPT\packages\global\core\dataset\apiDataset.d.ts`文件,添加第三方文档库 Server 类型。知识库类型的字段由自己设计,主要是自己需要那些内容。例如,语雀知识库中,需要提供`userId`、`token`两个字段作为鉴权信息。 ```ts export type YuqueServer = { userId: string; token?: string; basePath?: string; }; ``` 如果文档库有`根目录`选择的功能,需要设置添加一个字段`basePath`[点击查看`根目录`功能](./third_dataset.mdx#添加配置表单) ![](/imgs/thirddataset-1.png) ### 2. 创建 Hook 文件 每个第三方文档库都会采用 Hook 的方式来实现一套 API 接口的维护,Hook 里包含 5 个函数需要完成。 * 在`FastGPT\packages\service\core\dataset\apiDataset\`下创建一个文档库的文件夹,然后在文件夹下创建一个`api.ts`文件 * 在`api.ts`文件中,需要完成 5 个函数的定义,分别是: * `listFiles`:获取文件列表 * `getFileContent`:获取文件内容/文件链接 * `getFileDetail`:获取文件详情信息 * `getFilePreviewUrl`:获取原文预览地址 * `getFileId`: 获取原文件真实Id ### 3. 添加知识库类型 在`FastGPT\packages\global\core\dataset\type.d.ts`文件中,导入自己创建的知识库类型。 ![](/imgs/thirddataset-2.png) ### 4. 添加知识库数据获取 在`FastGPT\packages\global\core\dataset\apiDataset\utils.ts`文件中,添加如下内容。 ![](/imgs/thirddataset-3.png) ### 5. 添加知识库调用方法 在`FastGPT\packages\service\core\dataset\apiDataset\index.ts`文件下,添加如下内容。 ![](/imgs/thirddataset-4.png) ## 添加前端 `FastGPT\packages\web\i18n\zh-CN\dataset.json`,`FastGPT\packages\web\i18n\en\dataset.json`和`FastGPT\packages\web\i18n\zh-Hant\dataset.json`中添加自己的 I18n 翻译,以中文翻译为例,大体需要如下几个内容: ![](/imgs/thirddataset-5.png) `FastGPT\packages\service\support\user/audit\util.ts`文件下添加如下内容,以支持获取 I18n 翻译。 ![](/imgs/thirddataset-6.png) 此次 I18n 翻译内容存放在`FastGPT\packages\web\i18n\zh-Hant\account_team.json`,`FastGPT\packages\web\i18n\zh-CN\account_team.json`和`FastGPT\packages\web\i18n\en\account_team.json`,字段格式为`dataset.XXX_dataset`,以飞书知识库为例,字段值为`dataset.feishu_knowledge_dataset` `FastGPT\packages\web\components\common\Icon\icons\core\dataset\`添加自己的知识库图标,一共是两个,分为`Outline`和`Color`,分别是有颜色的和无色的,具体看如下图片。 ![](/imgs/thirddataset-7.png) 在`FastGPT\packages\web\components\common\Icon\constants.ts`文件中,添加自己的图标。 `import` 是图标的存放路径。 ![](/imgs/thirddataset-8.png) 在`FastGPT\packages\global\core\dataset\constants.ts`中,添加自己的知识库类型,分别要在`DatasetTypeEnum`和`ApiDatasetTypeMap`中添加内容。 | | | | ----------------------------- | ------------------------------ | | ![](/imgs/thirddataset-9.png) | ![](/imgs/thirddataset-10.png) | `courseUrl`字段是相应的文档说明,如果有的话,可以添加。 文档添加在`FastGPT/document/content/guide/build/workflow/nodes/knowledge_base_search_merge.mdx` `label`内容是自己之前通过 i18n 翻译添加的知识库名称的。 `icon`和`avatar`是自己之前添加的两个图标 在`FastGPT\projects\app\src\pages\dataset\list\index.tsx`文件下,添加如下内容。这个文件负责的是知识库列表页的`新建`按钮点击后的菜单,只有在该文件添加知识库后,才能创建知识库。 ![](/imgs/thirddataset-11.png) 在`FastGPT\projects\app\src\pageComponents\dataset\detail\Info\index.tsx`文件下,添加如下内容。此处配置对应ui界面的如下。 | | | | ------------------------------ | ------------------------------ | | ![](/imgs/thirddataset-12.png) | ![](/imgs/thirddataset-13.png) | ## 添加配置表单 在`FastGPT\projects\app\src\pageComponents\dataset\ApiDatasetForm.tsx`文件下,添加自己如下内容。这个文件负责的是创建知识库页的字段填写。 | | | | | ------------------------------ | ------------------------------ | ------------------------------ | | ![](/imgs/thirddataset-14.png) | ![](/imgs/thirddataset-15.png) | ![](/imgs/thirddataset-16.png) | 代码中添加的两个组件是对根目录选择的渲染,对应设计的 api 的 getfiledetail 方法,如果你的知识库不支持,你可以不引用。 ``` {renderBaseUrlSelector()} //这是对`Base URL`字段的渲染 {renderDirectoryModal()} //点击`选择`后出现的`选择根目录`窗口,见图 ``` | | | | ------------------------------ | ------------------------------ | | ![](/imgs/thirddataset-17.png) | ![](/imgs/thirddataset-18.png) | 如果知识库需要支持根目录,还需要在`ApiDatasetForm`文件中添加如下内容。 ### 1. 解析知识库类型 需要从`apiDatasetServer`解析出自己的知识库类型,如图: ![](/imgs/thirddataset-19.png) ### 2. 添加选择根目录逻辑和`parentId`赋值逻辑 需要添加根目录选择逻辑,来确保用户已经填写了调动的 api 方法所必需的字段,比如 Token 之类的。 ![](/imgs/thirddataset-20.png) ### 3. 添加字段检查和赋值逻辑 需要在调用方法前再次检测是否以及获取完所有必须字段,在选择根目录后,将根目录值赋值给对应的字段。 ![](/imgs/thirddataset-21.png) ## 提示 建议知识库创建完成后,完整测试一遍知识库的功能,以确定有无漏洞,如果你的知识库添加有问题,且无法在文档找到对应的文件解决,一定是杂项没有添加完全,建议重复一次全局搜索`YuqueServer`和`yuqueServer`,检查是否有地方没有加上自己的类型。 file: ./content/guide/dataset/third-party/yuque_dataset.en.mdx meta: { "title": "Yuque File Library", "description": "Introduction and usage of the FastGPT Yuque File Library" } | | | | ------------------------------- | ------------------------------- | | ![alt text](/imgs/image-31.png) | ![alt text](/imgs/image-32.png) | Starting from FastGPT v4.8.16, commercial edition users can import from Yuque file libraries by configuring a Yuque token and uid. This feature is currently in beta — some interactions may still need refinement. ## 1. Get the Yuque Token and UID Go to the Yuque homepage > click your avatar > Settings to find the relevant parameters. ![alt text](/imgs/image-36.png) Follow the images below to get the Token and User ID. Make sure to assign the appropriate permissions to the Token: **Personal Edition**: | Get Token | Add Permissions | Get User ID | | ------------------------------- | ------------------------------- | ------------------------------- | | ![alt text](/imgs/image-33.png) | ![alt text](/imgs/image-34.png) | ![alt text](/imgs/image-35.png) | **Enterprise Edition**: | Get Token | Get User ID | | -------------------------------- | -------------------------------- | | ![alt text](/imgs/image-109.png) | ![alt text](/imgs/image-108.png) | ## 2. Create the Knowledge Base Using the token and uid from the previous step, create a knowledge base. Select the Yuque file library type, fill in the parameters, and click Create. ![alt text](/imgs/image-37.png) ![alt text](/imgs/image-31.png) ## 3. Import Documents After creating the knowledge base, click `Add File` to import from your Yuque document library and follow the on-screen guidance. The Yuque knowledge base supports scheduled sync — it scans once daily at varying times. If documents have been updated, they will be synced automatically. You can also trigger a manual sync. ![alt text](/imgs/image-38.png) file: ./content/guide/dataset/third-party/yuque_dataset.mdx meta: { "title": "语雀文件库", "description": "FastGPT 语雀文件库功能介绍和使用方式" } | | | | ------------------------------- | ------------------------------- | | ![alt text](/imgs/image-31.png) | ![alt text](/imgs/image-32.png) | FastGPT v4.8.16 版本开始,商业版用户支持语雀文件库导入,用户可以通过配置语雀的 token 和 uid 来导入语雀文档库。目前处于测试阶段,部分交互有待优化。 ## 1. 获取语雀的 token 和 uid 在语雀首页 - 个人头像 - 设置,可找到对应参数。 ![alt text](/imgs/image-36.png) 参考下图获取 Token 和 User ID,注意给 Token 赋值权限: **个人版**: | 获取 Token | 增加权限 | 获取 User ID | | ------------------------------- | ------------------------------- | ------------------------------- | | ![alt text](/imgs/image-33.png) | ![alt text](/imgs/image-34.png) | ![alt text](/imgs/image-35.png) | **企业版**: | 获取 Token | 获取 User ID | | -------------------------------- | -------------------------------- | | ![alt text](/imgs/image-109.png) | ![alt text](/imgs/image-108.png) | ## 2. 创建知识库 使用上一步获取的 token 和 uid,创建知识库,选择语雀文件库类型,然后填入对应的参数,点击创建。 ![alt text](/imgs/image-37.png) ![alt text](/imgs/image-31.png) ## 3. 导入文档 创建完知识库后,点击`添加文件`即可导入语雀的文档库,跟随引导即可。 语雀知识库支持定时同步功能,每天会不定时的扫描一次,如果文档有更新,则会进行同步,也可以进行手动同步。 ![alt text](/imgs/image-38.png) 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** ![](/imgs/guide/team_permissions/invitation_link/image1.png) 2. **In the invitation dialog, click "Create Invitation Link" to generate a new link** ![](/imgs/guide/team_permissions/invitation_link/image2.png) 3. **Fill in the details** ![](/imgs/guide/team_permissions/invitation_link/image3.png) 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** ![](/imgs/guide/team_permissions/invitation_link/image4.png) 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 ![](/imgs/guide/team_permissions/invitation_link/image5.png) 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. **在团队管理页面,管理员可点击「邀请成员」按钮打开邀请成员弹窗** ![](/imgs/guide/team_permissions/invitation_link/image1.png) 2. **在邀请成员弹窗中,点击「创建邀请链接」按钮,创建邀请链接。** ![](/imgs/guide/team_permissions/invitation_link/image2.png) 3. **输入对应内容** ![](/imgs/guide/team_permissions/invitation_link/image3.png) 链接描述:建议将链接描述为使用场景或用途。链接创建后不支持修改噢。 有效期:30分钟,7天,1年 有效人数:1人,无限制 4. **点击复制链接,并将其发送给想要邀请的人。** ![](/imgs/guide/team_permissions/invitation_link/image4.png) 5. **用户访问链接后,如果未登录/未注册,则先跳转到登录页面进行登录。在登录后将进入团队页面,处理邀请。** > 邀请链接形如:fastgpt.cn/account/team?invitelinkid=xxxx ![](/imgs/guide/team_permissions/invitation_link/image5.png) 点击接受,则用户将加入团队 点击忽略,则关闭弹窗,用户下次访问该邀请链接则还可以选择加入。 ## 链接失效和自动清理 ### 链接失效原因 手动停用链接 邀请链接到达有效期,自动停用 有效人数为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: ![](/imgs/guide/team_permissions/team_roles_permissions/image1.jpeg) ### 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: ![](/imgs/guide/team_permissions/team_roles_permissions/image2.png) When managing team permissions, first select members/organizations/groups, then configure permissions. ![](/imgs/guide/team_permissions/team_roles_permissions/image3.png) For resources like apps and knowledge bases, you can directly modify member permissions. ![](/imgs/guide/team_permissions/team_roles_permissions/image4.png) Team permissions are set on a dedicated permissions page. ![](/imgs/guide/team_permissions/team_roles_permissions/image5.png) ## 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 提供三种权限管理维度: **成员权限**:最高优先级,直接赋予个人的权限 **部门与群组权限**:采用权限并集原则,优先级低于成员权限 权限判定遵循以下逻辑: 首先检查用户的个人成员权限 其次检查用户所属部门和群组的权限(取并集) 最终权限为上述结果的组合 鉴权逻辑如下: ![](/imgs/guide/team_permissions/team_roles_permissions/image1.jpeg) ### 资源权限 对于不同的**资源**,有不同的权限。 这里说的资源,是指应用、知识库、团队等等概念。 下表为不同资源,可以进行管理的权限。
资源 可管理权限 说明
团队 创建应用 创建,删除等基础操作
创建知识库 创建,删除等基础操作
创建团队 APIKey 创建,删除等基础操作
管理成员 邀请、移除用户,创建群组等
应用 可使用 允许进行对话交互
可编辑 修改基本信息,进行流程编排等
可管理 添加或删除协作者
知识库 可使用 可以在应用中调用该知识库
可编辑 修改知识库的内容
可管理 添加或删除协作者
### 协作者 必须先添加**协作者**,才能对其进行权限管理: ![](/imgs/guide/team_permissions/team_roles_permissions/image2.png) 管理团队权限时,需先选择成员/组织/群组,再进行权限配置。 ![](/imgs/guide/team_permissions/team_roles_permissions/image3.png) 对于应用和知识库等资源,可直接修改成员权限。 ![](/imgs/guide/team_permissions/team_roles_permissions/image4.png) 团队权限在专门的权限页面进行设置 ![](/imgs/guide/team_permissions/team_roles_permissions/image5.png) ## 特殊权限说明 ### 管理员权限 管理员主要负责管理资源的协作关系,但有以下限制: * 不能修改或移除自身权限 * 不能修改或移除其他管理员权限 -不能将管理员权限赋予其他协作者 ### 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/config/model/intro.en.mdx meta: { "title": "Model Configuration", "description": "FastGPT model configuration guide" } import { Alert } from '@/components/docs/Alert'; import { Accordion, Accordions } from 'fumadocs-ui/components/accordion'; ## Introduction FastGPT uses the `AI Proxy` service to connect to different model providers. AI Proxy also provides load balancing, model logging, and analytics dashboards to help you monitor model usage.

Notes:

  1. Only one speech recognition model can be active at a time, so you only need to configure one.
  2. The system requires at least one language model and one embedding model to function properly.
### Architecture Diagram ![alt text](../../../../public/imgs/image-95.png) ### 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. ![aiproxy1](../../../../public/imgs/aiproxy-1.png) Click "Add Channel" in the top-right corner to open the channel configuration page. ![alt text](../../../../public/imgs/image-122.png) Using Alibaba Bailian models as an example: ![alt text](../../../../public/imgs/image-123.png) 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". ![aiproxy4](../../../../public/imgs/aiproxy-4.png) ### 2. Channel Testing You can test the channel to verify that the configured models are working properly. ![aiproxy5](../../../../public/imgs/aiproxy-5.png) Click "Model Test" to see the list of configured models, then click "Start Test". ![aiproxy6](../../../../public/imgs/aiproxy-6.png) Once testing completes, you'll see the results and response times for each model. ![aiproxy7](../../../../public/imgs/aiproxy-7.png) ### 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 | | ------------------------------------------------- | -------------------------------------------------- | | ![alt text](../../../../public/imgs/image-92.png) | ![alt text](../../../../public/imgs/image-124.png) | ### 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. ![alt text](../../../../public/imgs/image-105.png) ## Model Configuration ### Edit Model Configuration Click the gear icon next to a model to open its configuration. Different model types have different configuration options. | | | | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-93.png) | ![alt text](../../../../public/imgs/image-94.png) | ### 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** | | | | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-96.png) | ![alt text](../../../../public/imgs/image-97.png) | 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. | | | | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-98.png) | ![alt text](../../../../public/imgs/image-99.png) | ```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. ![aiproxy9](../../../../public/imgs/aiproxy-9.png) ### 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. ![aiproxy10](../../../../public/imgs/aiproxy-10.png) ### 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). ![aiproxy11](../../../../public/imgs/aiproxy-11.png) ### 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. 系统至少需要一个语言模型和一个索引模型才能正常使用。
### 运行流程图 ![alt text](../../../../public/imgs/image-95.png) ### 模型类型 1. 语言模型 - 进行文本对话,多模态模型支持图片识别。 2. 索引模型 - 对文本块进行索引,用于相关文本检索。 3. 重排模型 - 对检索结果进行重排,用于优化检索排名。 4. 语音合成 - 将文本转换为语音。 5. 语音识别 - 将语音转换为文本。 ### 特殊术语介绍 * 模型 ID:接口请求时候,Body 中 `model` 字段的值,全局唯一。 * 模型名: 用于展示的模型名称,可以自定义。 * 模型渠道:不同的模型提供商协议,例如 OpenAI、Anthropic、Google 等。大部分自建渠道都遵守 OpenAI 的协议。一个模型可以在配置在不同渠道中,实现负载均衡。 * 自定义请求地址/Key:如果需要绕过 `模型渠道`,可以设置自定义请求地址和 Token。一般情况下不需要。(不推荐使用,不方便管理) ## 添加渠道/模型 可以 FastGPT 中 `账号-模型提供商` 页面中进行模型配置。 ### 1. 创建渠道 切换到 `模型渠道` 标签页。注意,这里只能增加 `模型配置` 里有的模型,系统仅内置了主流的模型,如果需要增加其他模型,需要先在 `模型配置` 中增加。 ![aiproxy1](../../../../public/imgs/aiproxy-1.png) 点击右上角的“新增渠道”,即可进入渠道配置页面 ![alt text](../../../../public/imgs/image-122.png) 以阿里百炼的模型为例,进行如下配置 ![alt text](../../../../public/imgs/image-123.png) 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 凭证。注意部分厂商需要提供多个密钥组合,可以根据提示进行输入。 最后点击“新增”,就能在“模型渠道”下看到刚刚配置的渠道 ![aiproxy4](../../../../public/imgs/aiproxy-4.png) ### 2. 渠道测试 然后可以对渠道进行测试,确保配置的模型有效 ![aiproxy5](../../../../public/imgs/aiproxy-5.png) 点击“模型测试”,可以看到配置的模型列表,点击“开始测试” ![aiproxy6](../../../../public/imgs/aiproxy-6.png) 等待模型测试完成后,会输出每个模型的测试结果以及请求时长 ![aiproxy7](../../../../public/imgs/aiproxy-7.png) ### 3. 启用模型 系统内置了目前主流厂商的模型,如果你不熟悉配置,直接点击 `启用` 即可。`模型 ID` 是和 `模型渠道` 中的 `模型` 一致。 点击启用模型,即可使用。 | 启用模型 | 模型 ID 映射说明 | | ------------------------------------------------- | -------------------------------------------------- | | ![alt text](../../../../public/imgs/image-92.png) | ![alt text](../../../../public/imgs/image-124.png) | ### 4. 测试模型 FastGPT 页面上提供了每类模型的简单测试,可以初步检查模型是否正常工作,会实际按模板发送一个请求。 ![alt text](../../../../public/imgs/image-105.png) ## 模型配置 ### 修改模型配置 点击模型右侧的齿轮即可进行模型配置,不同类型模型的配置有区别。 | | | | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-93.png) | ![alt text](../../../../public/imgs/image-94.png) | ### 新增自定义模型 如果系统内置的模型无法满足你的需求,你可以添加自定义模型。如果 `模型 ID` 与系统内置的模型 ID 重复,则会被认为是修改系统模型,而不是新增模型。 1. **通过表单添加模型** | | | | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-96.png) | ![alt text](../../../../public/imgs/image-97.png) | 2. **通过配置文件配置** 如果你觉得通过页面配置模型比较麻烦,你也可以通过配置文件来配置模型。或者希望快速将一个系统的配置,复制到另一个系统,也可以通过配置文件来实现。 | | | | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-98.png) | ![alt text](../../../../public/imgs/image-99.png) | ```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。数值越大,越容易被优先选中。 ![aiproxy9](../../../../public/imgs/aiproxy-9.png) ### 启用/禁用渠道 在渠道右侧的控制菜单中,还可以控制渠道的启用或禁用,被禁用的渠道将无法再提供模型服务 ![aiproxy10](../../../../public/imgs/aiproxy-10.png) ### 模型调用日志 通过渠道调用的模型,可以在 `调用日志` 页面,会展示发送到模型处的请求记录,包括具体的输入输出 tokens、请求时间、请求耗时、请求地址等等。错误的请求,则会详细的入参和错误信息,方便排查,但仅会保留 1 小时(环境变量里可配置)。 ![aiproxy11](../../../../public/imgs/aiproxy-11.png) ### 私有部署模型 [点击查看部署 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. ![alt text](../../../../public/imgs/image-104.png) ## 3. Add a Model Channel On the Model Channels page, add a new SiliconCloud channel and select the models you just added. ![alt text](../../../../public/imgs/image-126.png) ## 4. Test Models First, verify that all SiliconCloud models are running properly. ![alt text](../../../../public/imgs/image-127.png) ## 5. Test in an App ### Test Chat and Image Recognition Create a simple app, select the corresponding model, enable image upload, and test: | | | | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-68.png) | ![alt text](../../../../public/imgs/image-70.png) | 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): | | | | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-72.png) | ![alt text](../../../../public/imgs/image-71.png) | 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: | | | | | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-73.png) | ![alt text](../../../../public/imgs/image-75.png) | ![alt text](../../../../public/imgs/image-76.png) | After the conversation, click the citation at the bottom to view citation details, including retrieval and reranking scores: | | | | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-77.png) | ![alt text](../../../../public/imgs/image-78.png) | ### 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: ![alt text](../../../../public/imgs/image-79.png) ### Test Speech-to-Text In the same app, find "Voice Input" in the left sidebar configuration. Click to enable voice input from the popup: ![alt text](../../../../public/imgs/image-80.png) Once enabled, a microphone icon appears in the chat input box. Click it to start voice input: | | | | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-81.png) | ![alt text](../../../../public/imgs/image-82.png) | ## 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` 作为语音输入模型。 ![alt text](../../../../public/imgs/image-104.png) ## 3. 新增模型渠道 在模型渠道页,新增一个硅基流动的渠道,选择刚刚添加的模型即可。 ![alt text](../../../../public/imgs/image-126.png) ## 4. 测试模型 先测试下硅基流动的模型是否均可正常运行。 ![alt text](../../../../public/imgs/image-127.png) ## 5. 在应用中测试 ### 测试对话和图片识别 随便新建一个简易应用,选择对应模型,并开启图片上传后进行测试: | | | | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-68.png) | ![alt text](../../../../public/imgs/image-70.png) | 可以看到,72B 的模型,性能还是非常快的,这要是本地没几个 4090,不说配置环境,输出怕都要 30s 了。 ### 测试知识库导入和知识库问答 新建一个知识库(由于只配置了一个向量模型,页面上不会展示向量模型选择) | | | | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-72.png) | ![alt text](../../../../public/imgs/image-71.png) | 导入本地文件,直接选择文件,然后一路下一步即可。79 个索引,大概花了 20s 的时间就完成了。现在我们去测试一下知识库问答。 首先回到我们刚创建的应用,选择知识库,调整一下参数后即可开始对话: | | | | | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-73.png) | ![alt text](../../../../public/imgs/image-75.png) | ![alt text](../../../../public/imgs/image-76.png) | 对话完成后,点击底部的引用,可以查看引用详情,同时可以看到具体的检索和重排得分: | | | | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-77.png) | ![alt text](../../../../public/imgs/image-78.png) | ### 测试语音播放 继续在刚刚的应用中,左侧配置中找到语音播放,点击后可以从弹窗中选择语音模型,并进行试听: ![alt text](../../../../public/imgs/image-79.png) ### 测试语言输入 继续在刚刚的应用中,左侧配置中找到语音输入,点击后可以从弹窗中开启语言输入 ![alt text](../../../../public/imgs/image-80.png) 开启后,对话输入框中,会增加一个话筒的图标,点击可进行语音输入: | | | | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-81.png) | ![alt text](../../../../public/imgs/image-82.png) | ## 总结 如果你想快速的体验开源模型或者快速的使用 FastGPT,不想在不同服务商申请各类 Api Key,那么可以选择 SiliconCloud 的模型先进行快速体验。 如果你决定未来私有化部署模型和 FastGPT,前期可通过 SiliconCloud 进行测试验证,后期再进行硬件采购,减少 POC 时间和成本。 file: ./content/self-host/config/sandbox/opensandbox.en.mdx meta: { "title": "OpenSandbox Configuration", "description": "Configure OpenSandbox and Agent Sandbox Proxy for FastGPT" } import { Alert } from '@/components/docs/Alert'; OpenSandbox does not provide network isolation by default. Add your own network isolation policy if your environment requires it. OpenSandbox is designed for self-hosted Agent and Skill sandbox runtimes. FastGPT creates sandboxes through OpenSandbox Server, while Agent Sandbox Proxy provides browser access to files, terminals, and previews. ## Docker Compose Configuration The latest Docker Compose file already includes OpenSandbox Server, Volume Manager, Agent Sandbox Proxy, and the sandbox runtime images. You do not need to merge any additional YAML files. [View the latest docker-compose.yml (PgVector, global registries)](/deploy/docker/main/global/docker-compose.pg.yml) See [Deploy with Docker Compose](../../deploy/docker.en.mdx) for other vector databases and China Mainland registries. ## Environment Variables The Docker Compose YAML files include default values. This section documents each variable. This page tracks the latest configuration; older releases may differ, so check the YAML for the corresponding older release when needed. ### OpenSandbox Service Review these settings in the Compose file for your environment: | Setting | Description | | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | | `x-volume-manager-auth-token` | Volume Manager token. 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].host_ip` | Host address that sandbox endpoints expose to the proxy. Use the host's internal IP or `host.docker.internal`. | | Docker socket mount | The Docker runtime requires the host Docker socket. The default is `/var/run/docker.sock`; use the actual path if different. | If the host uses `HTTP_PROXY` or `HTTPS_PROXY`, explicitly set `NO_PROXY` and `no_proxy` for OpenSandbox Server and Volume Manager. Include at least `localhost,127.0.0.1,127.0.0.0/8,fastgpt-app,fastgpt-opensandbox-server,fastgpt-volume-manager,fastgpt-agent-sandbox-proxy,host.docker.internal` so internal requests do not go through the proxy. ### Agent Sandbox Proxy Service | Variable | Default | Description | | ---------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | | `PORT` | `1006` | Proxy container port, mapped to port `3006` on the host by default. | | `PREVIEW_PORT` | Same as `PORT` | In 4.16, sets a separate HTTP preview listener; update the host port mapping and `AGENT_SANDBOX_PREVIEW_PROXY_URL` accordingly. | | `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 FastGPT URL used by the proxy. | | `FASTGPT_APP_REQUEST_TIMEOUT_SECS` | `10` | Timeout for proxy requests to FastGPT, in seconds. Increase for slow cold starts. | | `RUST_LOG` | `info,fastgpt_agent_sandbox_proxy=debug` | Proxy service log level. | In 4.16, WebSocket and HTTP preview traffic use the same port by default. If your gateway cannot route both protocols on one port, set `PREVIEW_PORT` to another container port (for example, `1007`), change the Compose mapping to `3007:1007`, and point `AGENT_SANDBOX_PREVIEW_PROXY_URL` to port 3007. ### fastgpt-app Service Configure these variables in the Compose file's `x-agent-sandbox-config` anchor so `fastgpt-app` and `fastgpt-pro` share the OpenSandbox settings: ```dotenv AGENT_SANDBOX_PROVIDER=opensandbox # Internal OpenSandbox Server URL and API key AGENT_SANDBOX_OPENSANDBOX_BASEURL=http://fastgpt-opensandbox-server:8090 AGENT_SANDBOX_OPENSANDBOX_API_KEY=replace_with_opensandbox_api_key AGENT_SANDBOX_OPENSANDBOX_RUNTIME=docker AGENT_SANDBOX_OPENSANDBOX_IMAGE=ghcr.io/labring/fastgpt-agent-sandbox:v0.2.0 AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY=true # Volume Manager URL, token, and persistent volume name prefix AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_URL=http://fastgpt-volume-manager:3000 AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN=replace_with_volume_manager_token AGENT_SANDBOX_OPENSANDBOX_VOLUME_NAME_PREFIX=fastgpt-session # Agent Sandbox Proxy settings AGENT_SANDBOX_PROXY_SECRET=replace_with_32_chars_random_secret AGENT_SANDBOX_PROXY_URL=wss://sandbox-proxy.example.com AGENT_SANDBOX_PREVIEW_PROXY_URL=https://sandbox-proxy.example.com # Per-sandbox resource limits AGENT_SANDBOX_CPU_COUNT=1 AGENT_SANDBOX_MEMORY_MIB=2048 AGENT_SANDBOX_STORAGE_SIZE_GI=1 ``` `AGENT_SANDBOX_OPENSANDBOX_API_KEY` must match `[server].api_key`, `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN` must match `x-volume-manager-auth-token`, and `AGENT_SANDBOX_PROXY_SECRET` must match the same variable in Agent Sandbox Proxy. `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`. It still requires `AGENT_SANDBOX_PREVIEW_PROXY_URL`. Host the preview proxy on an origin separate from the FastGPT application, using a different scheme, host, or port. Sandbox HTML may contain user-generated scripts. If previews share the application origin, those scripts may be able to access application credentials or APIs. 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 preview URLs with users who should not have access to that Workspace. When upgrading from an earlier Volume Manager release, set `AGENT_SANDBOX_OPENSANDBOX_VOLUME_NAME_PREFIX` to the previous `VM_VOLUME_NAME_PREFIX` value so existing persistent volumes can still be cleaned up by their original names. ## Additional Configuration ### Custom Package Registries Configure package registries in both `fastgpt-app` and `fastgpt-pro` when sandboxes need to install npm or Python dependencies: ```dotenv AGENT_SANDBOX_NPM_REGISTRY=https://registry.npmmirror.com AGENT_SANDBOX_PYPI_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple ``` ### Resource and Lifecycle Settings | Variable | Default | Description | | ------------------------------------- | ---------- | ------------------------------------------------------- | | `AGENT_SANDBOX_CPU_COUNT` | `1` | Maximum CPU count for each Agent Sandbox. | | `AGENT_SANDBOX_MEMORY_MIB` | `2048` | Maximum memory for each Agent Sandbox, in MiB. | | `AGENT_SANDBOX_STORAGE_SIZE_GI` | `1` | Sandbox storage capacity, in Gi. | | `AGENT_SANDBOX_WS_MAX_MESSAGE_BYTES` | `67108864` | Maximum IDE Agent WebSocket message size. | | `AGENT_SANDBOX_WS_MAX_FRAME_BYTES` | `16777216` | Maximum IDE Agent WebSocket frame size. | | `AGENT_SANDBOX_SUSPEND_MINUTES` | `60` | Inactive minutes before a running sandbox is suspended. | | `AGENT_SANDBOX_ARCHIVE_INACTIVE_DAYS` | `7` | Inactive days before a suspended sandbox is archived. | ## FAQ ### Sandbox provider apiKey is required for opensandbox Check `AGENT_SANDBOX_OPENSANDBOX_API_KEY` and make sure it matches `[server].api_key` in `opensandbox-config`. ### AGENT\_SANDBOX\_OPENSANDBOX\_VOLUME\_MANAGER\_URL is required Check `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_URL` and `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN`, and make sure Volume Manager is running. ### AGENT\_SANDBOX\_PROXY\_URL or AGENT\_SANDBOX\_PREVIEW\_PROXY\_URL is required `fastgpt-app` requires `AGENT_SANDBOX_PROXY_SECRET`, `AGENT_SANDBOX_PROXY_URL`, and `AGENT_SANDBOX_PREVIEW_PROXY_URL`. `fastgpt-pro` requires `AGENT_SANDBOX_PREVIEW_PROXY_URL`. ### Browser WebSocket connection fails Check that the proxy is reachable from the browser and that your reverse proxy supports WebSocket Upgrade. If FastGPT uses HTTPS, `AGENT_SANDBOX_PROXY_URL` should use `wss://`. ### Proxy validation fails or returns 401 Make sure `AGENT_SANDBOX_PROXY_SECRET` is identical in FastGPT and Agent Sandbox Proxy and contains at least 32 characters. ### The sandbox is created, but the file tree or terminal does not connect Make sure `AGENT_SANDBOX_PROXY_URL` is a browser-accessible `ws://` or `wss://` URL, and verify that host port `3006` or the corresponding domain is accessible. ### Proxy cannot connect to the sandbox endpoint Check `[docker].host_ip` in `opensandbox-config`. Sandbox endpoints that use `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 Proxy 配置" } import { Alert } from '@/components/docs/Alert'; OpenSandbox 方案默认未做网络隔离。如有安全隔离要求,请自行补充网络隔离策略。 OpenSandbox 适合需要自托管 Agent/Skill 沙盒运行环境的场景。FastGPT 通过 OpenSandbox Server 创建沙盒,并通过 Agent Sandbox Proxy 为浏览器提供文件、终端和预览访问能力。 ## Docker Compose 配置 最新版 Docker Compose 已经包含 OpenSandbox Server、Volume Manager、Agent Sandbox Proxy 和沙盒运行时镜像配置,无需再单独合并其他 YAML 文件。 [查看最新版 docker-compose.yml(PgVector,中国大陆镜像源)](/deploy/docker/main/cn/docker-compose.pg.yml) 其他向量数据库和全球镜像源版本见 [Docker Compose 部署](../../deploy/docker)。 ## 环境变量配置 Docker compose yml 文件里均已带默认值,这里补充做每个变量的说明。该文档始终是最新配置,旧版的配置可能存在差异,需找旧版的 yml 来看实际变量值。 ### OpenSandbox 服务 根据实际部署环境检查 Compose 文件中的以下配置: | 配置 | 说明 | | ----------------------------- | ------------------------------------------------------------------------------------------- | | `x-volume-manager-auth-token` | Volume Manager 的认证 Token,需要与 FastGPT 的 `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN` 一致。 | | `[server].api_key` | OpenSandbox Server API Key,需要与 FastGPT 的 `AGENT_SANDBOX_OPENSANDBOX_API_KEY` 一致。 | | `[docker].host_ip` | 沙盒端点对 Proxy 可访问的宿主机地址,通常使用宿主机内网 IP 或 `host.docker.internal`。 | | Docker socket 挂载 | Docker runtime 需要挂载宿主机 Docker socket,默认是 `/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-app,fastgpt-opensandbox-server,fastgpt-volume-manager,fastgpt-agent-sandbox-proxy,host.docker.internal`,避免内部服务调用经过代理。 ### Agent Sandbox Proxy 服务 | 变量 | 默认值 | 说明 | | ---------------------------------- | ---------------------------------------- | -------------------------------------------------------------------------- | | `PORT` | `1006` | Proxy 容器监听端口,默认映射到宿主机 `3006`。 | | `PREVIEW_PORT` | 与 `PORT` 相同 | 4.16 可单独指定 HTTP 预览监听端口;修改后需同步调整宿主机端口映射和 `AGENT_SANDBOX_PREVIEW_PROXY_URL`。 | | `AGENT_SANDBOX_PROXY_SECRET` | 无 | 与 FastGPT 主服务共用的密钥,至少 32 位。 | | `FASTGPT_APP_URL` | `http://fastgpt-app:3000` | Proxy 回源 FastGPT 主服务的内网地址。 | | `FASTGPT_APP_REQUEST_TIMEOUT_SECS` | `10` | Proxy 回源请求超时时间,单位秒;沙盒冷启动较慢时可适当调大。 | | `RUST_LOG` | `info,fastgpt_agent_sandbox_proxy=debug` | Proxy 服务日志级别。 | 4.16 默认使用同一个端口提供 WebSocket 和 HTTP 预览。如果网关不支持同端口转发,可设置 `PREVIEW_PORT` 为其他容器端口(例如 `1007`),并将 Compose 端口映射改为 `3007:1007`,同时把 `AGENT_SANDBOX_PREVIEW_PROXY_URL` 指向新的 3007 端口。 ### fastgpt-app 服务 在 Compose 文件的 `x-agent-sandbox-config` 中配置以下变量,使 `fastgpt-app` 和 `fastgpt-pro` 共用 OpenSandbox 配置: ```dotenv AGENT_SANDBOX_PROVIDER=opensandbox # FastGPT 访问 OpenSandbox Server 的内网地址和密钥 AGENT_SANDBOX_OPENSANDBOX_BASEURL=http://fastgpt-opensandbox-server:8090 AGENT_SANDBOX_OPENSANDBOX_API_KEY=replace_with_opensandbox_api_key AGENT_SANDBOX_OPENSANDBOX_RUNTIME=docker AGENT_SANDBOX_OPENSANDBOX_IMAGE=registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox:v0.2.0 AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY=true # Volume Manager 地址、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_OPENSANDBOX_VOLUME_NAME_PREFIX=fastgpt-session # Agent Sandbox Proxy 配置 AGENT_SANDBOX_PROXY_SECRET=replace_with_32_chars_random_secret AGENT_SANDBOX_PROXY_URL=wss://sandbox-proxy.example.com AGENT_SANDBOX_PREVIEW_PROXY_URL=https://sandbox-proxy.example.com # 单个沙盒的资源限制 AGENT_SANDBOX_CPU_COUNT=1 AGENT_SANDBOX_MEMORY_MIB=2048 AGENT_SANDBOX_STORAGE_SIZE_GI=1 ``` `AGENT_SANDBOX_OPENSANDBOX_API_KEY` 必须与 `[server].api_key` 一致,`AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN` 必须与 `x-volume-manager-auth-token` 一致,`AGENT_SANDBOX_PROXY_SECRET` 必须与 Agent Sandbox Proxy 中的同名变量一致。 `fastgpt-pro` 不提供 Sandbox Editor 和 WebSocket Proxy 链路,因此不要求 `AGENT_SANDBOX_PROXY_SECRET` 和 `AGENT_SANDBOX_PROXY_URL`,但必须配置 `AGENT_SANDBOX_PREVIEW_PROXY_URL`。 预览代理应部署在与 FastGPT 主站不同的 origin(协议、域名或端口至少一项不同)。Sandbox 中的 HTML 可能包含用户生成的脚本;如果预览地址与主站同源,脚本可能访问主站凭证或接口。 预览链接是短期只读 bearer capability。获得链接的人可以在链接有效期内通过修改 URL 路径读取同一 Sandbox Workspace 中的其他文件,请勿将链接分享给无权访问该 Workspace 的用户。 从旧版 Volume Manager 升级时,请将原 `VM_VOLUME_NAME_PREFIX` 的值配置到 `AGENT_SANDBOX_OPENSANDBOX_VOLUME_NAME_PREFIX`,避免历史持久卷无法按原名称清理。 ## 更多配置 ### 自定义依赖源 如果沙盒内需要安装 npm 或 Python 依赖,可以在 `fastgpt-app` 和 `fastgpt-pro` 中配置依赖源: ```dotenv AGENT_SANDBOX_NPM_REGISTRY=https://registry.npmmirror.com AGENT_SANDBOX_PYPI_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple ``` ### 资源与生命周期 | 变量 | 默认值 | 说明 | | ------------------------------------- | ---------- | ------------------------------ | | `AGENT_SANDBOX_CPU_COUNT` | `1` | 单个 Agent Sandbox 的 CPU 核数上限。 | | `AGENT_SANDBOX_MEMORY_MIB` | `2048` | 单个 Agent Sandbox 的内存上限,单位 MiB。 | | `AGENT_SANDBOX_STORAGE_SIZE_GI` | `1` | 沙盒存储容量,单位 Gi。 | | `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_SANDBOX_ARCHIVE_INACTIVE_DAYS` | `7` | 已暂停的沙盒持续未活跃多少天后自动归档。 | ## 常见问题 ### 提示 Sandbox provider apiKey is required for opensandbox 检查 `AGENT_SANDBOX_OPENSANDBOX_API_KEY` 是否已配置,并确认它与 `opensandbox-config` 中的 `[server].api_key` 一致。 ### 提示 AGENT\_SANDBOX\_OPENSANDBOX\_VOLUME\_MANAGER\_URL is required 检查 `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_URL` 和 `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN`,并确认 Volume Manager 服务正常运行。 ### 提示 AGENT\_SANDBOX\_PROXY\_URL 或 AGENT\_SANDBOX\_PREVIEW\_PROXY\_URL is required `fastgpt-app` 必须配置 `AGENT_SANDBOX_PROXY_SECRET`、`AGENT_SANDBOX_PROXY_URL` 和 `AGENT_SANDBOX_PREVIEW_PROXY_URL`;`fastgpt-pro` 必须配置 `AGENT_SANDBOX_PREVIEW_PROXY_URL`。 ### 浏览器 WebSocket 连接失败 检查 Proxy 是否可从浏览器访问,并确认反向代理支持 WebSocket Upgrade。如果 FastGPT 使用 HTTPS,`AGENT_SANDBOX_PROXY_URL` 也应使用 `wss://`。 ### Proxy 校验失败或返回 401 确认 FastGPT 主服务和 Agent Sandbox Proxy 中的 `AGENT_SANDBOX_PROXY_SECRET` 完全一致,且长度不少于 32 位。 ### 沙盒创建成功,但文件树或终端连接失败 确认 `AGENT_SANDBOX_PROXY_URL` 是浏览器可访问的 `ws://` 或 `wss://` 地址,并检查宿主机 `3006` 端口或对应域名是否已开放。 ### Proxy 无法连接沙盒 endpoint 检查 `opensandbox-config` 的 `[docker].host_ip`。沙盒 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. 3. Follow [OpenSandbox Configuration](./opensandbox) to deploy `fastgpt-agent-sandbox-proxy`. ## 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 `AGENT_SANDBOX_PROXY_SECRET`, `AGENT_SANDBOX_PROXY_URL`, and `AGENT_SANDBOX_PREVIEW_PROXY_URL`, while `fastgpt-pro` requires `AGENT_SANDBOX_PREVIEW_PROXY_URL`. The proxy secret must match the value configured for `fastgpt-agent-sandbox-proxy` and contain at least 32 characters. ### 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、运行态镜像。 3. 参考 [OpenSandbox 配置](./opensandbox) 部署 `fastgpt-agent-sandbox-proxy` 服务。 ## 配置 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_SECRET`、`AGENT_SANDBOX_PROXY_URL` 和 `AGENT_SANDBOX_PREVIEW_PROXY_URL`,`fastgpt-pro` 必须配置 `AGENT_SANDBOX_PREVIEW_PROXY_URL`。Proxy Secret 需与 `fastgpt-agent-sandbox-proxy` 服务中的值一致,且不少于 32 位。 ### 提示 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/version/cloud/faq.en.mdx meta: { "title": "FAQ", "description": "FastGPT Cloud FAQ" } import FastGPTLink from '@/components/docs/linkFastGPT'; ## Account and Login Issues FastGPT has two versions, and accounts are not shared between them: China Mainland: {'https://fastgpt.cn'} (supports WeChat and phone number login) International: {'https://fastgpt.io'} (supports email, Google, and GitHub login; phone number sign-up was available before September 2024) If you have used FastGPT before but cannot log in, try switching between the two versions. ### Still Can't Log In? Contact Us Contact an administrator in the Lark community. ![Lark community](https://oss.laf.run/otnvvf-imgs/fastgpt-feishu1.png) ## Basics ### Does FastGPT Cloud Support Bringing Your Own Model? FastGPT Cloud currently does not support bringing your own model. You can only use the unified models provided by FastGPT. file: ./content/guide/version/cloud/faq.mdx meta: { "title": "常见问题", "description": "FastGPT 云服务常见问题" } import FastGPTLink from '@/components/docs/linkFastGPT'; ## 账号/登录问题 FastGPT 有两个版本,账号不互通:\ 中国大陆版:{'https://fastgpt.cn'} (支持微信/手机号登录)
国际版:{'https://fastgpt.io'} (支持邮箱/google/github/ 登录,2024 年 9 月前可手机号注册) 如果使用过,但是发现登录不了,可以尝试切换不同版本进行尝试。 ### 无法解决登录问题,联系我们 可在飞书社群中联系管理员。 ![飞书交流群](https://oss.laf.run/otnvvf-imgs/fastgpt-feishu1.png) ## 基础问题 ### 是否支持接入自己的模型 目前 FastGPT 云服务暂不支持接入自己的模型,只能使用官方提供的统一模型。 file: ./content/guide/version/cloud/intro.en.mdx meta: { "title": "FastGPT Cloud Service", "description": "FastGPT Cloud Service" } import FastGPTLink from '@/components/docs/linkFastGPT'; ## Service URLs * China Mainland: {'https://fastgpt.cn'} * International: {'https://fastgpt.io'} Register based on your needs. Accounts are not shared between the two versions. file: ./content/guide/version/cloud/intro.mdx meta: { "title": "介绍", "description": "FastGPT 云服务介绍" } import FastGPTLink from '@/components/docs/linkFastGPT'; ## 服务地址 * 中国大陆版:{'https://fastgpt.cn'} * 国际版:{'https://fastgpt.io'} 请按需注册,两个版本账号不互通。 file: ./content/guide/version/cloud/privacy.en.mdx meta: { "title": "Privacy Policy", "description": "FastGPT Privacy Policy" } Last updated: March 3, 2024 We take your privacy seriously. This policy describes how we collect, use, disclose, and protect your personal information when you use the FastGPT cloud service ("the Service"). Please read and fully understand this Privacy Policy before using the Service. **Information We May Collect** 1. When you register for or use the Service, we may collect personal information such as your name, phone number, email address, and mailing address. 2. Information generated during your use of the Service, including operation logs, IP addresses, and device models. 3. We may use cookies or similar technologies to collect and store information about your visits to improve your experience. **How We Use Collected Information** 1. We process your personal information in accordance with applicable laws and our agreements with you. 2. We may use collected information to improve service quality, develop new products or features, and similar purposes. 3. We may use collected information to send you Service-related notifications or advertisements. **Information Disclosure** 1. We will not disclose your personal information to third parties unless: 1. You have given prior consent; 2. Required by law or regulation; 3. Necessary to protect our legitimate interests or those of other users. 2. We may share your personal information with affiliates and partners, subject to appropriate confidentiality measures to ensure information security. **Information Protection** 1. We employ various security measures, including encryption and access controls, to protect your personal information from unauthorized access, use, or disclosure. 2. We regularly assess the security of the personal information we collect, store, and process. 3. In the event of a data breach or other security incident, we will immediately activate our emergency response plan and notify you promptly as required by applicable law. 4. We do not use your data for additional backup storage or model training. 5. Data deletions you perform in the Service are physical deletions and cannot be recovered. Any non-physical deletion operations will be clearly noted in the Service. **Your Rights** 1. You may access, correct, or delete your personal information at any time. 2. You may refuse our collection of your personal information, though this may limit your access to certain features. 3. You may request that we stop processing your personal information, though this may prevent you from continuing to use the Service. **Policy Updates** 1. We may update this Privacy Policy from time to time. Changes will be posted on the Service page. Continued use of the Service constitutes acceptance of the updated policy. 2. We encourage you to review this Privacy Policy periodically. **Protection of Minors** We take the protection of minors' personal information seriously. If you are a minor, please use the Service under the guidance of a guardian, and have your guardian help you handle personal information appropriately. **Cross-Border Data Transfers** Our servers may be located in different countries or regions. You agree that we may transfer your personal information to other jurisdictions for storage and processing as needed to provide the Service. We will take appropriate measures to ensure cross-border data transfers remain adequately protected. **Contact Us** 1. If you have any questions, suggestions, or complaints about this Privacy Policy, contact us at: [archer@fastgpt.io](mailto:archer@fastgpt.io). 2. We will respond and address your concerns as soon as possible. file: ./content/guide/version/cloud/privacy.mdx meta: { "title": "隐私政策", "description": " FastGPT 隐私政策" } 最后更新时间:2024年3月3日 我们非常重视您的隐私保护,在您使用FastGPT云服务时(以下简称为“本服务”),我们将按照以下政策收集、使用、披露和保护您的个人信息。请您仔细阅读并充分理解本隐私政策。 **我们可能需要收集的信息** 1. 在您注册或使用本服务时,我们可能收集您的姓名、电话号码、电子邮件地址、地址等个人信息。 2. 在您使用本服务过程中产生的信息,如操作日志、访问IP地址、设备型号等。 3. 我们可能会通过 Cookies 或其他技术收集和存储您访问本服务的相关信息,以便为您提供更好的用户体验。 **我们如何使用收集的信息?** 1. 我们会根据法律法规规定以及与用户之间的约定来处理用户的个人信息。 2. 我们可能会将收集到的信息用于改进服务质量、开发新产品或功能等目的。 3. 我们可能会将收集到的信息用于向您推送与本服务相关的通知或广告。 **信息披露** 1. 我们不会向任何第三方披露您的个人信息,除非: 1. 您事先同意; 2. 法律法规要求; 3. 为维护我们或其他用户的合法权益。 2. 我们可能与关联公司、合作伙伴分享您的个人信息,但我们会采取相应的保密措施,确保信息安全。 **信息保护** 1. 我们采取各种安全措施,包括加密、访问控制等技术手段,以保护您的个人信息免受未经授权的访问、使用或泄露。 2. 我们会定期对收集、存储和处理的个人信息进行安全评估,以确保个人信息安全。 3. 在发生个人信息泄露等安全事件时,我们会立即启动应急预案,并在法律法规规定的范围内向您及时告知。 4. 我们不会使用您的数据进行额外的备份存储或用于模型训练。 5. 您在本服务进行的数据删除均为物理删除,不可恢复。如有非物理删除的操作,我们会在服务中特别指出。 **用户权利** 1. 您有权随时查阅、更正或删除您的个人信息。 2. 您有权拒绝我们收集您的个人信息,但这可能导致您无法使用本服务的部分功能。 3. 您有权要求我们停止处理您的个人信息,但这可能导致您无法继续使用本服务。 **隐私政策更新** 1. 我们可能会对本隐私政策进行修改。如本隐私政策发生变更,我们将在本服务页面上发布修改后的隐私政策。如您继续使用本服务,则视为同意修改后的隐私政策。 2. 我们鼓励您定期查阅本隐私政策,以了解我们如何保护您的个人信息。 **未成年人保护** 我们非常重视对未成年人个人信息的保护,如您为未成年人,请在监护人指导下使用本服务,并请监护人帮助您在使用本服务过程中正确处理个人信息。 **跨境数据传输** 由于我们的服务器可能位于不同国家或地区,您同意我们可能需要将您的个人信息传输至其他国家或地区,并在该等国家或地区存储和处理以向您提供服务。我们会采取适当措施确保跨境传输的数据仍然受到适当保护。 **联系我们** 1. 如您对本隐私政策有任何疑问、建议或投诉,请通过以下方式与我们联系:[archer@fastgpt.io](mailto:archer@fastgpt.io)。 2. 我们将尽快回复并解决您提出的问题。 file: ./content/guide/version/cloud/terms.en.mdx meta: { "title": "Terms of Service", "description": "FastGPT Terms of Service" } Last updated: March 3, 2024 This FastGPT Terms of Service agreement ("Agreement") is between you and Zhuhai Huanjie Cloud Computing Co., Ltd. ("we," "us," or "the Company") regarding your use of the FastGPT cloud service ("the Service"). Please read all terms carefully, especially those regarding liability limitations, restrictions on your rights, dispute resolution, and applicable law. If you do not agree with any part of this Agreement, do not register for or use the Service. **Article 1: Service Content** 1. We provide internet-based information technology services including storage, computing, and network transmission. 2. We may send you updates via in-app messages, email, or SMS from time to time. 3. We provide technical support and customer service to help you get the most out of the Service. 4. We guarantee a monthly service availability of no less than 99%. **Article 2: Registration and Account Management** 1. You must register an account before using the Service. You warrant that all registration information is true, accurate, and complete, and that you will keep it up to date. 2. You are responsible for safeguarding your account credentials and for all activity under your account. If you discover unauthorized use, change your password immediately or contact us. 3. We reserve the right to review your account. If we detect abnormal or illegal activity, we may suspend or terminate your access. **Article 3: Usage Rules** 1. You may not use the Service for illegal activities or to infringe on the rights of others, including but not limited to intellectual property infringement and unauthorized disclosure of trade secrets. 2. You may not register accounts through malicious means, including but not limited to profiteering, speculation, or arbitrage. 3. You may not use the Service to distribute illegal, harmful, or malicious software or information. 4. You must comply with all applicable laws and this Agreement, and you bear full responsibility for all content you publish and all consequences arising from your use of the Service. 5. Using our connected model services to generate content that may harm individuals or society is prohibited. Platform safety is critical for long-term stable operations. Any account found using the platform's model capabilities to generate or distribute prohibited content will be immediately banned with no refund of account balance. Prohibited content includes but is not limited to: * Exploitation and Abuse * Content that describes, depicts, or promotes child sexual exploitation or abuse, regardless of legality. This includes content involving or sexualizing minors. * Content used for grooming children. Grooming refers to adults building relationships with children for the purpose of exploitation, particularly sexual exploitation, trafficking, or other forms of exploitation. * Non-Consensual Intimate Content * Content that describes, provides, or promotes non-consensual intimate activities. * Content that describes, provides, promotes, or solicits commercial sexual activities and services, including encouraging or facilitating real sexual activities. * Content that describes or facilitates human trafficking, including recruiting, transporting, paying for, or enabling exploitation such as forced labor, domestic servitude, indentured servitude, forced marriage, or forced medical procedures. * Self-Harm and Suicide: Content that describes, praises, supports, promotes, glorifies, encourages, or instructs self-harm or suicide. * Violent Content and Behavior * Content that describes, depicts, or promotes graphic violence or gore. * Content depicting terrorist acts; praising or supporting terrorist organizations, actors, or ideologies; encouraging terrorist activities; providing aid to terrorist organizations; or assisting in terrorist recruitment. * Content that advocates or promotes violence against others through threats or incitement. * Hate Speech and Discrimination * Content that attacks, defames, intimidates, degrades, targets, or excludes individuals or groups based on characteristics such as race, ethnicity, nationality, gender, gender identity, sexual orientation, religion, age, disability, caste, or any other characteristic associated with systemic bias or marginalization. * Content that threatens, intimidates, insults, or degrades individuals or groups through language or imagery, or promotes physical harm or abusive behavior such as stalking. * Content that is intentionally deceptive and may harm the public interest, including false content related to health, safety, electoral integrity, or civic participation. * Content that directly supports malicious software activities or illegal attacks, such as distributing malicious executables, organizing denial-of-service attacks, or managing command-and-control servers. **Article 4: Fees and Payment** 1. You agree to pay all fees associated with the Service based on our published pricing. 2. We may adjust pricing based on operational costs and market conditions. The price at the time of payment applies. **Article 5: Disclaimer and Liability Limitations** 1. The Service is provided on an as-is basis given existing technology and conditions. We do not guarantee the Service will be completely fault-free or meet all your requirements. 2. We are not liable for data loss or damage caused by your own operational errors. 3. Due to the nature of generative AI, regulations vary by country. All users must comply with the laws of their jurisdiction. If you use the Service in violation of FastGPT's Acceptable Use Policy -- including any use prohibited by law, regulation, or government order, or any use that infringes on the rights of others -- you assume full responsibility. We are not liable for issues arising from customer use. Below is a link to China's regulations on generative AI: [Interim Measures for the Administration of Generative Artificial Intelligence Services (Draft for Comment)](http://www.cac.gov.cn/2023-04/11/c_1682854275475410.htm) **Article 6: Intellectual Property** 1. We own all intellectual property rights to the Service and related software, technology, and documentation. You may not copy, distribute, rent, reverse-engineer, or otherwise exploit these materials without our express authorization. 2. You own all intellectual property rights to data and content (including files, images, etc.) you create through the Service. We will not use, copy, or modify your data or content. 3. Data and content from other users belong to those users. You may not use, copy, or modify their data or content without their permission. **Article 7: Miscellaneous** 1. If any provision of this Agreement is deemed invalid due to conflict with applicable law, the remaining provisions remain in full force and effect. 2. The Company reserves the right of final interpretation of this Agreement and the Privacy Policy. For questions, contact us at: [archer@fastgpt.io](mailto:archer@fastgpt.io). file: ./content/guide/version/cloud/terms.mdx meta: { "title": "服务协议", "description": " FastGPT 服务协议" } 最后更新时间:2026 年 5 月 28 日 FastGPT 服务协议是您与**广州环际云计算有限公司**(以下简称“我们”或“本公司”)之间就 FastGPT 云服务(以下简称“本服务”)的使用等相关事项所订立的协议。请您仔细阅读并充分理解本协议各条款,特别是免除或者限制我们责任的条款、对您权益的限制条款、争议解决和法律适用条款等。如您不同意本协议任一内容,请勿注册或使用本服务。 **第 1 条服务内容** 1. 我们将向您提供存储、计算、网络传输等基于互联网的信息技术服务。 2. 我们将不定期向您通过站内信、电子邮件或短信等形式向您推送最新的动态。 3. 我们将为您提供相关技术支持和客户服务,帮助您更好地使用本服务。 4. 我们将为您提供稳定的在线服务,保证每月服务可用性不低于 99%。 **第 2 条用户注册与账户管理** 1. 您在使用本服务前需要注册一个账户。您保证在注册时提供的信息真实、准确、完整,并及时更新。 2. 您应妥善保管账户名和密码,对由此产生的全部行为负责。如发现他人使用您的账户,请及时修改账号密码或与我们进行联系。 3. 我们有权对您的账户进行审查,如发现您的账户存在异常或违法情况,我们有权暂停或终止向您提供服务。 **第 3 条使用规则** 1. 您不得利用本服务从事任何违法活动或侵犯他人合法权益的行为,包括但不限于侵犯知识产权、泄露他人商业机密等。 2. 您不得通过任何手段恶意注册账户,包括但不限于以牟利、炒作、套现等目的。 3. 您不得利用本服务传播任何违法、有害、恶意软件等信息。 4. 您应遵守相关法律法规及本协议的规定,对在本服务中发布的信息及使用本服务所产生的结果承担全部责任。 5. 我们禁止使用我们对接的模型服务生成可能对个人或社会造成伤害的内容。保障平台的安全性,是长期稳定运营的关键。如发现任何利用平台接入模型能力进行违规内容生成和使用,将立即封号,账号余额不退。违规内容包括但不限于: * 剥削和虐待 * 禁止描述、展示或宣扬儿童性剥削或性虐待的内容,无论法律是否禁止。这包括涉及儿童或使儿童色情的内容。 * 禁止描述或用于培养儿童的内容。修饰是成年人以剥削,特别是性剥削为目的与儿童建立关系的行为。这包括以性剥削、贩运或其他形式剥削为目的与儿童交流。 * 未经同意的私密内容 * 服务禁止描述、提供或宣传未经同意的亲密活动的内容。 * 禁止描述、提供特征或宣传或用于招揽商业性活动和性服务的内容。这包括鼓励和协调真正的性活动。 * 禁止描述或用于人口贩运目的的内容。这包括招募人员、便利交通、支付和助长对人的剥削,如强迫劳动、家庭奴役、役、强迫婚姻和强迫医疗程序。 * 自杀和自残,禁止描述、赞美、支持、促进、美化、鼓励和/或指导个人自残或自杀的内容。 * 暴力内容和行为 * 禁止描述、展示或宣扬血腥暴力或血腥的内容。 * 禁止描绘恐怖主义行为的内容;赞扬或支持恐怖组织、恐怖行为者或暴力恐怖意识形态;鼓励恐怖活动;向恐怖组织或恐怖事业提供援助;或协助恐怖组织招募成员。 * 禁止通过暴力威胁或煽动来鼓吹或宣扬对他人的暴力行为的内容。 * 仇恨言论和歧视 * 禁止基于实际或感知的种族、民族、国籍、性别、性别认同、性取向、宗教信仰、年龄、残疾状况、种姓或与系统性偏见或边缘化相关的任何其他特征等特征攻击、诋毁、恐吓、降级、针对或排斥个人或群体的内容。 * 禁止针对个人或群体进行威胁、恐吓、侮辱、贬低或贬低的语言或图像、宣扬身体伤害或其他虐待行为(如跟踪)的内容。 * 禁止故意欺骗并可能对公共利益产生不利影响的内容,包括与健康、安全、选举诚信或公民参与相关的欺骗性或不真实内容。 * 直接支持非法主动攻击或造成技术危害的恶意软件活动的内容,例如提供恶意可执行文件、组织拒绝服务攻击或管理命令和控制服务器。 **第 4 条费用及支付** 1. 您同意支付与本服务相关的费用,具体费用标准以我们公布的价格为准。 2. 我们可能会根据运营成本和市场情况调整费用标准。最新价格以您付款时刻的价格为准。 **第 5 条服务免责与责任限制** 1. 本服务按照现有技术和条件所能达到的水平提供。我们不能保证本服务完全无故障或满足您的所有需求。 2. 对于因您自身误操作导致的数据丢失、损坏等情况,我们不承担责任。 3. 由于生成式 AI 的特性,其在不同国家的管控措施也会有所不同,请所有使用者务必遵守所在地的相关法律。如果您以任何违反 FastGPT 可接受使用政策的方式使用,包括但不限于法律、法规、政府命令或法令禁止的任何用途,或任何侵犯他人权利的使用;由使用者自行承担。我们对由客户使用产生的问题概不负责。下面是各国对生成式 AI 的管控条例的链接: [中国生成式人工智能服务管理办法(征求意见稿)](http://www.cac.gov.cn/2023-04/11/c_1682854275475410.htm) **第 6 条知识产权** 1. 我们对本服务及相关软件、技术、文档等拥有全部知识产权,除非经我们明确许可,您不得进行复制、分发、出租、反向工程等行为。 2. 您在使用本服务过程中产生的所有数据和内容(包括但不限于文件、图片等)的知识产权归您所有。我们不会对您的数据和内容进行使用、复制、修改等行为。 3. 在线服务中其他用户的数据和内容的知识产权归原用户所有,未经原用户许可,您不得进行使用、复制、修改等行为。 **第 7 条其他条款** 1. 如本协议中部分条款因违反法律法规而被视为无效,不影响其他条款的效力。 2. 本公司保留对本协议及隐私政策的最终解释权。如您对本协议或隐私政策有任何疑问,请联系我们:[archer@fastgpt.io](mailto:archer@fastgpt.io)。 file: ./content/self-host/upgrading/4-12/4120.en.mdx meta: { "title": "V4.12.0 (Environment Changes, Upgrade Script)", "description": "FastGPT V4.12.0 Update Notes, released on 2025-8-11" } ## Upgrade Guide ### 1. Update Images: * Update FastGPT image tag: v4.12.0 * Update FastGPT commercial edition image tag: v4.12.0 * Update fastgpt-plugin image tag: v0.1.9 * mcp\_server: no update required * Sandbox: no update required * AIProxy: no update required ### 2. Update Environment Variables Update the FastGPT commercial edition (fastgpt-pro) environment variables: ```sh # Secret key for file reading, must match the environment variable in the fastgpt image FILE_TOKEN_KEY=filetokenkey ``` ### 3. Run the Migration Script This script only needs to be run by commercial edition users. 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/initv4120' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` **Script Functions** 1. Initializes chat log permissions for team members. ## New Features 1. Commercial edition: app log data dashboard. 2. Commercial edition: simple chat page — select a model and preset tools to chat directly without building an app. 3. Chat page: quick team app switching. 4. Permission table restructured to use a Role-to-Permission mapping model. 5. Apps can now have chat log viewing permissions assigned individually. ## Improvements 1. Fixed 3 potential memory leak issues in the code. 2. Optimized workflow recursion checks to prevent infinite recursion. 3. Optimized the document reading Worker to use SharedBuffer, avoiding data copying. 4. Batch vector generation and storage to reduce network operations. 5. Knowledge base search: multi-query merged computation to reduce database operations. 6. Improved knowledge base selection UX. 7. Login page UI adjustments. 8. Stricter validation in workflows for whether a toolset can be added. 9. Chat log export now only exports selected columns, and fixed an issue where some columns could not be exported. ## Bug Fixes 1. Doc2x API update caused parsing failures. 2. Workflow: team app directories could be incorrectly added to workflows. 3. Workflow: array selector UI defect. 4. Member sync had incomplete permission deletion issues. ## Tool Updates 1. System tools can now return `citeLinks` in their response, enabling citation link display in the chat interface. file: ./content/self-host/upgrading/4-12/4120.mdx meta: { "title": "V4.12.0(环境变量变更、升级脚本)", "description": "FastGPT V4.12.0 更新说明, 发布于 2025-8-11" } ## 更新指南 ### 1. 更新镜像: * 更新 FastGPT 镜像tag: v4.12.0 * 更新 FastGPT 商业版镜像tag: v4.12.0 * 更新 fastgpt-plugin 镜像 tag: v0.1.9 * mcp\_server 无需更新 * Sandbox 无需更新 * AIProxy 无需更新 ### 2. 修改环境变量 修改 FastGPT 商业版(fastgpt-pro) 环境变量: ```sh # 文件阅读时的密钥,与 fastgpt 镜像中环境变量一致 FILE_TOKEN_KEY=filetokenkey ``` ### 3. 执行升级脚本 该脚本仅需商业版用户执行。 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。 ```bash curl --location --request POST 'https://{{host}}/api/admin/initv4120' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` **脚本功能** 1. 初始化团队成员的应用对话日志权限。 ## 🚀 新增内容 1. 商业版支持应用日志数据看板。 2. 商业版支持简易对话页,可直接选择模型和预设工具进行聊天,无需进行应用搭建。 3. 对话页,增加团队应用快速切换。 4. 权限表调整,采用 Role 映射 Permission 模式。 5. 应用可单独分配对话日志查看权限。 ## ⚙️ 优化 1. 优化 3 处存在潜在内存泄露的代码。 2. 优化工作流部分递归检查,避免无限递归。 3. 优化文档阅读 Worker,采用 ShareBuffer 避免数据拷贝。 4. 批量进行向量生成和入库,减少网络操作。 5. 知识库搜索,多 query 合并计算,减少数据库操作。 6. 选择知识库交互优化。 7. 登录页 UI 调整。 8. 工作流中,更严格检测工具集是否可被添加。 9. 对话日志导出,仅导出选中的表头,并修复部分表头无法导出的问题。 ## 🐛 修复 1. Doc2x API 更新,导致解析失败。 2. 工作流中,团队应用目录也可以被加入工作流。 3. 工作流,数组选择器 UI 缺陷。 4. 成员同步存在权限未完成删除问题 ## 🔨 工具更新 1. 系统工具可返回 citeLinks 响应值,从而在对话框实现引用链接展示。 file: ./content/self-host/upgrading/4-12/4121.en.mdx meta: { "title": "V4.12.1 (Upgrade Script)", "description": "FastGPT V4.12.1 Update Notes, released on 2025-8-18" } ## Upgrade Guide ### 1. Update Images: * Update FastGPT image tag: v4.12.1-fix * Update FastGPT commercial edition image tag: v4.12.1 * Update fastgpt-plugin image tag: v0.1.10 * mcp\_server: no update required * Sandbox: no update required * AIProxy: no update required ### 2. Run the Migration Script This script only needs to be run by commercial edition users. 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/initv4121' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` **Script Functions** 1. Migrates historical chat logs into the new log dashboard format. ## New Features 1. Automatic prompt generation and optimization. 2. Added `SIGNOZ_STORE_LEVEL` parameter to control the Signoz log storage level. ## Improvements 1. Workflow response optimization: explicitly specifying which response values go into chat history, instead of determining by key. 2. Prevented infinite loops or deep recursion risks caused by variable substitution in workflows. 3. Chat log export now consistently exports full conversation details. 4. Paginator UI improvements. ## Bug Fixes 1. Tool secret input: boolean values could not pass form validation. 2. Chat page: pane switching could cause data inconsistencies. 3. Incorrect index on the chat log dashboard data table. ## Tool Updates 1. System tools now support individual Tool description configuration for better model comprehension. file: ./content/self-host/upgrading/4-12/4121.mdx meta: { "title": "V4.12.1(升级脚本)", "description": "FastGPT V4.12.1 更新说明, 发布于 2025-8-18" } ## 更新指南 ### 1. 更新镜像: * 更新 FastGPT 镜像tag: v4.12.1-fix * 更新 FastGPT 商业版镜像tag: v4.12.1 * 更新 fastgpt-plugin 镜像 tag: v0.1.10 * mcp\_server 无需更新 * Sandbox 无需更新 * AIProxy 无需更新 ### 2. 执行升级脚本 该脚本仅需商业版用户执行。 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。 ```bash curl --location --request POST 'https://{{host}}/api/admin/initv4121' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` **脚本功能** 1. 将历史对话日志整理成新的日志看板数据。 ## 🚀 新增内容 1. Prompt 自动生成和优化。 2. 增加`SIGNOZ_STORE_LEVEL`参数,可以控制 Signoz 日志存储级别。 ## ⚙️ 优化 1. 工作流响应优化,主动指定响应值进入历史记录,而不是根据 key 决定。 2. 避免工作流中,变量替换导致的死循环或深度递归风险。 3. 对话日志导出,固定导出对话详情。 4. 分页器 UI 优化。 ## 🐛 修复 1. 工具密钥输入,boolean 值无法通过 form 校验。 2. 对话页,pane切换可能导致数据异常。 3. 对话日志看板数据表索引不正确。 ## 🔨 工具更新 1. 支持对系统工具单独配置 Tool description,更利于模型理解。 file: ./content/self-host/upgrading/4-12/4122.en.mdx meta: { "title": "V4.12.2", "description": "FastGPT V4.12.2 Update Notes, released on 2025-8-26" } ## Upgrade Guide ### 1. Update Images: * Update FastGPT image tag: v4.12.2-fix3 * Update FastGPT commercial edition image tag: v4.12.2-fix3 * Update fastgpt-plugin image tag: v0.1.11 * mcp\_server: no update required * Sandbox: no update required * AIProxy: no update required ## New Features 1. Embedding model concurrency settings — no longer hardcoded to 10, since some embedding models don't support concurrency. Default is now 1, configurable in model settings. 2. Chat page: admins can configure featured apps to recommend to team members. 3. Chat page home: admins can configure shortcut apps for commonly used team applications. 4. Support for disabling the team chat homepage. ## Improvements 1. Added anomaly detection for **isolated branches** in workflows. 2. When truncating embedding vectors above 1536 dimensions, normalization is now enforced. For other dimensions, normalization is determined entirely by configuration, reducing unnecessary automatic computation. 3. Moved model provider configuration into the plugin SDK. 4. Encapsulated LLM call functions to simplify LLM requests and tool calls. 5. Optimized workflow scheduling code to avoid deep recursion. 6. Improved workflow recursion detection with grouped checks on recursive paths, supporting more diverse connection patterns. ## Bug Fixes 1. Standalone chat page: various UI issues. 2. Standalone chat page: plugin interactions could not be rendered. 3. Standalone chat page: incorrect default URL when using sub-routes. 4. Multi-select picker causing page crashes. 5. Mobile: shared links incorrectly loaded the authenticated chat page navigation. 6. User sync could encounter write conflict issues. 7. System plans could not be fully disabled — empty object defaults caused authentication errors. 8. Workflow: searching for team apps was not working. 9. App versions: incorrect `ref` field prevented normal usage. 10. OceanBase: batch inserts did not correctly return inserted IDs. 11. Interaction nodes conflicted with toolsets, causing toolsets to malfunction after an interaction node. ## Tool Updates 1. Doc2x tool: incorrect response values. file: ./content/self-host/upgrading/4-12/4122.mdx meta: { "title": "V4.12.2", "description": "FastGPT V4.12.2 更新说明, 发布于 2025-8-26" } ## 更新指南 ### 1. 更新镜像: * 更新 FastGPT 镜像tag: v4.12.2-fix3 * 更新 FastGPT 商业版镜像tag: v4.12.2-fix3 * 更新 fastgpt-plugin 镜像 tag: v0.1.11 * mcp\_server 无需更新 * Sandbox 无需更新 * AIProxy 无需更新 ## 🚀 新增内容 1. 向量模型并发请求设置,不统一设置成 10,避免部分向量模型不支持并发,默认均为 1,可在模型配置中设置。 2. 对话页支持管理员配置精选应用,便于推荐给团队成员使用。 3. 对话页首页,支持管理员配置快捷应用,可以设置团队常用的应用。 4. 支持关闭团队的对话首页。 ## ⚙️ 优化 1. 增加工作流**独立分支**异常检测。 2. 向量模型超过 1536 维度进行截断时,强制进行归一化。其他维度是否归一化,完全由配置决定,减少自动判断的计算量。 3. 模型提供商配置移至 plugin sdk 中。 4. 封装 LLM 调用函数,简化 LLM 请求和工具调用。 5. 优化工作流调度代码,避免深度递归。 6. 工作流递归判断优化,对递归线继续分组检测,适配更多样连线。 ## 🐛 修复 1. 独立对话页部分 UI 异常。 2. 独立对话页无法渲染插件交互。 3. 独立对话页,使用二级路由时,默认地址错误。 4. 多选选择器导致的页面崩溃。 5. 移动端,分享链接,异常加载了登录态对话页的导航。 6. 用户同步可能出现写冲突问题。 7. 无法完全关闭系统套餐,会存在空对象默认值,导致鉴权异常。 8. 工作流,添加团队应用,搜索无效。 9. 应用版本,ref 字段错误,导致无法正常使用。 10. Oceanbase 批量插入时,未正确返回插入的 id。 11. 交互节点与工具集存在冲突,导致交互节点后工具集无法正常使用。 ## 🔨 工具更新 1. Doc2x 工具响应值异常。 file: ./content/self-host/upgrading/4-12/4123.en.mdx meta: { "title": "V4.12.3", "description": "FastGPT V4.12.3 Update Notes, released on 2025-9-8" } ## Upgrade Guide ### 1. Update Images: * Update FastGPT image tag: v4.12.3 * Update FastGPT commercial edition image tag: v4.12.3 * Update fastgpt-plugin image tag: v0.1.12 * mcp\_server: no update required * Sandbox: no update required * AIProxy: no update required ## New Features 1. Prompt editor now supports lists, tabs, and other rich text interactions. 2. Apps now have additional global variables: password, multi-select, and internal variables (hidden in on-site chat). ## Improvements 1. Corrected the RRF weight merging algorithm to use the standard RRF weight formula. 2. Multi-select component now supports dynamic width calculation to fit visible tags. 3. Variable update component rendering optimized for consistency with global variable rendering. ## Bug Fixes 1. In single-team mode, users who left could not rejoin the team. 2. Workflow file upload was enabled by default, but the input side did not include file output. 3. Consecutive user selections: branches could not run correctly. 4. Workflow: variable update array selector was not working properly. 5. App evaluation: only the first output text was captured instead of all output texts. ## Plugin Updates 1. Migrated system tool types to the plugin. 2. Moved model provider configuration to the plugin for hot-reload support. 3. Moved app templates to the plugin. file: ./content/self-host/upgrading/4-12/4123.mdx meta: { "title": "V4.12.3", "description": "FastGPT V4.12.3 更新说明, 发布于 2025-9-8" } ## 更新指南 ### 1. 更新镜像: * 更新 FastGPT 镜像tag: v4.12.3 * 更新 FastGPT 商业版镜像tag: v4.12.3 * 更新 fastgpt-plugin 镜像 tag: v0.1.12 * mcp\_server 无需更新 * Sandbox 无需更新 * AIProxy 无需更新 ## 🚀 新增内容 1. 提示词编辑器支持列表、tab 渲染等部分富文本交互。 2. 应用增加更多全局变量:密码、多选、内部变量(在站内对话不会显示)。 ## ⚙️ 优化 1. 纠正 RRF 权重合并算法,使用标准 RRF 权重公式。 2. 多选组件支持动态宽度计算,适配可见 tag。 3. 变量更新组件渲染优化,与全局变量渲染保持一致性。 ## 🐛 修复 1. 单团队模式下,如果用户离开,则无法重新进入团队。 2. 工作流文件上传默认打开,但输入侧未添加文件输出。 3. 连续用户选择,分支无法正常运行。 4. 工作流,变量更新,数组选择器异常。 5. 应用评测,评测内容仅获取了首个输出文本,未获取所有输出文本。 ## 🔨 插件更新 1. 系统工具类型迁移至 plugin。 2. 将模型提供商配置移动到 plugin,实现热更新。 3. 将应用模板移动至 plugin。 file: ./content/self-host/upgrading/4-12/4124.en.mdx meta: { "title": "V4.12.4 (Upgrade Script)", "description": "FastGPT V4.12.4 Update Notes, released on 2025-9-15" } ## Upgrade Guide ### 1. Update Images: * Update FastGPT image tag: v4.12.4 * Update FastGPT commercial edition image tag: v4.12.4 * Update fastgpt-plugin image tag: v0.1.13 * mcp\_server: no update required * Update Sandbox image tag: v4.12.4 * AIProxy: no update required ### 2. Run the Migration Script This script only needs to be run by commercial edition users. 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/initv4124' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` **Script Functions** 1. Adds owner permissions to all resources. ## New Features 1. Commercial edition: WeCom publishing channel support. ## Improvements 1. Permission inheritance optimization: when a child resource has higher permissions than its parent, inheritance mode is no longer forcibly interrupted. 2. Prompt editor now supports list rendering. 3. Navigating back to the knowledge base list from the data page now preserves pagination. 4. After successfully uploading files to a knowledge base, the view returns to the corresponding upload directory. 5. Reduced transaction operations when deleting apps. 6. User selection UI improvements. ## Bug Fixes 1. HTTP tool null pointer error prevented editing. 2. Python code execution: input parameters could not be boolean values. ## Plugin Updates file: ./content/self-host/upgrading/4-12/4124.mdx meta: { "title": "V4.12.4(升级脚本)", "description": "FastGPT V4.12.4 更新说明, 发布于 2025-9-15" } ## 更新指南 ### 1. 更新镜像: * 更新 FastGPT 镜像tag: v4.12.4 * 更新 FastGPT 商业版镜像tag: v4.12.4 * 更新 fastgpt-plugin 镜像 tag: v0.1.13 * mcp\_server 无需更新 * 更新 Sandbox 镜像 tag: v4.12.4 * AIProxy 无需更新 ### 2. 执行升级脚本 该脚本仅需商业版用户执行。 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。 ```bash curl --location --request POST 'https://{{host}}/api/admin/initv4124' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` **脚本功能** 1. 补充所有资源的owner权限 ## 🚀 新增内容 1. 商业版支持企微发布渠道。 ## ⚙️ 优化 1. 权限继承优化,子资源权限高于父级时,不会强制打断继承模式。 2. Prompt 编辑器支持列表渲染。 3. 数据页返回知识库列表,保持分页。 4. 知识库上传文件成功后,返回对应上传目录。 5. 删除应用,减少事务操作。 6. 用户选择 UI。 ## 🐛 修复 1. HTTP 工具空指针,导致无法编辑。 2. python 代码运行,入参无法是 boolean 值。 ## 🔨 插件更新 file: ./content/guide/version/opensource/intro.en.mdx meta: { "title": "Introduction", "description": "FastGPT Community Edition Introduction" } FastGPT Community Edition is the free version of FastGPT, designed for individual developers and small delivery teams. It includes all core FastGPT features: Agent building, workflows, and knowledge bases. Please use it in compliance with the [FastGPT Open Source License](./license.en.mdx). **Related Links** * [GitHub Repository](https://github.com/labring/FastGPT) * [Deployment Guide](../../../self-host/deploy/docker.en.mdx) * [Local Development Guide](../../../self-host/dev.en.mdx) file: ./content/guide/version/opensource/intro.mdx meta: { "title": "介绍", "description": "FastGPT 社区版介绍" } FastGPT 社区版是 FastGPT 的免费版本,适合于个人开发者或小型交付团队使用。包含了 FastGPT 所有核心功能:Agent 构建、工作流、知识库,请在遵守[FastGPT 开源协议](./license.mdx)的前提下使用。 **相关链接** * [GitHub 仓库](https://github.com/labring/FastGPT) * [部署教程](../../../self-host/deploy/docker.mdx) * [本地开发介绍](../../../self-host/dev.mdx) file: ./content/guide/version/opensource/license.en.mdx meta: { "title": "Open Source License", "description": "FastGPT Open Source License" } The FastGPT project is open-sourced under the Apache License 2.0, with the following additional conditions: * FastGPT may be used commercially -- for example, as a backend-as-a-service for other applications or as an application development platform for enterprises. However, a commercial license is required when the following conditions apply: * Multi-tenant SaaS: You may not use the fastgpt.io source code to operate a multi-tenant SaaS service similar to fastgpt.io without explicit written authorization from FastGPT. * Logo and copyright: You may not remove or modify the logo or copyright information in the FastGPT console. Contact us at [dennis@sealos.io](mailto:dennis@sealos.io) for licensing inquiries. * As a contributor, you agree that your contributed code may be used for the following purposes: * The maintainers reserve the right to change the open source license to a more restrictive or more permissive one. * It may be used for commercial purposes, such as FastGPT's cloud service. All other rights and restrictions follow the Apache License 2.0. For full details, refer to the complete Apache License 2.0 text. The interaction design of this product is protected by design patents. © 2023 Sealos. file: ./content/guide/version/opensource/license.mdx meta: { "title": "开源协议", "description": " FastGPT 开源许可证" } FastGPT 项目在 Apache License 2.0 许可下开源,但包含以下附加条件: * FastGPT 允许被用于商业化,例如作为其他应用的“后端即服务”使用,或者作为应用开发平台提供给企业。然而,当满足以下条件时,必须联系作者获得商业许可: * 多租户 SaaS 服务:除非获得 FastGPT 的明确书面授权,否则不得使用 fastgpt.io 的源码来运营与 fastgpt.io 服务类似的多租户 SaaS 服务。 * LOGO 及版权信息:在使用 FastGPT 的过程中,不得移除或修改 FastGPT 控制台内的 LOGO 或版权信息。 请通过电子邮件 [dennis@sealos.io](mailto:dennis@sealos.io) 联系我们咨询许可事宜。 * 作为贡献者,你必须同意将你贡献的代码用于以下用途: * 生产者有权将开源协议调整为更严格或更宽松的形式。 * 可用于商业目的,例如 FastGPT 的云服务。 除此之外,所有其他权利和限制均遵循 Apache License 2.0。如果你需要更多详细信息,可以参考 Apache License 2.0 的完整版本。本产品的交互设计受到外观专利保护。© 2023 Sealos. 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-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) See the [4.15 deployment YAML](https://doc.fastgpt.cn/deploy/docker/v4.15/cn/docker-compose.pg.yml) for the complete OpenSandbox setup. The 4.15 Docker Compose deployment file already includes OpenSandbox Server, Volume Manager, Agent Sandbox Proxy, and the image pre-pull services. For this upgrade, focus on: 1. Using the new Docker Compose deployment file, which includes the OpenSandbox services. 2. Updating OpenSandbox 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 的完整配置请参考 [4.15 部署 yml](https://doc.fastgpt.cn/deploy/docker/v4.15/cn/docker-compose.pg.yml)。4.15 的 Docker Compose 部署文件已经内置 OpenSandbox Server、Volume Manager、Agent Sandbox Proxy 和预拉取镜像服务。 本次升级主要需修改以下内容: 1. 使用新版 Docker Compose 部署文件,其中已包含 OpenSandbox 相关服务。 2. 修改 `fastgpt-app` 和 `fastgpt-pro` 里的 OpenSandbox 环境变量。 可以直接按新的 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-15/4157.en.mdx meta: { "title": "V4.15.7", "description": "FastGPT V4.15.7 Release Notes" } ## 📦 Upgrade Guide ### Image Changes * Update the fastgpt-app (FastGPT core service) image tag to v4.15.7. * Update the fastgpt-pro (FastGPT commercial edition) image tag to v4.15.7. ## 🐛 Fixes 1. Fixed duplicate request headers when MCP falls back to SSE after a failed Streamable HTTP connection. 2. Limited portal quick apps to 3 and added validation for legacy configurations that contain more than the allowed number. 3. Fixed published apps incorrectly rejecting uploads when file variables allow file uploads but the app-level upload configuration is disabled. file: ./content/self-host/upgrading/4-15/4157.mdx meta: { "title": "V4.15.7", "description": "FastGPT V4.15.7 更新说明" } ## 📦 升级指南 ### 镜像变更 * 更新 fastgpt-app(FastGPT 主服务)镜像 tag:v4.15.7 * 更新 fastgpt-pro(FastGPT 商业版)镜像 tag:v4.15.7 ## 🐛 修复 1. 修复 MCP 使用 Streamable HTTP 连接失败并回退到 SSE 时,请求头可能被重复发送的问题。 2. 门户页快捷应用数量上限调整为 3 个,并兼容校验历史配置中超过上限的快捷应用。 3. 修复应用发布后,文件变量配置允许上传文件,但预签名上传接口错误判断为未开启文件上传的问题。 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. ![alt text](../../../../public/imgs/image-121.png) ## 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 团队会默认激活所有系统工具。 除了安装外,还可对工具进行排序、默认安装、标签管理等。 ![alt text](../../../../public/imgs/image-121.png) ## 🚀 新增内容 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/self-host/upgrading/4-14/41930.en.mdx meta: { "title": "V4.14.30", "description": "FastGPT V4.14.30 release notes" } ## Upgrade Guide ### 1. Update image tags * Update the fastgpt-app image tag (FastGPT main service): v4.14.30 * Update the fastgpt-pro image tag (FastGPT commercial edition): v4.14.30 ## Changes 1. Fixed the issue with incorrect handling of MCP authentication header errors. file: ./content/self-host/upgrading/4-14/41930.mdx meta: { "title": "V4.14.30", "description": "FastGPT V4.14.30 更新说明" } ## 升级指南 ### 1. 更新镜像 tag * 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.30 * 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.14.30 ## 变更说明 1. 修复 mcp 鉴权头错误处理的问题 file: ./content/self-host/upgrading/4-16/41601.en.mdx meta: { "title": "V4.16.0-beta1 (Environment Variable Changes and Upgrade Scripts)", "description": "FastGPT V4.16.0-beta1 release notes" } ## 📦 Upgrade Guide ### 1. Update the Agent Sandbox Proxy environment variables (optional) 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 ``` The access URL must start with `http://` or `https://`. With a single-port deployment, it can use 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 from the main FastGPT site. A same-origin deployment places user-generated scripts inside the main site's security boundary, where they may access site credentials or APIs. FastGPT does not currently enforce origin isolation. Visit `https://{{host}}/health` to verify that the service is accessible. ### 2. Update the fastgpt-app environment variables (required when Sandbox is enabled) Update the variables in both `fastgpt-app` and `fastgpt-pro`. 1. Add the following environment variables ```dotenv # HTTP(S) URL used by browsers to preview Sandbox files. Use the URL configured in step 1. AGENT_SANDBOX_PREVIEW_PROXY_URL=https://sandbox-proxy.example.com # Required for OpenSandbox. Sets the full storage name prefix (previously configured on the volume image). VM_VOLUME_NAME_PREFIX=fastgpt-session ``` 2. Deprecated Sandbox environment variables `AGENT_SANDBOX_DISK_MB` and all E2B-related variables. 3. New optional Sandbox environment variables | 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 protocols have 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. ### 3. Update images * Update the fastgpt-app (FastGPT main service) image tag to `v4.16.0-beta1` * Update the fastgpt-pro (FastGPT commercial edition) image tag to `v4.16.0-beta1` * Update the fastgpt-plugin image tag to `v1.1.0-beta1` * Update the agent-sandbox-volumn image tag to `v0.3.0-beta4` (for OpenSandbox only) * Update the agent-sandbox-proxy image tag to `v0.3.0-beta4` (for Sandbox only) ### 4. 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. The migration first performs the beta6 normalization and continues to Workspace archiving in the same request only when no pending normalization work remains: ```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://你的域名/api/admin/4160/initUserSandbox' \ -H 'Content-Type: application/json' \ -H 'rootkey: 你的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. A Skill whose ID matches an App ID is excluded from Chat cleanup. 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. ### 5. Migrate 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`. ### 6. Other changes (optional) 1. `PASSWORD_LOGIN_LOCK_SECONDS` is deprecated. Use `PASSWORD_LOGIN_MINUTE_LIMIT_COUNT` to control the maximum number of password login attempts allowed per account per minute. ## 🚀 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. 9. Added empty-state guidance to the Skill list and linked Skill creation from the Skill selector. ## ⚙️ 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. 7. Refactored login and authentication code. 8. Refactored the rate-limiting module. file: ./content/self-host/upgrading/4-16/41601.mdx meta: { "title": "V4.16.0-beta1(环境变量变更、升级脚本)", "description": "FastGPT V4.16.0-beta1 更新说明" } ## 📦 升级指南 ### 1. 更新 Agent-sandbox-proxy 环境变量(可选) 4.16.0 需要依赖 proxy 进行静态资源代理访问,如果网关支持 ws 和 http 在同一个端口,则可以只开放一个端口。如果不支持,可以通过设置 `PREVIEW_PORT` 来设置 http 访问端口。 ```dotenv # ws和http服务的端口 PORT=1006 # http服务的端口,可以覆盖 PORT PREVIEW_PORT=1007 ``` 访问地址以 `http://` 或 `https://` 开头。单端口部署时,它可以与 `AGENT_SANDBOX_PROXY_URL` 指向同一域名和端口,但协议分别使用 HTTP(S) 和 WebSocket(S)。强烈建议配置的域名与 FastGPT 主站使用不同的 origin。同源部署会让这些脚本进入主站的同源安全边界,可能访问主站凭证或接口。系统当前不会强制检查 origin 是否隔离。 可以通过访问: `https://{{host}}/health` 来确认是否可访问。 ### 2. 更新 fastgpt-app 环境变量(启用沙盒的需更新) 在 `fastgpt-app` 和 `fastgpt-pro` 同时修改变量。 1. 增加环境变量 ```dotenv # 浏览器访问 Sandbox 文件预览的 HTTP(S) 地址,这个地址从第一步取。 AGENT_SANDBOX_PREVIEW_PROXY_URL=https://sandbox-proxy.example.com # opensandbox 需配置,存储全前缀名(之前是配置在 volumn 镜像环境变量里) VM_VOLUME_NAME_PREFIX=fastgpt-session ``` 2. 弃用的沙盒环境变量 `AGENT_SANDBOX_DISK_MB`,E2B 相关变量。 3. 新增的可选的沙盒配置变量 | 变量 | 默认值 | 说明 | | ------------------------------------- | ------ | ------------------------------------------------------------------------------------ | | `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 时必须使用本版本配套镜像,不支持新旧版本混合部署。 ### 3. 镜像更新 * 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.16.0-beta1 * 更新 fastgpt-pro(fastgpt 商业版) 镜像 tag: v4.16.0-beta1 * 更新 fastgpt-plugin 镜像 tag: v1.1.0-beta1 * 更新 agent-sandbox-volumn 镜像 tag: v0.3.0-beta4 (Opensandbox 专属) * 更新 agent-sandbox-proxy 镜像 tag: v0.3.0-beta4 (沙盒专属) ### 4. 迁移 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 记录会保留且不会迁移。 ### 5. 迁移 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`。 ### 6. 其他变更(可选) 1. 弃用 `PASSWORD_LOGIN_LOCK_SECONDS` 变量,改成 `PASSWORD_LOGIN_MINUTE_LIMIT_COUNT` , 用于控制每分钟登录频率控制。 ## 🚀 新增内容 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. 管理员配置系统工具密钥时,加密(兼容已配置的密钥)。 9. 技能列表空状态引导,以及选择技能时联动。 ## ⚙️ 优化 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. 优化系统工具多进程权限安全问题。 7. 重构登录与身份验证代码。 8. 重构限流模块。 file: ./content/self-host/upgrading/4-16/41602.en.mdx meta: { "title": "V4.16.0-beta2 (In Progress)", "description": "FastGPT V4.16.0-beta2 release notes" } ## ⚠️ Upgrade notes ### Clean up legacy system model configurations This release applies strict schemas when system models are initialized or saved. Numeric strings, serialized price tiers, and missing fields saved by earlier releases may fail initialization validation. After upgrading, run a dry run first to inspect the model configurations that require cleanup. A dry run does not modify data or reload the model cache: ```bash curl -X POST 'https://your-domain/api/admin/dataClean/cleanSystemModelConfigs' \ -H 'Content-Type: application/json' \ -H 'rootkey: YOUR_ROOT_KEY' \ -d '{"dryRun":true}' ``` After confirming that `invalidSamples` contains no records that require manual correction, run the cleanup: ```bash curl -X POST 'https://your-domain/api/admin/dataClean/cleanSystemModelConfigs' \ -H 'Content-Type: application/json' \ -H 'rootkey: YOUR_ROOT_KEY' \ -d '{"dryRun":false}' ``` The cleanup converts valid numeric strings to numbers, parses serialized `priceTiers` arrays, and removes invalid optional numeric fields. Invalid or missing required numeric fields use system defaults: LLM `maxContext/maxResponse/quoteMaxToken` default to `16000/16000/13000`, Embedding `defaultToken/maxToken` default to `500/3000`, and price fields default to `0`. `functionCall` remains optional, and a missing Embedding `weight` defaults to `0`. The write operation updates all matching records in one operation and immediately reloads the system model cache. The runtime cache is rebuilt even when no database record needs an update. The endpoint is safe to run repeatedly; a follow-up dry run should report `wouldUpdate` as `0`. Records that still fail the complete current model schema are not written, and all of them are listed in `invalidSamples`. ## 🚀 New 1. Moved Workflow app system settings to a dedicated panel in the canvas toolbar. The panel opens automatically when a new Workflow app is created. 2. Added support for configuring multiple preset questions separately, with drag-and-drop reordering. ## ⚙️ Improvements 1. Redesigned the Publish Channels page with separate native and third-party channel groups and a count of configured connections for each channel. 2. Improved batch updates in the Tool Marketplace. Partially failed updates now remain visible and can be retried or uninstalled individually, with clearer installed-version and update-status information. 3. Limited portal quick apps to three while preserving compatibility with existing configurations that exceed the limit. 4. Replaced fixed PDF edge cropping with dynamic edge detection to prevent valid content near page boundaries from being removed. ## 🐛 Fixes 1. Fixed legacy Workflow HTTP tools not restoring the correct default input mode for dynamic parameters. 2. Fixed incorrect initial configuration labels caused by Workflow translations not being preloaded when an app was created. 3. Fixed duplicate rendering of Workflow tool parameters. 4. Fixed file variables not accepting uploads after an app was published. 5. Fixed file uploads failing for shared Workflow tool parameters. 6. Fixed upload, parsing, preview, or download failures when S3 object keys or filenames contained spaces or special characters such as `%`, `#`, `?`, or slashes. file: ./content/self-host/upgrading/4-16/41602.mdx meta: { "title": "V4.16.0-beta2(进行中)", "description": "FastGPT V4.16.0-beta2 更新说明" } ## 📦 升级指南 ### 1. 清洗历史系统模型配置 本版本开始在系统模型初始化及保存时使用严格 Schema。此前版本保存的数字字符串、字符串形式的价格梯度或缺失字段可能导致初始化校验失败。升级后请先执行 dry-run,查看需要处理的模型配置;dry-run 不会修改数据或刷新缓存: ```bash curl -X POST 'https://你的域名/api/admin/dataClean/cleanSystemModelConfigs' \ -H 'Content-Type: application/json' \ -H 'rootkey: 你的ROOT_KEY' \ -d '{"dryRun":true}' ``` 确认 `invalidSamples` 中没有需要人工处理的数据后,执行正式清洗: ```bash curl -X POST 'https://你的域名/api/admin/dataClean/cleanSystemModelConfigs' \ -H 'Content-Type: application/json' \ -H 'rootkey: 你的ROOT_KEY' \ -d '{"dryRun":false}' ``` 清洗会将合法数字字符串转换为 number、将字符串形式的 `priceTiers` 转换为数组,并删除非法的可选数字。非法或缺失的必填数字使用系统默认值:LLM 的 `maxContext/maxResponse/quoteMaxToken` 分别为 `16000/16000/13000`,Embedding 的 `defaultToken/maxToken` 分别为 `500/3000`,价格为 `0`。`functionCall` 保持可选,Embedding 缺失的 `weight` 补为 `0`。 正式执行会统一写入数据并立即刷新系统模型缓存;即使没有记录需要更新,也会重新构建运行时缓存。接口可安全重复执行;再次 dry-run 时,`wouldUpdate` 应为 `0`。无法通过当前完整模型 Schema 的记录不会写入,详情会全部返回在 `invalidSamples` 中。 ## 🚀 新增内容 1. 工作流应用的系统配置移至画布左侧工具栏中的独立配置面板,新建工作流应用时会自动打开。 2. 开场白支持独立配置多个预设问题,并可拖拽排序。 ## ⚙️ 优化 1. 重构发布渠道页面,按原生渠道和第三方渠道分组展示,并显示各渠道已配置数量。 2. 工具市场批量更新支持展示部分失败项、单独重试或卸载,并完善已安装版本和更新状态的展示。 3. 门户页快捷应用数量上限调整为 3 个,并兼容已超出上限的历史配置。 4. PDF 解析器动态边缘裁剪,而不是固定边缘裁剪,避免裁剪掉真实内容。 ## 🐛 修复 1. 修复旧版工作流 HTTP 工具的动态参数未正确恢复默认输入方式的问题。 2. 修复新建工作流应用时,国际化资源未预加载导致初始配置文案异常的问题。 3. 修复工作流工具参数可能被重复渲染的问题。 4. 修复应用发布后,文件变量无法上传文件的问题。 5. 修复共享工作流工具的文件参数无法上传文件的问题。 6. 修复 S3 对象键和文件名包含空格、`%`、`#`、`?`、斜杠等特殊字符时,可能导致上传、解析、预览或下载异常的问题。 ## 🛠️ 代码优化 1. 审计日志归档,不再删除,改成转存到 S3 冷归档。 2. 增加对 admin 配置的数据校验和清洗。 file: ./content/self-host/upgrading/outdated/40.en.mdx meta: { "title": "V4.0 (Upgrade Script)", "description": "Upgrade guide from older versions to FastGPT V4.0" } import { Alert } from '@/components/docs/Alert'; If you are **upgrading from an older version to V4**, the MongoDB schema has changed significantly. You'll need to run the initialization scripts described below. ## Rename Collections Connect to your MongoDB database and run these two commands: ```js db.models.renameCollection('apps'); db.sharechats.renameCollection('outlinks'); ``` Note: When upgrading from an older version to V4, MongoDB will automatically create empty collections with these names. You need to manually drop those empty collections first before running the commands above. ## Initialize Fields in Several Collections Run the following 3 commands sequentially. They may take a while to complete. If a command fails, you can safely re-run it (already-initialized records will be skipped) until all data has been updated. ```js db.chats.find({ appId: { $exists: false } }).forEach(function (item) { db.chats.updateOne( { _id: item._id }, { $set: { appId: item.modelId } } ); }); db.collections.find({ appId: { $exists: false } }).forEach(function (item) { db.collections.updateOne( { _id: item._id }, { $set: { appId: item.modelId } } ); }); db.outlinks.find({ shareId: { $exists: false } }).forEach(function (item) { db.outlinks.updateOne( { _id: item._id }, { $set: { shareId: item._id.toString(), appId: item.modelId } } ); }); ``` ## Initialization APIs Deploy the new version, then send 3 HTTP requests (remember to include `headers.rootkey` — this value comes from your environment variables): 1. [https://xxxxx/api/admin/initv4](https://xxxxx/api/admin/initv4) 2. [https://xxxxx/api/admin/initChat](https://xxxxx/api/admin/initChat) 3. [https://xxxxx/api/admin/initOutlink](https://xxxxx/api/admin/initOutlink) Requests 1 and 2 may crash due to insufficient memory. If that happens, simply re-run them. file: ./content/self-host/upgrading/outdated/40.mdx meta: { "title": "V4.0(升级脚本)", "description": "FastGPT 从旧版本升级到 V4.0 操作指南" } import { Alert } from '@/components/docs/Alert'; 如果您是**从旧版本升级到 V4**,由于新版 MongoDB 表变更比较大,需要按照本文档的说明执行一些初始化脚本。 ## 重命名表名 需要连接上 MongoDB 数据库,执行两条命令: ```js db.models.renameCollection('apps'); db.sharechats.renameCollection('outlinks'); ``` 注意:从旧版更新到 V4, MongoDB 会自动创建空表,你需要先手动删除这两个空表,再执行上面的操作。 ## 初始化几个表中的字段 依次执行下面 3 条命令,时间比较长,不成功可以重复执行(会跳过已经初始化的数据),直到所有数据更新完成。 ```js db.chats.find({ appId: { $exists: false } }).forEach(function (item) { db.chats.updateOne( { _id: item._id }, { $set: { appId: item.modelId } } ); }); db.collections.find({ appId: { $exists: false } }).forEach(function (item) { db.collections.updateOne( { _id: item._id }, { $set: { appId: item.modelId } } ); }); db.outlinks.find({ shareId: { $exists: false } }).forEach(function (item) { db.outlinks.updateOne( { _id: item._id }, { $set: { shareId: item._id.toString(), appId: item.modelId } } ); }); ``` ## 初始化 API 部署新版项目,并发起 3 个 HTTP 请求(记得携带 `headers.rootkey`,这个值是环境变量里的) 1. [https://xxxxx/api/admin/initv4](https://xxxxx/api/admin/initv4) 2. [https://xxxxx/api/admin/initChat](https://xxxxx/api/admin/initChat) 3. [https://xxxxx/api/admin/initOutlink](https://xxxxx/api/admin/initOutlink) 1 和 2 有可能会因为内存不足挂掉,可以重复执行。 file: ./content/self-host/upgrading/outdated/41.en.mdx meta: { "title": "V4.1 (Environment Changes, Upgrade Script)", "description": "Upgrade guide from older versions to FastGPT V4.1" } If you are **upgrading from an older version to V4.1**, the chat storage structure has been redesigned. You'll need to initialize the existing stored data. ## Update Environment Variables V4.1 simplified the PostgreSQL and MongoDB connection variables — you now only need a single URL for each: Note: `/fastgpt` and `/postgres` refer to database names and must match the values from your previous configuration. ```bash # MongoDB config — no changes needed. If connection fails, try removing ?authSource=admin - MONGODB_URI=mongodb://username:password@mongo:27017/fastgpt?authSource=admin # PostgreSQL config — no changes needed - PG_URL=postgresql://username:password@pg:5432/postgres ``` ## Initialization API Deploy the new version, then send 1 HTTP request (remember to include `headers.rootkey` — this value comes from your environment variables): * [https://xxxxx/api/admin/initChatItem](https://xxxxx/api/admin/initChatItem) file: ./content/self-host/upgrading/outdated/41.mdx meta: { "title": "V4.1(环境变量变更、升级脚本)", "description": "FastGPT 从旧版本升级到 V4.1 操作指南" } 如果您是**从旧版本升级到 V4.1**,由于新版重新设置了对话存储结构,需要初始化原来的存储内容。 ## 更新环境变量 V4.1 优化了 PostgreSQL 和 MongoDB 的连接变量,只需要填 1 个 URL 即可: 注意:/fastgpt 和 /postgres 是指数据库名称,需要和旧版的变量对应。 ```bash # mongo 配置,不需要改. 如果连不上,可能需要去掉 ?authSource=admin - MONGODB_URI=mongodb://username:password@mongo:27017/fastgpt?authSource=admin # pg配置. 不需要改 - PG_URL=postgresql://username:password@pg:5432/postgres ``` ## 初始化 API 部署新版项目,并发起 1 个 HTTP 请求(记得携带 `headers.rootkey`,这个值是环境变量里的) * [https://xxxxx/api/admin/initChatItem](https://xxxxx/api/admin/initChatItem) file: ./content/self-host/upgrading/outdated/4100.en.mdx meta: { "title": "V4.10.0 (Environment Changes)", "description": "FastGPT V4.10.0 Update Notes" } ## Upgrade Guide ### Docker Deployment * Refer to the latest [docker-compose.yml](https://github.com/labring/FastGPT/blob/main/document/public/deploy/docker/main/global/docker-compose.pg.yml) file to add the `fastgpt-plugin` and `minio` services. * Set the `fastgpt-plugin` environment variable `AUTH_TOKEN` to a sufficiently complex value. * Set the `fastgpt-plugin` environment variable `MINIO_CUSTOM_ENDPOINT` to `http://ip:port` or a relevant domain name that is accessible to FastGPT users. * Update the environment variables for the `fastgpt` and `fastgpt-pro` (commercial edition) containers: ``` PLUGIN_BASE_URL=http://fastgpt-plugin:3000 PLUGIN_TOKEN=the AUTH_TOKEN value you just set ``` * Update the `fastgpt` and `fastgpt-pro` image tags to: v4.10.0-fix * Run `docker-compose up -d` to start/update all services. ### Sealos Deployment * In the Sealos desktop `Object Storage`, create a new bucket with `publicRead` permissions and obtain the relevant credentials: ![](../../../../public/imgs/sealos-s3.png) * Deploy the `fastgpt-plugin` service using the image `registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.1.0`. Expose internal port 3000 (no public access required) and set the following environment variables: ``` AUTH_TOKEN=authentication token # Log level: debug, info, warn, error LOG_LEVEL=info # S3 configuration MINIO_CUSTOM_ENDPOINT=External MINIO_ENDPOINT=Internal address MINIO_PORT=80 MINIO_USE_SSL=false MINIO_ACCESS_KEY=Access Key MINIO_SECRET_KEY=Secret Key MINIO_BUCKET=bucket name ``` * Update the environment variables and image tags for the `fastgpt` and `fastgpt-pro` (commercial edition) containers to: v4.10.0-fix ``` PLUGIN_BASE_URL=internal address of the fastgpt-plugin service PLUGIN_TOKEN=the AUTH_TOKEN value you just set ``` ## New Features 1. Standalone system tool service with support for independent development and debugging of system tools. 2. Updated [System Tool Development Guide](../../../plugin/system-tool-development.en.mdx). 3. Updated [Plugin System Overview](../../../plugin/intro.en.mdx). file: ./content/self-host/upgrading/outdated/4100.mdx meta: { "title": "V4.10.0(环境变量变更)", "description": "FastGPT V4.10.0 更新说明" } ## 更新指南 ### Docker 版本 * 参考最新的 [docker-compose.yml](https://github.com/labring/FastGPT/blob/main/document/public/deploy/docker/main/global/docker-compose.pg.yml) 文件,加入 `fastgpt-plugin` 和 `minio` 服务。 * 修改 `fastgpt-plugin` 环境变量 `AUTH_TOKEN` 为较复杂的值。 * 修改 `fastgpt-plugin` 环境变量 `MINIO_CUSTOM_ENDPOINT` 为 `http://ip:port` 或相关域名,要求 fastgpt 用户可访问。 * 更新 `fastgpt` 和 `fastgpt-pro` (商业版)容器的环境变量: ``` PLUGIN_BASE_URL=http://fastgpt-plugin:3000 PLUGIN_TOKEN=刚修改的 AUTH_TOKEN 值 ``` * 更新 `fastgpt` 和 `fastgpt-pro` 镜像 tag: v4.10.0-fix * `docker-compose up -d` 启动/更新所有服务。 ### Sealos 版本 * 在 Sealos 桌面的 `对象存储` 中,新建一个存储桶,设置 `publicRead` 权限。并获取相关密钥: ![](../../../../public/imgs/sealos-s3.png) * 部署 `fastgpt-plugin` 服务,镜像 `registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.1.0`,内网暴露端口 3000,无需公网访问,设置环境变量: ``` AUTH_TOKEN=鉴权 token # 日志等级: debug,info,warn,error LOG_LEVEL=info # S3 配置 MINIO_CUSTOM_ENDPOINT=External MINIO_ENDPOINT=Internal地址 MINIO_PORT=80 MINIO_USE_SSL=false MINIO_ACCESS_KEY=Access Key MINIO_SECRET_KEY=Secret Key MINIO_BUCKET=存储桶名 ``` * 更新 `fastgpt` 和 `fastgpt-pro` (商业版)容器的环境变量以及镜像 tag: v4.10.0-fix ``` PLUGIN_BASE_URL=fastgpt-plugin 服务的内网地址 PLUGIN_TOKEN=刚修改的 AUTH_TOKEN 值 ``` ## 🚀 新增内容 1. 独立系统工具服务,支持系统工具独立开发和调试。 2. 更新系统工具开发指南[系统工具开发指南](../../../plugin/system-tool-development.mdx)。 3. 更新[插件系统说明](../../../plugin/intro.mdx)。 file: ./content/self-host/upgrading/outdated/4101.en.mdx meta: { "title": "V4.10.1 (Upgrade Script)", "description": "FastGPT V4.10.1 Update Notes" } ## Upgrade Guide ### 1. Update Images: * Update FastGPT image tag: v4.10.1-fix3 * Update FastGPT commercial edition image tag: v4.10.1 * Update fastgpt-plugin image tag: v0.1.3 * mcp\_server: no update required * Sandbox: no update required * AIProxy: no update required ### 2. Run the Migration Script This script only needs to be run by commercial edition users. 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/initv4101' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` * Adds new scheduled tasks for auto-synced knowledge bases. ## New Features 1. System tools now support streaming output. 2. Commercial edition: scheduled sync for third-party knowledge bases now supports full sync, including entire directories. ## Improvements 1. Scheduled task error logs are now recorded in the chat logs. 2. Encapsulated dynamic form rendering component for apps. 3. Directory breadcrumb navigation now truncates on overflow. ## Bug Fixes 1. Search-type system tools were not displaying correctly. 2. Backward compatibility issues with some system tools. 3. AI node: manually selecting chat history caused duplicate system records. 4. Knowledge base tags could not scroll to the bottom. 5. When importing files via API to an API-based knowledge base, custom API parsing parameters were not applied. ## Tool Updates 1. New: Flux official image generation tool. 2. New: JinaAI toolset. 3. New: Alibaba Cloud Bailian Flux and Tongyi Wanxiang image generation. 4. Fixed incorrect output value type for SiliconFlow image generation tool. file: ./content/self-host/upgrading/outdated/4101.mdx meta: { "title": "V4.10.1(升级脚本)", "description": "FastGPT V4.10.1 更新说明" } ## 更新指南 ### 1. 更新镜像: * 更新 FastGPT 镜像tag: v4.10.1-fix3 * 更新 FastGPT 商业版镜像tag: v4.10.1 * 更新 fastgpt-plugin 镜像 tag: v0.1.3 * mcp\_server 无需更新 * Sandbox 无需更新 * AIProxy 无需更新 ### 2. 执行升级脚本 该脚本仅需商业版用户执行。 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。 ```bash curl --location --request POST 'https://{{host}}/api/admin/initv4101' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` * 给自动同步的知识库加入新的定时任务。 ## 🚀 新增内容 1. 系统工具支持流输出。 2. 商业版第三方知识库定时同步,支持全量同步,可以同步整个目录。 ## ⚙️ 优化 1. 定时任务报错日志记录到对话日志。 2. 封装应用动态form渲染组件。 3. 目录面包屑导航溢出省略。 ## 🐛 修复 1. 搜索类型系统工具无法正常显示。 2. 部分系统工具向下兼容问题。 3. AI 节点,手动选择历史记录时,会导致 system 记录重复。 4. 知识库 tag 无法滚动到底。 5. API 知识库通过 API 导入文件时,自定义 API 解析参数未生效。 ## 🔨 工具更新 1. 新增 Flux 官方绘图工具。 2. 新增 JinaAI 工具集。 3. 新增阿里百炼 Flux 和通义万相绘图。 4. 纠正硅基流动画图工具输出值类型。 file: ./content/self-host/upgrading/outdated/4110.en.mdx meta: { "title": "V4.11.0 (Environment Changes)", "description": "FastGPT V4.11.0 Update Notes" } ## Upgrade Guide ### 1. Update Environment Variables Commercial edition users can add the following evaluation-related environment variables, then click Save once in the admin panel after updating. ``` EVAL_CONCURRENCY=3 # Evaluation single-node concurrency EVAL_LINE_LIMIT=1000 # Maximum lines per evaluation file ``` ### 2. Update Images: * Update FastGPT image tag: v4.11.0 * Update FastGPT commercial edition image tag: v4.11.0 * Update fastgpt-plugin image tag: v0.1.5 * mcp\_server: no update required * Sandbox: no update required * AIProxy: no update required ## Project Changes 1. Removed all restrictions on **open-source features**, including limits on the number of apps and knowledge bases. 2. Updated the roadmap to include `Context Management`, `AI-Generated Workflows`, `Advanced Orchestration Debug Mode`, and more. 3. The international domain has been changed from `fastgpt.io` to `fastgpt.io`. ## New Features 1. Commercial edition: added **App Evaluation (Beta)** for supervised scoring of apps. 2. Workflow nodes now support error-catching branches. 3. Chat page: independent tab UX. 4. Support for Signoz traces and logs system monitoring. 5. Added model configurations for Gemini 2.5, Grok 4, and Kimi. 6. Model invocation logs now include time-to-first-token and request IP. ## Improvements 1. Optimized code to prevent memory buildup from recursion, significantly reducing memory consumption during high-concurrency knowledge base preprocessing. 2. Knowledge base training: support for retrying all failed data in a collection at once. 3. Workflow valueTypeFormat to prevent data type inconsistencies. 4. Knowledge base list search now properly escapes special characters in regex. ## Bug Fixes 1. Question classification and content extraction nodes: default model failed frontend validation, preventing workflow execution and publishing. ## Tool Updates 1. Markdown text to Docx and Xlsx file conversion. file: ./content/self-host/upgrading/outdated/4110.mdx meta: { "title": "V4.11.0(环境变量变更)", "description": "FastGPT V4.11.0 更新说明" } ## 升级说明 ### 1. 修改环境变量 FastGPT 商业版用户,可以增加评估相关环境变量,并在更新后,在管理端点击一次保存。 ``` EVAL_CONCURRENCY=3 # 评估单节点并发数 EVAL_LINE_LIMIT=1000 # 评估文件最大行数 ``` ### 2. 更新镜像: * 更新 FastGPT 镜像tag: v4.11.0 * 更新 FastGPT 商业版镜像tag: v4.11.0 * 更新 fastgpt-plugin 镜像 tag: v0.1.5 * mcp\_server 无需更新 * Sandbox 无需更新 * AIProxy 无需更新 ## 项目调整 1. 移除所有**开源功能**的限制,包括:应用数量和知识库数量上限。 2. 调整 RoadMap,增加`上下文管理`,`AI 生成工作流`,`高级编排 DeBug 调试模式`等计划。 3. 国际版域名将`fastgpt.io`调整成`fastgpt.io`。 ## 🚀 新增内容 1. 商业版增加**应用评测(Beta 版)**,可对应用进行有监督评分。 2. 工作流部分节点支持报错捕获分支。 3. 对话页独立 tab 页面UX。 4. 支持 Signoz traces 和 logs 系统追踪。 5. 新增 Gemini2.5, grok4, kimi 模型配置。 6. 模型调用日志增加首字响应时长和请求 IP。 ## ⚙️ 优化 1. 优化代码,避免递归造成的内存堆积,尤其在高并发连续的进行知识库预处理时,可显著降低内存消耗。 2. 知识库训练:支持全部重试当前集合异常数据。 3. 工作流 valueTypeFormat,避免数据类型不一致。 4. 知识库列表搜索时,正则未进行特殊词替换。 ## 🐛 修复 1. 问题分类和内容提取节点,默认模型无法通过前端校验,导致工作流无法运行和保存发布。 ## 🔨 工具更新 1. Markdown 文本转 Docx 和 Xlsx 文件。 file: ./content/self-host/upgrading/outdated/4111.en.mdx meta: { "title": "V4.11.1", "description": "FastGPT V4.11.1 Update Notes" } ## Upgrade Guide ### 1. Update Images: * Update FastGPT image tag: v4.11.1-fix2 * Update FastGPT commercial edition image tag: v4.11.1-fix * Update fastgpt-plugin image tag: v0.1.7 * mcp\_server: no update required * Sandbox: no update required * AIProxy: no update required ## New Features 1. System tools: toolsets can now be used directly for tool calls. 2. MCP architecture rewrite — after updating MCP, all active MCP components are automatically updated without needing to remove and re-add them. 3. Chat log dashboard now supports custom field display. 4. Account deletion. 5. New documentation framework. 6. GLM 4.5 series model configurations. ## Improvements 1. Redemption code feature now supports specifying corporate payment mode. 2. Optimized payment plan mode. 3. Renaming a global variable no longer causes referenced values in nodes to be lost. 4. Moved model preset configurations to the FastGPT Plugin project. ## Bug Fixes 1. MCP object-type data was passed incorrectly. 2. Login page UI misalignment. 3. Excel files with line break characters caused chunking errors. 4. Doc2x PDF parsing: removed extraneous tags. 5. 404 page translations were not applied. ## Tool Updates 1. New: libulibu drawing tool. 2. New: Metaso search tool. 3. New: Signoz system monitoring integration. 4. Fixed: incorrect data type in the math expression tool. file: ./content/self-host/upgrading/outdated/4111.mdx meta: { "title": "V4.11.1", "description": "FastGPT V4.11.1 更新说明" } ## 升级说明 ### 1. 更新镜像: * 更新 FastGPT 镜像tag: v4.11.1-fix2 * 更新 FastGPT 商业版镜像tag: v4.11.1-fix * 更新 fastgpt-plugin 镜像 tag: v0.1.7 * mcp\_server 无需更新 * Sandbox 无需更新 * AIProxy 无需更新 ## 🚀 新增内容 1. 系统工具,工具集支持直接给工具调用使用。 2. MCP 结构重写,更新 MCP后,会自动更新所有在用的 MCP 组件,无需重新删除再添加。 3. 对话日志看板,支持自定义字段展示。 4. 账号注销。 5. 新文档框架。 6. GLM 4.5 系列模型配置。 ## ⚙️ 优化 1. 兑换码功能支持指定对公支付模式。 2. 优化支付套餐模式。 3. 全局变量修改变量名后,节点中的引用值不会丢失。 4. 将模型预设配置移动到 FastGPT Plugin 项目中。 ## 🐛 修复 1. MCP object 类型数据传递错误。 2. 登录页 UI 偏移。 3. Excel 表带有换行符号时,导致分块异常。 4. Doc2x PDF 识别去除多余标签。 5. 404 页面翻译失效。 ## 🔨 工具更新 1. 新增:libulibu 绘图工具。 2. 新增:秘塔搜索工具。 3. 新增:支持 Signoz 系统监控接入。 4. 修复:数学表达式工具数据类型错误。 file: ./content/self-host/upgrading/outdated/42.en.mdx meta: { "title": "V4.2", "description": "Upgrade guide from older versions to FastGPT V4.2" } 99.9% of users are unaffected. The V4.2 upgrade primarily changes the `QAModel` format in the configuration file, converting it from an array to an object: ```json "QAModel": { "model": "gpt-3.5-turbo-16k", "name": "GPT35-16k", "maxToken": 16000, "price": 0 } ``` The rationale behind this change is that there's no need to offer multiple choices — just pick the most suitable model for the task. file: ./content/self-host/upgrading/outdated/42.mdx meta: { "title": "V4.2", "description": "FastGPT 从旧版本升级到 V4.2 操作指南" } 99.9%用户不影响,升级 4.2 主要是修改了配置文件中 QAModel 的格式。从原先的数组改成对象: ```json "QAModel": { "model": "gpt-3.5-turbo-16k", "name": "GPT35-16k", "maxToken": 16000, "price": 0 } ``` 改动目的是,我们认为不需要留有选择余地,选择一个最合适的模型去进行任务即可。 file: ./content/self-host/upgrading/outdated/421.en.mdx meta: { "title": "V4.2.1", "description": "Upgrade guide from older versions to FastGPT V4.2.1" } For self-hosted deployments with a custom configuration file, you need to update the `VectorModels` field. Add `defaultToken` and `maxToken` — these correspond to the default token count for direct chunking and the maximum token limit supported by the model (generally recommended not to exceed 3000). ```json "VectorModels": [ { "model": "text-embedding-ada-002", "name": "Embedding-2", "price": 0, "defaultToken": 500, "maxToken": 3000 } ] ``` The rationale behind this change is that there's no need to offer multiple choices — just pick the most suitable model for the task. file: ./content/self-host/upgrading/outdated/421.mdx meta: { "title": "V4.2.1", "description": "FastGPT 从旧版本升级到 V4.2.1 操作指南" } 私有部署,如果添加了配置文件,需要在配置文件中修改 `VectorModels` 字段。增加 defaultToken 和 maxToken,分别对应直接分段时的默认 token 数量和该模型支持的 token 上限 (通常不建议超过 3000) ```json "VectorModels": [ { "model": "text-embedding-ada-002", "name": "Embedding-2", "price": 0, "defaultToken": 500, "maxToken": 3000 } ] ``` 改动目的是,我们认为不需要留有选择余地,选择一个最合适的模型去进行任务即可。 file: ./content/self-host/upgrading/outdated/43.en.mdx meta: { "title": "V4.3 (Environment Changes, Upgrade Script)", "description": "Upgrade guide from older versions to FastGPT V4.3" } ## Run the Initialization API Send 1 HTTP request (remember to include `headers.rootkey` — this value comes from your environment variables): 1. [https://xxxxx/api/admin/initv43](https://xxxxx/api/admin/initv43) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv43' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This will add a new `file_id` column to the `modeldata` table in PostgreSQL, used for storing file IDs. ## Add Environment Variable Add a `FILE_TOKEN_KEY` environment variable, used to generate file preview links with a 30-minute expiration. ``` FILE_TOKEN_KEY=filetokenkey ``` file: ./content/self-host/upgrading/outdated/43.mdx meta: { "title": "V4.3(环境变量变更、升级脚本)", "description": "FastGPT 从旧版本升级到 V4.3 操作指南" } ## 执行初始化 API 发起 1 个 HTTP 请求 (记得携带 `headers.rootkey`,这个值是环境变量里的) 1. [https://xxxxx/api/admin/initv43](https://xxxxx/api/admin/initv43) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv43' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 会给 PG 数据库的 modeldata 表插入一个新列 file\_id,用于存储文件 ID。 ## 增加环境变量 增加一个 `FILE_TOKEN_KEY` 环境变量,用于生成文件预览链接,过期时间为 30 分钟。 ``` FILE_TOKEN_KEY=filetokenkey ``` file: ./content/self-host/upgrading/outdated/44.en.mdx meta: { "title": "V4.4 (Upgrade Script)", "description": "Upgrade guide from older versions to FastGPT V4.4" } ## Run the Initialization API Send 1 HTTP request (remember to include `headers.rootkey` — this value comes from your environment variables): 1. [https://xxxxx/api/admin/initv44](https://xxxxx/api/admin/initv44) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv44' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This will initialize certain fields in MongoDB. file: ./content/self-host/upgrading/outdated/44.mdx meta: { "title": "V4.4(升级脚本)", "description": "FastGPT 从旧版本升级到 V4.4 操作指南" } ## 执行初始化 API 发起 1 个 HTTP 请求 (记得携带 `headers.rootkey`,这个值是环境变量里的) 1. [https://xxxxx/api/admin/initv44](https://xxxxx/api/admin/initv44) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv44' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 会给初始化 Mongo 的部分字段。 file: ./content/self-host/upgrading/outdated/441.en.mdx meta: { "title": "V4.4.1 (Upgrade Script)", "description": "Upgrade guide from older versions to FastGPT V4.4.1" } ## Run the Initialization API Send 1 HTTP request (remember to include `headers.rootkey` — this value comes from your environment variables): 1. [https://xxxxx/api/admin/initv441](https://xxxxx/api/admin/initv441) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv441' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This will initialize the `dataset.files` collection in MongoDB, marking all data as available. file: ./content/self-host/upgrading/outdated/441.mdx meta: { "title": "V4.4.1(升级脚本)", "description": "FastGPT 从旧版本升级到 V4.4.1 操作指南" } ## 执行初始化 API 发起 1 个 HTTP 请求(记得携带 `headers.rootkey`,这个值是环境变量里的) 1. [https://xxxxx/api/admin/initv441](https://xxxxx/api/admin/initv441) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv441' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 会给初始化 Mongo 的 dataset.files,将所有数据设置为可用。 file: ./content/self-host/upgrading/outdated/442.en.mdx meta: { "title": "V4.4.2 (Upgrade Script)", "description": "Upgrade guide from older versions to FastGPT V4.4.2" } ## Run the Initialization API Send 1 HTTP request (remember to include `headers.rootkey` — this value comes from your environment variables): 1. [https://xxxxx/api/admin/initv442](https://xxxxx/api/admin/initv442) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv442' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This will reinitialize the indexes on the MongoDB `Bill` collection, as the previous TTL expiration was incorrect. file: ./content/self-host/upgrading/outdated/442.mdx meta: { "title": "V4.4.2(升级脚本)", "description": "FastGPT 从旧版本升级到 V4.4.2 操作指南" } ## 执行初始化 API 发起 1 个 HTTP 请求 (记得携带 `headers.rootkey`,这个值是环境变量里的) 1. [https://xxxxx/api/admin/initv442](https://xxxxx/api/admin/initv442) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv442' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 会给初始化 Mongo 的 Bill 表的索引,之前过期时间有误。 file: ./content/self-host/upgrading/outdated/445.en.mdx meta: { "title": "V4.4.5 (Upgrade Script)", "description": "FastGPT V4.4.5 Update" } ## Run the Initialization API Send 1 HTTP request (remember to include `headers.rootkey` — this value comes from your environment variables): 1. [https://xxxxx/api/admin/initv445](https://xxxxx/api/admin/initv445) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv445' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This initializes the variable module by merging it into the user guide module. ## What's New ### FastGPT V4.4.5 1. Added — Next-step suggestions: the model can now generate 3 predicted follow-up questions. 2. Commercial edition — Share link restrictions and hook-based identity verification (can integrate with your existing user system). 3. Commercial edition — API Key management: added alias, quota limits, and expiration. Includes a built-in appId, so no additional connection is needed. 4. Improved — Global variables and opening message merged into a single module. file: ./content/self-host/upgrading/outdated/445.mdx meta: { "title": "V4.4.5(升级脚本)", "description": "FastGPT V4.4.5 更新" } ## 执行初始化 API 发起 1 个 HTTP 请求(记得携带 `headers.rootkey`,这个值是环境变量里的) 1. [https://xxxxx/api/admin/initv445](https://xxxxx/api/admin/initv445) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv445' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 初始化了 variable 模块,将其合并到用户引导模块中。 ## 功能介绍 ### Fast GPT V4.4.5 1. 新增 - 下一步指引选项,可以通过模型生成 3 个预测问题。 2. 商业版新增 - 分享链接限制及 hook 身份校验(可对接已有的用户系统)。 3. 商业版新增 - Api Key 使用。增加别名、额度限制和过期时间。自带 appId,无需额外连接。 4. 优化 - 全局变量与开场白合并成同一模块。 file: ./content/self-host/upgrading/outdated/446.en.mdx meta: { "title": "V4.4.6", "description": "FastGPT V4.4.6 Update" } ## What's New 1. Advanced orchestration — New "App Call" module that lets you invoke other apps. 2. Added — Required connection validation. 3. Fixed — Identity issue with next-step suggestions in anonymous (no-login) mode. file: ./content/self-host/upgrading/outdated/446.mdx meta: { "title": "V4.4.6", "description": "FastGPT V4.4.6 更新" } ## 功能介绍 1. 高级编排新增模块 - 应用调用,可调用其他应用。 2. 新增 - 必要连接校验 3. 修复 - 下一步指引在免登录中身份问题。 file: ./content/self-host/upgrading/outdated/447.en.mdx meta: { "title": "V4.4.7 (Upgrade Script)", "description": "FastGPT V4.4.7 Update (includes upgrade script)" } ## Run the Initialization API Send 1 HTTP request (replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your domain): 1. [https://xxxxx/api/admin/initv447](https://xxxxx/api/admin/initv447) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv447' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This initializes PostgreSQL indexes and converts empty `file_id` objects to `manual` objects. If you have a large dataset, this may take a while — you can monitor progress via logs. ## What's New ### FastGPT V4.4.7 1. Improved Knowledge Base file CRUD operations. 2. Added support for reading links as a data source. 3. Differentiated between manual entries and annotations, enabling data traceability back to a specific file. 4. Upgraded the OpenAI SDK. file: ./content/self-host/upgrading/outdated/447.mdx meta: { "title": "V4.4.7(升级脚本)", "description": "FastGPT V4.4.7 更新(包含升级脚本)" } ## 执行初始化 API 发起 1 个 HTTP 请求(`{{rootkey}}` 替换成环境变量里的`rootkey`,`{{host}}`替换成自己域名) 1. [https://xxxxx/api/admin/initv447](https://xxxxx/api/admin/initv447) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv447' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 初始化 pg 索引以及将 file\_id 中空对象转成 manual 对象。如果数据多,可能需要较长时间,可以通过日志查看进度。 ## 功能介绍 ### Fast GPT V4.4.7 1. 优化了数据库文件 crud。 2. 兼容链接读取,作为 source。 3. 区分手动录入和标注,可追数据至某个文件。 4. 升级 openai sdk。 file: ./content/self-host/upgrading/outdated/45.en.mdx meta: { "title": "V4.5 (Complex Update Required)", "description": "FastGPT V4.5 Update" } FastGPT V4.5 introduces PgVector 0.5's HNSW index, which dramatically improves knowledge base search performance — roughly 3x to 10x faster than the `IVFFlat` index, easily achieving millisecond-level searches across millions of records. The downside is that index building is very slow: on a 4C16G machine with 5 million records, a `parallel build` took about 48 hours. For detailed parameter configuration, refer to the [PgVector official documentation](https://github.com/pgvector/pgvector). The following database operations are required for the upgrade: ## PgVector Upgrade: Sealos Deployment 1. Open the Database app from the [Sealos Desktop](https://cloud.sealos.io?uid=fnWRt09fZP). 2. Click on the details of the **pg** database. 3. Click Restart in the upper-right corner and wait for it to complete. 4. Click "One-Click Connect" on the left sidebar and wait for the Terminal to open. 5. Run the following SQL commands in order: ```sql -- Upgrade the extension ALTER EXTENSION vector UPDATE; -- Verify the upgrade was successful — the vector extension version should be 0.5.0 (previously 0.4.1) \dx -- The following two statements set the memory available to PG during index building. Adjust based on your database specs — a good rule of thumb is 1/4 of total memory. alter system set maintenance_work_mem = '2400MB'; select pg_reload_conf(); -- Rebuild database indexes and collation REINDEX DATABASE postgres; -- Start building the index. This takes a very long time — just close the Terminal by clicking the X in the upper-right corner. CREATE INDEX CONCURRENTLY vector_index ON modeldata USING hnsw (vector vector_ip_ops) WITH (m = 16, ef_construction = 64); -- You can reconnect to the Terminal and run the command below. If you see "vector_index" hnsw (vector vector_ip_ops) WITH (m='16', ef_construction='64'), the build is complete (make sure there is no INVALID at the end). \d modeldata ``` | | | | -------------------------------------- | -------------------------------------- | | ![](../../../../public/imgs/v45-1.jpg) | ![](../../../../public/imgs/v45-2.jpg) | | ![](../../../../public/imgs/v45-3.jpg) | ![](../../../../public/imgs/v45-4.jpg) | ## PgVector Upgrade: Docker Compose Deployment The commands below are based on the provided docker-compose template. If you've changed the database username or password, adjust accordingly. 1. Update the PG image version in `docker-compose.yml` to `ankane/pgvector:v0.5.0` or `registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:v0.5.0`. 2. Restart the PG container (`docker-compose pull && docker-compose up -d`) and wait for it to complete. 3. Enter the container: `docker exec -it pg bash` 4. Connect to the database: `psql 'postgresql://username:password@localhost:5432/postgres'` 5. Run the following SQL commands: ```sql -- Upgrade the extension ALTER EXTENSION vector UPDATE; -- Verify the upgrade was successful — the vector extension version should be 0.5.0 (previously 0.4.2) \dx -- The following two statements set the memory available to PG during index building. Adjust based on your database specs — a good rule of thumb is 1/4 of total memory. alter system set maintenance_work_mem = '2400MB'; select pg_reload_conf(); -- Rebuild database indexes and collation REINDEX DATABASE postgres; ALTER DATABASE postgres REFRESH COLLATION VERSION; -- Start building the index. This takes a very long time — just close the terminal window. Do NOT use ctrl+c to cancel. CREATE INDEX CONCURRENTLY vector_index ON modeldata USING hnsw (vector vector_ip_ops) WITH (m = 16, ef_construction = 64); -- You can reconnect to the database and run the command below. If you see "vector_index" hnsw (vector vector_ip_ops) WITH (m='16', ef_construction='64'), the build is complete (make sure there is no INVALID at the end). \d modeldata ``` ## New Features ### Fast GPT V4.5 1. New - Upgraded PgVector extension with HNSW index, dramatically improving knowledge base search speed. 2. New - AI Chat node now includes a "Return AI Content" option, allowing you to prevent AI responses from being sent directly to the browser. 3. New - Support for selecting models in the Question Classifier. 4. Improved - TextSplitter now uses a recursive splitting approach. 5. Improved - Advanced orchestration UX performance. 6. Fixed - Share link authentication issue. ## Configuration File Changes Required The legacy `config.json` guide is no longer maintained. For current versions, see [Model Configuration](../../config/model/intro.en.mdx). file: ./content/self-host/upgrading/outdated/45.mdx meta: { "title": "V4.5(需进行较为复杂更新)", "description": "FastGPT V4.5 更新" } FastGPT V4.5 引入 PgVector0.5 版本的 HNSW 索引,极大的提高了知识库检索的速度,比起 `IVFFlat` 索引大致有 3\~10 倍的性能提升,可轻松实现百万数据毫秒级搜索。缺点在于构建索引的速度非常慢,4c16g 500w 组数据使用 `并行构建` 大约花了 48 小时。具体参数配置可参考 [PgVector 官方](https://github.com/pgvector/pgvector) 下面需要对数据库进行一些操作升级: ## PgVector 升级:Sealos 部署方案 1. 点击 [Sealos 桌面](https://cloud.sealos.io?uid=fnWRt09fZP)的数据库应用。 2. 点击【pg】数据库的详情。 3. 点击右上角的重启,等待重启完成。 4. 点击左侧的一键链接,等待打开 Terminal。 5. 依次输入下方 sql 命令 ```sql -- 升级插件名 ALTER EXTENSION vector UPDATE; -- 插件是否升级成功,成功的话,vector插件版本为 0.5.0,旧版的为 0.4.1 \dx -- 下面两个语句会设置 pg 在构建索引时可用的内存大小,需根据自身的数据库规格来动态配置,可配置为 1/4 的内存大小 alter system set maintenance_work_mem = '2400MB'; select pg_reload_conf(); -- 重构数据库索引和排序 REINDEX DATABASE postgres; -- 开始构建索引,该索引构建时间非常久,直接点击右上角的叉,退出 Terminal 即可 CREATE INDEX CONCURRENTLY vector_index ON modeldata USING hnsw (vector vector_ip_ops) WITH (m = 16, ef_construction = 64); -- 可以再次点击一键链接,进入 Terminal,输入下方命令,如果看到 "vector_index" hnsw (vector vector_ip_ops) WITH (m='16', ef_construction='64') 则代表构建完成(注意,后面没有 INVALID) \d modeldata ``` | | | | -------------------------------------- | -------------------------------------- | | ![](../../../../public/imgs/v45-1.jpg) | ![](../../../../public/imgs/v45-2.jpg) | | ![](../../../../public/imgs/v45-3.jpg) | ![](../../../../public/imgs/v45-4.jpg) | ## PgVector 升级:Docker-compose.yml 部署方案 下面的命令是基于给的 docker-compose 模板,如果数据库账号密码更换了,请自行调整。 1. 修改 `docker-compose.yml` 中 pg 的镜像版本,改成 `ankane/pgvector:v0.5.0` 或 `registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:v0.5.0` 2. 重启 pg 容器(docker-compose pull && docker-compose up -d),等待重启完成。 3. 进入容器: `docker exec -it pg bash` 4. 连接数据库: `psql 'postgresql://username:password@localhost:5432/postgres'` 5. 执行下面 sql 命令 ```sql -- 升级插件名 ALTER EXTENSION vector UPDATE; -- 插件是否升级成功,成功的话,vector插件版本为 0.5.0,旧版的为 0.4.2 \dx -- 下面两个语句会设置 pg 在构建索引时可用的内存大小,需根据自身的数据库规格来动态配置,可配置为 1/4 的内存大小 alter system set maintenance_work_mem = '2400MB'; select pg_reload_conf(); -- 重构数据库索引和排序 REINDEX DATABASE postgres; ALTER DATABASE postgres REFRESH COLLATION VERSION; -- 开始构建索引,该索引构建时间非常久,直接关掉终端即可,不要使用 ctrl+c 关闭 CREATE INDEX CONCURRENTLY vector_index ON modeldata USING hnsw (vector vector_ip_ops) WITH (m = 16, ef_construction = 64); -- 可以再次连接数据库,输入下方命令。如果看到 "vector_index" hnsw (vector vector_ip_ops) WITH (m='16', ef_construction='64') 则代表构建完成(注意,后面没有 INVALID) \d modeldata ``` ## 版本新功能介绍 ### Fast GPT V4.5 1. 新增 - 升级 PgVector 插件,引入 HNSW 索引,极大加快的知识库搜索速度。 2. 新增 - AI 对话模块,增加【返回 AI 内容】选项,可控制 AI 的内容不直接返回浏览器。 3. 新增 - 支持问题分类选择模型 4. 优化 - TextSplitter,采用递归拆解法。 5. 优化 - 高级编排 UX 性能 6. 修复 - 分享链接鉴权问题 ## 该版本需要修改 `config.json` 文件 旧版 `config.json` 配置说明已不再维护,当前版本请参考[模型配置方案](../../config/model/intro.mdx)。 file: ./content/self-host/upgrading/outdated/451.en.mdx meta: { "title": "V4.5.1 (Upgrade Script)", "description": "FastGPT V4.5.1 Update" } ## Run the Initialization API Send 1 HTTP request (replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your domain). 1. [https://xxxxx/api/admin/initv451](https://xxxxx/api/admin/initv451) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv451' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` What the initialization does: 1. Renames database fields. 2. Initializes knowledge base-related fields in the Mongo APP collection. 3. Initializes PG and Mongo content — creates a collection in Mongo for each file and assigns the references back to PG. **This initialization endpoint may be very slow. If the request times out, don't worry — just check the logs.** ## What's New ### Fast GPT V4.5.1 1. New - Knowledge base folder management. 2. Fixed - OpenAI 4.x SDK incompatibility with OneAPI's Zhipu and Alibaba interfaces. 3. Fixed - Some nodes failing to trigger completion events. file: ./content/self-host/upgrading/outdated/451.mdx meta: { "title": "V4.5.1(升级脚本)", "description": "FastGPT V4.5.1 更新" } ## 执行初始化 API 发起 1 个 HTTP 请求(`{{rootkey}}` 替换成环境变量里的`rootkey`,`{{host}}`替换成自己域名) 1. [https://xxxxx/api/admin/initv451](https://xxxxx/api/admin/initv451) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv451' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 初始化内容: 1. rename 数据库字段 2. 初始化 Mongo APP 表中知识库的相关字段 3. 初始化 PG 和 Mongo 的内容,为每个文件创建一个集合(存储 Mongo 中),并反馈赋值给 PG。 **该初始化接口可能速度很慢,返回超时不用管,注意看日志即可** ## 功能介绍 ### Fast GPT V4.5.1 1. 新增知识库文件夹管理 2. 修复了 openai4.x sdk 无法兼容 oneapi 的智谱和阿里的接口。 3. 修复部分模块无法触发完成事件 file: ./content/self-host/upgrading/outdated/452.en.mdx meta: { "title": "V4.5.2", "description": "FastGPT V4.5.2 Update" } ## What's New ### Fast GPT V4.5.2 1. New - Module plugins, allowing you to assemble custom plugins for module reuse. 2. Improved - Knowledge base citation prompts. file: ./content/self-host/upgrading/outdated/452.mdx meta: { "title": "V4.5.2", "description": "FastGPT V4.5.2 更新" } ## 功能介绍 ### Fast GPT V4.5.2 1. 新增 - 模块插件,允许自行组装插件进行模块复用。 2. 优化 - 知识库引用提示。 file: ./content/self-host/upgrading/outdated/46.en.mdx meta: { "title": "V4.6 (Upgrade Script)", "description": "FastGPT V4.6 Update" } **V4.6 introduces basic team functionality, allowing you to invite other users to manage resources collaboratively. After upgrading to this version, older migration scripts cannot be run, and the upgrade cannot be rolled back.** ## 1. Update Images and Modify Configuration Update the image to the latest or V4.6 version. For the commercial edition, update to V0.2.1. The legacy `config.json` guide is no longer maintained. For current versions, see [Model Configuration](../../config/model/intro.en.mdx) and [Environment Variables](../../config/env.en.mdx). The commercial edition configuration file has also been updated — refer to the latest Lark documentation. ## 2. Run the Initialization APIs Send 2 HTTP requests (replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your domain). **These initialization endpoints may be very slow. If the request times out, don't worry — just check the logs. Important: Make sure initv46 completes successfully before running initv46-2.** 1. [https://xxxxx/api/admin/initv46](https://xxxxx/api/admin/initv46) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv46' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 2. [https://xxxxx/api/admin/initv46-2](https://xxxxx/api/admin/initv46-2) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv46-2' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` What the initialization does: 1. Creates the default team. 2. Initializes team fields for all resources in Mongo. 3. Initializes PG fields. 4. Initializes Mongo Data. ## V4.6 New Features 1. New - Team workspace. 2. New - Multi-vector support (multiple vectors mapped to a single dataset). 3. New - TTS (text-to-speech). 4. New - Support for configuring text preprocessing models in knowledge bases. 5. New (Online environment) - ReRank vector recall for improved retrieval accuracy. 6. Improved - Knowledge base export now triggers a streaming download instead of showing a loading spinner. ## V4.6 Bug Fix The initial V4.6 release was missing a field, which caused knowledge base data to not display during file imports. Run the following script to fix this: [https://xxxxx/api/admin/initv46-fix](https://xxxxx/api/admin/initv46-fix) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv46-fix' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` file: ./content/self-host/upgrading/outdated/46.mdx meta: { "title": "V4.6(升级脚本)", "description": "FastGPT V4.6 更新" } **V4.6 版本加入了简单的团队功能,可以邀请其他用户进来管理资源。该版本升级后无法执行旧的升级脚本,且无法回退。** ## 1。更新镜像并变更配置文件 更新镜像至 latest 或者 v4.6 版本。商业版镜像更新至 V0.2.1 旧版 `config.json` 配置说明已不再维护,当前版本请参考[模型配置方案](../../config/model/intro.mdx)和[环境变量说明](../../config/env.mdx),商业镜像配置文件也更新,参考最新的飞书文档。 ## 2。执行初始化 API 发起 2 个 HTTP 请求 ( `{{rootkey}}` 替换成环境变量里的 `rootkey`,`{{host}}` 替换成自己域名) **该初始化接口可能速度很慢,返回超时不用管,注意看日志即可,需要注意的是,需确保 initv46 成功后,在执行 initv46-2** 1. [https://xxxxx/api/admin/initv46](https://xxxxx/api/admin/initv46) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv46' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 2. [https://xxxxx/api/admin/initv46-2](https://xxxxx/api/admin/initv46-2) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv46-2' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 初始化内容:1。创建默认团队 2。初始化 Mongo 所有资源的团队字段 3。初始化 Pg 的字段 4。初始化 Mongo Data ## V4.6 功能介绍 1. 新增 - 团队空间 2. 新增 - 多路向量 (多个向量映射一组数据) 3. 新增 - tts 语音 4. 新增 - 支持知识库配置文本预处理模型 5. 线上环境新增 - ReRank 向量召回,提高召回精度 6. 优化 - 知识库导出,可直接触发流下载,无需等待转圈圈 ## 4.6 缺陷修复 旧的 4.6 版本由于缺少一个字段,导致文件导入时知识库数据无法显示,可执行下面的脚本: [https://xxxxx/api/admin/initv46-fix](https://xxxxx/api/admin/initv46-fix) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv46-fix' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` file: ./content/self-host/upgrading/outdated/461.en.mdx meta: { "title": "V4.6.1", "description": "FastGPT V4.6.1" } ## V4.6.1 New Features 1. New - GPT-4V model support. 2. New - Whisper voice input. 3. Improved - TTS streaming. 4. Improved - TTS caching. file: ./content/self-host/upgrading/outdated/461.mdx meta: { "title": "V4.6.1", "description": "FastGPT V4.6 .1" } ## V4.6.1 功能介绍 1. 新增 - GPT4-v 模型支持 2. 新增 - whisper 语音输入 3. 优化 - TTS 流传输 4. 优化 - TTS 缓存 file: ./content/self-host/upgrading/outdated/462.en.mdx meta: { "title": "V4.6.2 (Upgrade Script)", "description": "FastGPT V4.6.2" } ## 1. Run the Initialization API Send 1 HTTP request (replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your domain). 1. [https://xxxxx/api/admin/initv462](https://xxxxx/api/admin/initv462) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv462' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` What the initialization does: 1. Initializes full-text indexing. ## V4.6.2 New Features 1. New - Full-text indexing (requires a ReRank model; working on making it available in the community edition — the model API is somewhat specialized). 2. New - Plugin sources (expected to be officially used in V4.7/V4.8). 3. Improved - PDF parsing. 4. Improved - DOCX file parsing, now converts to Markdown while preserving images. 5. Fixed and improved the TextSplitter function. file: ./content/self-host/upgrading/outdated/462.mdx meta: { "title": "V4.6.2(升级脚本)", "description": "FastGPT V4.6.2" } ## 1。执行初始化 API 发起 1 个 HTTP 请求 (`{{rootkey}}` 替换成环境变量里的 `rootkey`,`{{host}}` 替换成自己域名) 1. [https://xxxxx/api/admin/initv462](https://xxxxx/api/admin/initv462) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv462' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 初始化说明: 1. 初始化全文索引 ## V4.6.2 功能介绍 1. 新增 - 全文索引(需配合 Rerank 模型,在看怎么放到社区版,模型接口比较特殊) 2. 新增 - 插件来源(预计4.7/4.8版本会正式使用) 3. 优化 - PDF读取 4. 优化 - docx文件读取,转成 markdown 并保留其图片内容 5. 修复和优化 TextSplitter 函数 file: ./content/self-host/upgrading/outdated/463.en.mdx meta: { "title": "V4.6.3 (Upgrade Script)", "description": "FastGPT V4.6.3" } ## 1. Run the Initialization API Send 1 HTTP request (replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your domain). 1. [https://xxxxx/api/admin/initv463](https://xxxxx/api/admin/initv463) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv463' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` What the initialization does: 1. Initializes certain fields in the Mongo dataset, collection, and data documents. ## V4.6.3 New Features 1. New (Commercial edition) - Web site sync. 2. New - Collection metadata tracking. 3. Improved - URL content fetching. 4. Improved - Streaming file reads to prevent memory overflow. 5. Improved - Vision models now automatically convert URLs to base64, enabling local debugging. 6. Improved - Image compression quality levels. 7. Fixed - Image compression failure errors that could cause file reading to hang. file: ./content/self-host/upgrading/outdated/463.mdx meta: { "title": "V4.6.3(升级脚本)", "description": "FastGPT V4.6.3" } ## 1。执行初始化 API 发起 1 个 HTTP 请求 (`{{rootkey}}` 替换成环境变量里的 `rootkey`,`{{host}}` 替换成自己域名) 1. [https://xxxxx/api/admin/initv463](https://xxxxx/api/admin/initv463) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv463' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 初始化说明: 1. 初始化Mongo 中 dataset,collection 和 data 的部分字段 ## V4.6.3 功能介绍 1. 商业版新增 - web站点同步 2. 新增 - 集合元数据记录 3. 优化 - url 读取内容 4. 优化 - 流读取文件,防止内存溢出 5. 优化 - 4v模型自动将 url 转 base64,本地也可调试 6. 优化 - 图片压缩等级 7. 修复 - 图片压缩失败报错,防止文件读取过程卡死。 file: ./content/self-host/upgrading/outdated/464.en.mdx meta: { "title": "V4.6.4 (Upgrade Script)", "description": "FastGPT V4.6.4" } ## 1. Run the Initialization API Send 1 HTTP request (replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your domain). 1. [https://xxxxx/api/admin/initv464](https://xxxxx/api/admin/initv464) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv464' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` What the initialization does: 1. Initializes the createTime field in PG. 2. Initializes the feedback field for chats in Mongo. ## V4.6.4 New Features 1. Rewritten - Share link identity logic, now using localID to track user IDs. 2. New (Commercial edition) - Share link SSO support. With just 3 API endpoints via an authentication URL, you can fully integrate your existing user system. See [Share Link Authentication](../../../guide/build/publish/link.en.mdx#share-link-authentication) for details. 3. New - More embedding options for share links, with additional DIY customization. 4. Improved - History module. The old history module has been deprecated — simply enter the value directly in the relevant field. 5. Adjusted - Knowledge base search module topK logic now uses MaxToken calculation, accommodating text chunks of varying lengths. 6. Adjusted - Authentication order to prioritize API keys, preventing cookies from overriding API key authentication. 7. Link fetching now supports multiple selectors. See [Web Site Sync Usage](../../../guide/dataset/websync.en.mdx). 8. Fixed - Image upload authentication issue in share links. 9. Fixed - Mongo connection pool not being released. 10. Fixed - Dataset description (Intro) not updating. 11. Fixed - Markdown code block rendering issue. 12. Fixed - Root permission issue. 13. Optimized Dockerfile. file: ./content/self-host/upgrading/outdated/464.mdx meta: { "title": "V4.6.4(升级脚本)", "description": "FastGPT V4.6.4" } ## 1。执行初始化 API 发起 1 个 HTTP 请求 ( `{{rootkey}}` 替换成环境变量里的 `rootkey`,`{{host}}` 替换成自己域名) 1. [https://xxxxx/api/admin/initv464](https://xxxxx/api/admin/initv464) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv464' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 初始化说明: 1. 初始化 PG 的 createTime 字段 2. 初始化 Mongo 中 chat 的 feedback 字段 ## V4.6.4 功能介绍 1. 重写 - 分享链接身份逻辑,采用 localID 记录用户的 ID。 2. 商业版新增 - 分享链接 SSO 方案,通过 `身份鉴权` 地址,仅需 `3个接口` 即可完全接入已有用户系统。具体参考[分享链接身份鉴权](../../../guide/build/publish/link.mdx#分享链接身份鉴权) 3. 新增 - 分享链接更多嵌入方式提示,更多 DIY 方式。 4. 优化 - 历史记录模块。弃用旧的历史记录模块,直接在对应地方填写数值即可。 5. 调整 - 知识库搜索模块 topk 逻辑,采用 MaxToken 计算,兼容不同长度的文本块 6. 调整鉴权顺序,提高 apikey 的优先级,避免 cookie 抢占 apikey 的鉴权。 7. 链接读取支持多选择器。参考 [Web 站点同步用法](../../../guide/dataset/websync.mdx) 8. 修复 - 分享链接图片上传鉴权问题 9. 修复 - Mongo 连接池未释放问题。 10. 修复 - Dataset Intro 无法更新 11. 修复 - md 代码块问题 12. 修复 - root 权限问题 13. 优化 docker file file: ./content/self-host/upgrading/outdated/465.en.mdx meta: { "title": "V4.6.5 (Configuration Changes)", "description": "FastGPT V4.6.5" } ## Configuration Changes Since OpenAI has begun deprecating function calls in favor of tool choice, FastGPT has updated its configuration and invocation methods accordingly. You'll need to make some changes to your configuration file: The legacy `config.json` guide is no longer maintained. For current versions, see [Model Configuration](../../config/model/intro.en.mdx). 1. The main change is renaming the `functionCall` field to `toolChoice` in your model configuration. Models with this set to `true` will use OpenAI's tools mode by default; models without it or with it set to `false` will use prompt-based generation. The question optimization model and content extraction model now share the same configuration. 2. Add `"ReRankModels": []` to your configuration. ## V4.6.5 New Features 1. New - [Question Optimization node](../../../guide/build/workflow/nodes/coreferenceResolution.en.mdx) 2. New - [Text Editor node](../../../guide/build/workflow/nodes/text_editor.en.mdx) 3. New - [Classifier node](../../../guide/build/workflow/nodes/tfswitch.en.mdx) 4. New - [Custom Feedback node](../../../guide/build/workflow/nodes/custom_feedback.en.mdx) 5. New - The Content Extraction node now supports model selection and field enumerations. 6. Improved - DOCX parsing with table support (tables are converted to Markdown). 7. Improved - Advanced orchestration connection line interactions. 8. Improved - Fixed CPU-intensive computation caused by html2md that was blocking the thread. 9. Fixed - Prompt extraction descriptions in advanced orchestration. file: ./content/self-host/upgrading/outdated/465.mdx meta: { "title": "V4.6.5(配置变更)", "description": "FastGPT V4.6.5" } ## 配置文件变更 由于 openai 已开始弃用 function call,改为 toolChoice。FastGPT 同步的修改了对于的配置和调用方式,需要对配置文件做一些修改: 旧版 `config.json` 配置说明已不再维护,当前版本请参考[模型配置方案](../../config/model/intro.mdx)。 1. 主要是修改模型的 `functionCall` 字段,改成 `toolChoice` 即可。设置为 `true` 的模型,会默认走 openai 的 tools 模式;未设置或设置为 `false` 的,会走提示词生成模式。 问题优化模型与内容提取模型使用同一组配置。 2. 增加 `"ReRankModels": []` ## V4.6.5 功能介绍 1. 新增 - [问题优化模块](../../../guide/build/workflow/nodes/coreferenceResolution.mdx) 2. 新增 - [文本编辑模块](../../../guide/build/workflow/nodes/text_editor.mdx) 3. 新增 - [判断器模块](../../../guide/build/workflow/nodes/tfswitch.mdx) 4. 新增 - [自定义反馈模块](../../../guide/build/workflow/nodes/custom_feedback.mdx) 5. 新增 -【内容提取】模块支持选择模型,以及字段枚举 6. 优化 - docx 读取,兼容表格(表格转 markdown) 7. 优化 - 高级编排连接线交互 8. 优化 - 由于 html2md 导致的 cpu 密集计算,阻断线程问题 9. 修复 - 高级编排提示词提取描述 file: ./content/self-host/upgrading/outdated/466.en.mdx meta: { "title": "V4.6.6 (Configuration Changes, Environment Changes)", "description": "FastGPT V4.6.6" } ## Configuration Changes To reduce code duplication, we've made some changes to the configuration file. The legacy `config.json` guide is no longer maintained. For current versions, see [Model Configuration](../../config/model/intro.en.mdx) and [Environment Variables](../../config/env.en.mdx). ## Commercial Edition Changes 1. Update the commercial edition image to version 4.6.6. 2. Move `SystemParams.pluginBaseUrl` from the old configuration file to an environment variable: PRO\_URL=commercial edition image address (no longer needs to end with /api), for example: PRO\_URL=[http://fastgpt-plugin.ns-hsss5d.svc.cluster.local:3000](http://fastgpt-plugin.ns-hsss5d.svc.cluster.local:3000) 3. The `FeConfig` section has been removed from the configuration file. You can now configure it directly through the commercial edition's web interface. All FastGPT parameters and models can be configured from the commercial edition dashboard — no need to modify `config.json` anymore. ## V4.6.6 Release Notes 1. Check out the [FastGPT 2024 RoadMap](https://github.com/labring/FastGPT?tab=readme-ov-file#-%E5%9C%A8%E7%BA%BF%E4%BD%BF%E7%94%A8). 2. New - HTTP node now supports a JSON editor for request headers. 3. New - [ReRank Model Deployment](../../custom-models/bge-rerank.en.mdx) 4. New - Search modes: separated vector semantic search, full-text search, and reranking, with RRF (Reciprocal Rank Fusion) for merging results. 5. Improved - Question classifier prompts with ID-guided classification. Tested with Chinese commercial API models (Baidu, Alibaba, Zhipu, iFlytek) — all work correctly in Prompt mode. 6. UI improvements — the interface will be gradually updated with a new design going forward. 7. Code optimization: Icons extracted and auto-generated. 8. Fixed - Link-based datasets not saving selectors, causing syncs to run without them. file: ./content/self-host/upgrading/outdated/466.mdx meta: { "title": "V4.6.6(配置变更、环境变量变更)", "description": "FastGPT V4.6.6" } ## 配置文件变更 为了减少代码重复度,我们对配置文件做了一些修改。旧版 `config.json` 配置说明已不再维护,当前版本请参考[模型配置方案](../../config/model/intro.mdx)和[环境变量说明](../../config/env.mdx)。 ## 商业版变更 1. 更新商业版镜像到 4.6.6 版本。 2. 将旧版配置文件中的 `SystemParams.pluginBaseUrl` 放置到环境变量中: PRO\_URL=商业版镜像地址(此处不再需要以 /API 结尾),例如:\ PRO\_URL= [http://fastgpt-plugin.ns-hsss5d.svc.cluster.local:3000](http://fastgpt-plugin.ns-hsss5d.svc.cluster.local:3000) 3. 原本在配置文件中的 `FeConfig` 已被移除,可以直接打开新的商业版镜像外网地址进行配置。包括 FastGPT 的各个参数和模型都可以直接在商业版镜像中配置,无需再变更 `config.json` 文件。 ## V4.6.6 更新说明 1. 查看 [FastGPT 2024 RoadMap](https://github.com/labring/FastGPT?tab=readme-ov-file#-%E5%9C%A8%E7%BA%BF%E4%BD%BF%E7%94%A8) 2. 新增 - Http 模块请求头支持 Json 编辑器。 3. 新增 - [ReRank 模型部署](../../custom-models/bge-rerank.mdx) 4. 新增 - 搜索方式:分离向量语义检索,全文检索和重排,通过 RRF 进行排序合并。 5. 优化 - 问题分类提示词,ID 引导。测试国产商用 API 模型(百度阿里智谱讯飞)使用 Prompt 模式均可分类。 6. UI 优化,未来将逐步替换新的 UI 设计。 7. 优化代码:Icon 抽离和自动化获取。 8. 修复 - 链接读取的数据集,未保存选择器,导致同步时不使用选择器。 file: ./content/self-host/upgrading/outdated/467.en.mdx meta: { "title": "V4.6.7 (Upgrade Script)", "description": "FastGPT V4.6.7" } ## 1. Run the Initialization API Send 1 HTTP request (replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your domain). 1. [https://xxxxx/api/admin/initv467](https://xxxxx/api/admin/initv467) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv467' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` What the initialization does: 1. Re-associates images with their datasets. 2. Sets null values in the PG table. ## V4.6.7 Release Notes 1. Redesigned knowledge base UI with a new import workflow. 2. Optimized knowledge base and chat data indexing. 3. Knowledge base OpenAPI — you can now [manage knowledge bases via API](../../../openapi/dataset.en.mdx). 4. New - Input field variable hints. After typing `{`, you'll see available variable suggestions. Based on community feedback on advanced orchestration, we plan to improve variable handling in the February release, adding support for node-scoped local variables and more global variables. 5. Improved - Switching teams now saves your selection, so you'll automatically log into that team on your next visit. 6. Fixed - chatId conflicts when using the API for conversations. 7. Fixed - Potential window\.onLoad conflicts when embedding via iframe. file: ./content/self-host/upgrading/outdated/467.mdx meta: { "title": "V4.6.7(升级脚本)", "description": "FastGPT V4.6.7" } ## 1。执行初始化 API 发起 1 个 HTTP 请求 (`{{rootkey}}` 替换成环境变量里的 `rootkey`,`{{host}}` 替换成自己域名) 1. [https://xxxxx/api/admin/initv467](https://xxxxx/api/admin/initv467) ```bash curl --location --request POST 'https://{{host}}/api/admin/initv467' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 初始化说明: 1. 将 images 重新关联到数据集 2. 设置 pg 表的 null 值。 ## V4.6.7 更新说明 1. 修改了知识库UI及新的导入交互方式。 2. 优化知识库和对话的数据索引。 3. 知识库 openAPI,支持通过 [API 操作知识库](../../../openapi/dataset.mdx)。 4. 新增 - 输入框变量提示。输入 `{` 号后将会获得可用变量提示。根据社区针对高级编排的反馈,我们计划于 2 月份的版本中,优化变量内容,支持模块的局部变量以及更多全局变量写入。 5. 优化 - 切换团队后会保存记录,下次登录时优先登录该团队。 6. 修复 - API 对话时,chatId 冲突问题。 7. 修复 - Iframe 嵌入网页可能导致的 window\.onLoad 冲突。 file: ./content/self-host/upgrading/outdated/468.en.mdx meta: { "title": "V4.6.8 (Upgrade Script)", "description": "FastGPT V4.6.8 Release Notes" } ## Docker Deployment - Manually Update MongoDB 1. Modify the mongo section in docker-compose.yml by adding the `command` and `entrypoint` fields: ```yml mongo: image: mongo:5.0.18 # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18 # Alibaba Cloud container_name: mongo ports: - 27017:27017 networks: - fastgpt command: mongod --keyFile /data/mongodb.key --replSet rs0 environment: # Make sure the password matches your previous configuration - MONGO_INITDB_ROOT_USERNAME=username - MONGO_INITDB_ROOT_PASSWORD=password volumes: - ./mongo/data:/data/db entrypoint: - bash - -c - | openssl rand -base64 128 > /data/mongodb.key chmod 400 /data/mongodb.key chown 999:999 /data/mongodb.key echo 'const isInited = rs.status().ok === 1 if(!isInited){ rs.initiate({ _id: "rs0", members: [ { _id: 0, host: "mongo:27017" } ] }) }' > /data/initReplicaSet.js # Start MongoDB service exec docker-entrypoint.sh "$@" & # Wait for MongoDB to start until mongo -u myusername -p mypassword --authenticationDatabase admin --eval "print('waited for connection')" > /dev/null 2>&1; do echo "Waiting for MongoDB to start..." sleep 2 done # Run the replica set initialization script mongo -u myusername -p mypassword --authenticationDatabase admin /data/initReplicaSet.js # Wait for the MongoDB process started by docker-entrypoint.sh wait $! ``` 2. Restart MongoDB ```bash # Restart Mongo docker-compose down docker-compose up -d ``` ## Sealos Deployment - No MongoDB Update Required ## Update Configuration File Removed duplicate model configurations. All LLM models are now consolidated into a single property. The legacy `config.json` guide is no longer maintained. For current versions, see [Model Configuration](../../config/model/intro.en.mdx). ## Commercial Edition Initialization Commercial edition users need to run an initialization to format team information. Send 1 HTTP request (replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your commercial edition domain): ```bash curl --location --request POST 'https://{{host}}/api/init/v468' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This will initialize the billing system. For internal use, you can increase the free storage quota. ## V4.6.8 Release Notes 1. New - Knowledge Base search merge module. 2. New - Redesigned HTTP module with more flexible parameter input. Supports automatic input/output data type conversion (e.g., JSON output is automatically converted to string type for use by other modules). Additional examples are available in the documentation. 3. Improved - Query completion. Query completion is now built into the Knowledge Base Search module, enabling both "reference resolution" and "query expansion" in a single pass. See [Knowledge Base Search Introduction](../../../guide/build/workflow/nodes/dataset_search.en.mdx) for details. 4. Improved - LLM model configuration no longer distinguishes between chat, classification, and extraction models. Default parameters per model are now supported via `defaultConfig` to avoid parameter conflicts between different models. 5. Improved - Streaming response, inspired by `ChatNextWeb`'s streaming implementation for smoother output. This may also fix previously reported issues with garbled text and interruptions that resolved after refreshing. 6. Fixed - Voice input file upload failure. 7. Fixed - Chat box regeneration not working. file: ./content/self-host/upgrading/outdated/468.mdx meta: { "title": "V4.6.8(升级脚本)", "description": "FastGPT V4.6.8更新说明" } ## docker 部署 - 手动更新 Mongo 1. 修改 docker-compose.yml 的 mongo 部分,补上 `command` 和 `entrypoint` ```yml mongo: image: mongo:5.0.18 # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18 # 阿里云 container_name: mongo ports: - 27017:27017 networks: - fastgpt command: mongod --keyFile /data/mongodb.key --replSet rs0 environment: # 这里密码注意要和以前的一致 - MONGO_INITDB_ROOT_USERNAME=username - MONGO_INITDB_ROOT_PASSWORD=password volumes: - ./mongo/data:/data/db entrypoint: - bash - -c - | openssl rand -base64 128 > /data/mongodb.key chmod 400 /data/mongodb.key chown 999:999 /data/mongodb.key echo 'const isInited = rs.status().ok === 1 if(!isInited){ rs.initiate({ _id: "rs0", members: [ { _id: 0, host: "mongo:27017" } ] }) }' > /data/initReplicaSet.js # 启动MongoDB服务 exec docker-entrypoint.sh "$@" & # 等待MongoDB服务启动 until mongo -u myusername -p mypassword --authenticationDatabase admin --eval "print('waited for connection')" > /dev/null 2>&1; do echo "Waiting for MongoDB to start..." sleep 2 done # 执行初始化副本集的脚本 mongo -u myusername -p mypassword --authenticationDatabase admin /data/initReplicaSet.js # 等待docker-entrypoint.sh脚本执行的MongoDB服务进程 wait $! ``` 2. 重启 MongoDB ```bash # 重启 Mongo docker-compose down docker-compose up -d ``` ## Sealos 部署 - 无需更新 Mongo ## 修改配置文件 去除了重复的模型配置,LLM 模型都合并到一个属性中。旧版 `config.json` 配置说明已不再维护,当前版本请参考[模型配置方案](../../config/model/intro.mdx)。 ## 商业版初始化 商业版用户需要执行一个初始化,格式化团队信息。 发起 1 个 HTTP 请求 ( `{{rootkey}}` 替换成环境变量里的 `rootkey`,`{{host}}` 替换成商业版域名) ```bash curl --location --request POST 'https://{{host}}/api/init/v468' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 会初始化计费系统,内部使用可把免费的存储拉大。 ## V4.6.8 更新说明 1. 新增 - 知识库搜索合并模块。 2. 新增 - 新的 Http 模块,支持更加灵活的参数传入。同时支持了输入输出自动数据类型转化,例如:接口输出的 JSON 类型会自动转成字符串类型,直接给其他模块使用。此外,还补充了一些例子,可在文档中查看。 3. 优化 - 内容补全。将内容补全内置到【知识库搜索】中,并实现了一次内容补全,即可完成“指代消除”和“问题扩展”。FastGPT 知识库搜索详细流程可查看:[知识库搜索介绍](../../../guide/build/workflow/nodes/dataset_search.mdx) 4. 优化 - LLM 模型配置,不再区分对话、分类、提取模型。同时支持模型的默认参数,避免不同模型参数冲突,可通过 `defaultConfig` 传入默认的配置。 5. 优化 - 流响应,参考了 `ChatNextWeb` 的流,更加丝滑。此外,之前提到的乱码、中断,刷新后又正常了,可能会修复。 6. 修复 - 语音输入文件无法上传。 7. 修复 - 对话框重新生成无法使用。 file: ./content/self-host/upgrading/outdated/469.en.mdx meta: { "title": "V4.6.9 (Environment Changes, Upgrade Script)", "description": "FastGPT V4.6.9 Release Notes" } ## Update Commercial Edition Environment Variables Add the OneAPI address and token: ``` OPENAI_BASE_URL=http://oneapi:3000/v1 CHAT_API_KEY=sk-fastgpt ``` ## Initialization Script From any terminal, send 1 HTTP request. Replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your domain. ```bash curl --location --request POST 'https://{{host}}/api/admin/initv469' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 1. Resets the usage tracking table. 2. Runs stale data cleanup (removes invalid files, images, Knowledge Base collections, and vectors). ## External API Updates 1. Due to billing system changes, the [share link chat reporting endpoint](../../../guide/build/publish/link.en.mdx#5-implement-the-chat-result-reporting-endpoint-optional) requires some adjustments. The `price` field has been replaced by `totalPoints`. The `inputToken` and `outputToken` fields are no longer provided — only a `token` field (total token count) is returned. ## V4.6.9 Release Notes 1. Commercial Edition - Knowledge Base now supports an "Enhanced Processing" training mode that generates additional index types. 2. New - Improved variable hints for the HTTP module. 3. New - HTTP module supports OpenAI single-endpoint import. 4. New - Global variables now support external variables, which can be passed via share link query parameters or the API `variables` parameter. 5. New - Content extraction module now supports default values. 6. Improved - Query completion now includes English language support. It can also be configured as a standalone module for reuse. 7. Improved - Rewrote the usage tracking system. 8. Improved - Token-based history filtering now keeps an even number of messages to prevent errors with certain models. 9. Improved - Share link SEO now displays the app name and avatar directly. 10. Fixed - Annotation feature. 11. Fixed - QA generation thread count error. 12. Fixed - Question classification connection type error. file: ./content/self-host/upgrading/outdated/469.mdx meta: { "title": "V4.6.9(环境变量变更、升级脚本)", "description": "FastGPT V4.6.9更新说明" } ## 修改商业版环境变量 增加 oneapi 地址和令牌。 ``` OPENAI_BASE_URL=http://oneapi:3000/v1 CHAT_API_KEY=sk-fastgpt ``` ## 初始化脚本 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成自己域名 ```bash curl --location --request POST 'https://{{host}}/api/admin/initv469' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 1. 重置计量表。 2. 执行脏数据清理(清理无效的文件、清理无效的图片、清理无效的知识库集合、清理无效的向量) ## 外部接口更新 1. 由于计费系统变更,[分享链接对话上报接口](../../../guide/build/publish/link.mdx#5-编写对话结果上报接口可选)需要做一些调整,price 字段被 totalPoints 字段取代。inputToken 和 outputToken 不再提供,只提供 `token` 字段(总 token 数量)。 ## V4.6.9 更新说明 1. 商业版新增 - 知识库新增“增强处理”训练模式,可生成更多类型索引。 2. 新增 - 完善了 HTTP 模块的变量提示。 3. 新增 - HTTP 模块支持 OpenAI 单接口导入。 4. 新增 - 全局变量支持增加外部变量。可通过分享链接的 Query 或 API 的 variables 参数传入。 5. 新增 - 内容提取模块增加默认值。 6. 优化 - 问题补全。增加英文类型。同时可以设置为单独模块,方便复用。 7. 优化 - 重写了计量模式 8. 优化 - Token 过滤历史记录,保持偶数条,防止部分模型报错。 9. 优化 - 分享链接 SEO,可直接展示应用名和头像。 10. 修复 - 标注功能。 11. 修复 - qa 生成线程计数错误。 12. 修复 - 问题分类连线类型错误 file: ./content/self-host/upgrading/outdated/47.en.mdx meta: { "title": "V4.7 (Upgrade Script)", "description": "FastGPT V4.7 Release Notes" } ## 1. Update Configuration File Added Boolean values to control which models are available for different feature modules, and added model logos. The legacy `config.json` guide is no longer maintained. For current versions, see [Model Configuration](../../config/model/intro.en.mdx). ## 2. Initialization Script After upgrading the image, send 1 HTTP request from any terminal. Replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your domain. ```bash curl --location --request POST 'https://{{host}}/api/admin/initv47' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` Script functions: 1. Initializes the parentId for plugins. ## 3. Upgrade ReRank Model V4.7 changed the ReRank model format to be compatible with Cohere's format, allowing direct use of Cohere's API. If you're using a local ReRank model, update the image to: `registry.cn-hangzhou.aliyuncs.com/fastgpt/bge-rerank-base:v0.1`. Cohere's reranking model doesn't perform as well with Chinese text compared to BGE. To integrate Cohere: 1. Apply for a Cohere API key: [https://dashboard.cohere.com/api-keys](https://dashboard.cohere.com/api-keys) 2. Update the FastGPT configuration file: ```json { "reRankModels": [ { "model": "rerank-multilingual-v2.0", // The model name must match a Cohere model "name": "Rerank", // Any display name "requestUrl": "https://api.cohere.ai/v1/rerank", "requestAuth": "Your Cohere API key" } ] } ``` ## V4.7 Release Notes 1. New - Tool calling module that allows LLM models to dynamically select other modules or plugins based on user intent. 2. New - Classification and content extraction now support functionCall mode. Models that support functionCall but not toolCall can now be used. Set `functionCall` to `true` and `toolChoice` to `false` in the LLM model configuration. If `toolChoice` is true, tool mode will be used instead. 3. New - HTTP plugin for quickly generating plugins via OpenAPI. 4. New - ReRank model now compatible with [Cohere's format](https://docs.cohere.com/reference/rerank-1), enabling direct use of Cohere's rerank models. 5. New - Helm chart installation support. 6. Improved - Advanced workflow editor performance. 7. Improved - Extracted Flow controller to packages. 8. Improved - AI model selection. 9. Improved - Manual Knowledge Base input dialog. 10. Improved - Variable input dialog. 11. Improved - Docker deployment now auto-initializes replica sets. 12. Improved - Browser file reading now auto-detects encoding to reduce garbled text. 13. Fixed - Community edition rerank model selection not working. 14. Fixed - HTTP request body sending `undefined` when not in use (caused some GET requests to fail). 15. New - HTTP URL now supports variables. 16. Fixed - V4.6.9 extraction prompts prone to hallucination. 17. Fixed - PG HNSW index not actually taking effect. After this update, search speed is significantly improved (though there may be some precision loss — refer to the PgVector documentation for index tuning). Details: [https://github.com/pgvector/pgvector?tab=readme-ov-file#troubleshooting](https://github.com/pgvector/pgvector?tab=readme-ov-file#troubleshooting) 18. Fixed - Safari browser voice input issue. 19. Fixed - Custom split rules now accept regex special characters (previously caused frontend crashes). file: ./content/self-host/upgrading/outdated/47.mdx meta: { "title": "V4.7(升级脚本)", "description": "FastGPT V4.7更新说明" } ## 1. 修改配置文件 增加一些 Boolean 值,用于决定不同功能块可以使用哪些模型,同时增加了模型的 logo。旧版 `config.json` 配置说明已不再维护,当前版本请参考[模型配置方案](../../config/model/intro.mdx)。 ## 2. 初始化脚本 升级完镜像后。从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成自己域名 ```bash curl --location --request POST 'https://{{host}}/api/admin/initv47' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 脚本功能: 1. 初始化插件的 parentId ## 3. 升级 ReRank 模型 4.7 对 ReRank 模型进行了格式变动,兼容 cohere 的格式,可以直接使用 cohere 提供的 API。如果是本地的 ReRank 模型,需要修改镜像为:`registry.cn-hangzhou.aliyuncs.com/fastgpt/bge-rerank-base:v0.1`。 cohere 的重排模型对中文不是很好,感觉不如 bge 的好用,接入教程如下: 1. 申请 Cohere 官方 Key: [https://dashboard.cohere.com/api-keys](https://dashboard.cohere.com/api-keys) 2. 修改 FastGPT 配置文件 ```json { "reRankModels": [ { "model": "rerank-multilingual-v2.0", // 这里的 model 需要对应 cohere 的模型名 "name": "检索重排", // 随意 "requestUrl": "https://api.cohere.ai/v1/rerank", "requestAuth": "Coherer上申请的key" } ] } ``` ## V4.7 更新说明 1. 新增 - 工具调用模块,可以让 LLM 模型根据用户意图,动态的选择其他模型或插件执行。 2. 新增 - 分类和内容提取支持 functionCall 模式。部分模型支持 functionCall 不支持 ToolCall,也可以使用了。需要把 LLM 模型配置文件里的 `functionCall` 设置为 `true`,`toolChoice` 设置为 `false`。如果 `toolChoice` 为 true,会走 tool 模式。 3. 新增 - HTTP 插件,可实现 OpenAPI 快速生成插件。 4. 新增 - Rerank 模型兼容 [cohere 的格式](https://docs.cohere.com/reference/rerank-1),可以直接使用 cohere 的 rerank 模型。 5. 新增 - Helm 安装。 6. 优化 - 高级编排性能。 7. 优化 - 抽离 Flow controller 到 packages。 8. 优化 - AI 模型选择。 9. 优化 - 手动输入知识库弹窗。 10. 优化 - 变量输入弹窗。 11. 优化 - docker 部署,自动初始化副本集。 12. 优化 - 浏览器读取文件自动推断编码,减少乱码情况。 13. 修复 - 社区版重排选不上。 14. 修复 - http 请求 body,不使用时,传入 undefined。(会造成部分 GET 请求失败) 15. 新增 - 支持 http URL 使用变量。 16. 修复 - 469 的提取的提示词容易造成幻觉。 17. 修复 - PG HNSW 索引未实际生效问题,本次更新后,搜索速度大幅度提升(但是可能会出现精度损失,如果出现精度损失需要参考 PgVector 文档,对索引进行调整)。详细见:[https://github.com/pgvector/pgvector?tab=readme-ov-file#troubleshooting](https://github.com/pgvector/pgvector?tab=readme-ov-file#troubleshooting) 18. 修复 Safari 浏览器语音输入问题。 19. 修复 - 自定义分割规则可输入正则特殊字符(之前输入的话,会导致前端崩溃) file: ./content/self-host/upgrading/outdated/471.en.mdx meta: { "title": "V4.7.1 (Environment Changes, Upgrade Script)", "description": "FastGPT V4.7.1 Release Notes" } ## Initialization Script From any terminal, send 1 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/clearInvalidData' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This request runs stale data cleanup (removes invalid files, images, Knowledge Base collections, and vectors). ## Update Configuration File Added Laf environment configuration. The legacy `config.json` guide is no longer maintained. For current versions, see [Environment Variables](../../config/env.en.mdx). ## V4.7.1 Release Notes 1. New - Full voice input configuration. Supports toggling voice input on/off (including on share pages), auto-send after voice input, and auto voice playback after input (streaming). 2. New - PPTX and XLSX file reading. Note that all file reading now happens server-side, which consumes more server resources and prevents content preview during upload. 3. New - Laf cloud function integration. You can use cloud functions from your Laf account as HTTP modules. 4. New - Scheduled cleanup timer for stale data. Uses incremental cleanup (cleans data from the last N hours), so keep the service running continuously. For a full cleanup after extended downtime, use the `clearInvalidData` endpoint. 5. Commercial Edition - Admin panel system notification configuration. 6. Improved - Knowledge Base export now supports IP-based mode. 7. Changed - CSV import template no longer validates headers; automatically reads the first two columns. 8. Fixed - Tool calling module connection data type validation error. 9. Fixed - Custom index input data destructuring failure. 10. Fixed - ReRank model data format. 11. Fixed - Query completion history bug. 12. Fixed - Share page slow loading in certain edge cases (caused by database connections not being triggered during SSR). file: ./content/self-host/upgrading/outdated/471.mdx meta: { "title": "V4.7.1(环境变量变更、升级脚本)", "description": "FastGPT V4.7.1 更新说明" } ## 初始化脚本 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成 FastGPT 的域名。 ```bash curl --location --request POST 'https://{{host}}/api/admin/clearInvalidData' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 该请求会执行脏数据清理(清理无效的文件、清理无效的图片、清理无效的知识库集合、清理无效的向量) ## 修改配置文件 增加了 Laf 环境配置。旧版 `config.json` 配置说明已不再维护,当前版本请参考[环境变量说明](../../config/env.mdx)。 ## V4.7.1 更新说明 1. 新增 - 语音输入完整配置。支持选择是否打开语音输入(包括分享页面),支持语音输入后自动发送,支持语音输入后自动语音播放(流式)。 2. 新增 - pptx 和 xlsx 文件读取。但所有文件读取都放服务端,会消耗更多的服务器资源,以及无法在上传时预览更多内容。 3. 新增 - 集成 Laf 云函数,可以读取 Laf 账号中的云函数作为 HTTP 模块。 4. 新增 - 定时器,清理垃圾数据。(采用小范围清理,会清理最近 n 个小时的,所以请保证服务持续运行,长时间不允许,可以继续执行 clearInvalidData 的接口进行全量清理。) 5. 商业版新增 - 后台配置系统通知。 6. 优化 - 支持 ip 模式导出知识库。 7. 修改 - csv 导入模板,取消 header 校验,自动获取前两列。 8. 修复 - 工具调用模块连线数据类型校验错误。 9. 修复 - 自定义索引输入时,解构数据失败。 10. 修复 - rerank 模型数据格式。 11. 修复 - 问题补全历史记录 BUG 12. 修复 - 分享页面特殊情况下加载缓慢问题(由于 ssr 时候数据库不会触发连接) file: ./content/self-host/upgrading/outdated/48.en.mdx meta: { "title": "V4.8", "description": "FastGPT V4.8 Release Notes" } import { Alert } from '@/components/docs/Alert'; ## New Workflow FastGPT Workflow V2 is here, with a cleaner and more streamlined workflow experience. **Due to significant workflow changes, many parts need to be manually rebuilt. Please rebuild plugins first, then apps.** We recommend updating your workflows as soon as possible to avoid future compatibility issues as the platform continues to evolve. A `version` field has been added to apps and plugins to distinguish between old and new workflows. After upgrading to V4.8, all saved and newly created workflows use the new version. Old workflows will show a reset prompt dialog. Workflows called via API or share links will continue to work until you save them again. ## Commercial Edition Configuration Update Commercial edition users who have configured email verification codes need to update the admin panel: go to Admin Panel -> Project Settings -> Login Settings -> Email Login Settings -> update the **Email SMTP Server Address**. Previously only aliases were supported; now you can configure custom addresses. Here are some alias-to-address mappings: qq: smtp.qq.com gmail: smtp.gmail.com ## V4.8 Release Notes 1. Refactored - Workflow engine. 2. New - If/ElseIf/Else conditional node. @newfish-cmyk (If/Else nodes from the preview version need to be deleted and recreated) 3. New - Variable update node for modifying workflow output variables or global variables at runtime. @newfish-cmyk 4. New - Workflow auto-save and version management. 5. New - Workflow Debug mode for testing individual nodes or stepping through the workflow. 6. New - Scheduled app execution for easy cron-like tasks. 7. New - Improved plugin custom input with rendered input components. 8. New - Share link pre-chat hook. [https://github.com/labring/FastGPT/pull/1252](https://github.com/labring/FastGPT/pull/1252) @gaord 9. Improved - Workflow connections now support 4-directional linking for easier loop construction. 10. Improved - Workflow context passing performance. 11. Improved - Ctrl+Enter and Alt+Enter line break cursor positioning. 12. Improved - Variable configuration storage in chat to prevent edits from affecting existing conversations. 13. Improved - Simple mode now auto-updates the debug panel after config changes without saving. 14. Improved - Worker process management; token calculation is now delegated to worker processes. 15. Improved - Tool calling now supports specifying field data types (string, boolean, number). [https://github.com/labring/FastGPT/issues/1236](https://github.com/labring/FastGPT/issues/1236) 16. Improved - Completions API size limit. [https://github.com/labring/FastGPT/issues/1241](https://github.com/labring/FastGPT/issues/1241) 17. Improved - Node API middleware and API-side code. @c121914yu 18. Improved - Chat history is now trimmed to an even number of messages to support models that require paired messages. Max length increased to 50 rounds. [https://github.com/labring/FastGPT/issues/1384](https://github.com/labring/FastGPT/issues/1384) 19. Improved - HTTP node now terminates the process on error. [https://github.com/labring/FastGPT/issues/1290](https://github.com/labring/FastGPT/issues/1290) 20. Fixed - Tool calling name cannot start with a number (random IDs occasionally generated numeric prefixes). @c121914yu 21. Fixed - Share link global variable query params being cached. @c121914yu 22. Fixed - Tool calling field compatibility. [https://github.com/labring/FastGPT/issues/1253](https://github.com/labring/FastGPT/issues/1253) 23. Fixed - HTTP module URL cursor issue. [https://github.com/labring/FastGPT/issues/1334](https://github.com/labring/FastGPT/issues/1334) @maquannene file: ./content/self-host/upgrading/outdated/48.mdx meta: { "title": "V4.8", "description": "FastGPT V4.8 更新说明" } import { Alert } from '@/components/docs/Alert'; ## 新工作流 FastGPT workflow V2上线,支持更加简洁的工作流模式。 **由于工作流差异较大,不少地方需要手动重新构建。请依次重建插件和应用** 简易尽快更新工作流,避免未来持续迭代后导致无法兼容。 给应用和插件增加了 version 的字段,用于标识是旧工作流还是新工作流。当你更新 4.8 后,保存和新建的工作流均为新版,旧版工作流会有一个重置的弹窗提示。并且,如果是通过 API 和 分享链接 调用的工作流,仍可以正常使用,直到你下次保存它们。 ## 商业版配置更新 商业版用户如果配置了邮件验证码,需要在管理端 -> 项目配置 -> 登录配置 -> 邮箱登录配置 -> 修改 **邮箱服务SMTP地址**,之前只能配置别名,现在可以配置自定义的地址。下面是一组别名和实际地址关系: qq: smtp.qq.com gmail: smtp.gmail.com ## V4.8 更新说明 1. 重构 - 工作流 2. 新增 - 判断器。支持 if elseIf else 判断。 @newfish-cmyk (preview版本的if else节点需要删除重建) 3. 新增 - 变量更新节点。支持更新运行中工作流输出变量,或更新全局变量。@newfish-cmyk 4. 新增 - 工作流自动保存和版本管理。 5. 新增 - 工作流 Debug 模式,可以调试单个节点或者逐步调试工作流。 6. 新增 - 定时执行应用。可轻松实现定时任务。 7. 新增 - 插件自定义输入优化,可以渲染输入组件。 8. 新增 - 分享链接发送对话前 hook [https://github.com/labring/FastGPT/pull/1252](https://github.com/labring/FastGPT/pull/1252) @gaord 9. 优化 - 工作流连线,可以四向连接,方便构建循环工作流。 10. 优化 - 工作流上下文传递,性能🚀。 11. 优化 - ctrl和alt+enter换行,换行符位置不正确。 12. 优化 - chat中存储变量配置。避免修改变量后,影响旧的对话。 13. 优化 - 简易模式,更新配置后自动更新调试框内容,无需保存。 14. 优化 - worker进程管理,并将计算 Token 任务分配给 worker 进程。 15. 优化 - 工具调用支持指定字段数据类型(string, boolean, number) [https://github.com/labring/FastGPT/issues/1236](https://github.com/labring/FastGPT/issues/1236) 16. 优化 - completions接口size限制 [https://github.com/labring/FastGPT/issues/1241](https://github.com/labring/FastGPT/issues/1241) 17. 优化 - Node api 中间件。优化 api 端代码。@c121914yu 18. 优化 - 对话记录保持为偶数进行截取,避免部分模型不支持奇数的历史记录,最大长度增加到50轮。 [https://github.com/labring/FastGPT/issues/1384](https://github.com/labring/FastGPT/issues/1384) 19. 优化 - HTTP节点错误后终止进程 [https://github.com/labring/FastGPT/issues/1290](https://github.com/labring/FastGPT/issues/1290) 20. 修复 - 工具调用时候,name不能是数字开头(随机数有概率数字开头)@c121914yu 21. 修复 - 分享链接, query 全局变量会被缓存。 @c121914yu 22. 修复 - 工具调用字段兼容。 [https://github.com/labring/FastGPT/issues/1253](https://github.com/labring/FastGPT/issues/1253) 23. 修复 - HTTP 模块url光标问题 [https://github.com/labring/FastGPT/issues/1334](https://github.com/labring/FastGPT/issues/1334) @maquannene file: ./content/self-host/upgrading/outdated/481.en.mdx meta: { "title": "V4.8.1 (Upgrade Script)", "description": "FastGPT V4.8.1 Release Notes" } ## Initialization Script From any terminal, send 1 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/initv481' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` Due to previously inconsistent collection names, this initialization will reset table names. Before running, make sure the `dataset.trainings` table has no data. It's best to pause all active operations before initializing to avoid data conflicts. ## Run Stale Data Cleanup From any terminal, send 1 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/clearInvalidData' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` After initialization, you can run this command. The previous scheduled cleanup timer had some issues and missed certain data. This allows you to trigger a full cleanup manually. ## V4.8.1 Release Notes If you're using the Chat API, note that a new `event: updateVariables` event has been added for updating variables. [View the full release notes](https://github.com/labring/FastGPT/releases/tag/v4.8.1) file: ./content/self-host/upgrading/outdated/481.mdx meta: { "title": "V4.8.1(升级脚本)", "description": "FastGPT V4.8.1 更新说明" } ## 初始化脚本 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成FastGPT的域名。 ```bash curl --location --request POST 'https://{{host}}/api/admin/initv481' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 由于之前集合名不规范,该初始化会重置表名。请在初始化前,确保 dataset.trainings 表没有数据。 最好更新该版本时,暂停所有进行中业务,再进行初始化,避免数据冲突。 ## 执行脏数据清理 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成FastGPT的域名。 ```bash curl --location --request POST 'https://{{host}}/api/admin/clearInvalidData' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 初始化完后,可以执行这个命令。之前定时清理的定时器有些问题,部分数据没被清理,可以手动执行清理。 ## V4.8.1 更新说明 使用 Chat api 接口需要注意,增加了 event: updateVariables 事件,用于更新变量。 [点击查看升级说明](https://github.com/labring/FastGPT/releases/tag/v4.8.1) file: ./content/self-host/upgrading/outdated/4810.en.mdx meta: { "title": "V4.8.10 (Environment Changes, Upgrade Script)", "description": "FastGPT V4.8.10 Release Notes" } ## Upgrade Guide ### 1. Back up your database ### 2. Commercial Edition — Update environment variables 1. Add the sandbox environment variable to the `fastgpt-pro` image: `SANDBOX_URL=http://xxxxx:3000` 2. Add the following environment variables to both the `fastgpt-pro` and `fastgpt` images for better system log storage: ``` LOG_LEVEL=debug STORE_LOG_LEVEL=warn ``` ### 3. Update image tags * Update the FastGPT image tag to v4.8.10 * Update the FastGPT commercial edition image tag to v4.8.10 * Sandbox image update is optional ## 4. Run initialization 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/initv4810' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 1. Initializes publish record version markers 2. Initializes invoice records *** ## V4.8.10 Release Notes For full details, see: [4.8.10 release](https://github.com/labring/FastGPT/releases/tag/v4.8.10) 1. New - Template marketplace. 2. New - Workflow node drag-and-drop auto-alignment and snapping. 3. New - User selection node (not yet supported in Debug mode). 4. New - Added `uid` global variable to workflows. 5. New - Workflow undo and redo. 6. New - Workflow edit history for the current session, replacing auto-save. 7. New - Workflow versions support renaming. 8. New - The "App Call" node in workflows is deprecated and migrated to a standalone node that works the same way as plugins, with support for passing global variables and user-uploaded files. 9. New - Plugins now support usage instructions configuration. 10. New - Plugin custom inputs support radio buttons. 11. New - HTTP node supports `text/plain` mode. 12. New - HTTP node supports timeout configuration, additional Body types, and a new variable selection mode for params and headers. 13. New - Workflow export/import now supports JSON files directly for easier sharing. 14. New - Verification code security check. 15. Commercial - Lark bot integration. 16. Commercial - WeChat Official Account integration. 17. Commercial - Self-service invoice requests. 18. Commercial - SSO customization. 19. Improved - Workflow loop validation to prevent skip-loop idle spinning. Also supports fully concurrent branch execution. 20. Improved - Workflow nested execution to prevent potential parameter pollution. 21. Improved - Added data type constraints to some global variables. 22. Improved - Node selection to prevent path loading errors when switching tabs. 23. Improved - Updated React Markdown component with Base64 image support. 24. Improved - Chat dialog performance. 25. Improved - Radio buttons auto-scroll to the selected position when opened. 26. Improved - Disabling a Knowledge Base collection directory now recursively disables all children. 27. Improved - SSE response code. 28. Improved - Improved copy functionality when SSL certificate is not available. 29. Improved - Knowledge Base list UI. 30. Improved - Knowledge Base detail page UI. 31. Improved - Support running without network configuration. 32. Improved - Updated .env.template MongoDB documentation for better clarity. 33. Improved - New payment mode. 34. Improved - Default user avatars. 35. Fixed - Prompt mode tool calls including `0:` prefix markers in non-stream mode. 36. Fixed - Chat log authentication: users who are only app administrators could not view chat log details. 37. Fixed - Unable to export Knowledge Base when using Milvus deployment. 38. Fixed - Creating an app copy failed to copy system configuration. 39. Fixed - Image recognition mode regex for auto-parsing image URLs was not strict enough. 40. Fixed - Content extraction data types not matching output data types. 41. Fixed - Workflow run time statistics were incorrect. 42. Fixed - Tool calls could produce `undefined` in stream mode. 43. Fixed - Reranker typo. 44. Fixed - Home host typo. 45. Fixed - i18n display. 46. Fixed - Global variable keys could be defined with duplicates. 47. Fixed - Global variables not persisting in Debug mode. 48. Fixed - Global variables not persisting via API. 49. Fixed - OpenAPI `detail=false` mode should not return tool call results, only text (resolves CoW compatibility issue). 50. Fixed - Knowledge Base tags loading repeatedly. 51. Fixed - Custom separators not taking effect when re-fetching web links. 52. Fixed - Plugin runtime passing extra global variables, potentially polluting plugin-internal variables. 53. Docs - QA docs. 54. Docs - Updated feishu.md. 55. Docs - Updated baseURL. file: ./content/self-host/upgrading/outdated/4810.mdx meta: { "title": "V4.8.10(环境变量变更、升级脚本)", "description": "FastGPT V4.8.10 更新说明" } ## 更新指南 ### 1. 做好数据备份 ### 2. 商业版 —— 修改环境变量 1. 需要给`fastgpt-pro`镜像,增加沙盒的环境变量:`SANDBOX_URL=http://xxxxx:3000` 2. 给`fastgpt-pro`镜像和`fastgpt`镜像增加环境变量,以便更好的存储系统日志: ``` LOG_LEVEL=debug STORE_LOG_LEVEL=warn ``` ### 3. 修改镜像tag * 更新 FastGPT 镜像 tag: v4.8.10 * 更新 FastGPT 商业版镜像 tag: v4.8.10 * Sandbox 镜像,可以不更新 ## 4. 执行初始化 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。 ```bash curl --location --request POST 'https://{{host}}/api/admin/initv4810' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 1. 初始化发布记录版本标记 2. 初始化开票记录 *** ## V4.8.10 更新说明 完整内容请见:[4.8.10 release](https://github.com/labring/FastGPT/releases/tag/v4.8.10) 1. 新增 - 模板市场。 2. 新增 - 工作流节点拖动自动对齐吸附。 3. 新增 - 用户选择节点(Debug 模式暂未支持)。 4. 新增 - 工作流增加 uid 全局变量。 5. 新增 - 工作流撤销和重做。 6. 新增 - 工作流本次编辑记录,取代自动保存。 7. 新增 - 工作流版本支持重命名。 8. 新增 - 工作流的“应用调用”节点弃用,迁移成单独节点,与插件使用方式相同,同时可以传递全局变量和用户上传的文件。 9. 新增 - 插件增加使用说明配置。 10. 新增 - 插件自定义输入支持单选框。 11. 新增 - HTTP 节点支持 text/plain 模式。 12. 新增 - HTTP模块支持超时配置、支持更多的 Body 类型,params 和 headers 支持新的变量选择模式。 13. 新增 - 工作流导出导入,支持直接导出和导入 JSON 文件,便于交流。 14. 新增 - 发送验证码安全校验。 15. 商业版新增 - 飞书机器人接入。 16. 商业版新增 - 公众号接入接入。 17. 商业版新增 - 自助开票申请。 18. 商业版新增 - SSO 定制。 19. 优化 - 工作流循环校验,避免 skip 循环空转。同时支持分支完全并发执行。 20. 优化 - 工作流嵌套执行,参数可能存在的污染问题。 21. 优化 - 部分全局变量,增加数据类型约束。 22. 优化 - 节点选择,避免切换 tab 时候,path 加载报错。 23. 优化 - 最新 React Markdown 组件,支持 Base64 图片。 24. 优化 - 对话框性能问题。 25. 优化 - 单选框打开后自动滚动到选中的位置。 26. 优化 - 知识库集合禁用,目录禁用会递归修改其下所有 children 的禁用状态。 27. 优化 - SSE 响应代码优化。 28. 优化 - 无 SSL 证书情况下,优化复制。 29. 优化 - 知识库列表 UI。 30. 优化 - 知识库详情页 UI。 31. 优化 - 支持无网络配置情况下运行。 32. 优化 - 调整.env.template关于mongodb的说明,使得更易于理解。 33. 优化 - 新的支付模式。 34. 优化 - 用户默认头像。 35. 修复 - Prompt 模式调用工具,stream=false 模式下,会携带 0: 开头标记。 36. 修复 - 对话日志鉴权问题:仅为 APP 管理员的用户,无法查看对话日志详情。 37. 修复 - 选择 Milvus 部署时,无法导出知识库。 38. 修复 - 创建 APP 副本,无法复制系统配置。 39. 修复 - 图片识别模式下,自动解析图片链接正则不够严谨问题。 40. 修复 - 内容提取的数据类型与输出数据类型未一致。 41. 修复 - 工作流运行时间统计错误。 42. 修复 - stream 模式下,工具调用有可能出现 undefined。 43. 修复 - reranker typo。 44. 修复 - home host typo。 45. 修复 - i18n display。 46. 修复 - 全局变量可重复定义 key。 47. 修复 - 全局变量在 Debug 模式下不可持久化。 48. 修复 - 全局变量在 API 中无法持久化。 49. 修复 - OpenAPI,detail=false模式下,不应该返回 tool 调用结果,仅返回文字。(可解决 cow 不适配问题)。 50. 修复 - 知识库标签重复加载。 51. 修复 - 网络链接重新获取时,自定义分割符不生效。 52. 修复 - 插件运行时,会传递额外的全局变量,可能造成插件内变量污染。 53. 文档 - qa docs。 54. 文档 - Update feishu.md。 55. 文档 - update baseURL。 file: ./content/self-host/upgrading/outdated/4811.en.mdx meta: { "title": "V4.8.11 (Upgrade Script)", "description": "FastGPT V4.8.11 Release Notes" } ## Upgrade Guide ### 1. Back up your data ### 2. Update configuration file To add the OpenAI o1 model, add the following configuration: ```json { "model": "o1-mini", "name": "o1-mini", "avatar": "/imgs/model/openai.svg", "maxContext": 125000, "maxResponse": 65000, "quoteMaxToken": 120000, "maxTemperature": 1.2, "charsPointsPrice": 0, "censor": false, "vision": false, "datasetProcess": true, "usedInClassify": true, "usedInExtractFields": true, "usedInToolCall": true, "toolChoice": false, "functionCall": false, "customCQPrompt": "", "customExtractPrompt": "", "defaultSystemChatPrompt": "", "defaultConfig": { "temperature": 1 } }, { "model": "o1-preview", "name": "o1-preview", "avatar": "/imgs/model/openai.svg", "maxContext": 125000, "maxResponse": 32000, "quoteMaxToken": 120000, "maxTemperature": 1.2, "charsPointsPrice": 0, "censor": false, "vision": false, "datasetProcess": true, "usedInClassify": true, "usedInExtractFields": true, "usedInToolCall": true, "toolChoice": false, "functionCall": false, "customCQPrompt": "", "customExtractPrompt": "", "defaultSystemChatPrompt": "", "defaultConfig": { "temperature": 1 } } ``` *** ### 3. Update image tags and restart * Update the FastGPT image tag to v4.8.11-fix * Update the FastGPT commercial edition image tag to v4.8.11 * Update the FastGPT Sandbox image tag to v4.8.11 ### 4. Commercial Edition initialization 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/init/4811' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This initializes team member groups. ## V4.8.11 Release Notes 1. New - Form input node, allowing users to enter information during workflow execution. 2. New - Loop execution node that accepts an array for batch processing, currently supporting up to 50 items in serial execution. 3. New - Nodes can now be collapsed. 4. New - Simple Mode supports a new history mode that records local change history. 5. New - Chat history now uses scroll-based loading instead of only loading 30 messages. 6. New - Workflow adds a trackpad-priority mode, toggled via the button in the bottom-right corner. 7. New - Sandbox adds a string-to-Base64 global method (global variable `strToBase64`). 8. New - Support for OpenAI o1 models. Requires adding `defaultConfig` to the model configuration to override `temperature`, `max_tokens`, and `stream` settings, as o1 does not support stream mode. 9. New - AI chat node Knowledge Base references now support configuring `role=system` and `role=user`. Nodes with custom prompts already configured will keep `user` mode; all others will switch to `system` mode. 10. New - Plugins support uploading system files. 11. New - Plugin outputs support designating specific fields as tool responses. 12. New - When nesting child apps in workflows, you can now set "non-stream mode". Simple Mode can also select workflows as plugins. Simple Mode always forces non-stream mode when calling child apps. 13. New - In debug mode, child app calls return detailed execution data. 14. New - Logs for nested child app calls are now preserved in all modes. 15. New - Chat logs display team members. 16. New - Commercial edition supports configuring AI-generated copy prompts in the admin panel. 17. New - Jest unit testing framework. 18. New - Tool call parameter node for fully custom parameter declarations with tool calls. 19. New - BI chart plugin. 20. New - Surya OCR recognition module example. 21. New - Right-click to add comments in workflows. 22. Commercial - Team member groups. 23. Improved - Workflow nesting limited to 20 levels to prevent infinite loops from improper configurations. 24. Improved - Workflow handler performance. 25. Improved - Workflow shortcuts no longer trigger copy and undo during debug testing. 26. Improved - Removed extra "#" from names when copying workflow nodes. 27. Improved - Stream output continues even after switching browser tabs. 28. Improved - Enhanced external file Knowledge Base APIs. 29. Improved - Updated config.json path. 30. Improved - Properly handle hyperlinks starting with `//`. 31. Improved - Workflow Textarea scrolls normally instead of zooming. 32. Improved - Trimmed leading/trailing spaces from some input fields. 33. Improved - Returning to workflow now navigates to the last remembered tab. 34. Improved - Workflow canvas prevents trackpad browser zoom. 35. Improved - Some workflow nodes auto-select user question as the initial value. 36. Improved - Prompt Editor supports dynamic height expansion. 37. Improved - Auto-complete tool descriptions. 38. Improved - Updated configuration.md documentation. 39. Improved - iOS Safari voice input accuracy. 40. Fixed - Knowledge Base selection permission issue. 41. Fixed - Starting a conversation with an empty chatId caused errors when the first message included user selections. 42. Fixed - `createDataset` API not assigning `intro`. 43. Fixed - Chat dialog rendering performance issue. 44. Fixed - Rerank documentation URL. 45. Fixed - In stream mode with toolChoice, the `function` and `type` fields of toolCall could be null. 46. Fixed - Site sync custom separators not syncing. 47. Fixed - Tool call history storage issue. 48. Fixed - Chat page could enter an infinite redirect loop. 49. Fixed - Global variables not persisting across tool calls. file: ./content/self-host/upgrading/outdated/4811.mdx meta: { "title": "V4.8.11(升级脚本)", "description": "FastGPT V4.8.11 更新说明" } ## 更新指南 ### 1. 做好数据备份 ### 2. 修改配置文件 如需增加 openai o1 模型,可添加如下配置: ```json { "model": "o1-mini", "name": "o1-mini", "avatar": "/imgs/model/openai.svg", "maxContext": 125000, "maxResponse": 65000, "quoteMaxToken": 120000, "maxTemperature": 1.2, "charsPointsPrice": 0, "censor": false, "vision": false, "datasetProcess": true, "usedInClassify": true, "usedInExtractFields": true, "usedInToolCall": true, "toolChoice": false, "functionCall": false, "customCQPrompt": "", "customExtractPrompt": "", "defaultSystemChatPrompt": "", "defaultConfig": { "temperature": 1 } }, { "model": "o1-preview", "name": "o1-preview", "avatar": "/imgs/model/openai.svg", "maxContext": 125000, "maxResponse": 32000, "quoteMaxToken": 120000, "maxTemperature": 1.2, "charsPointsPrice": 0, "censor": false, "vision": false, "datasetProcess": true, "usedInClassify": true, "usedInExtractFields": true, "usedInToolCall": true, "toolChoice": false, "functionCall": false, "customCQPrompt": "", "customExtractPrompt": "", "defaultSystemChatPrompt": "", "defaultConfig": { "temperature": 1 } } ``` *** ### 3. 修改镜像 tag 并重启 * 更新 FastGPT 镜像 tag: v4.8.11-fix * 更新 FastGPT 商业版镜像 tag: v4.8.11 * 更新 FastGPT Sandbox 镜像 tag: v4.8.11 ### 4. 商业版初始化 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成 **FastGPT 域名**: ```bash curl --location --request POST 'https://{{host}}/api/admin/init/4811' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 会初始化团队成员组。 ## V4.8.11 更新说明 1. 新增 - 表单输入节点,允许用户在工作流中让用户输入一些信息。 2. 新增 - 循环运行节点,可传入数组进行批量调用,目前最多支持 50 长度的数组串行执行。 3. 新增 - 节点支持折叠。 4. 新增 - 简易模式支持新的历史记录模式,可记录本地变更记录。 5. 新增 - 聊天记录滚动加载,不再只加载 30 条。 6. 新增 - 工作流增加触摸板优先模式,可以通过工作流右下角按键进行切换。 7. 新增 - 沙盒增加字符串转 base64 全局方法(全局变量 strToBase64)。 8. 新增 - 支持 Openai o1 模型,需增加模型的 `defaultConfig` 配置,覆盖 `temperature`、`max_tokens` 和 `stream` 配置,o1 不支持 stream 模式。 9. 新增 - AI 对话节点知识库引用,支持配置 role=system 和 role=user,已配置的过自定义提示词的节点将会保持 user 模式,其余用户将转成 system 模式。 10. 新增 - 插件支持上传系统文件。 11. 新增 - 插件输出,支持指定字段作为工具响应。 12. 新增 - 支持工作流嵌套子应用时,可以设置 `非流模式`,同时简易模式也可以选择工作流作为插件了,简易模式调用子应用时,都将强制使用非流模式。 13. 新增 - 调试模式下,子应用调用,支持返回详细运行数据。 14. 新增 - 保留所有模式下子应用嵌套调用的日志。 15. 新增 - 对话日志显示成员。 16. 新增 - 商业版支持后台配置 AI 生成文案提示。 17. 新增 - Jest 单测框架。 18. 新增 - 工具调用参数节点,可以配合工具调用完全自由声明参数。 19. 新增 - BI 图表插件。 20. 新增 - Surya OCR 识别模块示例。 21. 新增 - 工作流右键新增注释。 22. 商业版新增 - 团队成员组。 23. 优化 - 工作流嵌套层级限制 20 层,避免因编排不合理导致的无限死循环。 24. 优化 - 工作流 handler 性能优化。 25. 优化 - 工作流快捷键,避免调试测试时也会触发复制和回退。 26. 优化 - 工作流复制时,名字去掉多余“#”。 27. 优化 - 流输出,切换浏览器 Tab 后仍可以继续输出。 28. 优化 - 完善外部文件知识库相关 API。 29. 优化 - 修改 config.json 的地址。 30. 优化 - 正确处理//开头的超链接。 31. 优化 - 工作流 Textarea 滚轮可以正常滚动而不是缩放。 32. 优化 - 去除部分输入框前后空格。 33. 优化 - 工作流返回时,跳转到上一次记忆的 Tab。 34. 优化 - 工作流画布禁止触摸板缩放浏览器。 35. 优化 - 工作流部分节点会自动选择用户问题作为初始值。 36. 优化 - Prompt Editor 支持动态增高。 37. 优化 - 自动补全工具描述。 38. 优化 - 文档说明 configuration.md。 39. 优化 - iOS safari 浏览器语音输入不准确。 40. 修复 - 知识库选择权限问题。 41. 修复 - 空 chatId 发起会话,首轮携带用户选择时会异常。 42. 修复 - createDataset 接口,intro 未赋值。 43. 修复 - 对话框渲染性能问题。 44. 修复 - Rerank 文档地址。 45. 修复 - Stream 模式下使用 toolChoice,toolCall 的 function 和 type 可能为 null。 46. 修复 - 站点同步自定义分割符未同步。 47. 修复 - 工具调用历史记录存储问题。 48. 修复 - 对话页面可能无限重定向。 49. 修复 - 全局变量在工具调用中未持久传递。 file: ./content/self-host/upgrading/outdated/4812.en.mdx meta: { "title": "V4.8.12 (Upgrade Script)", "description": "FastGPT V4.8.12 Release Notes" } ## Upgrade Guide ### 1. Back up your data ### 2. Update images * Update the FastGPT image tag to v4.8.12-fix * Update the FastGPT admin image tag to v4.8.12 (fastgpt-pro image) * Sandbox image update is optional ### 3. Run initialization (Commercial Edition) 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/init/4812' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This initializes member group data for apps and Knowledge Bases. ### 4. Rebuild Milvus data Due to JavaScript int64 precision loss, users who previously deployed with Milvus or Zilliz and experienced data precision loss need to rebuild their Milvus data. (Check the `dataset_datas` collection — if `dataId` values in the `indexes` field have trailing precision loss, a rebuild is needed.) PG users do not need to take action. 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/resetMilvus' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` ## Release Notes 1. New - Global variables support number type, with configurable default values and input field parameters. 2. New - Plugin custom inputs (text fields, number fields, select boxes, toggles) all support being referenced as variables by default. 3. New - `FE_DOMAIN` environment variable. When configured, uploaded files/images get a complete URL with the domain suffix (resolves the issue where models sometimes fabricate image domains for docx file image links). 4. New - Tool calls support using the interaction node. 5. New - Debug mode supports inputting global variables. 6. New - Chat OpenAPI documentation. 7. New - Wiki search plugin. 8. New - Google search plugin. 9. New - Database connection and operation plugin. 10. New - Cookie privacy policy prompt. 11. New - HTTP node supports JSONPath expressions. 12. New - Apps and Knowledge Bases support member group permission configuration. 13. Improved - Loop node supports selecting variables from external nodes. 14. Improved - Docx file reading: optimized HTML-to-Markdown conversion for better speed and significantly reduced memory consumption. 15. Fixed - File extension detection now ignores query string parameters. 16. Fixed - Empty AI responses causing LLM history record merging. 17. Fixed - User interaction node not blocking the workflow. 18. Fixed - Creating a new app sometimes causing a null pointer error. 19. Fixed - Incorrect execution when multiple loop nodes are present. 20. Fixed - Variable modifications inside loop nodes not propagating. 21. Fixed - In non-stream mode, nested child apps/plugins unable to receive child app responses. 22. Fixed - Data chunking strategy now chunks each Markdown section independently. file: ./content/self-host/upgrading/outdated/4812.mdx meta: { "title": "V4.8.12(升级脚本)", "description": "FastGPT V4.8.12 更新说明" } ## 更新指南 ### 1. 做好数据备份 ### 2. 修改镜像 * 更新 FastGPT 镜像 tag: v4.8.12-fix * 更新 FastGPT 管理端镜像 tag: v4.8.12 (fastgpt-pro镜像) * Sandbox 镜像,可以不更新 ### 3. 商业版执行初始化 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**: ```bash curl --location --request POST 'https://{{host}}/api/admin/init/4812' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 会初始化应用和知识库的成员组数据。 ### 4. 重构 Milvus 数据 由于 js int64 精度丢失问题,之前私有化使用 milvus 或者 zilliz 的用户,如果存在数据精度丢失的问题,需要重构 Milvus 数据。(可以查看 dataset\_datas 表中,indexes 中的 dataId 是否末尾精度丢失)。使用 PG 的用户不需要操作。 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。 ```bash curl --location --request POST 'https://{{host}}/api/admin/resetMilvus' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` ## 更新说明 1. 新增 - 全局变量支持数字类型,支持配置默认值和部分输入框参数。 2. 新增 - 插件自定义输入,文本输入框、数字输入框、选择框、开关,默认都支持作为变量引用。 3. 新增 - FE\_DOMAIN 环境变量,配置该环境变量后,上传文件/图片会补全后缀后得到完整地址。(可解决 docx 文件图片链接,有时模型会伪造图片域名) 4. 新增 - 工具调用支持使用交互节点 5. 新增 - Debug 模式支持输入全局变量 6. 新增 - chat OpenAPI 文档 7. 新增 - wiki 搜索插件 8. 新增 - Google 搜索插件 9. 新增 - 数据库连接和操作插件 10. 新增 - Cookie 隐私协议提示 11. 新增 - HTTP 节点支持 JSONPath 表达式 12. 新增 - 应用和知识库支持成员组配置权限 13. 优化 - 循环节点支持选择外部节点的变量 14. 优化 - Docx 文件读取中, HTML to Markdown 优化,提高速度和大幅度降低内存消耗。 15. 修复 - 文件后缀判断,去除 query 影响。 16. 修复 - AI 响应为空时,会造成 LLM 历史记录合并。 17. 修复 - 用户交互节点未阻塞流程。 18. 修复 - 新建 APP,有时候会导致空指针报错。 19. 修复 - 拥有多个循环节点时,错误运行。 20. 修复 - 循环节点中修改变量,无法传递。 21. 修复 - 非 stream 模式,嵌套子应用/插件执行时无法获取子应用响应。 22. 修复 - 数据分块策略,同时将每个 Markdown 独立分块。 file: ./content/self-host/upgrading/outdated/4813.en.mdx meta: { "title": "V4.8.13 (Environment Changes)", "description": "FastGPT V4.8.13 Release Notes" } ## Upgrade Guide ### 1. Back up your data ### 2. Update images * Update the FastGPT image tag to v4.8.13-fix * Update the FastGPT commercial edition image tag to v4.8.13-fix (fastgpt-pro image) * Sandbox image update is optional ### 3. Add environment variables * Add the environment variable `FE_DOMAIN=http://xx.com` to both the fastgpt and fastgpt-pro images. Set the value to the FastGPT frontend access URL (do not include a trailing `/`). This automatically prepends the domain to relative file paths. ### 4. Update file upload workflow configuration While the old file upload workflow configuration is still supported, backward compatibility will be removed within the next two versions. Please update your workflows to use the new file upload logic as soon as possible. In particular, file passing in nested apps will no longer be automatic — you must explicitly specify which files to pass. For details, see: [File Upload Changes](../../../guide/build/general/fileInput.en.mdx#4813%E7%89%88%E6%9C%AC%E8%B5%B7%E5%85%B3%E4%BA%8E%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0%E7%9A%84%E6%9B%B4%E6%96%B0) ## Release Notes 1. New - Array variable selection supports multi-select. You can select multiple arrays or their corresponding single data types, which are automatically merged in selection order. 2. New - Revamped file upload approach. AI chat and tool call nodes directly accept file URLs and enforce prompt injection without relying on model-driven decisions. Plugin custom variables support file upload types, replacing global files. 3. New - Chat history now displays timestamps. 4. New - Workflow validation errors now navigate to the error node. 5. New - Loop node adds an index value. 6. New - Added translations for some chat error messages. 7. New - Chat input box supports drag-and-drop file upload. 8. New - Chat logs now show the specific share link/API name as the source. 9. New - Share links support configuring whether to display real-time execution status. 10. Improved - Merged multiple system prompts into one to support models that don't accept multiple system prompts. 11. Improved - Better error messages for Knowledge Base file uploads. 12. Improved - Full-text search query optimization, eliminating one subquery. 13. Improved - Replaced `findLast` with `[...array].reverse().find` for older browser compatibility. 14. Improved - Markdown component auto-spacing to avoid splitting Chinese characters in URLs. 15. Improved - Workflow context splitting for better performance. 16. Improved - Text-to-speech: browsers that don't support `mediaSource` can now wait for full audio generation before playback. 17. Improved - Chat starter CSV reading with automatic encoding detection. 18. Improved - Fixed potential garbled text when importing chat starters via CSV. 19. Fixed - Dockerfile pnpm install now supports proxy. 20. Fixed - Dockerfile pnpm install now supports proxy. 21. Fixed - BI chart generation unable to write files. Also improved parsing to support numeric array types. 22. Fixed - Share link title displaying incorrectly on first load. file: ./content/self-host/upgrading/outdated/4813.mdx meta: { "title": "V4.8.13(环境变量变更)", "description": "FastGPT V4.8.13 更新说明" } ## 更新指南 ### 1. 做好数据备份 ### 2. 修改镜像 * 更新 FastGPT 镜像 tag: v4.8.13-fix * 更新 FastGPT 商业版镜像 tag: v4.8.13-fix (fastgpt-pro镜像) * Sandbox 镜像,可以不更新 ### 3. 添加环境变量 * 给 fastgpt 和 fastgpt-pro 镜像添加环境变量:`FE_DOMAIN=http://xx.com`,值为 fastgpt 前端访问地址,注意后面不要加`/`。可以自动补齐相对文件地址的前缀。 ### 4. 调整文件上传编排 虽然依然兼容旧版的文件上传编排,但是未来两个版本内将会去除兼容代码,请尽快调整编排,以适应最新的文件上传逻辑。尤其是嵌套应用的文件传递,未来将不会自动传递,必须手动指定传递的文件。具体内容可参考: [文件上传变更](../../../guide/build/general/fileInput.mdx#4813%E7%89%88%E6%9C%AC%E8%B5%B7%E5%85%B3%E4%BA%8E%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0%E7%9A%84%E6%9B%B4%E6%96%B0) ## 更新说明 1. 新增 - 数组变量选择支持多选,可以选多个数组或对应的单一数据类型,会自动按选择顺序进行合并。 2. 新增 - 文件上传方案调整,AI对话和工具调用节点直接支持接收文件链接,并且会强制加入提示词,无需由模型决策调用。插件自定义变量支持文件上传类型,取代全局文件。 3. 新增 - 对话记录增加时间显示。 4. 新增 - 工作流校验错误时,跳转至错误节点。 5. 新增 - 循环节点增加下标值。 6. 新增 - 部分对话错误提醒增加翻译。 7. 新增 - 对话输入框支持拖拽文件上传,可直接拖文件到输入框中。 8. 新增 - 对话日志,来源可显示分享链接/API具体名称 9. 新增 - 分享链接支持配置是否展示实时运行状态。 10. 优化 - 合并多个 system 提示词成 1 个,避免部分模型不支持多个 system 提示词。 11. 优化 - 知识库上传文件,优化报错提示。 12. 优化 - 全文检索语句,减少一轮子查询。 13. 优化 - 修改 findLast 为 \[...array].reverse().find,适配旧版浏览器。 14. 优化 - Markdown 组件自动空格,避免分割 url 中的中文。 15. 优化 - 工作流上下文拆分,性能优化。 16. 优化 - 语音播报,不支持 mediaSource 的浏览器可等待完全生成语音后输出。 17. 优化 - 对话引导 csv 读取,自动识别编码 18. 优化 - csv 导入问题引导可能乱码 19. 修复 - Dockerfile pnpm install 支持代理。。 20. 修复 - Dockerfile pnpm install 支持代理。 21. 修复 - BI 图表生成无法写入文件。同时优化其解析,支持数字类型数组。 22. 修复 - 分享链接首次加载时,标题显示不正确。 file: ./content/self-host/upgrading/outdated/4814.en.mdx meta: { "title": "V4.8.14", "description": "FastGPT V4.8.14 Release Notes" } ## Upgrade Guide ### 1. Back up your data ### 2. Update images * Update the FastGPT image tag to v4.8.14-fix * Update the FastGPT commercial edition image tag to v4.8.14 (fastgpt-pro image) * Sandbox image update is optional For Milvus users: use the v4.8.14-milvus-fix image. ## New Feature Preview ### Auto-trigger Workflow You can configure a workflow to automatically trigger once when a user loads a conversation. This is useful for CRM systems where you want to proactively guide users without waiting for them to initiate. | | | | ------------------------------------------------ | ------------------------------------------------ | | ![alt text](../../../../public/imgs/image-8.png) | ![alt text](../../../../public/imgs/image-9.png) | ## Full Release Notes 1. New - Workflows support auto-triggering a conversation round when entering the chat or clicking "Start conversation". 2. New - Rewritten chatContext. Chat testing now generates logs, and conversations persist after page refresh. 3. New - Share links support configuring whether to allow viewing original source text. 4. New - New doc2x plugin. 5. New - Traditional Chinese language support. 6. New - Share links and chat API support passing a custom uid. 7. Commercial - Microsoft OAuth login. 8. Improved - Workflow UI details. 9. Improved - App edit history now uses diff-based storage to prevent browser overflow. 10. Improved - Code entry point adds a register entry, no longer requiring the first visit to execute. 11. Improved - Workflow validation with additional missing value checks. 12. Improved - Added maximum retry limit for Knowledge Base training. 13. Improved - Image path issues and diagram tasks. 14. Improved - Milvus description. 15. Fixed - Chunking strategy was dropping level-4 headings. Also added level-5 heading support. 16. Fixed - MongoDB Knowledge Base collection unique index. 17. Fixed - Deselecting Knowledge Base references could cause errors. 18. Fixed - Converting Simple Mode to workflow was not using the latest edit history. 19. Fixed - Form input description text not displaying. 20. Fixed - API unable to use Base64 images. file: ./content/self-host/upgrading/outdated/4814.mdx meta: { "title": "V4.8.14", "description": "FastGPT V4.8.14 更新说明" } ## 更新指南 ### 1. 做好数据备份 ### 2. 修改镜像 * 更新 FastGPT 镜像 tag: v4.8.14-fix * 更新 FastGPT 商业版镜像 tag: v4.8.14 (fastgpt-pro镜像) * Sandbox 镜像,可以不更新 milvus版本使用:v4.8.14-milvus-fix 镜像。 ## 新功能预览 ### 自动触发工作流 可以允许你配置用户加载对话时,自动触发一次工作流。可以用于一些 CRM 系统,可以快速的引导用户使用,无需等待用户主动触发。 | | | | ------------------------------------------------ | ------------------------------------------------ | | ![alt text](../../../../public/imgs/image-8.png) | ![alt text](../../../../public/imgs/image-9.png) | ## 完整更新内容 1. 新增 - 工作流支持进入聊天框/点击开始对话后,自动触发一轮对话。 2. 新增 - 重写 chatContext,对话测试也会有日志,并且刷新后不会丢失对话。 3. 新增 - 分享链接支持配置是否允许查看原文。 4. 新增 - 新的 doc2x 插件。 5. 新增 - 繁体中文。 6. 新增 - 分析链接和 chat api 支持传入自定义 uid。 7. 商业版新增 - 微软 oauth 登录 8. 优化 - 工作流 ui 细节。 9. 优化 - 应用编辑记录采用 diff 存储,避免浏览器溢出。 10. 优化 - 代码入口,增加 register 入口,无需等待首次访问才执行。 11. 优化 - 工作流检查,增加更多缺失值检查。 12. 优化 - 增加知识库训练最大重试次数限制。 13. 优化 - 图片路径问题和示意图任务 14. 优化 - Milvus description 15. 修复 - 分块策略,四级标题会被丢失。 同时新增了五级标题的支持。 16. 修复 - MongoDB 知识库集合唯一索引。 17. 修复 - 反选知识库引用后可能会报错。 18. 修复 - 简易模式转工作流,不是使用最新编辑记录进行转移。 19. 修复 - 表单输入的说明文字不显示。 20. 修复 - API 无法使用 base64 图片。 file: ./content/self-host/upgrading/outdated/4815.en.mdx meta: { "title": "V4.8.15 (Upgrade Script)", "description": "FastGPT V4.8.15 Release Notes" } ## New Feature Preview ### API Knowledge Base | | | | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-20.png) | ![alt text](../../../../public/imgs/image-21.png) | ### HTML Rendering | Source Mode | Preview Mode | Fullscreen Mode | | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-22.png) | ![alt text](../../../../public/imgs/image-23.png) | ![alt text](../../../../public/imgs/image-24.png) | ## Upgrade Guide * Update the fastgpt image tag to v4.8.15-fix3 * Update the fastgpt-pro commercial edition image tag to v4.8.15 * Sandbox image update is optional ## Run Migration 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/initv4815' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This resets the scheduled execution fields for apps, removing null values to reduce index size. *** 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/init/refreshFreeUser' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This recalculates free-tier user durations. A previous version upgrade did not recalculate time properly, which caused incorrect notifications. ## Full Release Notes 1. New - API Knowledge Base. See [API Knowledge Base Introduction](../../../guide/dataset/third-party/api_dataset.en.mdx). The external file library will be deprecated. 2. New - Toolbox page displaying all available system resources. The commercial edition admin panel now offers easier configuration of system plugins and custom categories. 3. New - HTML code in Markdown is now rendered separately. You can choose preview mode, which blocks all scripts and only displays content. 4. New - Custom system-level file parsing service. See [Integrating Marker PDF Document Parsing](../../custom-models/marker.en.mdx). 5. New - Collections can be reconfigured directly without deleting and re-importing. 6. New - Commercial edition admin panel supports configuring sidebar navigation links. 7. Improved - Base64 image truncation detection. 8. Improved - i18n cookie detection. 9. Improved - Markdown text splitting now supports heading-only sections with no content. 10. Improved - String variable substitution: unassigned variables now resolve to `undefined` instead of preserving the raw ID string. 11. Improved - Global variable default values now take effect in API calls, and custom variables support default values. 12. Improved - Added JSON parsing for HTTP Body with regex conversion of `undefined` to `null`, reducing Body parsing errors. 13. Improved - Scheduled execution now includes run logs and retries to reduce error rates. 14. Fixed - Share link like/upvote authentication issue. 15. Fixed - Switching to an auto-execute app on the chat page could incorrectly trigger non-auto-execute apps. 16. Fixed - Audio playback authentication issue. 17. Fixed - Plugin app Knowledge Base reference limit was always capped at 3000. 18. Fixed - Workflow edit history storage limit. Removed local storage and added forced auto-save on abnormal exit. 19. Fixed - Workflow special variable substitution issue (strings starting with `$` could not be replaced). file: ./content/self-host/upgrading/outdated/4815.mdx meta: { "title": "V4.8.15(升级脚本)", "description": "FastGPT V4.8.15 更新说明" } ## 新功能预览 ### API 知识库 | | | | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-20.png) | ![alt text](../../../../public/imgs/image-21.png) | ### HTML 渲染 | 源码模式 | 预览模式 | 全屏模式 | | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | | ![alt text](../../../../public/imgs/image-22.png) | ![alt text](../../../../public/imgs/image-23.png) | ![alt text](../../../../public/imgs/image-24.png) | ## 升级指南 * 更新 fastgpt 镜像 tag: v4.8.15-fix3 * 更新 fastgpt-pro 商业版镜像 tag: v4.8.15 * Sandbox 镜像,可以不更新 ## 运行升级脚本 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**: ```bash curl --location --request POST 'https://{{host}}/api/admin/initv4815' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 会重置应用定时执行的字段,把 null 去掉,减少索引大小。 *** 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**: ```bash curl --location --request POST 'https://{{host}}/api/admin/init/refreshFreeUser' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 重新计算一次免费版用户的时长,之前有版本升级时没有重新计算时间,导致会误发通知。 ## 完整更新内容 1. 新增 - API 知识库, 见 [API 知识库介绍](../../../guide/dataset/third-party/api_dataset.mdx),外部文件库会被弃用。 2. 新增 - 工具箱页面,展示所有可用的系统资源。商业版后台可更便捷的配置系统插件和自定义分类。 3. 新增 - Markdown 中,HTML代码会被额外渲染,可以选择预览模式,会限制所有 script 脚本,仅做展示。 4. 新增 - 自定义系统级文件解析服务, 见 [接入 Marker PDF 文档解析](../../custom-models/marker.mdx) 5. 新增 - 集合直接重新调整参数,无需删除再导入。 6. 新增 - 商业版后台支持配置侧边栏跳转链接。 7. 优化 - base64 图片截取判断。 8. 优化 - i18n cookie 判断。 9. 优化 - 支持 Markdown 文本分割时,只有标题,无内容。 10. 优化 - 字符串变量替换,未赋值的变量会转成 undefined,而不是保留原来 id 串。 11. 优化 - 全局变量默认值在 API 生效,并且自定义变量支持默认值。 12. 优化 - 增加 HTTP Body 的 JSON 解析,正则将 undefined 转 null,减少 Body 解析错误。 13. 优化 - 定时执行增加运行日志,增加重试,减少报错概率。 14. 修复 - 分享链接点赞鉴权问题。 15. 修复 - 对话页面切换自动执行应用时,会误触发非自动执行应用。 16. 修复 - 语言播放鉴权问题。 17. 修复 - 插件应用知识库引用上限始终为 3000 18. 修复 - 工作流编辑记录存储上限,去掉本地存储,增加异常离开时,强制自动保存。 19. 修复 - 工作流特殊变量替换问题。($开头的字符串无法替换) file: ./content/self-host/upgrading/outdated/4816.en.mdx meta: { "title": "V4.8.16 (Configuration Changes)", "description": "FastGPT V4.8.16 Release Notes" } ## Upgrade Guide ### 1. Update images: * Update the fastgpt image tag to v4.8.16 * Update the fastgpt-pro commercial edition image tag to v4.8.16 * Update the Sandbox image tag to v4.8.16 ### 2. Update configuration file Update your `config.json` or admin model configuration. Add the `provider` field to LLMModel and VectorModel for model categorization. The legacy `config.json` guide is no longer maintained. For current versions, see [Model Configuration](../../config/model/intro.en.mdx). For example: ```json { "provider": "OpenAI", // This is new "model": "gpt-4o", "name": "gpt-4o", "maxContext": 125000, "maxResponse": 4000, "quoteMaxToken": 120000, "maxTemperature": 1.2, "charsPointsPrice": 0, "censor": false, "vision": true, "datasetProcess": true, "usedInClassify": true, "usedInExtractFields": true, "usedInToolCall": true, "usedInQueryExtension": true, "toolChoice": true, "functionCall": false, "customCQPrompt": "", "customExtractPrompt": "", "defaultSystemChatPrompt": "", "defaultConfig": {}, "fieldMap": {} } ``` ## Full Release Notes 1. New - SearXNG search plugin. 2. New - Commercial edition supports scheduled sync for API Knowledge Bases and link collections. 3. New - "Suggested questions" supports model selection and custom prompts. 4. New - DingTalk and WeCom bot webhook plugins. 5. New - Commercial edition supports DingTalk SSO login configuration. [View tutorial](../../../guide/admin/sso.en.mdx#钉钉) 6. New - Commercial edition supports Lark and Yuque Knowledge Base import. [View tutorial](../../../guide/dataset/third-party/lark_dataset.en.mdx) 7. New - Sandbox adds `createHmac` encryption global method. 8. New - Right-click in workflow supports "Collapse all". 9. Improved - Model selector. 10. Improved - SSR rendering now pre-detects mobile vs. desktop to reduce page jitter. 11. Improved - Workflow/Simple Mode variable initialization code. Removed listener-based initialization to prevent failures from inconsistent render order. 12. Improved - Workflow now performs type conversion when receiving mismatched data types, preventing `undefined`. 13. Fixed - Unable to auto-switch default language. Share links now force a default language switch on load. 14. Fixed - Array selector auto-compatibility with pre-4.8.13 data. 15. Fixed - Site sync Knowledge Base not using the selector for link syncing. 16. Fixed - Converting Simple Mode to workflow did not convert system configuration items. 17. Fixed - Plugin standalone execution not applying initial variable values. 18. Fixed - Workflow modal components sometimes causing page offset after closing. 19. Fixed - Plugin debug logs not saving plugin input parameters. 20. Fixed - Some template marketplace templates. 21. Fixed - Incorrect image file URL when NEXT\_PUBLIC\_BASE\_URL is set. file: ./content/self-host/upgrading/outdated/4816.mdx meta: { "title": "V4.8.16(配置变更)", "description": "FastGPT V4.8.16 更新说明" } ## 更新指南 ### 1. 更新镜像: * 更新 fastgpt 镜像 tag: v4.8.16 * 更新 fastgpt-pro 商业版镜像 tag: v4.8.16 * Sandbox 镜像 tag: v4.8.16 ### 2. 更新配置文件 更新 `config.json` 或 admin 中模型文件配置。给 LLMModel 和 VectorModel 增加 `provider` 字段,以便进行模型分类。旧版 `config.json` 配置说明已不再维护,当前版本请参考[模型配置方案](../../config/model/intro.mdx)。例如: ```json { "provider": "OpenAI", // 这是新增的 "model": "gpt-4o", "name": "gpt-4o", "maxContext": 125000, "maxResponse": 4000, "quoteMaxToken": 120000, "maxTemperature": 1.2, "charsPointsPrice": 0, "censor": false, "vision": true, "datasetProcess": true, "usedInClassify": true, "usedInExtractFields": true, "usedInToolCall": true, "usedInQueryExtension": true, "toolChoice": true, "functionCall": false, "customCQPrompt": "", "customExtractPrompt": "", "defaultSystemChatPrompt": "", "defaultConfig": {}, "fieldMap": {} } ``` ## 完整更新内容 1. 新增 - SearXNG 搜索插件 2. 新增 - 商业版支持 API 知识库和链接集合定时同步。 3. 新增 - 猜你想问支持选择模型和自定义提示词。 4. 新增 - 钉钉和企微机器人 webhook 插件。 5. 新增 - 商业版支持钉钉 SSO 登录配置。[点击查看教程](../../../guide/admin/sso.mdx#钉钉) 6. 新增 - 商业版支持飞书和语雀知识库导入。[点击查看教程](../../../guide/dataset/third-party/lark_dataset.mdx) 7. 新增 - sandbox 新增 createHmac 加密全局方法。 8. 新增 - 工作流右键支持全部折叠。 9. 优化 - 模型选择器。 10. 优化 - SSR 渲染,预判断是移动端还是 pc 端,减少页面抖动。 11. 优化 - 工作流/简易模式变量初始化代码,去除监听初始化,避免因渲染顺序不一致导致的失败。 12. 优化 - 工作流获取数据类型不一致数据时,增加类型转化,避免 undefined。 13. 修复 - 无法自动切换默认语言。增加分享链接,强制执行一次切换默认语言。 14. 修复 - 数组选择器自动兼容 4.8.13 以前的数据。 15. 修复 - 站点同步知识库,链接同步时未使用选择器。 16. 修复 - 简易模式转工作流,没有把系统配置项转化。 17. 修复 - 插件独立运行,变量初始值未赋上。 18. 修复 - 工作流使用弹窗组件时,关闭弹窗后,有时候会出现页面偏移。 19. 修复 - 插件调试时,日志未保存插件输入参数。 20. 修复 - 部分模板市场模板 21. 修复 - 设置 NEXT\_PUBLIC\_BASE\_URL 时,图片文件读取 URL 不正确 file: ./content/self-host/upgrading/outdated/4817.en.mdx meta: { "title": "V4.8.17 (Upgrade Script)", "description": "FastGPT V4.8.17 Release Notes" } ## Upgrade Guide ### 1. Update images: * Update the fastgpt image tag to v4.8.17-fix-title * Update the fastgpt-pro commercial edition image tag to v4.8.17 * Sandbox image update is not required ### 2. Run migration 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/initv4817' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This migrates user-bound OpenAI accounts to the team level. ## Completions API response changes The `/api/v1/chat/completions` endpoint response has been updated. Nodes that use models (chat nodes, tool nodes, etc.) will no longer return a `tokens` field. Instead, they return `inputTokens` and `outputTokens` fields representing the input and output token counts respectively. ## Full Release Notes 1. New - Simple Mode tool calls support array-type plugins. 2. New - Workflow adds auto-save on abnormal exit to prevent workflow loss. 3. New - LLM model parameters support disabling `max_tokens` and `temperature`. 4. New - Commercial edition supports configuring the template marketplace in the admin panel. 5. New - Commercial edition supports configuring custom workflow variables in the admin panel for business system authentication integration. 6. New - Search test API supports query optimization. 7. New - Input tokens and output tokens are now tracked and displayed separately in workflows. Also fixed billing not recording output tokens for some requests. 8. Improved - Markdown size check: content exceeding 200K characters no longer uses the Markdown component to prevent crashes. 9. Improved - Knowledge Base search parameters: sliders now support input mode for more precise control. 10. Improved - Available models display UI. 11. Improved - MongoDB queries with added virtual fields. 12. Fixed - File response API missing `Content-Length` header, causing Alibaba vision models to fail image recognition when uploading files from different origins. 13. Fixed - Removed hidden line breaks from both ends of condition node strings to prevent condition evaluation failures. 14. Fixed - Variable update node: non-string data types could not be auto-converted when manually entering update content. 15. Fixed - Doubao models unable to make tool calls. file: ./content/self-host/upgrading/outdated/4817.mdx meta: { "title": "V4.8.17(升级脚本)", "description": "FastGPT V4.8.17 更新说明" } ## 更新指南 ### 1. 更新镜像: * 更新 fastgpt 镜像 tag: v4.8.17-fix-title * 更新 fastgpt-pro 商业版镜像 tag: v4.8.17 * Sandbox 镜像无需更新 ### 2. 运行升级脚本 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。 ```bash curl --location --request POST 'https://{{host}}/api/admin/initv4817' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 会将用户绑定的 OpenAI 账号移动到团队中。 ## 调整 completions 接口返回值 /api/v1/chat/completions 接口返回值调整,对话节点、工具节点等使用到模型的节点,将不再返回 `tokens` 字段,改为返回 `inputTokens` 和 `outputTokens` 字段,分别表示输入和输出的 Token 数量。 ## 完整更新内容 1. 新增 - 简易模式工具调用支持数组类型插件。 2. 新增 - 工作流增加异常离开自动保存,避免工作流丢失。 3. 新增 - LLM 模型参数支持关闭 max\_tokens 和 temperature。 4. 新增 - 商业版支持后台配置模板市场。 5. 新增 - 商业版支持后台配置自定义工作流变量,用于与业务系统鉴权打通。 6. 新增 - 搜索测试接口支持问题优化。 7. 新增 - 工作流中 Input Token 和 Output Token 分开记录展示。并修复部分请求未记录输出 Token 计费问题。 8. 优化 - Markdown 大小测试,超出 20 万字符不使用 Markdown 组件,避免崩溃。 9. 优化 - 知识库搜索参数,滑动条支持输入模式,可以更精准的控制。 10. 优化 - 可用模型展示UI。 11. 优化 - Mongo 查询语句,增加 virtual 字段。 12. 修复 - 文件返回接口缺少 Content-Length 头,导致通过非同源文件上传时,阿里 vision 模型无法识别图片。 13. 修复 - 去除判断器两端字符串隐藏换行符,避免判断器失效。 14. 修复 - 变量更新节点,手动输入更新内容时候,非字符串类型数据类型无法自动转化。 15. 修复 - 豆包模型无法工具调用。 file: ./content/self-host/upgrading/outdated/4818.en.mdx meta: { "title": "V4.8.18 (Upgrade Script)", "description": "FastGPT V4.8.18 Release Notes" } ## Upgrade Guide ### 1. Update images: * Update the fastgpt image tag to v4.8.18-fix * Update the fastgpt-pro commercial edition image tag to v4.8.18-fix * Sandbox image update is not required ### 2. Run migration 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/initv4818' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This migrates the full-text search table. The migration takes a while — full-text search will be unavailable during the process. The log will print the amount of data already migrated. ## Full Release Notes 1. New - Support creating apps directly via JSON configuration. 2. New - Support quickly creating HTTP plugins via CURL scripts. 3. New - Commercial edition supports department-based permission structure. 4. New - Support configuring custom CORS security policies (defaults to fully open). 5. New - Added model troubleshooting documentation for private deployments. 6. Improved - HTTP Body special handling to resolve parsing issues with newlines in string variables. 7. Improved - Share links generate random user avatars. 8. Improved - Image upload security validation. Added unique avatar image storage to prevent cumulative storage. 9. Improved - Separated MongoDB full-text index table. 10. Improved - Merged Knowledge Base search queries to reduce database calls. 11. Improved - File encoding detection to reduce CSV file garbled text. 12. Improved - Asynchronous file content reading to reduce process blocking. 13. Improved - File viewer: HTML files are now downloaded directly instead of being viewable online. 14. Fixed - HTML file upload: Base64 images not auto-converting to image URLs. 15. Fixed - Plugin billing errors. file: ./content/self-host/upgrading/outdated/4818.mdx meta: { "title": "V4.8.18(升级脚本)", "description": "FastGPT V4.8.18 更新说明" } ## 更新指南 ### 1. 更新镜像: * 更新 fastgpt 镜像 tag: v4.8.18-fix * 更新 fastgpt-pro 商业版镜像 tag: v4.8.18-fix * Sandbox 镜像无需更新 ### 2. 运行升级脚本 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**: ```bash curl --location --request POST 'https://{{host}}/api/admin/initv4818' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 会迁移全文检索表,时间较长,迁移期间全文检索会失效,日志中会打印已经迁移的数据长度。 ## 完整更新内容 1. 新增 - 支持通过 JSON 配置直接创建应用。 2. 新增 - 支持通过 CURL 脚本快速创建 HTTP 插件。 3. 新增 - 商业版支持部门架构权限模式。 4. 新增 - 支持配置自定跨域安全策略,默认全开。 5. 新增 - 补充私有部署,模型问题排查文档。 6. 优化 - HTTP Body 增加特殊处理,解决字符串变量带换行时无法解析问题。 7. 优化 - 分享链接随机生成用户头像。 8. 优化 - 图片上传安全校验。并增加头像图片唯一存储,确保不会累计存储。 9. 优化 - Mongo 全文索引表分离。 10. 优化 - 知识库检索查询语句合并,同时减少查库数量。 11. 优化 - 文件编码检测,减少 CSV 文件乱码概率。 12. 优化 - 异步读取文件内容,减少进程阻塞。 13. 优化 - 文件阅读,HTML 直接下载,不允许在线阅读。 14. 修复 - HTML 文件上传,base64 图片无法自动转图片链接。 15. 修复 - 插件计费错误。 file: ./content/self-host/upgrading/outdated/4819.en.mdx meta: { "title": "V4.8.19 (Upgrade Script)", "description": "FastGPT V4.8.19 Release Notes" } ## Upgrade Guide ### 1. Update images: * Update the fastgpt image tag to v4.8.19-beta * Update the fastgpt-pro commercial edition image tag to v4.8.19-beta * Sandbox image update is not required ### 2. Run migration 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/initv4819' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This migrates user avatars from the user table to the member table. ## Full Release Notes 1. New - Workflow Knowledge Base search supports filtering by Knowledge Base permissions. 2. New - Lark/Yuque Knowledge Base view original source. 3. New - Flow wait plugin that pauses execution for n milliseconds before continuing. 4. New - Lark bot integration supports configuring a private Lark server URL. 5. Improved - Member list pagination loading. 6. Improved - Unified pagination loading code. 7. Improved - Chat page loading now supports configuring whether it's a standalone page. 8. Improved - Member avatars migrated to the member table. 9. Fixed - Yuque file library import: nested file contents could not be expanded. 10. Fixed - Workflow editor: LLM parameters could not be disabled. 11. Fixed - Workflow editor: code execution node template restoration issue. 12. Fixed - HTTP interface object string parsing compatibility. 13. Fixed - API file upload (localFile) endpoint: image expiration flag not being cleared. 14. Fixed - Workflow import: number input types could not be overridden. 15. Fixed - Some model provider logos not displaying correctly. file: ./content/self-host/upgrading/outdated/4819.mdx meta: { "title": "V4.8.19(升级脚本)", "description": "FastGPT V4.8.19 更新说明" } ## 更新指南 ### 1. 更新镜像: * 更新 fastgpt 镜像 tag: v4.8.19-beta * 更新 fastgpt-pro 商业版镜像 tag: v4.8.19-beta * Sandbox 镜像无需更新 ### 2. 运行升级脚本 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**: ```bash curl --location --request POST 'https://{{host}}/api/admin/initv4819' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 迁移用户表的头像到成员表中。 ## 完整更新内容 1. 新增 - 工作流知识库检索支持按知识库权限进行过滤。 2. 新增 - 飞书/语雀知识库查看原文。 3. 新增 - 流程等待插件,可以等待 n 毫秒后继续执行流程。 4. 新增 - 飞书机器人接入,支持配置私有化飞书地址。 5. 优化 - 成员列表分页加载。 6. 优化 - 统一分页加载代码。 7. 优化 - 对话页面加载时,可配置是否为独立页面。 8. 优化 - 成员头像迁移,移动到成员表。 9. 修复 - 语雀文件库导入时,嵌套文件内容无法展开的问题。 10. 修复 - 工作流编排中,LLM 参数无法关闭问题。 11. 修复 - 工作流编排中,代码运行节点还原模板问题。 12. 修复 - HTTP 接口适配对象字符串解析。 13. 修复 - 通过 API 上传文件(localFile)接口,图片过期标记未清除。 14. 修复 - 工作流导入编排时,number input 类型无法覆盖。 15. 修复 - 部分模型提供商 logo 无法正常显示。 file: ./content/self-host/upgrading/outdated/482.en.mdx meta: { "title": "V4.8.2 (Environment Changes)", "description": "FastGPT V4.8.2 Release Notes" } ## Sealos Upgrade Instructions 1. Create a new app in App Management with the image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.8.1 2. No external access URL is needed. Set the port to 3000. 3. After deployment, copy the app's internal network address. 4. Click "Update" on FastGPT, modify the environment variables, and add the following: ``` SANDBOX_URL=internal-network-address ``` ## Docker Deployment You can pull the latest [docker-compose.yml](https://github.com/labring/FastGPT/blob/main/document/public/deploy/docker/main/global/docker-compose.pg.yml) file for reference. 1. Add a new `sandbox` container. 2. Add the `SANDBOX_URL` environment variable to the fastgpt and fastgpt-pro (commercial edition) containers. 3. It's recommended not to expose the sandbox to the public network, as it has no credential verification. ## V4.8.2 Release Notes 1. New - JavaScript code execution node (with improved type hints; more enhancements coming). 2. New - Content extraction node now supports data type selection. 3. Fixed - Newly added site sync not working. 4. Fixed - Scheduled tasks unable to accept input content. file: ./content/self-host/upgrading/outdated/482.mdx meta: { "title": "V4.8.2(环境变量变更)", "description": "FastGPT V4.8.2 更新说明" } ## Sealos 升级说明 1. 在应用管理中新建一个应用,镜像为:registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.8.1 2. 无需外网访问地址,端口号为 3000 3. 部署完后,复制应用的内网地址 4. 点击变更\`FastGPT - 修改环境变量,增加下面的环境变量即可 ``` SANDBOX_URL=内网地址 ``` ## Docker 部署 可以拉取最新 [docker-compose.yml](https://github.com/labring/FastGPT/blob/main/document/public/deploy/docker/main/global/docker-compose.pg.yml) 文件参考 1. 新增一个容器 `sandbox` 2. fastgpt 和 fastgpt-pro(商业版) 容器新增环境变量: `SANDBOX_URL` 3. sandbox 简易不要开启外网访问,未做凭证校验。 ## V4.8.2 更新说明 1. 新增 - js 代码运行节点(更完整的 type 提醒,后续继续完善) 2. 新增 - 内容提取节点支持数据类型选择 3. 修复 - 新增的站点同步无法使用 4. 修复 - 定时任务无法输入内容 file: ./content/self-host/upgrading/outdated/4820.en.mdx meta: { "title": "V4.8.20 (Environment Changes, Upgrade Script)", "description": "FastGPT V4.8.20 Release Notes" } ## Upgrade Guide ### 1. Back up your database ### 2. Update environment variables If you are an early adopter who configured `ONEAPI_URL`, you need to change it to `OPENAI_BASE_URL`. ### 3. Update images: * Update the fastgpt image tag to v4.8.20-fix2 * Update the fastgpt-pro commercial edition image tag to v4.8.20-fix2 * Sandbox image update is not required ### 4. Run migration 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/initv4820' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` The script automatically loads models from the old configuration file into the new model configuration. ## Full Release Notes 1. New - Visual model parameter configuration, replacing the old config file approach. Over 100 model presets included, with one-click testing for all model types. (Full in-page channel configuration is planned for the next version.) [View model configuration guide](../../config/model/intro.en.mdx) 2. New - DeepSeek Reasoner model supports outputting the thinking process. 3. New - Usage record export and dashboard. 4. New - Markdown syntax extension supporting audio and video (via `audio` and `video` code blocks). 5. New - Adjusted `max_tokens` calculation logic. `max_tokens` is now prioritized at the configured value; if it exceeds the maximum context, history is reduced instead. For example, requesting 8000 `max_tokens` reduces the context length by 8000. 6. Improved - Query optimization now includes context filtering to prevent exceeding context limits. 7. Improved - Page component extraction to reduce page component routing. 8. Improved - Full-text search is now case-insensitive. 9. Improved - QA generation and enhanced indexing switched to streaming output to prevent timeouts with some models. 10. Improved - Automatically adds `null` to empty assistant `content`, and merges consecutive text assistant messages to prevent errors from some models. 11. Improved - Adjusted image host: domain is no longer appended during upload but before sending a conversation, preventing broken images after domain changes. 12. Fixed - Member list not triggering bottom-loading in some scenarios. 13. Fixed - Workflow recursive execution failing under certain conditions. file: ./content/self-host/upgrading/outdated/4820.mdx meta: { "title": "V4.8.20(环境变量变更、升级脚本)", "description": "FastGPT V4.8.20 更新说明" } ## 更新指南 ### 1. 做好数据库备份 ### 2. 更新环境变量 如果有很早版本用户,配置了`ONEAPI_URL`的,需要统一改成`OPENAI_BASE_URL` ### 3. 更新镜像: * 更新 fastgpt 镜像 tag: v4.8.20-fix2 * 更新 fastgpt-pro 商业版镜像 tag: v4.8.20-fix2 * Sandbox 镜像无需更新 ### 4. 运行升级脚本 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**: ```bash curl --location --request POST 'https://{{host}}/api/admin/initv4820' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 脚本会自动把原配置文件的模型加载到新版模型配置中。 ## 完整更新内容 1. 新增 - 可视化模型参数配置,取代原配置文件配置模型。预设超过 100 个模型配置。同时支持所有类型模型的一键测试。(预计下个版本会完全支持在页面上配置渠道)。[点击查看模型配置方案](../../config/model/intro.mdx) 2. 新增 - DeepSeek resoner 模型支持输出思考过程。 3. 新增 - 使用记录导出和仪表盘。 4. 新增 - markdown 语法扩展,支持音视频(代码块 audio 和 video)。 5. 新增 - 调整 max\_tokens 计算逻辑。优先保证 max\_tokens 为配置值,如超出最大上下文,则减少历史记录。例如:如果申请 8000 的 max\_tokens,则上下文长度会减少 8000。 6. 优化 - 问题优化增加上下文过滤,避免超出上下文。 7. 优化 - 页面组件抽离,减少页面组件路由。 8. 优化 - 全文检索,忽略大小写。 9. 优化 - 问答生成和增强索引改成流输出,避免部分模型超时。 10. 优化 - 自动给 assistant 空 content,补充 null,同时合并连续的 text assistant,避免部分模型抛错。 11. 优化 - 调整图片 Host, 取消上传时补充 FE\_DOMAIN,改成发送对话前补充,避免替换域名后原图片无法正常使用。 12. 修复 - 部分场景成员列表无法触底加载。 13. 修复 - 工作流递归执行,部分条件下无法正常运行。 file: ./content/self-host/upgrading/outdated/4821.en.mdx meta: { "title": "V4.8.21", "description": "FastGPT V4.8.21 Release Notes" } ## Upgrade Guide ### 1. Back up your database ### 2. Update images: * Update the fastgpt image tag to v4.8.21-fix * Update the fastgpt-pro commercial edition image tag to v4.8.21-fix * Sandbox image update is not required ## Full Release Notes 1. New - Deprecated/deleted plugin indicators. 2. New - Chat logs with source categorization, title search, and export. 3. New - Global variables support drag-and-drop reordering. 4. New - LLM models support `top_p`, `response_format`, and `json_schema` parameters. 5. New - Doubao 1.5 model preset. Alibaba Embedding v3 preset. 6. New - Vector models support normalization configuration to accommodate unnormalized vector models such as Doubao embedding models. 7. New - AI chat node supports outputting thinking process results, which can be referenced by other nodes. 8. Improved - Embedded chat widget with window position adaptation. 9. Improved - Better error messages when models are not configured. 10. Improved - Support for non-stream mode thinking output. 11. Improved - Added null pointer protection when TTS voice is not configured. 12. Improved - Markdown link parsing/splitting rules switched to strict matching mode, sacrificing compatibility for fewer false positives. 13. Improved - Reduced data fetching scope for unauthenticated users to improve system privacy. 14. Fixed - Simple Mode: switching to a non-vision model now correctly disables image recognition. 15. Fixed - o1/o3 models: field mapping not taking effect during testing, causing errors. 16. Fixed - WeChat Official Account chat null pointer exception. 17. Fixed - Multiple audio/video files displaying incorrectly. 18. Fixed - Share link authentication error causing infinite loop. file: ./content/self-host/upgrading/outdated/4821.mdx meta: { "title": "V4.8.21", "description": "FastGPT V4.8.21 更新说明" } ## 更新指南 ### 1. 做好数据库备份 ### 2. 更新镜像: * 更新 fastgpt 镜像 tag: v4.8.21-fix * 更新 fastgpt-pro 商业版镜像 tag: v4.8.21-fix * Sandbox 镜像无需更新 ## 完整更新内容 1. 新增 - 弃用/已删除的插件提示。 2. 新增 - 对话日志按来源分类、标题检索、导出功能。 3. 新增 - 全局变量支持拖拽排序。 4. 新增 - LLM 模型支持 top\_p, response\_format, json\_schema 参数。 5. 新增 - Doubao1.5 模型预设。阿里 embedding3 预设。 6. 新增 - 向量模型支持归一化配置,以便适配未归一化的向量模型,例如 Doubao 的 embedding 模型。 7. 新增 - AI 对话节点,支持输出思考过程结果,可用于其他节点引用。 8. 优化 - 网站嵌入式聊天窗口,增加窗口位置适配。 9. 优化 - 模型未配置时错误提示。 10. 优化 - 适配非 Stream 模式思考输出。 11. 优化 - 增加 TTS voice 未配置时的空指针保护。 12. 优化 - Markdown 链接解析分割规则,改成严格匹配模式,牺牲兼容多种情况,减少误解析。 13. 优化 - 减少未登录用户的数据获取范围,提高系统隐私性。 14. 修复 - 简易模式,切换到其他非视觉模型时候,会强制关闭图片识别。 15. 修复 - o1,o3 模型,在测试时候字段映射未生效导致报错。 16. 修复 - 公众号对话空指针异常。 17. 修复 - 多个音频/视频文件展示异常。 18. 修复 - 分享链接鉴权报错后无限循环。 file: ./content/self-host/upgrading/outdated/4822.en.mdx meta: { "title": "V4.8.22 (Upgrade Script)", "description": "FastGPT V4.8.22 Release Notes" } ## Upgrade Guide ### 1. Back up your database ### 2. Update images: * Update the fastgpt image tag to v4.8.22 * Update the fastgpt-pro commercial edition image tag to v4.8.22 * Sandbox image update is not required ### 3. Run migration script Only required for commercial edition users providing SaaS services. 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/initv4822' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This migrates contact information to the corresponding user table. ## New Features 1. AI chat node parses `` tag content as chain-of-thought, enabling thinking process output for various models. You need to manually enable model thinking output. 2. Chat API optimization: conversation logs are now saved regardless of whether a `chatId` is provided. If no `chatId` is passed, a random one is generated for storage. 3. PPIO model provider. ## Improvements 1. Better prompts when models are not configured, reducing conflicting messages. 2. Usage record code improvements. 3. Content extraction node: long field descriptions now wrap. Output names now use `key` instead of `description`. 4. Team management interaction improvements. 5. Chat API non-stream responses now include error fields. ## Bug Fixes 1. Thinking content not counted toward output tokens. 2. Thinking chain stream output sometimes out of order with main content. 3. API workflow calls: images that don't support HEAD detection were being filtered out. Added error detection to prevent incorrect filtering. 4. Some template marketplace templates had errors. 5. Guest window unable to correctly detect whether language recognition is enabled. 6. Chat log export not compatible with sub-path deployments. 7. Member list not refreshing when switching teams. 8. List API null pointer possibility when joining member data. 9. Workflow base nodes unable to upgrade. 10. Vector search results not deduplicated. 11. User selection node unable to connect properly. 12. Chat record source not being saved correctly. file: ./content/self-host/upgrading/outdated/4822.mdx meta: { "title": "V4.8.22(升级脚本)", "description": "FastGPT V4.8.22 更新说明" } ## 🌟更新指南 ### 1. 做好数据库备份 ### 2. 更新镜像: * 更新 fastgpt 镜像 tag: v4.8.22 * 更新 fastgpt-pro 商业版镜像 tag: v4.8.22 * Sandbox 镜像无需更新 ### 3. 运行升级脚本 仅商业版,并提供 Saas 服务的用户需要运行该升级脚本。 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**: ```bash curl --location --request POST 'https://{{host}}/api/admin/initv4822' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 会迁移联系方式到对应用户表中。 ## 🚀 新增内容 1. AI 对话节点解析 `` 标签内容作为思考链,便于各类模型进行思考链输出。需主动开启模型输出思考。 2. 对话 API 优化,无论是否传递 chatId,都会保存对话日志。未传递 chatId,则随机生成一个 chatId 来进行存储。 3. ppio 模型提供商 ## ⚙️ 优化 1. 模型未配置时提示,减少冲突提示。 2. 使用记录代码。 3. 内容提取节点,字段描述过长时换行。同时修改其输出名用 key,而不是 description。 4. 团队管理交互。 5. 对话接口,非流响应,增加报错字段。 ## 🐛 修复 1. 思考内容未进入到输出 Tokens. 2. 思考链流输出时,有时与正文顺序偏差。 3. API 调用工作流,如果传递的图片不支持 Head 检测时,图片会被过滤。已增加该类错误检测,避免被错误过滤。 4. 模板市场部分模板错误。 5. 免登录窗口无法正常判断语言识别是否开启。 6. 对话日志导出,未兼容 sub path。 7. 切换团队时未刷新成员列表 8. list 接口在联查 member 时,存在空指针可能性。 9. 工作流基础节点无法升级。 10. 向量检索结果未去重。 11. 用户选择节点无法正常连线。 12. 对话记录保存时,source 未正常记录。 file: ./content/self-host/upgrading/outdated/4823.en.mdx meta: { "title": "V4.8.23 (Upgrade Script)", "description": "FastGPT V4.8.23 Release Notes" } ## Upgrade Guide ### 1. Back up your database ### 2. Update images: * Update the fastgpt image tag to v4.8.23-fix * Update the fastgpt-pro commercial edition image tag to v4.8.23-fix * Sandbox image update is not required ### 3. Run migration 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/initv4823' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` The script cleans up Knowledge Base dirty data, primarily redundant full-text indexes. ## New Features 1. Added default "Knowledge Base text understanding model" configuration. 2. AI Proxy V1, which can replace OneAPI and provides complete model call logs for easier troubleshooting. 3. Added support ticket entry point. ## Improvements 1. Model configuration form now includes required field validation. 2. Collection list data statistics method improved for better performance with large datasets. 3. Optimized math formulas: LaTeX format is now escaped to Markdown format. 4. Document image parsing: oversized images are now automatically skipped. 5. Time picker: start time defaults to 00:00:00 and end time to 23:59:59 for the selected day, preventing UI/logic discrepancies. 6. Upgraded mongoose library dependency. ## Bug Fixes 1. Tag filtering not working correctly for subfolders. 2. Temporarily removed Markdown reading optimization to prevent link splitting errors. 3. Member list not refreshing when leaving a team. 4. PPTX encoding error causing parsing failures. 5. Full-text index not deleted when removing a single Knowledge Base data entry. 6. Fixed Mongo Dataset text index not taking effect during data queries. file: ./content/self-host/upgrading/outdated/4823.mdx meta: { "title": "V4.8.23(升级脚本)", "description": "FastGPT V4.8.23 更新说明" } ## 更新指南 ### 1. 做好数据库备份 ### 2. 更新镜像: * 更新 fastgpt 镜像 tag: v4.8.23-fix * 更新 fastgpt-pro 商业版镜像 tag: v4.8.23-fix * Sandbox 镜像无需更新 ### 3. 运行升级脚本 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**: ```bash curl --location --request POST 'https://{{host}}/api/admin/initv4823' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 脚本会清理一些知识库脏数据,主要是多余的全文索引。 ## 🚀 新增内容 1. 增加默认“知识库文本理解模型”配置 2. AI proxy V1版,可替换 OneAPI使用,同时提供完整模型调用日志,便于排查问题。 3. 增加工单入口支持。 ## ⚙️ 优化 1. 模型配置表单,增加必填项校验。 2. 集合列表数据统计方式,提高大数据量统计性能。 3. 优化数学公式,转义 Latex 格式成 Markdown 格式。 4. 解析文档图片,图片太大时,自动忽略。 5. 时间选择器,当天开始时间自动设0,结束设置设 23:59:59,避免 UI 与实际逻辑偏差。 6. 升级 mongoose 库版本依赖。 ## 🐛 修复 1. 标签过滤时,子文件夹未成功过滤。 2. 暂时移除 md 阅读优化,避免链接分割错误。 3. 离开团队时,未刷新成员列表。 4. PPTX 编码错误,导致解析失败。 5. 删除知识库单条数据时,全文索引未跟随删除。 6. 修复 Mongo Dataset text 索引在查询数据时未生效。 file: ./content/self-host/upgrading/outdated/483.en.mdx meta: { "title": "V4.8.3", "description": "FastGPT V4.8.3 Release Notes" } ## Upgrade Guide * Update the fastgpt image tag to v4.8.3 * Update the fastgpt-sandbox image tag to v4.8.3 * Update the commercial edition image tag to v4.8.3 ## V4.8.3 Release Notes 1. New - Milvus database support. See the latest [docker-compose-milvus.yml](https://github.com/labring/FastGPT/blob/main/document/public/deploy/docker/main/global/docker-compose.milvus.yml) for reference. 2. New - Added logging for empty answers in the chat API to help troubleshoot model issues. 3. New - If/Else conditional node now supports regex for string matching. 4. New - Code execution node now supports console.log for debug output. 5. Fixed - Variable update failing in Debug mode. file: ./content/self-host/upgrading/outdated/483.mdx meta: { "title": "V4.8.3", "description": "FastGPT V4.8.3 更新说明" } ## 升级指南 * fastgpt 镜像 tag 修改成 v4.8.3 * fastgpt-sandbox 镜像 tag 修改成 v4.8.3 * 商业版镜像 tag 修改成 v4.8.3 ## V4.8.3 更新说明 1. 新增 - 支持 Milvus 数据库,可参考最新的 [docker-compose-milvus.yml](https://github.com/labring/FastGPT/blob/main/document/public/deploy/docker/main/global/docker-compose.milvus.yml) . 2. 新增 - 给 chat 接口 empty answer 增加 log,便于排查模型问题。 3. 新增 - ifelse 判断器,字符串支持正则。 4. 新增 - 代码运行支持 console.log 输出调试。 5. 修复 - 变量更新在 Debug 模式下出错。 file: ./content/self-host/upgrading/outdated/484.en.mdx meta: { "title": "V4.8.4 (Upgrade Script)", "description": "FastGPT V4.8.4 Release Notes" } ## Upgrade Guide ### 1. Update Images * Update the fastgpt image tag to v4.8.4 * Update the fastgpt-sandbox image tag to v4.8.4 (optional, no changes) * Update the commercial edition image tag to v4.8.4 ### 2. Commercial Edition Initialization From any terminal, send 1 HTTP request. Replace `{{rootkey}}` with the `rootkey` from your environment variables, and `{{host}}` with your **FastGPT commercial edition domain**. ```bash curl --location --request POST 'https://{{host}}/api/admin/init/484' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` ## V4.8.4 Release Notes 1. New - Apps now use the new permission system. 2. New - Apps now support folders. 3. Improved - Text splitting now removes consecutive line breaks and tabs to avoid performance issues with large text. 4. Critical Fix - Fixed system plugin runtime pool data pollution. Since data was loaded from memory, it caused global state contamination. 5. Fixed - Debug mode showing abnormal connections when source and target content are identical. 6. Fixed - Scheduled execution initialization error. 7. Fixed - App invocation parameter passing error. 8. Fixed - Incorrect nodeId when copying complex nodes with Ctrl+C/V. 9. Adjusted global theme for the component library. file: ./content/self-host/upgrading/outdated/484.mdx meta: { "title": "V4.8.4(升级脚本)", "description": "FastGPT V4.8.4 更新说明" } ## 升级指南 ### 1. 修改镜像 * fastgpt 镜像 tag 修改成 v4.8.4 * fastgpt-sandbox 镜像 tag 修改成 v4.8.4 (选择性,无变更) * 商业版镜像 tag 修改成 v4.8.4 ### 2. 商业版用户执行初始化 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 商业版的域名**。 ```bash curl --location --request POST 'https://{{host}}/api/admin/init/484' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` ## V4.8.4 更新说明 1. 新增 - 应用使用新权限系统。 2. 新增 - 应用支持文件夹。 3. 优化 - 文本分割增加连续换行、制表符清除,避免大文本性能问题。 4. 重要修复 - 修复系统插件运行池数据污染问题,由于从内存获取,会导致全局污染。 5. 修复 - Debug 模式下,相同 source 和 target 内容,导致连线显示异常。 6. 修复 - 定时执行初始化错误。 7. 修复 - 应用调用传参异常。 8. 修复 - ctrl + cv 复杂节点时,nodeId错误。 9. 调整组件库全局theme。 file: ./content/self-host/upgrading/outdated/485.en.mdx meta: { "title": "V4.8.5 (Upgrade Script)", "description": "FastGPT V4.8.5 Release Notes" } ## Upgrade Guide ### 1. Back Up Your Database ### 2. Update Images * Update the fastgpt image tag to v4.8.5 * Update the commercial edition image tag to v4.8.5 ### 3. Run Initialization From any terminal, send 1 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/initv485' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This will merge the plugin data table into the app table. The plugin table will not be deleted. *** **Commercial edition users: run the additional initialization below** From any terminal, send 1 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/init/485' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This will reset the Knowledge Base permission system. ## V4.8.5 Release Notes 1. New - Merged plugins and apps into a unified workspace. 2. New - App duplication feature. 3. New - App template creation. 4. New - Code execution results can now be used as tool output. 5. New - Markdown image output supports pinch-to-zoom on mobile. 6. Improved - Raw file encoding for storage and retrieval. 7. Improved - Simple mode now filters out deleted Knowledge Bases to avoid false error states. 8. Improved - Folder reading now supports more than 100 files per folder. 9. Improved - QA splitting / manual entry: when an `a` field is present, the `q` field is automatically used as a supplementary index. 10. Improved - Chat dialog page code. 11. Improved - New workflow nodes are now auto-numbered. 12. Fixed - Scheduled tasks could not actually be disabled. 13. Fixed - Input guide special characters causing regex errors. 14. Fixed - Files containing unescaped `%` characters causing page crashes. 15. Fixed - Page crash when selecting Knowledge Base references in custom input. file: ./content/self-host/upgrading/outdated/485.mdx meta: { "title": "V4.8.5(升级脚本)", "description": "FastGPT V4.8.5 更新说明" } ## 升级指南 ### 1. 做好数据库备份 ### 2. 修改镜像 * fastgpt 镜像 tag 修改成 v4.8.5 * 商业版镜像 tag 修改成 v4.8.5 ### 3. 执行初始化 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。 ```bash curl --location --request POST 'https://{{host}}/api/admin/initv485' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 会把插件的数据表合并到应用中,插件表不会删除。 *** **商业版用户执行额外的初始化** 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**: ```bash curl --location --request POST 'https://{{host}}/api/admin/init/485' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 会重置知识库权限系统。 ## V4.8.5 更新说明 1. 新增 - 合并插件和应用,统一成工作台 2. 新增 - 应用创建副本功能 3. 新增 - 应用创建模板 4. 新增 - 支持代码运行结果作为工具输出。 5. 新增 - Markdown 图片输出,支持移动端放大缩放。 6. 优化 - 原文件编码存取 7. 优化 - 知识库删除后,简易模式会过滤掉删除的知识库,避免错误判断。 8. 优化 - 文件夹读取,支持单个文件夹超出 100 个文件 9. 优化 - 问答拆分/手动录入,当有`a`字段时,自动将`q`作为补充索引。 10. 优化 - 对话框页面代码 11. 优化 - 工作流新节点自动增加序号名 12. 修复 - 定时任务无法实际关闭 13. 修复 - 输入引导特殊字符导致正则报错 14. 修复 - 文件包含特殊字符`%`,且为转义时会导致页面崩溃 15. 修复 - 自定义输入选择知识库引用时页面崩溃 file: ./content/self-host/upgrading/outdated/486.en.mdx meta: { "title": "V4.8.6 (Upgrade Script)", "description": "FastGPT V4.8.6 Release Notes" } ## Upgrade Guide ### 1. Back Up Your Database ### 2. Update Images * Update the fastgpt image tag to v4.8.6 * Update the fastgpt-sandbox image tag to v4.8.6 * Update the commercial edition image tag to v4.8.6 ### 3. Run Initialization From any terminal, send 1 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/initv486' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This will initialize inherited permissions for apps. *** ## V4.8.6 Release Notes 1. New - App permission inheritance. 2. New - Knowledge Base now supports disabling individual collections. 3. New - System plugin architecture change. Added link reader and math calculator plugins. The official release will include documentation on creating custom system plugins. 4. New - Code sandbox runtime parameters. 5. New - Option to hide the header during AI conversations, primarily for mobile optimization. 6. Improved - File reading now defaults to MongoDB secondary nodes to reduce primary node load. 7. Improved - Prompt templates. 8. Improved - Fixed duplicate Mongo model loading. 9. Fixed - Creating a link collection not returning the ID. 10. Fixed - API documentation descriptions. 11. Fixed - API system prompt merging. 12. Fixed - Content inside team plugin folders failing to load. 13. Fixed - Knowledge Base collection folder breadcrumbs failing to load. 14. Fixed - Markdown export conversation error. 15. Fixed - Prompt template closing tag error. 16. Fixed - Documentation descriptions. file: ./content/self-host/upgrading/outdated/486.mdx meta: { "title": "V4.8.6(升级脚本)", "description": "FastGPT V4.8.6 更新说明" } ## 升级指南 ### 1. 做好数据库备份 ### 2. 修改镜像 * fastgpt 镜像 tag 修改成 v4.8.6 * fastgpt-sandbox 镜像 tag 修改成 v4.8.6 * 商业版镜像 tag 修改成 v4.8.6 ### 3. 执行初始化 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。 ```bash curl --location --request POST 'https://{{host}}/api/admin/initv486' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 会初始化应用的继承权限 *** ## V4.8.6 更新说明 1. 新增 - 应用权限继承 2. 新增 - 知识库支持单个集合禁用功能 3. 新增 - 系统插件模式变更,新增链接读取和数学计算器插件,正式版会更新如何自定义系统插件 4. 新增 - 代码沙盒运行参数 5. 新增 - AI对话时隐藏头部的功能,主要是适配移动端 6. 优化 - 文件读取,Mongo 默认使用从节点,减轻主节点压力 7. 优化 - 提示词模板 8. 优化 - Mongo model 重复加载 9. 修复 - 创建链接集合未返回 id 10. 修复 - 文档接口说明 11. 修复 - api system 提示合并 12. 修复 - 团队插件目录内的内容无法加载 13. 修复 - 知识库集合目录面包屑无法加载 14. 修复 - Markdown 导出对话异常 15. 修复 - 提示模板结束标签错误 16. 修复 - 文档描述 file: ./content/self-host/upgrading/outdated/487.en.mdx meta: { "title": "V4.8.7", "description": "FastGPT V4.8.7 Release Notes" } ## Upgrade Guide ### 1. Back up your database ### 2. Update images * Update the fastgpt image tag to v4.8.7 * Update the commercial edition image tag to v4.8.7 *** ## V4.8.7 Release Notes 1. New - Plugins now support standalone execution, publishing, and log viewing. 2. New - App search. 3. Improved - Chat dialog code. 4. Improved - Upgraded Dockerfile Node and pnpm versions. 5. Improved - Vision mode now works properly with local domain deployments. 6. Fixed - Unable to modify global variables in Simple Mode. 7. Fixed - GPT-4o unable to use tools and images simultaneously. file: ./content/self-host/upgrading/outdated/487.mdx meta: { "title": "V4.8.7", "description": "FastGPT V4.8.7 更新说明" } ## 升级指南 ### 1. 做好数据库备份 ### 2. 修改镜像 * fastgpt 镜像 tag 修改成 v4.8.7 * 商业版镜像 tag 修改成 v4.8.7 *** ## V4.8.7 更新说明 1. 新增 - 插件支持独立运行,发布和日志查看 2. 新增 - 应用搜索 3. 优化 - 对话框代码 4. 优化 - 升级 Dockerfile node 和 pnpm 版本 5. 优化 - local 域名部署,也可以正常使用 vision 模式 6. 修复 - 简易模式无法变更全局变量 7. 修复 - gpt4o 无法同时使用工具和图片 file: ./content/self-host/upgrading/outdated/488.en.mdx meta: { "title": "V4.8.8 (Upgrade Script)", "description": "FastGPT V4.8.8 Release Notes" } ## Upgrade Guide ### 1. Back up your database ### 2. Update images * Update the fastgpt image tag to v4.8.8-fix2 * Update the commercial edition image tag to v4.8.8 ### 3. Run initialization 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/initv488' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This will initialize inherited permissions for Knowledge Bases. *** ## V4.8.8 Release Notes [View full release notes](https://github.com/labring/FastGPT/releases/tag/v4.8.8) 1. New - Restructured system plugin architecture. Community members can now submit system plugins via PR. See: [How to Submit System Plugins to the FastGPT Community](https://fael3z0zfze.feishu.cn/wiki/ERZnw9R26iRRG0kXZRec6WL9nwh). 2. New - DuckDuckGo system plugin. 3. New - Lark webhook system plugin. 4. New - Revamped variable input method. Prompt input fields and all Textarea inputs in workflows now support typing `/` to trigger variable selection, allowing you to directly pick any upstream output value without dynamic imports. 5. Commercial - Knowledge Base permission inheritance. 6. Improved - Mobile quick app switching interaction. 7. Improved - Node icons. 8. Improved - Added a dedicated copy button to chat references for easier copying. Added collapsible reference content. 9. Improved - Upgraded OpenAI SDK with a custom Whisper model interface (the SDK's built-in Whisper interface doesn't seem to work well with standard FastAPI endpoints). 10. Fixed - Permission table declaration issue. 11. Fixed - Parallel execution nodes not recording run time correctly. 12. Fixed - Run details not displaying nested node information correctly. 13. Fixed - Simple Mode failing to load Knowledge Base configuration on first entry. 14. Fixed - Log debug level configuration not taking effect. 15. Fixed - When running plugins standalone, plugin input values were being variable-substituted, potentially causing downstream node variable issues. file: ./content/self-host/upgrading/outdated/488.mdx meta: { "title": "V4.8.8(升级脚本)", "description": "FastGPT V4.8.8 更新说明" } ## 升级指南 ### 1. 做好数据库备份 ### 2. 修改镜像 * fastgpt 镜像 tag 修改成 v4.8.8-fix2 * 商业版镜像 tag 修改成 v4.8.8 ### 3. 执行初始化 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。 ```bash curl --location --request POST 'https://{{host}}/api/admin/initv488' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 会初始化知识库的继承权限 *** ## V4.8.8 更新说明 [点击查看完整更新](https://github.com/labring/FastGPT/releases/tag/v4.8.8) 1. 新增 - 重构系统插件的结构。允许向开源社区 PR 系统插件,具体可见: [如何向 FastGPT 社区提交系统插件](https://fael3z0zfze.feishu.cn/wiki/ERZnw9R26iRRG0kXZRec6WL9nwh)。 2. 新增 - DuckDuckGo 系统插件。 3. 新增 - 飞书 webhook 系统插件。 4. 新增 - 修改变量填写方式。提示词输入框以以及工作流中所有 Textarea 输入框,支持输入 / 唤起变量选择,可直接选择所有上游输出值,无需动态引入。 5. 商业版新增 - 知识库权限继承。 6. 优化 - 移动端快速切换应用交互。 7. 优化 - 节点图标。 8. 优化 - 对话框引用增加额外复制案件,便于复制。增加引用内容折叠。 9. 优化 - OpenAI sdk 升级,并自定义了 whisper 模型接口(未仔细查看 sdk 实现,但 sdk 中 whisper 接口,似乎无法适配一般 fastapi 接口) 10. 修复 - Permission 表声明问题。 11. 修复 - 并行执行节点,运行时间未正确记录。 12. 修复 - 运行详情未正确展示嵌套节点信息。 13. 修复 - 简易模式,首次进入,无法正确获取知识库配置。 14. 修复 - Log debug level 配置无效。 15. 修复 - 插件独立运行时,会将插件输入的值进行变量替换,可能导致后续节点变量异常。 file: ./content/self-host/upgrading/outdated/489.en.mdx meta: { "title": "V4.8.9 (Upgrade Script)", "description": "FastGPT V4.8.9 Release Notes" } ## Upgrade Guide ### 1. Back up your database ### 2. Update images * Update the FastGPT image tag to v4.8.9 * Update the FastGPT commercial edition image tag to v4.8.9 * Sandbox image update is optional ### 3. Run initialization (Commercial Edition) 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/init/489' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` This initializes notification methods for multi-tenancy (internal use only, no action needed). *** ## V4.8.9 Release Notes 1. New - File upload configuration. Image upload capability is now determined by system configuration rather than relying on vision model availability. 2. New - AI chat node and tool calls support toggling "Enable image recognition". When enabled, it automatically retrieves images uploaded in the chat and image URLs from "User question". 3. New - Document parsing node. 4. Commercial - Team notification account binding for receiving important messages. 5. Commercial - Knowledge Base collection tagging for tag-based management. 6. Commercial - Knowledge Base search node supports tag filtering and creation date filtering. 7. Commercial - Transfer app owner permissions. 8. New - Delete all conversation starters. 9. New - QA splitting supports custom chunk sizes, and optimized the issue where GPT-4o-mini produced very little content with large chunks. 10. Improved - Lazy loading for chat messages to reduce network transfer. 11. Improved - Clear file selection cache to allow re-selecting the same file. 12. Fixed - Knowledge Base file upload progress not reaching 100% under unstable network or with many files. 13. Fixed - After deleting an app, returning to chat and selecting the last conversation from the deleted app showed an error. 14. Fixed - Plugin dynamic variable default values not displaying correctly. 15. Fixed - Tool call temperature and max response values not taking effect. 16. Fixed - In function call mode, GPT models require the `content` parameter in assistant role messages (doesn't affect most models since nearly all have switched to ToolChoice mode; FC mode is deprecated). 17. Fixed - Knowledge Base file upload progress updates could be incorrect. 18. Fixed - Knowledge Base page always resetting to the first page during rebuilding. 19. Fixed - Knowledge Base list OpenAPI authentication issue. 20. Fixed - Unable to provide feedback on new conversations via share links. file: ./content/self-host/upgrading/outdated/489.mdx meta: { "title": "V4.8.9(升级脚本)", "description": "FastGPT V4.8.9 更新说明" } ## 升级指南 ### 1. 做好数据库备份 ### 2. 修改镜像 * 更新 FastGPT 镜像 tag: v4.8.9 * 更新 FastGPT 商业版镜像 tag: v4.8.9 * Sandbox 镜像,可以不更新 ### 3. 商业版执行初始化 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**: ```bash curl --location --request POST 'https://{{host}}/api/admin/init/489' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` 会初始化多租户的通知方式,仅内部使用的,无需执行。 *** ## V4.8.9 更新说明 1. 新增 - 文件上传配置,不再依赖视觉模型决定是否可上传图片,而是通过系统配置决定。 2. 新增 - AI 对话节点和工具调用支持选择“是否开启图片识别”,开启后会自动获取对话框上传的图片和“用户问题”中的图片链接。 3. 新增 - 文档解析节点。 4. 商业版新增 - 团队通知账号绑定,用于接收重要信息。 5. 商业版新增 - 知识库集合标签功能,可以对知识库进行标签管理。 6. 商业版新增 - 知识库搜索节点支持标签过滤和创建时间过滤。 7. 商业版新增 - 转移 App owner 权限。 8. 新增 - 删除所有对话引导内容。 9. 新增 - QA 拆分支持自定义 chunk 大小,并优化 gpt4o-mini 拆分时,chunk 太大导致生成内容很少的问题。 10. 优化 - 对话框信息懒加载,减少网络传输。 11. 优化 - 清除选文件缓存,支持重复选择同一个文件。 12. 修复 - 知识库上传文件,网络不稳定或文件较多情况下,进度无法到 100%。 13. 修复 - 删除应用后回到聊天选择最后一次对话的应用为删除的应用时提示无该应用问题。 14. 修复 - 插件动态变量配置默认值时,无法正常显示默认值。 15. 修复 - 工具调用温度和最大回复值未生效。 16. 修复 - 函数调用模式,assistant role 中,GPT 模型必须传入 content 参数。(不影响大部分模型,目前基本都改用用 ToolChoice 模式,FC 模式已弃用)。 17. 修复 - 知识库文件上传进度更新可能异常。 18. 修复 - 知识库 rebuilding 时候,页面总是刷新到第一页。 19. 修复 - 知识库 list openapi 鉴权问题。 20. 修复 - 分享链接,新对话无法反馈。 file: ./content/self-host/upgrading/outdated/490.en.mdx meta: { "title": "V4.9.0 (Environment Changes, Upgrade Script)", "description": "FastGPT V4.9.0 Release Notes" } ## Upgrade Guide ### 1. Back Up Your Database ### 2. Update Images and PG Container * Update FastGPT image tag: v4.9.0 * Update FastGPT Pro image tag: v4.9.0 * Sandbox image: no update required * Update PG container to v0.8.0-pg15. See the [latest yml](https://raw.githubusercontent.com/labring/FastGPT/main/document/public/deploy/docker/main/global/docker-compose.pg.yml) ### 3. Replace OneAPI (Optional) Follow this step if you want to replace OneAPI with [AI Proxy](https://github.com/labring/aiproxy). #### 1. Modify the yml File Refer to the [latest yml](https://raw.githubusercontent.com/labring/FastGPT/main/document/public/deploy/docker/main/global/docker-compose.pg.yml) file. OneAPI has been removed and AI Proxy configuration has been added, including one service and one PgSQL database. Append the `aiproxy` configuration after the OneAPI configuration (don't remove OneAPI yet — the initialization process will automatically sync OneAPI's configuration).
AI Proxy Yml Configuration ``` # AI Proxy aiproxy: image: 'ghcr.io/labring/aiproxy:latest' container_name: aiproxy restart: unless-stopped depends_on: aiproxy_pg: condition: service_healthy networks: - fastgpt environment: # Corresponds to AIPROXY_API_TOKEN in FastGPT - ADMIN_KEY=aiproxy # Error log detail retention time (hours) - LOG_DETAIL_STORAGE_HOURS=1 # Database connection URL - SQL_DSN=postgres://postgres:aiproxy@aiproxy_pg:5432/aiproxy # Maximum retry attempts - RETRY_TIMES=3 # Billing not required - BILLING_ENABLED=false # Strict model validation not required - DISABLE_MODEL_CONFIG=true healthcheck: test: ['CMD', 'curl', '-f', 'http://localhost:3000/api/status'] interval: 5s timeout: 5s retries: 10 aiproxy_pg: image: pgvector/pgvector:0.8.0-pg15 # docker hub # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:v0.8.0-pg15 # Alibaba Cloud restart: unless-stopped container_name: aiproxy_pg volumes: - ./aiproxy_pg:/var/lib/postgresql/data networks: - fastgpt environment: TZ: Asia/Shanghai POSTGRES_USER: postgres POSTGRES_DB: aiproxy POSTGRES_PASSWORD: aiproxy healthcheck: test: ['CMD', 'pg_isready', '-U', 'postgres', '-d', 'aiproxy'] interval: 5s timeout: 5s retries: 10 ```
#### 2. Add FastGPT Environment Variables: Modify the environment variables for the FastGPT container in the yml file: ``` # AI Proxy address — takes priority if configured - AIPROXY_API_ENDPOINT=http://aiproxy:3000 # AI Proxy Admin Token, must match the ADMIN_KEY env var in AI Proxy - AIPROXY_API_TOKEN=aiproxy ``` #### 3. Restart Services Run `docker-compose down` to stop services, then `docker-compose up -d` to start them. This will add the `aiproxy` service and update FastGPT's configuration. #### 4. Run the OneAPI to AI Proxy Migration Script * If the container has internet access: ```bash # Enter the aiproxy container docker exec -it aiproxy sh # Install curl apk add curl # Run the migration script curl --location --request POST 'http://localhost:3000/api/channels/import/oneapi' \ --header 'Authorization: Bearer aiproxy' \ --header 'Content-Type: application/json' \ --data-raw '{ "dsn": "mysql://root:oneapimmysql@tcp(mysql:3306)/oneapi" }' # A response of {"data":[],"success":true} indicates success ``` * If the container has no internet access, expose the `aiproxy` external port and run the script locally. Expose the aiproxy port: 3003:3000, then run `docker-compose up -d` to restart services. ```bash # Run the script from your terminal curl --location --request POST 'http://localhost:3003/api/channels/import/oneapi' \ --header 'Authorization: Bearer aiproxy' \ --header 'Content-Type: application/json' \ --data-raw '{ "dsn": "mysql://root:oneapimmysql@tcp(mysql:3306)/oneapi" }' # A response of {"data":[],"success":true} indicates success ``` * If you're not familiar with Docker operations, skip the migration script and manually re-add channels after removing all OneAPI content. #### 5. Verify AI Proxy is Running in FastGPT Log in with the root account. On the `Account - Model Providers` page, you should see two new options: `Model Channels` and `Call Logs`. Open Model Channels to verify that your previous OneAPI channels are listed, confirming the migration was successful. You can then manually check that each channel is working properly. #### 6. Remove the OneAPI Service ```bash # Stop services, or selectively stop OneAPI and its MySQL docker-compose down # Remove OneAPI and its MySQL dependency from the yml file # Restart services docker-compose up -d ``` ### 4. Run the FastGPT 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/initv490' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` **Script Functions** 1. Upgrades the PG Vector extension version. 2. Updates all knowledge base collection fields. 3. Updates the index `type` field across all knowledge base data. (This takes a while — you may see a timeout at the end, which can be ignored. The process will continue incrementally as long as the database is running.) ## Compatibility & Deprecations 1. Deprecated — The previous custom file parsing solution for private deployments. Please update to the latest environment-variable configuration. [See Environment Variables](../../config/env.en.mdx) 2. Deprecated — The legacy local file upload API: `/api/core/dataset/collection/create/file` (previously available only in the Pro edition). This endpoint has been replaced by: `/api/core/dataset/collection/create/localFile` 3. Maintenance ending, deprecation upcoming — External file library APIs. Use the API File Library as a replacement. 4. API Update — For endpoints that include a `trainingType` field (file upload to knowledge base, link collection creation, API file library, push chunk data, etc.), `trainingType` will only support `chunk` and `QA` modes going forward. Enhanced indexing mode will use a separate field: `autoIndexes`. Legacy `trainingType=auto` code is still supported for now, but please migrate to the new API format as soon as possible. See: [Knowledge Base OpenAPI Documentation](../../../openapi/dataset.en.mdx) ## New Features 1. PDF enhanced parsing UI added to the page. Doc2x service is now built in, allowing direct PDF parsing via Doc2x. 2. Automatic image annotation, along with updated data logic and UI for knowledge base file uploads. 3. PG Vector extension upgraded to 0.8.0, introducing iterative search to reduce cases where data cannot be retrieved. 4. Added qwen-qwq series model configurations. ## Improvements 1. Knowledge base data no longer has a limit on the number of indexes — unlimited custom indexes are now supported. Input text indexes are automatically updated without affecting custom indexes. 2. Markdown parsing now detects Chinese punctuation after links and adds spacing. 3. Prompt-mode tool calls now support reasoning models, with improved format detection to reduce empty outputs. 4. Merged Mongo file read streams to reduce computation. Optimized storage chunks for significantly faster large file reads — 50MB PDF read time improved by 3x. 5. HTTP Body adaptation now supports string object types. ## Bug Fixes 1. Added security link validation for web scraping. 2. During batch runs, global variables were not passed to subsequent runs, causing incorrect final variable updates. file: ./content/self-host/upgrading/outdated/490.mdx meta: { "title": "V4.9.0(环境变量变更、升级脚本)", "description": "FastGPT V4.9.0 更新说明" } ## 更新指南 ### 1. 做好数据库备份 ### 2. 更新镜像和 PG 容器 * 更新 FastGPT 镜像 tag: v4.9.0 * 更新 FastGPT 商业版镜像 tag: v4.9.0 * Sandbox 镜像,可以不更新 * 更新 PG 容器为 v0.8.0-pg15, 可以查看[最新的 yml](https://raw.githubusercontent.com/labring/FastGPT/main/document/public/deploy/docker/main/global/docker-compose.pg.yml) ### 3. 替换 OneAPI(可选) 如果需要使用 [AI Proxy](https://github.com/labring/aiproxy) 替换 OneAPI 的用户可执行该步骤。 #### 1. 修改 yml 文件 参考[最新的 yml](https://raw.githubusercontent.com/labring/FastGPT/main/document/public/deploy/docker/main/global/docker-compose.pg.yml) 文件。里面已移除 OneAPI 并添加了 AIProxy 配置。包含一个服务和一个 PgSQL 数据库。将 `aiproxy` 的配置 `追加` 到 OneAPI 的配置后面(先不要删除 OneAPI,有一个初始化会自动同步 OneAPI 的配置)
AI Proxy Yml 配置 ``` # AI Proxy aiproxy: image: 'ghcr.io/labring/aiproxy:latest' container_name: aiproxy restart: unless-stopped depends_on: aiproxy_pg: condition: service_healthy networks: - fastgpt environment: # 对应 fastgpt 里的AIPROXY_API_TOKEN - ADMIN_KEY=aiproxy # 错误日志详情保存时间(小时) - LOG_DETAIL_STORAGE_HOURS=1 # 数据库连接地址 - SQL_DSN=postgres://postgres:aiproxy@aiproxy_pg:5432/aiproxy # 最大重试次数 - RETRY_TIMES=3 # 不需要计费 - BILLING_ENABLED=false # 不需要严格检测模型 - DISABLE_MODEL_CONFIG=true healthcheck: test: ['CMD', 'curl', '-f', 'http://localhost:3000/api/status'] interval: 5s timeout: 5s retries: 10 aiproxy_pg: image: pgvector/pgvector:0.8.0-pg15 # docker hub # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:v0.8.0-pg15 # 阿里云 restart: unless-stopped container_name: aiproxy_pg volumes: - ./aiproxy_pg:/var/lib/postgresql/data networks: - fastgpt environment: TZ: Asia/Shanghai POSTGRES_USER: postgres POSTGRES_DB: aiproxy POSTGRES_PASSWORD: aiproxy healthcheck: test: ['CMD', 'pg_isready', '-U', 'postgres', '-d', 'aiproxy'] interval: 5s timeout: 5s retries: 10 ```
#### 2. 增加 FastGPT 环境变量: 修改 yml 文件中,fastgpt 容器的环境变量: ``` # AI Proxy 的地址,如果配了该地址,优先使用 - AIPROXY_API_ENDPOINT=http://aiproxy:3000 # AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY - AIPROXY_API_TOKEN=aiproxy ``` #### 3. 重载服务 `docker-compose down` 停止服务,然后 `docker-compose up -d` 启动服务,此时会追加 `aiproxy` 服务,并修改 FastGPT 的配置。 #### 4. 执行 OneAPI 迁移 AI proxy 脚本 * 可联网方案: ```bash # 进入 aiproxy 容器 docker exec -it aiproxy sh # 安装 curl apk add curl # 执行脚本 curl --location --request POST 'http://localhost:3000/api/channels/import/oneapi' \ --header 'Authorization: Bearer aiproxy' \ --header 'Content-Type: application/json' \ --data-raw '{ "dsn": "mysql://root:oneapimmysql@tcp(mysql:3306)/oneapi" }' # 返回 {"data":[],"success":true} 代表成功 ``` * 无法联网时,可打开 `aiproxy` 的外网暴露端口,然后在本地执行脚本。 aiProxy 暴露端口:3003:3000,修改后重新 `docker-compose up -d` 启动服务。 ```bash # 在终端执行脚本 curl --location --request POST 'http://localhost:3003/api/channels/import/oneapi' \ --header 'Authorization: Bearer aiproxy' \ --header 'Content-Type: application/json' \ --data-raw '{ "dsn": "mysql://root:oneapimmysql@tcp(mysql:3306)/oneapi" }' # 返回 {"data":[],"success":true} 代表成功 ``` * 如果不熟悉 docker 操作,建议不要走脚本迁移,直接删除 OneAPI 所有内容,然后手动重新添加渠道。 #### 5. 进入 FastGPT 检查 `AI Proxy` 服务是否正常启动。 登录 root 账号后,在 `账号-模型提供商` 页面,可以看到多出了 `模型渠道` 和 `调用日志` 两个选项,打开模型渠道,可以看到之前 OneAPI 的渠道,说明迁移完成,此时可以手动再检查下渠道是否正常。 #### 6. 删除 OneAPI 服务 ```bash # 停止服务,或者针对性停止 OneAPI 和其 Mysql docker-compose down # yml 文件中删除 OneAPI 和其 Mysql 依赖 # 重启服务 docker-compose up -d ``` ### 4. 运行 FastGPT 升级脚本 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成 **FastGPT 域名**。 ```bash curl --location --request POST 'https://{{host}}/api/admin/initv490' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` **脚本功能** 1. 升级 PG Vector 插件版本 2. 全量更新知识库集合字段。 3. 全量更新知识库数据中,index 的 type 类型。(时间较长,最后可能提示 timeout,可忽略,数据库不崩都会一直增量执行) ## 兼容 & 弃用 1. 弃用 - 之前私有化部署的自定义文件解析方案,请同步更新到最新的环境变量配置方案。[点击查看环境变量说明](../../config/env.mdx) 2. 弃用 - 弃用旧版本地文件上传 API:/api/core/dataset/collection/create/file(以前仅商业版可用的 API,该接口已放切换成:/api/core/dataset/collection/create/localFile) 3. 停止维护,即将弃用 - 外部文件库相关 API,可通过 API 文件库替代。 4. API 更新 - 上传文件至知识库、创建连接集合、API 文件库、推送分块数据等带有 `trainingType` 字段的接口,`trainingType` 字段未来仅支持 `chunk` 和 `QA` 两种模式。增强索引模式将设置单独字段:`autoIndexes`,目前仍有适配旧版 `trainingType=auto` 代码,但请尽快变更成新接口类型。具体可见:[知识库 OpenAPI 文档](../../../openapi/dataset.mdx) ## 🚀 新增内容 1. PDF 增强解析交互添加到页面上。同时内嵌 Doc2x 服务,可直接使用 Doc2x 服务解析 PDF 文件。 2. 图片自动标注,同时修改知识库文件上传部分数据逻辑和交互。 3. pg vector 插件升级 0.8.0 版本,引入迭代搜索,减少部分数据无法被检索的情况。 4. 新增 qwen-qwq 系列模型配置。 ## ⚙️ 优化 1. 知识库数据不再限制索引数量,可无限自定义。同时可自动更新输入文本的索引,不影响自定义索引。 2. Markdown 解析,增加链接后中文标点符号检测,增加空格。 3. Prompt 模式工具调用,支持思考模型。同时优化其格式检测,减少空输出的概率。 4. Mongo 文件读取流合并,减少计算量。同时优化存储 chunks,极大提高大文件读取速度。50M PDF 读取时间提高 3 倍。 5. HTTP Body 适配,增加对字符串对象的适配。 ## 🐛 修复 1. 增加网页抓取安全链接校验。 2. 批量运行时,全局变量未进一步传递到下一次运行中,导致最终变量更新错误。 file: ./content/self-host/upgrading/outdated/491.en.mdx meta: { "title": "V4.9.1 (Upgrade Script)", "description": "FastGPT V4.9.1 Release Notes" } ## Upgrade Guide ### 1. Back Up Your Database ### 2. Update Images * Update FastGPT image tag: v4.9.1-fix2 * Update FastGPT Pro image tag: v4.9.1-fix2 * Sandbox image: no update required * AIProxy image changed to: registry.cn-hangzhou.aliyuncs.com/labring/aiproxy:v0.1.3 ### 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/initv491' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` **Script Functions** Re-processes tokenization using the latest jieba dictionary. This takes a while — you can monitor progress in the logs. ## New Features 1. Pro edition supports single-team mode for better internal member management. 2. Knowledge base chunk reader. 3. API knowledge base supports PDF enhanced parsing. 4. Team member invitations now use an invite link model. 5. Hybrid search weight configuration support. 6. Rerank model selection and weight configuration support. The knowledge base search weight calculation has been adjusted from `vector search weight + full-text search weight + rerank weight` to `search weight + rerank weight`. This may affect search results — you can adjust the relevant weights to adapt your data. ## Improvements 1. Knowledge base data input UI improvements. 2. App-bound knowledge base data fetching moved to backend processing. 3. Added dependency package security version checks and upgraded some dependencies. 4. Model testing code improvements. 5. Optimized reasoning output parsing: as long as a model is configured to support reasoning, `` tags will always be parsed, even when reasoning is disabled during a conversation. 6. Loaded the latest jieba dictionary for improved full-text search tokenization. ## Bug Fixes 1. Max response tokens tooltip showing incorrect values. 2. HTTP Node failing to parse strings containing newline characters. 3. Knowledge base question optimization not passing conversation history. 4. Missing error message translations. 5. Content extraction node: incorrect schema for array types. 6. Model channel testing not actually targeting the specified channel. 7. Adding a custom model would also save default model fields, causing incorrect default model detection. 8. Prompt-mode tool calls not null-checking the reasoning chain, causing UI rendering errors. 9. Editing app info causing avatar loss. 10. Share link titles being reset on refresh. 11. Authentication failure when calculating parentPath, causing it to be cleared. file: ./content/self-host/upgrading/outdated/491.mdx meta: { "title": "V4.9.1(升级脚本)", "description": "FastGPT V4.9.1 更新说明" } ## 更新指南 ### 1. 做好数据库备份 ### 2. 更新镜像 * 更新 FastGPT 镜像 tag: v4.9.1-fix2 * 更新 FastGPT 商业版镜像 tag: v4.9.1-fix2 * Sandbox 镜像,可以不更新 * AIProxy 镜像修改为: registry.cn-hangzhou.aliyuncs.com/labring/aiproxy:v0.1.3 ### 3. 执行升级脚本 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。 ```bash curl --location --request POST 'https://{{host}}/api/admin/initv491' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` **脚本功能** 重新使用最新的 jieba 分词库进行分词处理。时间较长,可以从日志里查看进度。 ## 🚀 新增内容 1. 商业版支持单团队模式,更好的管理内部成员。 2. 知识库分块阅读器。 3. API 知识库支持 PDF 增强解析。 4. 邀请团队成员,改为邀请链接模式。 5. 支持混合检索权重设置。 6. 支持重排模型选择和权重设置,同时调整了知识库搜索权重计算方式,改成 搜索权重 + 重排权重,而不是向量检索权重+全文检索权重+重排权重。会对检索结果有一定影响,可以通过调整相关权重来进行数据适配。 ## ⚙️ 优化 1. 知识库数据输入框交互 2. 应用拉取绑定知识库数据交由后端处理。 3. 增加依赖包安全版本检测,并升级部分依赖包。 4. 模型测试代码。 5. 优化思考过程解析逻辑:只要配置了模型支持思考,均会解析 `` 标签,不会因为对话时,关闭思考而不解析。 6. 载入最新 jieba 分词库,增强全文检索分词效果。 ## 🐛 修复 1. 最大响应 tokens 提示显示错误的问题。 2. HTTP Node 中,字符串包含换行符时,会解析失败。 3. 知识库问题优化中,未传递历史记录。 4. 错误提示翻译缺失。 5. 内容提取节点,array 类型 schema 错误。 6. 模型渠道测试时,实际未指定渠道测试。 7. 新增自定义模型时,会把默认模型字段也保存,导致默认模型误判。 8. 修复 promp 模式工具调用,未判空思考链,导致 UI 错误展示。 9. 编辑应用信息导致头像丢失。 10. 分享链接标题会被刷新掉。 11. 计算 parentPath 时,存在鉴权失败清空。 file: ./content/self-host/upgrading/outdated/4910.en.mdx meta: { "title": "V4.9.10", "description": "FastGPT V4.9.10 Release Notes" } ## Upgrade Guide Important: This update rebuilds the full-text index. During the rebuild, full-text search results will be empty. On a 4c16g instance, rebuilding approximately 7 million full-text indexes takes about 25 minutes. For a seamless upgrade, you'll need to handle table synchronization yourself. ### 1. Back Up Your Data ### 2. Update Image Tags * Update FastGPT image tag: v4.9.10-fix2 * Update FastGPT Pro image tag: v4.9.10-fix2 * mcp\_server: no update required * Sandbox: no update required * AIProxy: no update required ## New Features 1. Support for setting the `systemEnv.hnswMaxScanTuples` parameter in PG to increase the total data volume for iterative search. 2. Knowledge base preprocessing now includes a "Chunk Conditions" parameter to control when chunking should be skipped. 3. Knowledge base preprocessing now includes a "Paragraph Priority" mode with configurable maximum paragraph depth. The previous "Length Priority" mode no longer includes embedded paragraph priority logic. 4. Workflow adjusted to single-direction input/output connections, with quick "add next node" support. 5. Lark and Yuque knowledge bases are now available in the Community Edition. 6. Latest Gemini and Claude model presets. ## Improvements 1. Increased default timeout for LLM stream calls. 2. Various confirmation dialog UI improvements. 3. Renamed the knowledge base "Table Dataset" to "Backup Import". Also added support for exporting and importing knowledge base indexes. 4. Knowledge base citation limit in workflows: if no related AI nodes exist in the workflow, the interaction mode switches to manual input only, with a limit of 10 million. 5. Mobile voice input now accurately detects whether the device is a phone rather than just a small screen. 6. Optimized context truncation algorithm to always preserve at least one Human message. ## Bug Fixes 1. Incorrect score sorting during full-text search across multiple knowledge bases. 2. Stream response potentially capturing incorrect `finish_reason` values. 3. Tool call mode not saving reasoning output. 4. Knowledge base `indexSize` parameter not taking effect. 5. Incorrect preview citations and context after 2 levels of workflow nesting. 6. Extra leading space when converting xlsx to Markdown. 7. Base64 images in Markdown files not being extracted and saved during file reading. file: ./content/self-host/upgrading/outdated/4910.mdx meta: { "title": "V4.9.10", "description": "FastGPT V4.9.10 更新说明" } ## 升级指南 重要提示:本次更新会重新构建全文索引,构建期间,全文检索结果会为空,4c16g 700 万组全文索引大致消耗 25 分钟。如需无缝升级,需自行做表同步工程。 ### 1. 做好数据备份 ### 2. 更新镜像 tag * 更新 FastGPT 镜像 tag: v4.9.10-fix2 * 更新 FastGPT 商业版镜像 tag: v4.9.10-fix2 * mcp\_server 无需更新 * Sandbox 无需更新 * AIProxy 无需更新 ## 🚀 新增内容 1. 支持 PG 设置`systemEnv.hnswMaxScanTuples`参数,提高迭代搜索的数据总量。 2. 知识库预处理参数增加 “分块条件”,可控制某些情况下不进行分块处理。 3. 知识库预处理参数增加 “段落优先” 模式,可控制最大段落深度。原“长度优先”模式,不再内嵌段落优先逻辑。 4. 工作流调整为单向接入和接出,支持快速的添加下一步节点。 5. 开放飞书和语雀知识库到社区版。 6. gemini 和 claude 最新模型预设。 ## ⚙️ 优化 1. LLM stream调用,默认超时调大。 2. 部分确认交互优化。 3. 纠正原先知识库的“表格数据集”名称,改成“备份导入”。同时支持知识库索引的导出和导入。 4. 工作流知识库引用上限,如果工作流中没有相关 AI 节点,则交互模式改成纯手动输入,并且上限为 1000万。 5. 语音输入,移动端判断逻辑,准确判断是否为手机,而不是小屏。 6. 优化上下文截取算法,至少保证留下一组 Human 信息。 ## 🐛 修复 1. 全文检索多知识库时排序得分排序不正确。 2. 流响应捕获 finish\_reason 可能不正确。 3. 工具调用模式,未保存思考输出。 4. 知识库 indexSize 参数未生效。 5. 工作流嵌套 2 层后,获取预览引用、上下文不正确。 6. xlsx 转成 Markdown 时候,前面会多出一个空格。 7. 读取 Markdown 文件时,Base64 图片未进行额外抓换保存。 file: ./content/self-host/upgrading/outdated/4911.en.mdx meta: { "title": "V4.9.11 (Upgrade Script)", "description": "FastGPT V4.9.11 Release Notes" } ## Upgrade Guide ### 1. Update Images: * Update FastGPT image tag: v4.9.11 * Update FastGPT Pro image tag: v4.9.11 * mcp\_server: no update required * Update Sandbox image tag: v4.9.11 * AIProxy: no update required ### 2. Run the Upgrade Script This script only needs to be run by Pro edition users. 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/initv4911' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` **Script Functions** 1. Migrates third-party knowledge base API configurations. ## New Features 1. Pro edition supports image knowledge bases. 2. Added node search functionality in the workflow editor. 3. Sub-workflow version control in workflows now supports a "Keep Latest Version" option — no manual updates needed. 4. Additional audit operation logs. 5. Knowledge base now has an async document parsing queue — documents can be imported without waiting for parsing to complete. 6. Third-party knowledge base development documentation. [View here](../../../guide/dataset/third-party/third_dataset.en.mdx) ## Improvements 1. Raw text cache now uses GridFS storage for higher capacity. 2. Added knowledge base template import option. ## Bug Fixes 1. Admin-declared global system tools in workflows unable to be version-managed. 2. Context errors when an interactive node precedes a tool call node. 3. Backup import failing to chunk content under 1,000 characters. 4. Custom PDF parsing unable to save Base64 images. 5. Non-stream requests not performing CITE marker replacement. 6. Hidden security vulnerability in the Python sandbox. 7. Missing confirm button when importing plugins via curl. file: ./content/self-host/upgrading/outdated/4911.mdx meta: { "title": "V4.9.11(升级脚本)", "description": "FastGPT V4.9.11 更新说明" } ## 更新指南 ### 1. 更新镜像: * 更新 FastGPT 镜像 tag: v4.9.11 * 更新 FastGPT 商业版镜像 tag: v4.9.11 * mcp\_server 无需更新 * 更新 Sandbox 镜像 tag: v4.9.11 * AIProxy 无需更新 ### 2. 执行升级脚本 该脚本仅需商业版用户执行。 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。 ```bash curl --location --request POST 'https://{{host}}/api/admin/initv4911' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` **脚本功能** 1. 移动第三方知识库 API 配置。 ## 🚀 新增内容 1. 商业版支持图片知识库。 2. 工作流中增加节点搜索功能。 3. 工作流中,子流程版本控制,可选择“保持最新版本”,无需手动更新。 4. 增加更多审计操作日志。 5. 知识库增加文档解析异步队列,导入文档时,无需等待文档解析完毕才进行导入。 6. 第三方知识库开发文档, [点击查看](../../../guide/dataset/third-party/third_dataset.mdx) ## ⚙️ 优化 1. 原文缓存改用 gridfs 存储,提高上限。 2. 增加知识库模板导入选项。 ## 🐛 修复 1. 工作流中,管理员声明的全局系统工具,无法进行版本管理。 2. 工具调用节点前,有交互节点时,上下文异常。 3. 修复备份导入,小于 1000 字时,无法分块问题。 4. 自定义 PDF 解析,无法保存 base64 图片。 5. 非流请求,未进行 CITE 标记替换。 6. Python 沙盒存在隐藏风险。 7. curl 导入插件缺失确认按键 file: ./content/self-host/upgrading/outdated/4912.en.mdx meta: { "title": "V4.9.12 (Environment Changes)", "description": "FastGPT V4.9.12 Release Notes" } ## Upgrade Guide ### 1. Update Environment Variables Add the following environment variable to both the `fastgpt` and `fastgpt-pro` image configurations: `AES256_SECRET_KEY=` — used for secret key encryption. ### 2. Update Images: * Update FastGPT image tag: v4.9.12 * Update FastGPT Pro image tag: v4.9.12 * mcp\_server: no update required * Sandbox: no update required * Update AIProxy image tag: v0.2.2 ## New Features 1. Enhanced AI Proxy monitoring with chart and table views for model call and performance metrics. 2. HTTP nodes and MCP now support separate "Auth Configuration" — plaintext credentials are never sent back to the client, ensuring data security. 3. Question classification and content extraction now automatically include the previous round's results in the prompt for additional guidance. 4. Conditional node now supports variable references. 5. Pro edition supports LLM-based automatic segment detection during knowledge base chunking. 6. Admin dashboard with data analytics. 7. Doubao 1.6 series models and updated Qwen model configurations. ## Improvements 1. Password validation now accepts more special characters. 2. Backend now fully computes knowledge base chunk parameters to prevent default values from being incorrectly applied in auto mode. 3. Text chunking moved to a worker thread to avoid blocking. 4. More subscription plan usage information displayed. 5. Input box styling improvements, with updated voice input UI for both desktop and mobile. 6. MCP tool calls now use raw schema for invocation to ensure completeness. 7. Deleting knowledge base files no longer fails if the file doesn't exist. 8. Upgraded MCP SDK with compatibility for the latest HTTP Streamable protocol. 9. Yuque document library now recursively fetches data from document-type directories. ## Bug Fixes 1. Custom QA extraction prompts being overwritten. 2. Template import failing when empty indexes exist in the data. 3. Potential XSS vulnerability on the login page. 4. Voice input in the text box causing the file list to be lost. 5. Image TTL field not being cleared in knowledge base documents, causing images to expire. 6. MCP tool storage not escaping integer type data. file: ./content/self-host/upgrading/outdated/4912.mdx meta: { "title": "V4.9.12(环境变量变更)", "description": "FastGPT V4.9.12 更新说明" } ## 更新指南 ### 1. 更新环境变量 在 `fastgpt`和`fastgpt-pro`镜像环境变量中加入: `AES256_SECRET_KEY=` 变量,用于密钥加密。 ### 2. 更新镜像: * 更新 FastGPT 镜像 tag: v4.9.12 * 更新 FastGPT 商业版镜像 tag: v4.9.12 * mcp\_server 无需更新 * Sandbox 无需更新 * 更新 AIProxy 镜像 tag: v0.2.2 ## 🚀 新增内容 1. AI proxy 监控完善,支持以图表/表格形式查看模型调用和性能情况。 2. HTTP 节点和 MCP 支持单独“鉴权配置”,鉴权配置明文不会二次返回客户端,以保障数据安全。 3. 问题分类和内容提取,提示词中自动加入上一轮结果进行额外引导。 4. 判断器支持变量引用。 5. 商业版支持知识库分块时,LLM 进行自动分段识别。 6. Admin 管理员数据看板。 7. 豆包 1.6 系列模型,更新 qwen 模型配置。 ## ⚙️ 优化 1. 密码校验时,增加更多的特殊字符 2. 后端全量计算知识库 chunk 参数,避免自动模式下部分参数未正确使用默认值。 3. 将文本分块移至 worker 线程,避免阻塞。 4. 展示更多套餐用量信息。 5. 优化输入框样式,桌面和移动端的语音输入样式更新。 6. MCP 工具调用,使用 Raw schema 进行工具调用,保障完整性。 7. 删除知识库文件时,如果文件不存在,不会阻断删除。 8. 升级 MCP SDK,兼容最新的 HTTPStreamable。 9. 语雀文档库,递归获取文档类型目录下的数据。 ## 🐛 修复 1. 自定义问答提取提示词被覆盖。 2. 模板导入时,存在空 indexes 时,导致数据插入失败。 3. 登录页可能存在的 XSS 攻击。 4. 输入框语音输入时候会丢失文件列表的问题。 5. 知识库文档中图片 TTL 字段未清除,导致图片过期。 6. MCP 工具存储时,未转义 int 类型数据。 file: ./content/self-host/upgrading/outdated/4913.en.mdx meta: { "title": "V4.9.13", "description": "FastGPT V4.9.13 Release Notes" } ## Upgrade Guide ### 1. Update Images: * Update FastGPT image tag: v4.9.13 * Update FastGPT Pro image tag: v4.9.13 * mcp\_server: no update required * Sandbox: no update required * AIProxy: no update required ## New Features 1. Subscription plan caching to reduce MongoDB query frequency. ## Improvements 1. All NodeId random value generation adjusted to avoid starting with a digit. 2. Knowledge base collection search now supports nested search. ## Bug Fixes 1. Chat log date range selection issues. 2. System prompt potentially being duplicated when passed via API calls. 3. AI chat/tool calls reading files from history even when no file link was selected. 4. Manually updating knowledge base indexes incorrectly deleting old indexes, causing manual indexes to become ineffective. file: ./content/self-host/upgrading/outdated/4913.mdx meta: { "title": "V4.9.13", "description": "FastGPT V4.9.13 更新说明" } ## 更新指南 ### 1. 更新镜像: * 更新 FastGPT 镜像 tag: v4.9.13 * 更新 FastGPT 商业版镜像 tag: v4.9.13 * mcp\_server 无需更新 * Sandbox 无需更新 * AIProxy 无需更新 ## 🚀 新增内容 1. 套餐缓存,减少 MongoDB 查询次数。 ## ⚙️ 优化 1. 所有 NodeId 调整随机值生成,避免首字母数字开头。 2. 知识库集合搜索,支持嵌套搜索。 ## 🐛 修复 1. 对话日志,日期范围选择问题。 2. API 调用时,传入的 system 提示词可能会重复。 3. AI 对话/工具调用,未选择文件链接时,也会从历史记录读取文件。 4. 手动更新知识库索引时,错误的删除旧索引,导致手动索引无效。 file: ./content/self-host/upgrading/outdated/4914.en.mdx meta: { "title": "V4.9.14", "description": "FastGPT V4.9.14 Release Notes" } ## Upgrade Guide ### 1. Update Images: * Update FastGPT image tag: v4.9.14 * Update FastGPT Pro image tag: v4.9.14 * mcp\_server: no update required * Sandbox: no update required * AIProxy: no update required ## New Features 1. Knowledge base import now supports automatically adding the filename to the system index. 2. Admin-side audit logs. ## Improvements 1. Unified knowledge base training queue code logic. 2. Input box UX improvements. 3. Image knowledge base now automatically removes line breaks from descriptions to prevent model output line breaks from breaking image display. 4. Image indexing now generates separate image content descriptions, and attaches them to search results after retrieval — enabling LLMs to understand image content. 5. Auto-completion for MCP Schema entries missing the `properties` field to prevent errors with certain models. 6. Error handling for potential JSON import template failures. 7. Dangerous characters filtered during CSV export. 8. Added security request headers. 9. Changing password now invalidates all other active sessions. 10. Citation display optimization: detects preceding URLs and automatically adds spacing. ## Bug Fixes 1. Knowledge base data input incorrectly detecting QA mode. 2. Knowledge base tag condition conflicts. 3. Chat log like/dislike statistics. file: ./content/self-host/upgrading/outdated/4914.mdx meta: { "title": "V4.9.14", "description": "FastGPT V4.9.14 更新说明" } ## 更新指南 ### 1. 更新镜像: * 更新 FastGPT 镜像 tag: v4.9.14 * 更新 FastGPT 商业版镜像 tag: v4.9.14 * mcp\_server 无需更新 * Sandbox 无需更新 * AIProxy 无需更新 ## 🚀 新增内容 1. 知识库导入,支持配置:自动将文件名加入系统索引中。 2. Admin 端审计日志。 ## ⚙️ 优化 1. 统一知识库训练队列代码逻辑。 2. 输入框 UX。 3. 图片知识库自动去除介绍中的换行,避免模型输出换行导致无法显示图片。 4. 图片索引过程会单独描述图片内容,并在检索后会将图片描述赋予检索结果,使语言模型也可以对图片进行理解。 5. 对于 MCP Schema 中,缺少`properties`属性的值,进行自动补全,避免部分模型报错。 6. 对 JSON 导入模板可能的报错进行捕获。 7. 过滤 CSV 导出时可能存在的危险字符串。 8. 添加安全请求头。 9. 修改密码,强制其他登录端失效。 10. Cite 引用展示优化,识别前置的 url 并自动加空格。 ## 🐛 修复 1. 知识库数据输入,识别 QA 模式错误。 2. 知识库标签条件冲突。 3. 对话日志点赞点踩统计。 file: ./content/self-host/upgrading/outdated/492.en.mdx meta: { "title": "V4.9.2 (Environment Changes)", "description": "FastGPT V4.9.2 Release Notes" } ## Upgrade Guide You can skip directly to v4.9.3 — v4.9.2 has a workflow data type conversion bug. ### 1. Back Up Your Database ### 2. SSO Migration Pro edition users using SSO or member sync with DingTalk or WeCom need to migrate their existing SSO configuration: Refer to [SSO & External Member Sync](../../../guide/admin/sso.en.mdx) for deploying and configuring the `sso-service`. 1. Before upgrading images, copy and back up the existing configuration from the Pro admin panel (e.g., for WeCom, copy the AppId, Secret, etc.). 2. Follow the documentation above to deploy the SSO service and configure the relevant environment variables. 3. If you were previously using WeCom org structure sync, after upgrading, switch the team mode to "Sync Mode" in the Pro admin panel. ### 3. Configuration Parameter Changes Rename the `systemEnv.pgHNSWEfSearch` parameter in your `config.json` file to `hnswEfSearch`. Pro edition users can make this change in the admin panel under `System Configuration - Basic Settings` after upgrading. ### 4. Update Images * Update FastGPT image tag: v4.9.2 * Update FastGPT Pro image tag: v4.9.2 * Sandbox image: no update required * AIProxy image changed to: registry.cn-hangzhou.aliyuncs.com/labring/aiproxy:v0.1.4 ## Important Updates * Knowledge base data import API changes: added optional parameters `chunkSettingMode`, `chunkSplitMode`, and `indexSize`. See the [Knowledge Base Data Import API](../../../openapi/dataset.en.mdx) documentation for details. ## New Features 1. Knowledge base chunking optimization: supports separate configuration for chunk size and index size, allowing extra-large chunks that trade higher input tokens for complete chunks. 2. Knowledge base chunking now includes custom separator presets and supports custom newline-based splitting. 3. External variables renamed to Custom Variables. Now supports debugging during testing, and the variable is hidden in share links. 4. Collection sync now supports syncing title changes. 5. Team member management overhaul: extracted mainstream IM SSO (WeCom, Lark, DingTalk) and added support for connecting to FastGPT via custom SSO. Also improved member sync with external systems. 6. Support for `oceanbase` vector database. Set the `OCEANBASE_URL` environment variable to enable. 7. PDF parsing example based on mistral-ocr. 8. PDF parsing example based on miner-u. ## Improvements 1. Chat log export now includes member names. 2. Invite link UI improvements. 3. When SSL certificate is unavailable and copy fails, a dialog is shown for manual copying. 4. FastGPT now properly displays AI Proxy channel names even when channels are not built in. 5. Upgraded Next.js to version 14.2.25. 6. Workflow node array-string type now auto-adapts to string input. 7. Workflow node array type now automatically JSON-parses string input. 8. AI Proxy log optimization: removed retry failure logs, keeping only the final error log. 9. Personal info and notification display improvements. 10. Model testing loading animation improvements. 11. Minor chunking algorithm adjustments: * Stronger continuity between cross-processing symbols. * Code blocks now use the LLM model context as chunk size to better preserve code block integrity. * Tables now use the LLM model context as chunk size to better preserve table integrity. ## Bug Fixes 1. Lark and Yuque knowledge bases unable to sync. 2. Channel testing using the custom request URL instead of the channel request URL when a custom URL was configured. 3. Speech recognition model testing unable to test disabled models. 4. Admin-configured system plugins failing authentication when the plugin contains other system apps. 5. Removing TTS custom request URL requiring the requestAuth field to be filled. file: ./content/self-host/upgrading/outdated/492.mdx meta: { "title": "V4.9.2(环境变量变更)", "description": "FastGPT V4.9.2 更新说明" } ## 更新指南 可直接升级v4.9.3,v4.9.2存在一个工作流数据类型转化错误。 ### 1. 做好数据库备份 ### 2. SSO 迁移 使用了 SSO 或成员同步的商业版用户,并且是对接`钉钉`、`企微`的,需要迁移已有的 SSO 相关配置: 参考:[SSO & 外部成员同步](../../../guide/admin/sso.mdx)中的配置进行`sso-service`的部署和配置。 1. 先将原商业版后台中的相关配置项复制备份出来(以企微为例,将 AppId, Secret 等复制出来)再进行镜像升级。 2. 参考上述文档,部署 SSO 服务,配置相关的环境变量 3. 如果原先使用企微组织架构同步的用户,升级完镜像后,需要在商业版后台切换团队模式为“同步模式” ### 3. 配置参数变更 修改`config.json`文件中`systemEnv.pgHNSWEfSearch`参数名,改成`hnswEfSearch`。\ 商业版用户升级镜像后,直接在后台`系统配置-基础配置`中进行变更。 ### 4. 更新镜像 * 更新 FastGPT 镜像 tag: v4.9.2 * 更新 FastGPT 商业版镜像 tag: v4.9.2 * Sandbox 镜像,可以不更新 * AIProxy 镜像修改为: registry.cn-hangzhou.aliyuncs.com/labring/aiproxy:v0.1.4 ## 重要更新 * 知识库导入数据 API 变更,增加`chunkSettingMode`,`chunkSplitMode`,`indexSize`可选参数,具体可参考 [知识库导入数据 API](../../../openapi/dataset.mdx) 文档。 ## 🚀 新增内容 1. 知识库分块优化:支持单独配置分块大小和索引大小,允许进行超大分块,以更大的输入 Tokens 换取完整分块。 2. 知识库分块增加自定义分隔符预设值,同时支持自定义换行符分割。 3. 外部变量改名:自定义变量。 并且支持在测试时调试,在分享链接中,该变量直接隐藏。 4. 集合同步时,支持同步修改标题。 5. 团队成员管理重构,抽离主流 IM SSO(企微、飞书、钉钉),并支持通过自定义 SSO 接入 FastGPT。同时完善与外部系统的成员同步。 6. 支持 `oceanbase` 向量数据库。填写环境变量`OCEANBASE_URL`即可。 7. 基于 mistral-ocr 的 PDF 解析示例。 8. 基于 miner-u 的 PDF 解析示例。 ## ⚙️ 优化 1. 导出对话日志时,支持导出成员名。 2. 邀请链接交互。 3. 无 SSL 证书时复制失败,会提示弹窗用于手动复制。 4. FastGPT 未内置 ai proxy 渠道时,也能正常展示其名称。 5. 升级 nextjs 版本至 14.2.25。 6. 工作流节点数组字符串类型,自动适配 string 输入。 7. 工作流节点数组类型,自动进行 JSON parse 解析 string 输入。 8. AI proxy 日志优化,去除重试失败的日志,仅保留最后一份错误日志。 9. 个人信息和通知展示优化。 10. 模型测试 loading 动画优化。 11. 分块算法小调整: * 跨处理符号之间连续性更强。 * 代码块分割时,用 LLM 模型上下文作为分块大小,尽可能保证代码块完整性。 * 表格分割时,用 LLM 模型上下文作为分块大小,尽可能保证表格完整性。 ## 🐛 修复 1. 飞书和语雀知识库无法同步。 2. 渠道测试时,如果配置了模型自定义请求地址,会走自定义请求地址,而不是渠道请求地址。 3. 语音识别模型测试未启用的模型时,无法正常测试。 4. 管理员配置系统插件时,如果插件包含其他系统应用,无法正常鉴权。 5. 移除 TTS 自定义请求地址时,必须需要填 requestAuth 字段。 file: ./content/self-host/upgrading/outdated/493.en.mdx meta: { "title": "V4.9.3", "description": "FastGPT V4.9.3 Release Notes" } ## Upgrade Guide ### 1. Back Up Your Database ### 2. Update Images * Update FastGPT image tag: v4.9.3 * Update FastGPT Pro image tag: v4.9.3 * Sandbox image tag: v4.9.3 * AIProxy image tag: v0.1.5 ## New Features 1. Workflow debug mode now supports interactive nodes. 2. Code execution now supports Python 3. ## Bug Fixes 1. Workflow format conversion errors. file: ./content/self-host/upgrading/outdated/493.mdx meta: { "title": "V4.9.3", "description": "FastGPT V4.9.3 更新说明" } ## 更新指南 ### 1. 做好数据库备份 ### 2. 更新镜像 * 更新 FastGPT 镜像 tag: v4.9.3 * 更新 FastGPT 商业版镜像 tag: v4.9.3 * Sandbox 镜像tag: v4.9.3 * AIProxy 镜像tag: v0.1.5 ## 🚀 新增内容 1. 工作流 debug 模式支持交互节点。 2. 代码运行支持 Python3 代码。 ## 🐛 修复 1. 工作流格式转化异常。 file: ./content/self-host/upgrading/outdated/494.en.mdx meta: { "title": "V4.9.4 (Environment Changes, Upgrade Script)", "description": "FastGPT V4.9.4 Release Notes" } ## Upgrade Guide ### 1. Back Up Your Data ### 2. Install Redis * For Docker deployments, refer to the latest `docker-compose.yml` file to add Redis configuration. Add a Redis container and configure the `REDIS_URL` environment variable for both `fastgpt` and `fastgpt-pro`. * For Sealos deployments, create a new `redis` database in the Database section, copy the `internal connection` URL as the Redis connection string, then configure the `REDIS_URL` environment variable for both `fastgpt` and `fastgpt-pro`. | | | | | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | | ![](../../../../public/imgs/sealos-redis1.png) | ![](../../../../public/imgs/sealos-redis2.png) | ![](../../../../public/imgs/sealos-redis3.png) | ### 3. Update Image Tags * Update FastGPT image tag: v4.9.4 * Update FastGPT Pro image tag: v4.9.4 * Sandbox: no update required * AIProxy: no update required ### 4. Run the Upgrade Script This script only needs to be run by Pro edition users. 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/initv494' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` **Script Functions** 1. Updates the site sync scheduler. ## New Features 1. Collection data training status display. 2. SMTP email sending plugin. 3. BullMQ message queue. 4. Partial data caching via Redis. 5. Site sync now supports configuring training parameters and incremental sync. 6. AI chat/tool calls now return the model's `finish_reason` field for easier tracking of output interruption causes. 7. Mobile voice input UI adjustments. ## Improvements 1. Admin template rendering adjustments. 2. Chat file expiration time now configurable via environment variable. 3. MongoDB log database can now be deployed independently. ## Bug Fixes 1. Unable to click into subdirectories when searching apps/knowledge bases. 2. Retraining parameters not properly initialized. 3. Inconsistent requests in package/service across multiple apps. file: ./content/self-host/upgrading/outdated/494.mdx meta: { "title": "V4.9.4(环境变量变更、升级脚本)", "description": "FastGPT V4.9.4 更新说明" } ## 升级指南 ### 1. 做好数据备份 ### 2. 安装 Redis * docker 部署的用户,参考最新的 `docker-compose.yml` 文件增加 Redis 配置。增加一个 redis 容器,并配置`fastgpt`,`fastgpt-pro`的环境变量,增加 `REDIS_URL` 环境变量。 * Sealos 部署的用户,在数据库里新建一个`redis`数据库,并复制`内网地址的 connection` 作为 `redis` 的链接串。然后配置`fastgpt`,`fastgpt-pro`的环境变量,增加 `REDIS_URL` 环境变量。 | | | | | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | | ![](../../../../public/imgs/sealos-redis1.png) | ![](../../../../public/imgs/sealos-redis2.png) | ![](../../../../public/imgs/sealos-redis3.png) | ### 3. 更新镜像 tag * 更新 FastGPT 镜像 tag: v4.9.4 * 更新 FastGPT 商业版镜像 tag: v4.9.4 * Sandbox 无需更新 * AIProxy 无需更新 ### 4. 执行升级脚本 该脚本仅需商业版用户执行。 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**: ```bash curl --location --request POST 'https://{{host}}/api/admin/initv494' \ --header 'rootkey: {{rootkey}}' \ --header 'Content-Type: application/json' ``` **脚本功能** 1. 更新站点同步定时器 ## 🚀 新增内容 1. 集合数据训练状态展示 2. SMTP 发送邮件插件 3. BullMQ 消息队列。 4. 利用 redis 进行部分数据缓存。 5. 站点同步支持配置训练参数和增量同步。 6. AI 对话/工具调用,增加返回模型 finish\_reason 字段,便于追踪模型输出中断原因。 7. 移动端语音输入交互调整 ## ⚙️ 优化 1. Admin 模板渲染调整。 2. 支持环境变量配置对话文件过期时间。 3. MongoDB log 库可独立部署。 ## 🐛 修复 1. 搜索应用/知识库时,无法点击目录进入下一层。 2. 重新训练时,参数未成功初始化。 3. package/service 部分请求在多 app 中不一致。 file: ./content/self-host/upgrading/outdated/495.en.mdx meta: { "title": "V4.9.5", "description": "FastGPT V4.9.5 Release Notes" } ## Upgrade Guide ### 1. Back Up Your Data ### 2. Update Image Tags * Update FastGPT image tag: v4.9.5 * Update FastGPT Pro image tag: v4.9.5 * Sandbox: no update required * AIProxy: no update required ## New Features 1. Granular team member permissions: separately control whether members can create root-level apps/knowledge bases and API keys. 2. Interactive nodes now work inside nested workflows. 3. Team member operation audit logs. 4. User input node now supports checkboxes. ## Improvements 1. Traditional Chinese translation updates. 2. ARM image builds. ## Bug Fixes 1. Incorrect password validation rules. 2. Share links unable to hide knowledge base search results. 3. Regex compatibility issues on older iOS versions. 4. QA extraction queue counter not resetting after errors, causing the queue to stop working. 5. Debug mode interactive nodes potentially causing infinite loops on next step. file: ./content/self-host/upgrading/outdated/495.mdx meta: { "title": "V4.9.5", "description": "FastGPT V4.9.5 更新说明" } ## 升级指南 ### 1. 做好数据备份 ### 2. 更新镜像 tag * 更新 FastGPT 镜像 tag: v4.9.5 * 更新 FastGPT 商业版镜像 tag: v4.9.5 * Sandbox 无需更新 * AIProxy 无需更新 ## 🚀 新增内容 1. 团队成员权限细分,可分别控制是否可创建在根目录应用/知识库以及 API Key 2. 支持交互节点在嵌套工作流中使用。 3. 团队成员操作日志。 4. 用户输入节点支持多选框。 ## ⚙️ 优化 1. 繁体中文翻译。 2. Arm 镜像打包 ## 🐛 修复 1. password 检测规则错误。 2. 分享链接无法隐藏知识库检索结果。 3. IOS 低版本正则兼容问题。 4. 修复问答提取队列错误后,计数器未清零问题,导致问答提取队列失效。 5. Debug 模式交互节点下一步可能造成死循环。 file: ./content/self-host/upgrading/outdated/496.en.mdx meta: { "title": "V4.9.6 (Environment Changes)", "description": "FastGPT V4.9.6 Release Notes" } ## New Features 1. Apps can now be called externally via MCP. 2. Support for creating tools using the MCP SSE protocol. 3. Batch execution node now supports interactive nodes, enabling human participation in each loop iteration. 4. Added workspace secondary menu with merged toolbox. 5. Added system configurations for grok3, GPT4.1, o-series, and Gemini 2.5 models. ## Improvements 1. Enhanced workflow data type conversion robustness and compatibility. 2. Python sandbox code now supports large data inputs. 3. Breadcrumb component now supports configuring whether the last step is clickable. 4. Knowledge base tool call results now automatically prepend image domain names. 5. GitHub Action runner upgraded to Ubuntu 24. 6. Removed extra leading/trailing newlines when replying via Lark, WeChat Official Account, and other third-party channels. 7. Adjusted chunking strategy: large tables are now split into independent chunks instead of being merged into oversized blocks. 8. Iframe embed component now includes built-in microphone permission declaration. ## Bug Fixes 1. Sub-workflows with interactive nodes not fully restoring all sub-workflow data. 2. Completion v1 API not accepting the `interactive` parameter, causing API call failures. 3. Consecutive tool calls causing abnormal context truncation. ## Upgrade Guide ### 1. Back Up Your Data ### 2. Deploy the MCP Server Service #### Docker Deployment Add the `fastgpt-mcp-server` service to your `docker-compose.yml` file: ```yml fastgpt-mcp-server: container_name: fastgpt-mcp-server image: ghcr.io/labring/fastgpt-mcp_server:v4.9.6 ports: - 3005:3000 networks: - fastgpt restart: always environment: - FASTGPT_ENDPOINT=http://fastgpt:3000 ``` #### Sealos Deployment In `App Management`, add a new `fastgpt-mcp-server` app with the image `ghcr.io/labring/fastgpt-mcp_server:v4.9.6` and set the environment variable `FASTGPT_ENDPOINT=`. ### 3. Update FastGPT Container Environment Variables #### Community Edition Add the following to your `config.json` configuration file: `"feconfigs.mcpServerProxyEndpoint": ""` (no trailing slash). For example: ```json { "feConfigs": { "lafEnv": "https://laf.dev", "mcpServerProxyEndpoint": "https://mcp.fastgpt.cn" } } ``` #### Pro Edition In the Admin panel, go to `System Configuration - Basic Settings - System Parameters` and set the `MCP Proxy Server URL` to the public access URL of your `fastgpt-mcp-server`. ### 4. Update Image Tags * Update FastGPT image tag: v4.9.6 * Update FastGPT Pro image tag: v4.9.6 * Update Sandbox image tag: v4.9.6 * Add FastGPT MCP Server image tag: v4.9.6 * AIProxy: no update required file: ./content/self-host/upgrading/outdated/496.mdx meta: { "title": "V4.9.6(环境变量变更)", "description": "FastGPT V4.9.6 更新说明" } ## 🚀 新增内容 1. 以 MCP 方式对外提供应用调用。 2. 支持以 MCP SSE 协议创建工具。 3. 批量执行节点支持交互节点,可实现每一轮循环都人工参与。 4. 增加工作台二级菜单,合并工具箱。 5. 增加 grok3、GPT4.1、o 系列、Gemini2.5 模型系统配置。 ## ⚙️ 优化 1. 工作流数据类型转化鲁棒性和兼容性增强。 2. Python sandbox 代码,支持大数据输入。 3. 路径组件支持配置最后一步是否可点击。 4. 知识库工具调用结果,自动补充图片域名。 5. GitHub action runner 升级成 unbuntu24 6. 去除飞书、公众号等三方渠道,回复时,可能前后多一个换行的问题。 7. 调整分块策略,大表格时,不进行超大块合并,而是独立拆块。 8. Iframe 嵌套组件,内置允许麦克风声明。 ## 🐛 修复 1. 修复子工作流包含交互节点时,未成功恢复子工作流所有数据。 2. completion v1 接口,未接受 interactive 参数,导致 API 调用失败。 3. 连续工具调用,上下文截断异常 ## 升级指南 ### 1. 做好数据备份 ### 2. 部署 MCP server 服务 #### Docker 部署 在 `docker-compose.yml` 文件中,加入 `fastgpt-mcp-server` 服务: ```yml fastgpt-mcp-server: container_name: fastgpt-mcp-server image: ghcr.io/labring/fastgpt-mcp_server:v4.9.6 ports: - 3005:3000 networks: - fastgpt restart: always environment: - FASTGPT_ENDPOINT=http://fastgpt:3000 ``` #### Sealos 部署 直接在 `应用管理` 中,增加一个 `fastgpt-mcp-server` 应用,镜像为 `ghcr.io/labring/fastgpt-mcp_server:v4.9.6`,并设置环境变量 `FASTGPT_ENDPOINT=fastgpt 的访问地址`。 ### 3. 修改 FastGPT 容器环境变量 #### 社区版 修改 `config.json` 配置文件,增加: `"feconfigs.mcpServerProxyEndpoint": "fastgpt-mcp-server 的访问地址"`,末尾不要携带/,例如: ```json { "feConfigs": { "lafEnv": "https://laf.dev", "mcpServerProxyEndpoint": "https://mcp.fastgpt.cn" } } ``` #### 商业版 在 Admin 后台,`系统配置-基础配置-系统参数` 中的 `MCP 转发服务地址` 中,设置 `fastgpt-mcp-server` 的公网访问地址。 ### 4. 更新镜像 tag * 更新 FastGPT 镜像 tag: v4.9.6 * 更新 FastGPT 商业版镜像 tag: v4.9.6 * 更新 Sandbox 镜像 tag: v4.9.6 * 增加 FastGPT mcp server 镜像 tag: v4.9.6 * AIProxy 无需更新 file: ./content/self-host/upgrading/outdated/497.en.mdx meta: { "title": "V4.9.7", "description": "FastGPT V4.9.7 Release Notes" } ## Upgrade Guide ### 1. Back Up Your Data ### 2. Update Image Tags * Update FastGPT image tag: v4.9.7-fix2 * Update FastGPT Pro image tag: v4.9.7 * mcp\_server: no update required * Sandbox: no update required * Update AIProxy image tag: v0.1.8 ## New Features 1. Knowledge base answers now include citations at the end of each referenced paragraph. 2. MCP tools support the HTTP Streamable protocol. 3. MCP Server supports editing tool names to accommodate clients that don't support Chinese characters. 4. Right-click in the workflow editor to auto-align nodes. 5. Support for custom `config.json` path in production environments. 6. API calls support passing a special chatId (`NO_RECORD_HISTORIES`) to prevent the system from storing conversation history. 7. Rerank model usage-based billing support. 8. Subscription plan redemption codes. 9. Alipay payment support. 10. Short link analytics tracking. 11. Added Jina AI model system configuration. ## Improvements 1. Doc2x document parsing: added error message capture and increased timeout duration. 2. Adjusted PG vector query to force vector index usage. 3. Conversation time statistics now accurately return the overall workflow execution time. 4. Audio parsing duration now retrieved from ai\_proxy. 5. AI model token counts now prioritize the API usage values for accuracy. If unavailable, falls back to GPT-3.5 estimation. 6. Optimized the chat log list API to handle scenarios with large numbers of messages in a single conversation. ## Bug Fixes 1. File upload chunk size limit to prevent exceeding MongoDB limits. 2. Usage dashboard unable to retrieve statistics for specific members. 3. Dashboard API returning incorrect statistics due to timezone handling issues. 4. LLM model test API unable to test disabled models. Also fixed the issue where model testing would strip custom request URLs. 5. Copy app permission issues. 6. Chat record export now limits individual conversations to 1,000 message pairs to prevent export failures. 7. Workflow variables followed by another workflow variable not triggering rendering. 8. Debugging the knowledge base search module showing "no permission" errors. 9. Text content extraction node default value assignment logic. 10. Share links forcibly returning citation content from nested apps. 11. Knowledge base collection metadata filtering: same-named tags across different knowledge bases returning no results when using `$and` filters. 12. App list permission configuration potentially causing index refresh issues. file: ./content/self-host/upgrading/outdated/497.mdx meta: { "title": "V4.9.7", "description": "FastGPT V4.9.7 更新说明" } ## 升级指南 ### 1. 做好数据备份 ### 2. 更新镜像 tag * 更新 FastGPT 镜像 tag: v4.9.7-fix2 * 更新 FastGPT 商业版镜像 tag: v4.9.7 * mcp\_server 无需更新 * Sandbox 无需更新 * 更新 AIProxy 镜像 tag: v0.1.8 ## 🚀 新增内容 1. 知识库回答时,回答段落末尾增加引用。 2. MCP 工具支持 HTTP Streamable 协议。 3. MCP server 支持编辑工具名,适配部分客户端不支持中文名问题。 4. 工作流右键可自动对齐节点。 5. 支持生产环境自定义`config.json`路径。 6. API 调用,支持传递一个特殊 chatId(`NO_RECORD_HISTORIES`),使得系统不会进行历史记录存储。 7. 支持 Rerank 模型按量计费。 8. 套餐兑换码功能。 9. 支付宝支付。 10. 短链数据埋点。 11. 新增 Jina AI 模型系统配置。 ## ⚙️ 优化 1. Doc2x 文档解析,增加报错信息捕获,增加超时时长。 2. 调整 PG vector 查询语句,强制使用向量索引。 3. 对话时间统计,准确返回工作流整体运行时间。 4. 从 ai\_proxy 获取音频解析时长。 5. AI 模型 Token 值均优先采用 API usage,确保 tokens 值准确,若为空,则再采用 GPT3.5 的估算方式。 6. 优化对话日志 list 接口,适配单个对话框,大量对话的场景。 ## 🐛 修复 1. 文件上传分块大小限制,避免超出 MongoDB 限制。 2. 使用记录仪表盘,无法获取指定成员的使用统计。 3. 仪表盘接口,因未考虑时区问题,统计异常。 4. LLM 模型测试接口,无法测试未启用的 LLM。同时修复,模型测试接口会把模型自定义请求地址去除问题。 5. Copy app 权限问题。 6. 导出对话记录,限制单条对话记录消息上限 1000 组,避免导出失败。 7. 工作流变量下一段文本仍是工作流变量,不触发渲染。 8. 调试知识库检索模块,提示无权操作知识库。 9. 文本内容提取节点,默认值赋值逻辑。 10. 分享链接中,会强制返回嵌套应用中的引用内容。 11. 知识库集合元数据过滤时,不同知识库的同名标签使用 $and 筛选无法获取结果。 12. 修复应用列表,权限配置可能出现 index 刷新问题。 file: ./content/self-host/upgrading/outdated/498.en.mdx meta: { "title": "V4.9.8", "description": "FastGPT V4.9.8 Release Notes" } ## Upgrade Guide ### 1. Back Up Your Data ### 2. Update Image Tags * Update FastGPT image tag: v4.9.8 * Update FastGPT Pro image tag: v4.9.8 * mcp\_server: no update required * Sandbox: no update required * AIProxy: no update required ## New Features 1. Support for parallel tool call execution. 2. All built-in tasks switched from non-stream mode to stream mode to avoid compatibility issues with models that don't support non-stream mode. To override, you can force `stream=false` in the model's `Extra Body` parameters. 3. Qwen3 model presets. 4. Yuque knowledge base now supports setting a root directory. 5. Configurable password expiration — users will be forced to change their password on next login after expiration. 6. Password login now includes preLogin temporary key verification. 7. Admin panel now supports configuring visibility of publishing channels and third-party knowledge bases. ## Improvements 1. Chat log list optimization to prevent memory overflow with large datasets. 2. Token calculation worker is now preloaded to prevent thread blocking from concurrent creation during main tasks. 3. Workflow node version control UI improvements. 4. Web fetch and html2md optimization: now supports video and audio tag conversion. ## Bug Fixes 1. App list / knowledge base list: incorrect permission display for delete row actions. 2. Opening knowledge base search parameters automatically enabling the rerank option. 3. Incorrect API request format for LLM json\_schema mode. 4. Expired image indexes not properly cleared during retraining, causing image loss. 5. Retraining permission issues. 6. Documentation link URLs. 7. Claude tool calls failing due to empty index values. 8. Nested workflows with interactive nodes inside tool calls causing abnormal flow behavior. file: ./content/self-host/upgrading/outdated/498.mdx meta: { "title": "V4.9.8", "description": "FastGPT V4.9.8 更新说明" } ## 升级指南 ### 1. 做好数据备份 ### 2. 更新镜像 tag * 更新 FastGPT 镜像 tag: v4.9.8 * 更新 FastGPT 商业版镜像 tag: v4.9.8 * mcp\_server 无需更新 * Sandbox 无需更新 * AIProxy 无需更新 ## 🚀 新增内容 1. 支持 Toolcalls 并行执行。 2. 将所有内置任务,从非 stream 模式调整成 stream 模式,避免部分模型不支持非 stream 模式。如需覆盖,则可以在模型`额外 Body`参数中,强制指定`stream=false`。 3. qwen3 模型预设 4. 语雀知识库支持设置根目录。 5. 可配置密码过期时间,过期后下次登录会强制要求修改密码。 6. 密码登录增加 preLogin 临时密钥校验。 7. 支持 Admin 后台配置发布渠道和第三方知识库的显示隐藏。 ## ⚙️ 优化 1. Chat log list 优化,避免大数据时超出内存限制。 2. 预加载 token 计算 worker,避免主任务中并发创建导致线程阻塞。 3. 工作流节点版本控制交互优化。 4. 网络获取以及 html2md 优化,支持视频和音频标签的转换。 ## 🐛 修复 1. 应用列表/知识库列表,删除行权限展示问题。 2. 打开知识库搜索参数后,重排选项自动被打开。 3. LLM json\_schema 模式 API 请求格式错误。 4. 重新训练时,图片过期索引未成功清除,导致图片会丢失。 5. 重新训练权限问题。 6. 文档链接地址。 7. Claude 工具调用,由于 index 为空,导致工具调用失败。 8. 嵌套工作流,工具调用下包含交互节点时,流程异常。 file: ./content/self-host/upgrading/outdated/499.en.mdx meta: { "title": "V4.9.9", "description": "FastGPT V4.9.9 Release Notes" } ## Upgrade Guide ### 1. Back Up Your Data ### 2. Pro Edition Users: Replace Your License Pro edition users can contact the FastGPT team for a license replacement plan. After replacement, you can upgrade the system directly — the admin panel will prompt you to enter the new license. ### 3. Update Image Tags * Update FastGPT image tag: v4.9.9 * Update FastGPT Pro image tag: v4.9.9 * mcp\_server: no update required * Sandbox: no update required * AIProxy: no update required ## New Features 1. Switched from JWT to SessionId-based login authentication, with configurable maximum concurrent client sessions. 2. New Pro edition license management model. 3. WeChat Official Account calls now display and log chat conversation errors for easier troubleshooting. 4. API knowledge base now supports BasePath selection. Requires an additional API endpoint — see [API Knowledge Base Introduction](../../../guide/dataset/third-party/api_dataset.en.mdx#4-获取文件详细信息用于获取文件信息) for details. ## Improvements 1. Optimized tool call logic for new tool detection. 2. Adjusted citation prompt text. ## Bug Fixes 1. Unable to retrieve app history save/publish records. 2. Member MCP tool creation permission issues. 3. Source citation display passing incorrect IDs, causing "no permission to access this file" errors. 4. Answer annotation frontend data errors. file: ./content/self-host/upgrading/outdated/499.mdx meta: { "title": "V4.9.9", "description": "FastGPT V4.9.9 更新说明" } ## 升级指南 ### 1. 做好数据备份 ### 2. 商业版用户替换新 License 商业版用户可以联系 FastGPT 团队支持同学,获取 License 替换方案。替换后,可以直接升级系统,管理后台会提示输入新 License。 ### 3. 更新镜像 tag * 更新 FastGPT 镜像 tag: v4.9.9 * 更新 FastGPT 商业版镜像 tag: v4.9.9 * mcp\_server 无需更新 * Sandbox 无需更新 * AIProxy 无需更新 ## 🚀 新增内容 1. 切换 SessionId 来替代 JWT 实现登录鉴权,可控制最大登录客户端数量。 2. 新的商业版 License 管理模式。 3. 公众号调用,显示记录 chat 对话错误,方便排查。 4. API 知识库支持 BasePath 选择,需增加 API 接口,具体可见[API 知识库介绍](../../../guide/dataset/third-party/api_dataset.mdx#4-获取文件详细信息用于获取文件信息) ## ⚙️ 优化 1. 优化工具调用,新工具的判断逻辑。 2. 调整 Cite 引用提示词。 ## 🐛 修复 1. 无法正常获取应用历史保存/发布记录。 2. 成员创建 MCP 工具权限问题。 3. 来源引用展示,存在 ID 传递错误,导致提示无权操作该文件。 4. 回答标注前端数据报错。 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 ![](/imgs/plugins/entry.png) ### 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. ![](/imgs/plugins/files.png) ### 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. 进入配置页面 ![](/imgs/plugins/entry.png) ### 2. 准备工具文件 在上传之前,请确保您的 `.pkg` 文件是从 fastgpt-plugin 项目中通过 `bun run build:pkg` 命令打包后的 `dist/pkgs` 文件夹下得到的 ![](/imgs/plugins/files.png) ### 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 ![](/imgs/aichat.png) ## 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. ![](/imgs/aichat02.png) ![](/imgs/aichat2.png) 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'; ## 特点 * 可重复添加 * 触发执行 * 核心模块 ![](/imgs/aichat.png) ## 参数说明 ## AI模型 可以通过 [config.json](../../../../self-host/config/model/intro.mdx) 配置可选的对话模型。 点击AI模型后,可以配置模型的相关参数。 ![](/imgs/aichat02.png) ![](/imgs/aichat2.png) 具体配置参数介绍可以参考: [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 ![](/imgs/extract1.png) ## 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 模块 * 核心模块 ![](/imgs/extract1.png) ## 功能 从文本中提取结构化数据,通常是配合 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 ![](/imgs/coreferenceResolution1.jpg) ## 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: ![](/imgs/coreferenceResolution2.webp) 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: ![](/imgs/coreferenceResolution3.webp) ## 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": "问题优化模块介绍和使用" } ## 特点 * 可重复添加 * 有外部输入 * 触发执行 ![](/imgs/coreferenceResolution1.jpg) ## 背景 在 RAG 中,我们需要根据输入的问题去数据库里执行 embedding 搜索,查找相关的内容,从而查找到相似的内容(简称知识库搜索)。 在搜索的过程中,尤其是连续对话的搜索,我们通常会发现后续的问题难以搜索到合适的内容,其中一个原因是知识库搜索只会使用“当前”的问题去执行。看下面的例子: ![](/imgs/coreferenceResolution2.webp) 用户在提问“第二点是什么”的时候,只会去知识库里查找“第二点是什么”,压根查不到内容。实际上需要查询的是“QA 结构是什么”。因此我们需要引入一个【问题优化】模块,来对用户当前的问题进行补全,从而使得知识库搜索能够搜索到合适的内容。使用补全后效果如下: ![](/imgs/coreferenceResolution3.webp) ## 功能 调用 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 | | | | ------------------------------ | ------------------------------ | | ![](/imgs/customfeedback1.jpg) | ![](/imgs/customfeedback2.jpg) | | ![](/imgs/customfeedback3.jpg) | ![](/imgs/customfeedback4.jpg) | ## 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": "自定义反馈模块介绍" } 该模块为临时模块,后续会针对该模块进行更全面的设计。 ## 特点 * 可重复添加 * 无外部输入 * 自动执行 | | | | ------------------------------ | ------------------------------ | | ![](/imgs/customfeedback1.jpg) | ![](/imgs/customfeedback2.jpg) | | ![](/imgs/customfeedback3.jpg) | ![](/imgs/customfeedback4.jpg) | ## 介绍 自定义反馈模块,可以为你的对话增加一个反馈标记,从而方便在后台更好的分析对话的数据。 在调试模式下,不会记录反馈内容,而是直接提示: `自动反馈测试: 反馈内容`。 在对话模式(对话、分享窗口、带 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 ![](/imgs/flow-dataset1.png) ## 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) ## 特点 * 可重复添加(复杂编排时防止线太乱,可以更美观) * 有外部输入 * 有静态配置 * 触发执行 * 核心模块 ![](/imgs/flow-dataset1.png) ## 参数说明 ### 输入 - 关联的知识库 可以选择一个或多个**相同向量模型**的知识库,用于向量搜索。 ### 输入 - 搜索参数 [点击查看参数介绍](../../../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" } | | | | --------------------------------- | --------------------------------- | | ![](/imgs/document_analysis1.png) | ![](/imgs/document_analysis2.png) | 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 文档解析模块介绍" } | | | | --------------------------------- | --------------------------------- | | ![](/imgs/document_analysis1.png) | ![](/imgs/document_analysis2.png) | 开启文件上传后,可使用文档解析组件。 ## 功能 ## 作用 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 ![](/imgs/form_input1.png) ## 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. ![](/imgs/form_input2.png) In the example above, when the Form Input node is triggered, the chat box is hidden and the conversation enters interactive mode. ![](/imgs/form_input3.png) 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 表单输入模块介绍" } ## 特点 * 用户交互 * 可重复添加 * 触发执行 ![](/imgs/form_input1.png) ## 功能 「表单输入」节点属于用户交互节点,当触发这个节点时,对话会进入“交互”状态,会记录工作流的状态,等用户完成交互后,继续向下执行工作流 ![](/imgs/form_input2.png) 比如上图中的例子,当触发表单输入节点时,对话框隐藏,对话进入“交互状态” ![](/imgs/form_input3.png) 当用户填完必填的信息并点击提交后,节点能够收集用户填写的表单信息,传递到后续的节点中使用 ## 作用 能够精准收集需要的用户信息,再根据用户信息进行后续操作 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 ![](/imgs/http1.jpg) ## 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'; ## 特点 * 可重复添加 * 手动配置 * 触发执行 * 核中核模块 ![](/imgs/http1.jpg) ## 介绍 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" } ![](/imgs/knowledge_merge1.png) ## 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). ![](/imgs/knowledge_merge2.png) Use **Knowledge Base Search Merge** to combine results from multiple Knowledge Bases into one. ![](/imgs/knowledge_merge3.png) ## 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 知识库搜索引用合并模块介绍" } ![](/imgs/knowledge_merge1.png) ## 作用 将多个知识库搜索结果合并成一个结果进行输出,并会通过 RRF 进行重新排序(根据排名情况),并且支持最大 tokens 过滤。 ## 使用方法 AI对话只能接收一个知识库引用内容。因此,如果调用了多个知识库,无法直接引用所有知识库(如下图) ![](/imgs/knowledge_merge2.png) 使用**知识库搜索引用合并**,可以把多个知识库的搜索结果合在一起。 ![](/imgs/knowledge_merge3.png) ## 可用例子: 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. ![Batch Processing node](/imgs/fastgpt-loop-node.png) > 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`) 2. **Loop Body (Required)**: Defines the node flow executed in each iteration: * Loop Body Start: Marks where the loop begins * Loop Body End: Marks where the loop ends, with an optional output variable ### Loop Body Configuration ![Loop body configuration](/imgs/fastgpt-loop-node-config.webp) 1. Inside the loop body, you can add any type of node: * AI Chat node * HTTP Request node * Content Extraction node * Text Processing node, etc. 2. Loop Body End node configuration: * Select the output variable from the dropdown * This variable is collected as the current iteration's result * Results from all iterations form a new array as the final output ## Examples ### Batch Processing an Array Suppose you have an array of texts that each need AI processing. This is the most basic and common use case. #### Steps 1. Prepare the input array ![Prepare input array](/imgs/fastgpt-loop-node-example-1.png) Use a Code Execution node to create a test array: ```javascript const texts = [ "这是第一段文本", "这是第二段文本", "这是第三段文本" ]; return { textArray: texts }; ``` 2. Configure the Batch Processing node ![Configure Batch Processing node](/imgs/fastgpt-loop-node-example-2.png) * Array input: Select the `textArray` output from the previous Code Execution node. * Add an AI Chat node inside the loop body to process each text. Set the prompt to: `Please translate this text to English`. * Add a Specified Reply node to output the translated text. * Set the Loop Body End node's output variable to the AI reply content. #### Execution Flow ![Execution flow](/imgs/fastgpt-loop-node-example-3.png) 1. The Code Execution node runs and generates the test array 2. The Batch Processing node receives the array and begins iteration 3. For each element: * The AI Chat node processes the current element * The Specified Reply node outputs the translated text * The Loop Body End node collects the result 4. After all elements are processed, the result array is output ### Long Text Translation When translating long texts, you often face these challenges: * Text length exceeds LLM token limits * Translation style must remain consistent * Context coherence must be maintained * Translation quality may need multiple refinement passes The **Batch Processing** node handles these well. #### Steps 1. Text preprocessing and segmentation ![Text preprocessing and segmentation](/imgs/fastgpt-loop-node-example-4.png) Use a Code Execution node for text segmentation: ```javascript const MAX_HEADING_LENGTH = 7; // Max heading length const MAX_HEADING_CONTENT_LENGTH = 200; // Max heading content length const MAX_HEADING_UNDERLINE_LENGTH = 200; // Max heading underline length const MAX_HTML_HEADING_ATTRIBUTES_LENGTH = 100; // Max HTML heading attributes length const MAX_LIST_ITEM_LENGTH = 200; // Max list item length const MAX_NESTED_LIST_ITEMS = 6; // Max nested list items const MAX_LIST_INDENT_SPACES = 7; // Max list indent spaces const MAX_BLOCKQUOTE_LINE_LENGTH = 200; // Max blockquote line length const MAX_BLOCKQUOTE_LINES = 15; // Max blockquote lines const MAX_CODE_BLOCK_LENGTH = 1500; // Max code block length const MAX_CODE_LANGUAGE_LENGTH = 20; // Max code language length const MAX_INDENTED_CODE_LINES = 20; // Max indented code lines const MAX_TABLE_CELL_LENGTH = 200; // Max table cell length const MAX_TABLE_ROWS = 20; // Max table rows const MAX_HTML_TABLE_LENGTH = 2000; // Max HTML table length const MIN_HORIZONTAL_RULE_LENGTH = 3; // Min horizontal rule length const MAX_SENTENCE_LENGTH = 400; // Max sentence length const MAX_QUOTED_TEXT_LENGTH = 300; // Max quoted text length const MAX_PARENTHETICAL_CONTENT_LENGTH = 200; // Max parenthetical content length const MAX_NESTED_PARENTHESES = 5; // Max nested parentheses const MAX_MATH_INLINE_LENGTH = 100; // Max inline math length const MAX_MATH_BLOCK_LENGTH = 500; // Max math block length const MAX_PARAGRAPH_LENGTH = 1000; // Max paragraph length const MAX_STANDALONE_LINE_LENGTH = 800; // Max standalone line length const MAX_HTML_TAG_ATTRIBUTES_LENGTH = 100; // Max HTML tag attributes length const MAX_HTML_TAG_CONTENT_LENGTH = 1000; // Max HTML tag content length const LOOKAHEAD_RANGE = 100; // Lookahead range for sentence boundaries const AVOID_AT_START = `[\\s\\]})>,']`; // Characters to avoid at start const PUNCTUATION = `[.!?…]|\\.{3}|[\\u2026\\u2047-\\u2049]|[\\p{Emoji_Presentation}\\p{Extended_Pictographic}]`; // Punctuation const QUOTE_END = `(?:'(?=\`)|''(?=\`\`))`; // Quote end const SENTENCE_END = `(?:${PUNCTUATION}(?] {0,${MAX_HTML_HEADING_ATTRIBUTES_LENGTH}}>)[^\\r\\n]{1,${MAX_HEADING_CONTENT_LENGTH}}(?:)?(?:\\r?\\n|$))` + "|" + // New pattern for citations `(?:\\[[0-9]+\\][^\\r\\n]{1,${MAX_STANDALONE_LINE_LENGTH}})` + "|" + // 2. List items (bulleted, numbered, lettered, or task lists, including nested, up to three levels, with length constraints) `(?:(?:^|\\r?\\n)[ \\t]{0,3}(?:[-*+•]|\\d{1,3}\\.\\w\\.|\\[[ xX]\\])[ \\t]+${SENTENCE_PATTERN.replace(/{MAX_LENGTH}/g, String (MAX_LIST_ITEM_LENGTH))}` + `(?:(?:\\r?\\n[ \\t]{2,5}(?:[-*+•]|\\d{1,3}\\.\\w\\.|\\[[ xX]\\])[ \\t]+${SENTENCE_PATTERN.replace(/{MAX_LENGTH}/g, String (MAX_LIST_ITEM_LENGTH))}){0,${MAX_NESTED_LIST_ITEMS}}` + `(?:\\r?\\n[ \\t]{4,${MAX_LIST_INDENT_SPACES}}(?:[-*+•]|\\d{1,3}\\.\\w\\.|\\[[ xX]\\])[ \\t]+${SENTENCE_PATTERN.replace(/{MAX_LENGTH}/g, String (MAX_LIST_ITEM_LENGTH))}){0,${MAX_NESTED_LIST_ITEMS}})?)` + "|" + // 3. Block quotes (including nested quotes and citations, up to three levels, with length constraints) `(?:(?:^>(?:>|\\s{2,}){0,2}${SENTENCE_PATTERN.replace(/{MAX_LENGTH}/g, String(MAX_BLOCKQUOTE_LINE_LENGTH))}\\r?\\n?){1,$ {MAX_BLOCKQUOTE_LINES}})` + "|" + // 4. Code blocks (fenced, indented, or HTML pre/code tags, with length constraints) `(?:(?:^|\\r?\\n)(?:\`\`\`|~~~)(?:\\w{0,${MAX_CODE_LANGUAGE_LENGTH}})?\\r?\\n[\\s\\S]{0,${MAX_CODE_BLOCK_LENGTH}}?(?:\`\`\`|~~~)\\r?\\n?` + `|(?:(?:^|\\r?\\n)(?: {4}|\\t)[^\\r\\n]{0,${MAX_LIST_ITEM_LENGTH}}(?:\\r?\\n(?: {4}|\\t)[^\\r\\n]{0,${MAX_LIST_ITEM_LENGTH}}){0,$ {MAX_INDENTED_CODE_LINES}}\\r?\\n?)` + `|(?:
(?:)?[\\s\\S]{0,${MAX_CODE_BLOCK_LENGTH}}?(?:)?
))` + "|" + // 5. Tables (Markdown, grid tables, and HTML tables, with length constraints) `(?:(?:^|\\r?\\n)(?:\\|[^\\r\\n]{0,${MAX_TABLE_CELL_LENGTH}}\\|(?:\\r?\\n\\|[-:]{1,${MAX_TABLE_CELL_LENGTH}}\\|){0,1}(?:\\r?\\n\\|[^\\r\\n]{0,$ {MAX_TABLE_CELL_LENGTH}}\\|){0,${MAX_TABLE_ROWS}}` + `|[\\s\\S]{0,${MAX_HTML_TABLE_LENGTH}}?
))` + "|" + // 6. Horizontal rules (Markdown and HTML hr tag) `(?:^(?:[-*_]){${MIN_HORIZONTAL_RULE_LENGTH},}\\s*$|)` + "|" + // 10. Standalone lines or phrases (including single-line blocks and HTML elements, with length constraints) `(?!${AVOID_AT_START})(?:^(?:<[a-zA-Z][^>]{0,${MAX_HTML_TAG_ATTRIBUTES_LENGTH}}>)?${SENTENCE_PATTERN.replace(/{MAX_LENGTH}/g, String (MAX_STANDALONE_LINE_LENGTH))}(?:)?(?:\\r?\\n|$))` + "|" + // 7. Sentences or phrases ending with punctuation (including ellipsis and Unicode punctuation) `(?!${AVOID_AT_START})${SENTENCE_PATTERN.replace(/{MAX_LENGTH}/g, String(MAX_SENTENCE_LENGTH))}` + "|" + // 8. Quoted text, parenthetical phrases, or bracketed content (with length constraints) "(?:" + `(?)?${SENTENCE_PATTERN.replace(/{MAX_LENGTH}/g, String(MAX_PARAGRAPH_LENGTH))}(?:

)?(?=\\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}}?|\\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 ![Configure Batch Processing node](/imgs/fastgpt-loop-node-example-5.png) * 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 版本新增的一个重要功能模块。它允许工作流对数组类型的输入数据进行迭代处理,每次处理数组中的一个元素,并自动执行后续节点,直到完成整个数组的处理。 这个节点的设计灵感来自编程语言中的循环结构,但以可视化的方式呈现。 ![批量运行节点](/imgs/fastgpt-loop-node.png) > 在程序中,节点可以理解为一个个 Function 或者接口。可以理解为它就是一个**步骤**。将多个节点一个个拼接起来,即可一步步的去实现最终的 AI 输出。 【**批量运行**】节点本质上也是一个 Function,它的主要职责是自动化地重复执行特定的工作流程。 ## 核心特性 1. **数组批量处理** * 支持输入数组类型数据 * 自动遍历数组元素 * 保持处理顺序 * 支持并行处理 (性能优化) 2. **自动迭代执行** * 自动触发后续节点 * 支持条件终止 * 支持循环计数 * 维护执行上下文 3. **与其他节点协同** * 支持与 AI 对话节点配合 * 支持与 HTTP 节点配合 * 支持与内容提取节点配合 * 支持与判断器节点配合 ## 应用场景 【**批量运行**】节点的主要作用是通过自动化的方式扩展工作流的处理能力,使 FastGPT 能够更好地处理批量任务和复杂的数据处理流程。特别是在处理大规模数据或需要多轮迭代的场景下,批量运行节点能显著提升工作流的效率和自动化程度。 【**批量运行**】节点特别适合以下场景: 1. **批量数据处理** * 批量翻译文本 * 批量总结文档 * 批量生成内容 2. **数据流水线处理** * 对搜索结果逐条分析 * 对知识库检索结果逐条处理 * 对 HTTP 请求返回的数组数据逐项处理 3. **递归或迭代任务** * 长文本分段处理 * 多轮优化内容 * 链式数据处理 ## 使用方法 ### 输入参数设置 【**批量运行**】节点需要配置两个核心输入参数: 1. **数组 (必填)**:接收一个数组类型的输入,可以是: * 字符串数组 (`Array`) * 数字数组 (`Array`) * 布尔数组 (`Array`) * 对象数组 (`Array`) 2. **循环体 (必填)**:定义每次循环需要执行的节点流程,包含: * 循环体开始:标记循环开始的位置。 * 循环体结束:标记循环结束的位置,并可选择输出结果变量。 ### 循环体配置 ![循环体配置](/imgs/fastgpt-loop-node-config.webp) 1. 在循环体内部,可以添加任意类型的节点,如: * AI 对话节点 * HTTP 请求节点 * 内容提取节点 * 文本加工节点等 2. 循环体结束节点配置: * 通过下拉菜单选择要输出的变量 * 该变量将作为当前循环的结果被收集 * 所有循环的结果将组成一个新的数组作为最终输出 ## 场景示例 ### 批量处理数组 假设我们有一个包含多个文本的数组,需要对每个文本进行 AI 处理。这是批量运行节点最基础也最常见的应用场景。 #### 实现步骤 1. 准备输入数组 ![准备输入数组](/imgs/fastgpt-loop-node-example-1.png) 使用【代码运行】节点创建测试数组: ```javascript const texts = [ "这是第一段文本", "这是第二段文本", "这是第三段文本" ]; return { textArray: texts }; ``` 2. 配置批量运行节点 ![配置批量运行节点](/imgs/fastgpt-loop-node-example-2.png) * 数组输入:选择上一步代码运行节点的输出变量 `textArray`。 * 循环体内添加一个【AI 对话】节点,用于处理每个文本。这里我们输入的 prompt 为:`请将这段文本翻译成英文`。 * 再添加一个【指定回复】节点,用于输出翻译后的文本。 * 循环体结束节点选择输出变量为 AI 回复内容。 #### 运行流程 ![运行流程](/imgs/fastgpt-loop-node-example-3.png) 1. 【代码运行】节点执行,生成测试数组 2. 【批量运行】节点接收数组,开始遍历 3. 对每个数组元素: * 【AI 对话】节点处理当前元素 * 【指定回复】节点输出翻译后的文本 * 【循环体结束】节点收集处理结果 4. 完成所有元素处理后,输出结果数组 ### 长文本翻译 在处理长文本翻译时,我们经常会遇到以下挑战: * 文本长度超出 LLM 的 token 限制 * 需要保持翻译风格的一致性 * 需要维护上下文的连贯性 * 翻译质量需要多轮优化 【**批量运行**】节点可以很好地解决这些问题。 #### 实现步骤 1. 文本预处理与分段 ![文本预处理与分段](/imgs/fastgpt-loop-node-example-4.png) 使用【代码运行】节点进行文本分段,代码如下: ```javascript const MAX_HEADING_LENGTH = 7; // 最大标题长度 const MAX_HEADING_CONTENT_LENGTH = 200; // 最大标题内容长度 const MAX_HEADING_UNDERLINE_LENGTH = 200; // 最大标题下划线长度 const MAX_HTML_HEADING_ATTRIBUTES_LENGTH = 100; // 最大HTML标题属性长度 const MAX_LIST_ITEM_LENGTH = 200; // 最大列表项长度 const MAX_NESTED_LIST_ITEMS = 6; // 最大嵌套列表项数 const MAX_LIST_INDENT_SPACES = 7; // 最大列表缩进空格数 const MAX_BLOCKQUOTE_LINE_LENGTH = 200; // 最大块引用行长度 const MAX_BLOCKQUOTE_LINES = 15; // 最大块引用行数 const MAX_CODE_BLOCK_LENGTH = 1500; // 最大代码块长度 const MAX_CODE_LANGUAGE_LENGTH = 20; // 最大代码语言长度 const MAX_INDENTED_CODE_LINES = 20; // 最大缩进代码行数 const MAX_TABLE_CELL_LENGTH = 200; // 最大表格单元格长度 const MAX_TABLE_ROWS = 20; // 最大表格行数 const MAX_HTML_TABLE_LENGTH = 2000; // 最大HTML表格长度 const MIN_HORIZONTAL_RULE_LENGTH = 3; // 最小水平分隔线长度 const MAX_SENTENCE_LENGTH = 400; // 最大句子长度 const MAX_QUOTED_TEXT_LENGTH = 300; // 最大引用文本长度 const MAX_PARENTHETICAL_CONTENT_LENGTH = 200; // 最大括号内容长度 const MAX_NESTED_PARENTHESES = 5; // 最大嵌套括号数 const MAX_MATH_INLINE_LENGTH = 100; // 最大行内数学公式长度 const MAX_MATH_BLOCK_LENGTH = 500; // 最大数学公式块长度 const MAX_PARAGRAPH_LENGTH = 1000; // 最大段落长度 const MAX_STANDALONE_LINE_LENGTH = 800; // 最大独立行长度 const MAX_HTML_TAG_ATTRIBUTES_LENGTH = 100; // 最大HTML标签属性长度 const MAX_HTML_TAG_CONTENT_LENGTH = 1000; // 最大HTML标签内容长度 const LOOKAHEAD_RANGE = 100; // 向前查找句子边界的字符数 const AVOID_AT_START = `[\\s\\]})>,']`; // 避免在开头匹配的字符 const PUNCTUATION = `[.!?…]|\\.{3}|[\\u2026\\u2047-\\u2049]|[\\p{Emoji_Presentation}\\p{Extended_Pictographic}]`; // 标点符号 const QUOTE_END = `(?:'(?=\`)|''(?=\`\`))`; // 引号结束 const SENTENCE_END = `(?:${PUNCTUATION}(?] {0,${MAX_HTML_HEADING_ATTRIBUTES_LENGTH}}>)[^\\r\\n]{1,${MAX_HEADING_CONTENT_LENGTH}}(?:)?(?:\\r?\\n|$))` + "|" + // New pattern for citations `(?:\\[[0-9]+\\][^\\r\\n]{1,${MAX_STANDALONE_LINE_LENGTH}})` + "|" + // 2. List items (bulleted, numbered, lettered, or task lists, including nested, up to three levels, with length constraints) `(?:(?:^|\\r?\\n)[ \\t]{0,3}(?:[-*+•]|\\d{1,3}\\.\\w\\.|\\[[ xX]\\])[ \\t]+${SENTENCE_PATTERN.replace(/{MAX_LENGTH}/g, String (MAX_LIST_ITEM_LENGTH))}` + `(?:(?:\\r?\\n[ \\t]{2,5}(?:[-*+•]|\\d{1,3}\\.\\w\\.|\\[[ xX]\\])[ \\t]+${SENTENCE_PATTERN.replace(/{MAX_LENGTH}/g, String (MAX_LIST_ITEM_LENGTH))}){0,${MAX_NESTED_LIST_ITEMS}}` + `(?:\\r?\\n[ \\t]{4,${MAX_LIST_INDENT_SPACES}}(?:[-*+•]|\\d{1,3}\\.\\w\\.|\\[[ xX]\\])[ \\t]+${SENTENCE_PATTERN.replace(/{MAX_LENGTH}/g, String (MAX_LIST_ITEM_LENGTH))}){0,${MAX_NESTED_LIST_ITEMS}})?)` + "|" + // 3. Block quotes (including nested quotes and citations, up to three levels, with length constraints) `(?:(?:^>(?:>|\\s{2,}){0,2}${SENTENCE_PATTERN.replace(/{MAX_LENGTH}/g, String(MAX_BLOCKQUOTE_LINE_LENGTH))}\\r?\\n?){1,$ {MAX_BLOCKQUOTE_LINES}})` + "|" + // 4. Code blocks (fenced, indented, or HTML pre/code tags, with length constraints) `(?:(?:^|\\r?\\n)(?:\`\`\`|~~~)(?:\\w{0,${MAX_CODE_LANGUAGE_LENGTH}})?\\r?\\n[\\s\\S]{0,${MAX_CODE_BLOCK_LENGTH}}?(?:\`\`\`|~~~)\\r?\\n?` + `|(?:(?:^|\\r?\\n)(?: {4}|\\t)[^\\r\\n]{0,${MAX_LIST_ITEM_LENGTH}}(?:\\r?\\n(?: {4}|\\t)[^\\r\\n]{0,${MAX_LIST_ITEM_LENGTH}}){0,$ {MAX_INDENTED_CODE_LINES}}\\r?\\n?)` + `|(?:
(?:)?[\\s\\S]{0,${MAX_CODE_BLOCK_LENGTH}}?(?:)?
))` + "|" + // 5. Tables (Markdown, grid tables, and HTML tables, with length constraints) `(?:(?:^|\\r?\\n)(?:\\|[^\\r\\n]{0,${MAX_TABLE_CELL_LENGTH}}\\|(?:\\r?\\n\\|[-:]{1,${MAX_TABLE_CELL_LENGTH}}\\|){0,1}(?:\\r?\\n\\|[^\\r\\n]{0,$ {MAX_TABLE_CELL_LENGTH}}\\|){0,${MAX_TABLE_ROWS}}` + `|[\\s\\S]{0,${MAX_HTML_TABLE_LENGTH}}?
))` + "|" + // 6. Horizontal rules (Markdown and HTML hr tag) `(?:^(?:[-*_]){${MIN_HORIZONTAL_RULE_LENGTH},}\\s*$|)` + "|" + // 10. Standalone lines or phrases (including single-line blocks and HTML elements, with length constraints) `(?!${AVOID_AT_START})(?:^(?:<[a-zA-Z][^>]{0,${MAX_HTML_TAG_ATTRIBUTES_LENGTH}}>)?${SENTENCE_PATTERN.replace(/{MAX_LENGTH}/g, String (MAX_STANDALONE_LINE_LENGTH))}(?:)?(?:\\r?\\n|$))` + "|" + // 7. Sentences or phrases ending with punctuation (including ellipsis and Unicode punctuation) `(?!${AVOID_AT_START})${SENTENCE_PATTERN.replace(/{MAX_LENGTH}/g, String(MAX_SENTENCE_LENGTH))}` + "|" + // 8. Quoted text, parenthetical phrases, or bracketed content (with length constraints) "(?:" + `(?)?${SENTENCE_PATTERN.replace(/{MAX_LENGTH}/g, String(MAX_PARAGRAPH_LENGTH))}(?:

)?(?=\\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}}?|\\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}; } ``` 这里我们用到了 [Jina AI 开源的一个强大的正则表达式](https://x.com/JinaAI_/status/1823756993108304135),它能利用所有可能的边界线索和启发式方法来精确切分文本。 2. 配置批量运行节点 ![配置批量运行节点](/imgs/fastgpt-loop-node-example-5.png) * 数组输入:选择上一步代码运行节点的输出变量 `chunks`。 * 循环体内添加一个【代码运行】节点,对源文本进行格式化。 * 添加一个【搜索词库】节点,将专有名词的词库作为知识库,在翻译前进行搜索。 * 添加一个【AI 对话】节点,使用 CoT 思维链,让 LLM 显式地、系统地生成推理链条,展示翻译的完整思考过程。 * 添加一个【代码运行】节点,将【AI 对话】节点最后一轮的翻译结果提取出来。 * 添加一个【指定回复】节点,输出翻译后的文本。 * 循环体结束节点选择输出变量为【取出翻译文本】的输出变量 `result`。 file: ./content/guide/build/workflow/nodes/loop_run.en.mdx meta: { "title": "Loop", "description": "FastGPT Loop node overview and usage (applicable to version 4.15.0 and above)" } ## Node Overview The **Loop Node** allows you to repeatedly execute a sub-workflow. Whether you want to process a batch of data item by item (Array Loop), or iteratively optimize a task until it meets a specific standard (Conditional Loop), the Loop Node makes it easy. ![Loop Node](/imgs/fastgpt-loop-run-node.png) Ideal for scenarios such as: * Summarizing paragraph chunks of a long article one by one (Array Loop) * Refining an AI draft and repeatedly revising it if the score is below 80, until it passes (Conditional Loop) * Calling external APIs sequentially in batches *** ## Core Features & Loop Modes The Loop Node provides two running modes. ### 1. Array Loop * **How it works**: Iterates through a provided array (e.g., article paragraphs), processing one element per iteration. * **Data Injection**: During each iteration, the **Loop Start** node automatically outputs `Current Item` and `Current Index` (0-based). ### 2. Conditional Loop * **How it works**: Runs repeatedly based on conditions instead of an array, until a **Loop Break** node is executed. * **Requirement**: **Must contain at least one Loop Break node** inside the loop container, otherwise saving or running the workflow will result in an error. * **Data Injection**: During each iteration, the **Loop Start** node automatically outputs `Current Loop Count` (1-based). ### 3. Error Handling & User Interaction * **Preserving Prior Run Logs**: If a loop fails at some point, the logs and results from previous successful iterations are kept. You can inspect the step-by-step trace in "Execution Details" to easily spot what went wrong. * **User Interaction Support**: Supports nodes that require user input (like Form Input) inside the loop. The loop will temporarily pause when reaching these nodes and automatically resume running from where it paused once the user completes the input. *** ## Parameter Descriptions ### Inputs | Parameter | Required | Default | Description | | :------------ | :------- | :--------- | :----------------------------------------------------------------------------------------------------------------------------------- | | **Loop Type** | Yes | Array Loop | Choose between `Array Loop` (array) or `Conditional Loop` (conditional). | | **Array** | Yes | - | *(Visible only in Array Loop mode)* The list of data to process. Typically referenced from a preceding node's array output. | | **Loop Body** | Yes | - | The sub-workflow to execute inside the container, starting from the **Loop Start** node (can be exited via the **Loop Break** node). | ### Outputs | Parameter | Type | Description | | :----------------- | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Error Text** | `string` | The error message if the loop terminates abnormally due to an error. | | **Custom Outputs** | Any | Users can add custom outputs by typing a variable name in the node's **Output area** and binding it to an internal node's variable reference. When the node finishes running, it outputs the values from the final iteration (or upon termination). | *** ## Important Caveats & Best Practices 1. **No Nesting** * You cannot place another **Loop Node** or **Parallel Run** node inside a Loop Node. 2. **Returns the Final Iteration Only** * The custom outputs on the Loop Node only hold the values from the **last iteration** when the loop exits (it no longer aggregates all outputs into a single array). * **How to aggregate results from all iterations?**\ If you need to collect and aggregate data from all runs into a list, declare an array variable **outside** the Loop Node as a global variable, and use a **Variable Update** node **inside** the loop body to append the result of each iteration into that global array. 3. **Variable and External Output Writeback** * After each successful iteration, global variable changes made inside the loop body are written back to the main flow. If a Variable Update node changes an output on a node outside the loop container, that output is also written back after that iteration succeeds. * Failed iterations do not commit variable or external output changes from that iteration. When an interactive node pauses execution, the completed changes before the pause are kept as a resumable checkpoint so the loop can continue after the user submits input. 4. **Prevent Infinite Loops** * For Conditional Loops, ensure that a **Loop Break** node is reachable under certain conditions. * The system enforces a maximum iteration limit (default 100). The loop will automatically terminate and throw an error if this limit is reached. *** ## Deployment Settings For self-hosted developers or operators, you can adjust the execution limits of the Loop Node via the following environment variable: | Environment Variable | Default | Description | | :------------------------ | :------ | :------------------------------------------------------------------------------------------------------------------------------------- | | `WORKFLOW_MAX_LOOP_TIMES` | 100 | The maximum length of input arrays and the maximum iteration limit for Conditional Loops (shared by both Loop and Parallel Run nodes). | ## Example Scenario: AI Copy Refinement Until Approval This example demonstrates how to use the **Conditional Loop** mode to allow the AI to optimize copy over multiple rounds, evaluating it through scoring logic at each iteration until the score passes a set threshold. This represents a key advantage of the Loop node—correcting drafts based on feedback from previous runs. ![AI Copy Refinement Scenario Example](/imgs/fastgpt-loop-run-example.png) #### Implementation Steps 1. **Set Loop Type** * Loop Type: `Conditional Loop`. 2. **Configure Sub-Workflow inside the Loop Body** * **【AI Chat】(Copy Refinement)**: Receives the draft inputs. * **【AI Chat#2】(Evaluation)**: Grades the refined draft, outputting a numeric score. * **【Condition】**: * If the score meets the requirements: Route to the **【Assigned Reply】** node (to output the final copy to the user), then connect it to the **【Loop Break】** node to exit the loop. * If the score does not meet the requirements: Do not trigger any subsequent connections. The loop will automatically start the next iteration using the draft polished in this round. 3. **Configure Outputs** * Add a custom output `final_text` in the **Outputs** panel of the Loop Node, referencing the reply of the 【AI Chat (Copy Refinement)】 node inside. * Once the loop exits, downstream nodes can reference this `final_text` variable to receive the final polished copy. #### Execution Flow & Details After the execution completes, you can expand and inspect the detailed execution path of each iteration in the "Complete Response" panel: ![Execution Flow Details](/imgs/fastgpt-loop-run-detail.png) 1. **First Optimization Round**: Runs `Loop Start` ➡️ `AI Chat` ➡️ `AI Chat#2` ➡️ `Condition`. Since the score did not meet the requirements, the break node was not triggered, and the system automatically proceeded to the next iteration. 2. **Second Optimization Round**: Continues running `AI Chat` ➡️ `AI Chat#2` ➡️ `Condition`. This time the score meets the requirements, routing to the `Assigned Reply` and triggering the `Loop Break` node. The entire loop exits safely. file: ./content/guide/build/workflow/nodes/loop_run.mdx meta: { "title": "循环节点", "description": "FastGPT 循环节点介绍和使用(适用于 4.15.0 及以上版本)" } ## 节点概述 【**循环节点**】用于在工作流中重复执行同一段子工作流。无论您是想对一批数据逐个进行处理(数组循环),还是需要把一个任务反复迭代优化直到符合特定标准为止(条件循环),循环节点都能帮您轻松实现。 ![循环节点](/imgs/fastgpt-loop-run-node.png) 适合以下任务场景: * 依次总结一批长文章的段落(数组循环) * 让 AI 生成方案并不断评估,若评分低于 80 分就重复修改,直到达标再退出(条件循环) * 批量且顺序地调用外部 API *** ## 核心功能与运行模式 循环节点提供两种核心运行模式。 ### 1. 数组循环 (Array Loop) * **原理**:依次遍历您传入的数组(如文章段落列表),每轮处理一个元素。 * **数据注入**:每轮循环开始时,【循环开始】节点会自动输出 `当前元素` 与 `当前下标`(从 `0` 开始)。 ### 2. 条件循环 (Conditional Loop) * **原理**:不依赖特定数组,持续重复执行循环体,直到触发内部的【循环终止】节点。 * **要求**:循环体内部**必须包含至少一个【循环终止】节点**,否则工作流在保存或执行时会报错。 * **数据注入**:每轮循环开始时,【循环开始】节点会自动输出 `当前循环次数`(从 `1` 开始)。 ### 3. 出错与用户交互时的处理 * **保留出错前的记录**:循环如果在哪一轮出错,前面几轮已经成功运行完的日志和结果依然会保留下来,您可以通过“运行详情”查看每一轮的详细步骤,方便排查问题。 * **支持运行中交互**:循环体内支持使用表单输入等需要用户交互的节点。流程执行到这些节点时会先停下来,等用户填写完表单后,再接着那轮继续往下跑。 *** ## 参数说明 ### 输入 | 参数 | 必填 | 默认 | 说明 | | :------- | :- | :--- | :----------------------------------------- | | **循环类型** | 是 | 数组循环 | 可选 `数组循环` (array) 或 `条件循环` (conditional) | | **数组** | 是 | - | *(仅在数组循环模式下显示)* 要批量处理的数据列表。通常来自上游节点的数组输出。 | | **循环体** | 是 | - | 节点内部要执行的子流程,它以【循环开始】节点作为起点(可通过【循环终止】节点退出)。 | ### 输出 | 参数 | 类型 | 说明 | | :-------- | :------- | :----------------------------------------------------------------------- | | **错误信息** | `string` | 循环执行异常中断时的错误信息。 | | **自定义输出** | 任意类型 | 用户可在节点的**输出区域**输入变量名来新增自定义输出,并为其绑定内部节点的变量引用。该节点运行结束时,输出最后一轮迭代(或中断退出时)的值。 | *** ## 注意事项与使用避坑 1. **不能嵌套** * 循环节点内部不能再放入另一个【循环节点】或【并行执行】节点。 2. **只输出最后一轮结果** * 新版循环节点的“自定义输出”在退出时,只包含**最后一轮迭代的值**(不再默认将所有轮次的输出聚合成一个数组)。 * **如何聚合所有轮次的结果?** 如果您需要将每一轮的数据收集并汇总成一个列表,请在循环体**外部**声明一个全局变量数组,并在循环体**内部**使用【变量更新】节点,每次将当前轮次的结果追加到该全局变量中。 3. **变量与外部输出回写** * 每轮成功结束后,循环体内对全局变量的修改会写回主流程;通过【变量更新】修改循环容器外节点输出时,也会在该轮成功结束后写回。 * 失败轮不会提交本轮变量或外部输出变更;遇到交互节点暂停时,会作为可恢复 checkpoint 保留暂停前已完成节点的更新,便于用户提交后继续运行。 4. **条件循环防止死循环** * 条件循环必须在子流程某个分支能最终触发【循环终止】节点。 * 系统设定了最大循环次数(默认 100 次),达到上限会自动报错并安全停止。 *** ## 部署参数 如果您是私有化部署的开发者或运维人员,可以通过以下环境变量来调优运行限制: | 环境变量 | 默认值 | 说明 | | :------------------------ | :-- | :---------------------------------------- | | `WORKFLOW_MAX_LOOP_TIMES` | 100 | 输入数组的最大长度以及条件循环的最大迭代轮数上限(【循环节点】与【并行执行】共用) | *** ## 场景示例:AI 润色文案直至评估达标 本示例演示如何使用 **条件循环** 模式,让 AI 对文案进行多轮优化,并在每轮运行后由打分逻辑评估,直到评分达标才最终输出。这充分体现了循环节点“根据上轮反馈不断修正”的代表性优势。 ![AI 润色文案直至评估达标示例](/imgs/fastgpt-loop-run-example.png) #### 实现步骤 1. **设置循环类型** * 循环类型选择:`条件循环`。 2. **配置循环体内部流程** * **【AI 对话】(文案优化)**:接收并优化输入的文案。 * **【AI 对话#2】(评分评估)**:对优化后的文案进行评估打分,输出分数。 * **【判断器】**:判断分数是否满足要求。 * 如果满足要求:连线执行 **【指定回复】** 节点(向用户输出最终文案),随后连接执行 **【循环终止】** 节点退出循环。 * 如果不满足要求:不触发后续连线,循环会自动直接进入下一轮继续优化。 3. **配置输出使用** * 在循环节点的 **输出** 栏动态添加自定义输出 `final_text`,将其值引用为循环体内的【AI 对话(文案优化)】节点的回复内容。 * 循环退出后,下游节点通过引用该 `final_text` 变量,即可拿到最终符合要求的满意文案。 #### 执行流程与运行详情 运行完成后,您可以在调试面板的“完整响应”中展开查看详细的执行轨迹: ![执行流程详情](/imgs/fastgpt-loop-run-detail.png) 1. **第一轮优化**:执行了 `循环开始` ➡️ `AI 对话` ➡️ `AI 对话#2` ➡️ `判断器`。由于评分未达标,未触发终止节点,系统自动进入下一轮。 2. **第二轮优化**:继续执行 `AI 对话` ➡️ `AI 对话#2` ➡️ `判断器`。本轮评分达标,走向 `指定回复` 并触发 `循环终止`。整个循环安全退出。 file: ./content/guide/build/workflow/nodes/parallel_run.en.mdx meta: { "title": "Parallel Run", "description": "FastGPT Parallel Run node overview and usage (available in 4.14.11+)" } ## Node Overview The **Parallel Run** node takes an array as input and runs the same sub-workflow for **every element at the same time**, then aggregates the results. ![Parallel Run node](/imgs/fastgpt-parallel-run-node.png) It fits batch tasks where each item is **independent and does not depend on the others** — for example: * Translating a batch of text snippets * Scraping multiple web pages and extracting information * Calling an external API for many records ## Core Features 1. **Runs in parallel, finishes faster** * Items are processed at the same time instead of queuing one by one * You can set "how many to run at once" to balance speed against resource usage 2. **A single failure does not break the batch** * A failed task does not interrupt the others * Failures are retried automatically; the retry count is configurable * Successful and failed results are grouped separately for easier downstream handling 3. **Per-task view in the debug panel** * After the run finishes, each task's execution can be inspected independently * No need to dig through a flat list of child-node responses ## Parameters ### Inputs | Parameter | Required | Default | Description | | -------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------- | | Array | Yes | - | The items to process, usually from an upstream node's array output. Elements can be strings, numbers, objects, etc. | | Max concurrency | Yes | 5 | How many tasks are allowed to run at the same time. Range: 1 to the upper limit (set by the deployment, default 10) | | Max retries per task | Yes | 3 | How many times to retry a failed task. Range: 0–5. `0` disables retries | | Execution Logic | Yes | - | The sub-flow to run, wrapped between the fixed Start and End anchors. You can place any nodes in between | ### Outputs | Output | Type | Description | | --------------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Success Results | `Array` | Outputs of successful tasks only, ordered by input index. Failed items are filtered out. **This is what you usually reference downstream.** | | Full Results | `Array` | Has the **same length as the input**. Each item is `{ success, message, data }`: on success `success=true` and `data` is the value; on failure `success=false`, `message` holds the error and `data` is `null` | | Status | `string` | Overall status: `success` (all succeeded), `partial_success` (some failed), `failed` (all failed). Useful for branching | ## Notes * **No nesting**: a Parallel Run node cannot contain another Parallel Run or a Batch Processing node * **No interactive nodes**: form input, user selection, and other interactive nodes cannot run inside the Execution Logic — the editor blocks dropping them in * **Variable and output races**: global variable changes from successful tasks are written back to the main flow. If a Variable Update node changes an output on a node outside the parallel container, that output is also written back after the task succeeds. When multiple tasks write the same variable or external node output, the final value depends on task completion order and is not guaranteed to be stable. For deterministic results, return values through the End node and use the Parallel Run aggregate outputs * **Array length cap**: the input array is capped at 100 items by default (adjustable by the deployment — see below) * **Turn off streaming for AI nodes inside the Execution Logic**: it is strongly recommended to disable **"Return AI content"** on AI Chat nodes placed inside the parallel body. Otherwise multiple tasks will stream to the same chat window at once and the text will interleave into a garbled mess. Usually you only want a final **Specified Reply** node *after* the parallel node to emit the aggregated result. ### Deployment Settings The following environment variables can be tuned on self-hosted deployments: | Environment variable | Default | Description | | ----------------------------------- | ------- | ------------------------------------------------------------------------------------- | | `WORKFLOW_MAX_LOOP_TIMES` | 100 | Maximum length of the input array (shared by Batch Processing and Parallel Run) | | `WORKFLOW_PARALLEL_MAX_CONCURRENCY` | 10 | Upper bound of the Max concurrency setting. Must not exceed `WORKFLOW_MAX_LOOP_TIMES` | ## Example: Translate a Text Array in Parallel The minimal flow below translates a few text snippets into English in parallel. ![Parallel translate example](/imgs/fastgpt-parallel-run-example.png) #### Steps 1. Prepare the input array Use a Code Execution node to build a test array: ```javascript function main(){ const texts = [ "这是第一段文本", "这是第二段文本", "这是第三段文本" ]; return { textArray: texts }; } ``` 2. Configure the Parallel Run node * **Array input**: select `textArray` from the previous Code Execution node * **Max concurrency**: keep the default `5` (only 3 items, so 3 tasks actually run at once) * **Max retries per task**: keep the default `3` * Inside the Execution Logic, add an AI Chat node that references the Start node's input as the text to translate, with a prompt like `Translate the following text into English: {current item}`. Be sure to **turn off "Return AI content"** so outputs from different tasks do not interleave. * On the End node, select the AI reply as the output variable 3. Use the results * Reference **Success Results** downstream to get the array of translated strings * Reference **Full Results** when you need to check each item's success/failure * Use **Status** to decide whether to run a fallback (for example, alert when everything failed) #### Execution Flow ![Parallel run detail](/imgs/fastgpt-parallel-run-detail.png) 1. The Code Execution node produces 3 text snippets 2. The Parallel Run node sends all 3 snippets to the AI chat node at the same time 3. Any failing translation is retried automatically; still-failing items are marked as failed in **Full Results** 4. Once all tasks finish, the node emits **Success Results**, **Full Results**, and **Status** together file: ./content/guide/build/workflow/nodes/parallel_run.mdx meta: { "title": "并行执行", "description": "FastGPT 并行执行节点介绍和使用(适用于 4.14.11 及以上版本)" } ## 节点概述 【**并行执行**】节点接收一个数组,对每个元素**同时**执行同一段子工作流,最后把所有结果汇总输出。 ![并行执行节点](/imgs/fastgpt-parallel-run-node.png) 适合那些**每一项都可以独立完成、互不依赖**的批量任务,比如: * 同时翻译一批文本片段 * 同时抓取多个网页并提取信息 * 批量调用外部接口 ## 核心特性 1. **同时处理,更快完成** * 多个任务一起跑,不用一个一个排队 * 可以设置「最多几个同时跑」,平衡速度与资源消耗 2. **单个失败不影响整体** * 某个任务失败不会中断其他任务 * 失败会自动重试,重试次数可自定义 * 最后把成功和失败的结果分别归总,方便下游处理 3. **结果按任务折叠展示** * 运行完成后,可以在调试面板按任务单独查看每一项的执行过程 * 不用在一堆节点里翻找某一项的执行细节 ## 参数说明 ### 输入 | 参数 | 必填 | 默认 | 说明 | | -------- | -- | -- | ------------------------------------------- | | 数组 | 是 | - | 要批量处理的数据,通常来自上游节点的数组输出,元素可以是字符串、数字、对象等 | | 最大并发数 | 是 | 5 | 最多允许几个任务同时进行,范围 1\~上限值(上限由部署方设置,默认 10) | | 单轮报错重试次数 | 是 | 3 | 单个任务失败后自动重试的次数,范围 0\~5;设为 0 表示失败不再重试 | | 执行逻辑 | 是 | - | 节点内部要执行的子流程,由「开始」和「结束」两个固定锚点包围,中间可以自由编排其他节点 | ### 输出 | 参数 | 类型 | 说明 | | ---- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | 成功结果 | `Array` | 只包含执行成功的任务输出,按输入顺序排列;失败的那些会被过滤掉。**下游通常用这个字段** | | 完整结果 | `Array` | 与输入数组**一一对应**,每项形如 `{ success, message, data }`。成功时 `success=true`、`data` 是输出值;失败时 `success=false`、`message` 是错误提示、`data` 为 `null` | | 完成状态 | `string` | 整体状态:`success`(全部成功)、`partial_success`(部分失败)、`failed`(全部失败),可用于分支判断 | ## 注意事项 * **不能嵌套**:并行执行节点里不能再放另一个【并行执行】或【批量运行】节点 * **不支持交互节点**:表单输入、用户选择等需要和用户互动的节点不能放在执行逻辑内,编辑器会阻止拖入 * **变量与输出竞争**:成功任务内对全局变量的修改会写回主流程;通过【变量更新】修改并行容器外节点输出时,也会在任务成功后写回主流程。多个任务同时写同一个变量或同一个外部节点输出时,最终值取决于任务完成顺序,不保证稳定;需要确定结果时,请通过「结束」节点输出并使用并行节点的汇总结果 * **数组长度**:输入数组最多 100 项(由部署方统一设置,可通过下文环境变量调整) * **尽量关闭 AI 节点的流式输出**:执行逻辑内的【AI 对话】等节点建议关闭「返回 AI 内容」(流式输出),否则多个任务的输出会同时往对话窗口里推送,容易出现内容交错、显示混乱。通常只在并行节点**之后**的【指定回复】节点里统一输出汇总结果即可。 ### 部署参数 以下两个环境变量在私有化部署时可以按需调整: | 环境变量 | 默认值 | 说明 | | ----------------------------------- | --- | ---------------------------------------- | | `WORKFLOW_MAX_LOOP_TIMES` | 100 | 输入数组的最大长度(【批量运行】和【并行执行】共用) | | `WORKFLOW_PARALLEL_MAX_CONCURRENCY` | 10 | 最大并发数的上限值,不能超过 `WORKFLOW_MAX_LOOP_TIMES` | ## 场景示例:并行翻译文本数组 假设我们要把一组文本片段并行翻译成英文,下面是最简流程。 ![并行翻译文本数组](/imgs/fastgpt-parallel-run-example.png) #### 实现步骤 1. 准备输入数组 使用【代码运行】节点构造测试数组: ```javascript function main(){ const texts = [ "这是第一段文本", "这是第二段文本", "这是第三段文本" ]; return { textArray: texts }; } ``` 2. 配置并行执行节点 * **数组输入**:选择上一步【代码运行】节点的输出变量 `textArray` * **最大并发数**:保持默认 `5`(数组只有 3 项,实际会同时跑 3 个任务) * **单轮报错重试次数**:保持默认 `3` * 在执行逻辑内添加一个【AI 对话】节点,引用「开始」节点的输入作为待翻译文本,prompt 设为:`请将下面这段文本翻译成英文:{当前数组项}`,并**关闭「返回 AI 内容」**,避免多个任务的输出交错 * 「结束」节点选择输出变量为 AI 对话的回复内容 3. 使用结果 * 下游引用「**成功结果**」即可拿到翻译好的字符串数组 * 如果需要核对每一项是否成功,引用「**完整结果**」查看每项的状态 * 通过「**完成状态**」可以快速判断是否需要走兜底逻辑(例如全部失败时发送告警) #### 执行流程 ![并行执行详情](/imgs/fastgpt-parallel-run-detail.png) 1. 【代码运行】节点生成 3 段文本 2. 【并行执行】节点接收数组,3 段文本同时送入 AI 翻译 3. 任一翻译失败会自动重试,仍失败的项会在「完整结果」中标记为失败 4. 所有任务完成后,节点一次性输出「成功结果」「完整结果」「完成状态」 file: ./content/guide/build/workflow/nodes/question_classify.en.mdx meta: { "title": "Question Classification", "description": "FastGPT Question Classification node overview" } ## Characteristics * Can be added multiple times * Has external input * Requires manual configuration * Trigger-based execution * function\_call module ![](/imgs/cq1.png) ## What It Does Classifies user questions into categories and executes different operations based on the result. Classification may be less effective in ambiguous scenarios. ## Parameters ### System Prompt Placed at the beginning of the conversation to provide supplementary definitions for classification categories. For example, questions might be classified as: 1. Greetings 2. Billing FAQs 3. Other questions Since "billing" can cover multiple cases, define it in the system prompt: ``` Billing FAQs include plan prices, balance, credit usage, renewals, invoices, and refunds Questions about why credits were deducted, how to recharge, or where to view bills should be classified as Billing FAQs General product feature questions or greetings should not be classified as Billing FAQs ``` ### Chat History Adding some chat history enables context-aware classification. ### User Question The user's input content. ### Classification Categories Using the same 3 categories as an example, here is the resulting Function composition. The return values are randomly generated by the system and can be ignored. 1. Greetings 2. Billing FAQs 3. Other questions ```js const agentFunction = { name: agentFunName, description: 'Determine which category the user question belongs to and return the corresponding enum value', parameters: { type: 'object', properties: { type: { type: 'string', description: `Greetings, return: abc; Billing FAQs, return: vvv; Other questions, return: aaa` enum: ["abc","vvv","aaa"] } }, required: ['type'] } }; ``` The Function above always returns one of `type = abc, vvv, aaa`, achieving the classification. file: ./content/guide/build/workflow/nodes/question_classify.mdx meta: { "title": "问题分类", "description": "FastGPT 问题分类模块介绍" } ## 特点 * 可重复添加 * 有外部输入 * 需要手动配置 * 触发执行 * function\_call 模块 ![](/imgs/cq1.png) ## 功能 可以将用户的问题进行分类,分类后执行不同操作。在一些较模糊的场景中,分类效果不是很明显。 ## 参数说明 ### 系统提示词 被放置在对话最前面,可用于补充说明分类内容的定义。例如问题会被分为: 1. 打招呼 2. 计费常见问题 3. 其他问题 由于“计费”范围比较宽,需要给它一个定义,此时提示词里可以填入计费问题的定义: ``` 计费常见问题包括套餐价格、余额、积分消耗、续费、发票、退款等问题 当用户询问为什么扣费、如何充值、如何查看账单时,应归类为计费常见问题 当用户只是在询问产品功能或打招呼时,不应归类为计费常见问题 ``` ### 聊天记录 适当增加一些聊天记录,可以联系上下文进行分类。 ### 用户问题 用户输入的内容。 ### 分类内容 依然以这 3 个分类为例,可以看到最终组成的 Function。其中返回值由系统随机生成,不需要关心。 1. 打招呼 2. 计费常见问题 3. 其他问题 ```js const agentFunction = { name: agentFunName, description: '判断用户问题的类型属于哪方面,返回对应的枚举字段', parameters: { type: 'object', properties: { type: { type: 'string', description: `打招呼,返回: abc;计费常见问题,返回:vvv;其他问题,返回:aaa` enum: ["abc","vvv","aaa"] } }, required: ['type'] } }; ``` 上面的 Function 必然会返回 `type = abc,vvv,aaa` 其中一个值,从而实现分类判断。 file: ./content/guide/build/workflow/nodes/reply.en.mdx meta: { "title": "Specified Reply", "description": "FastGPT Specified Reply module overview" } ## Features * Can be added multiple times (helps keep complex workflows visually clean by avoiding tangled connections) * Supports manual input * Supports external input * Outputs results to the client The Specified Reply module is typically used for special-case responses. There are two ways to define reply content: 1. Manually enter fixed content. 2. Use variable references. ![](/imgs/specialreply.png) file: ./content/guide/build/workflow/nodes/reply.mdx meta: { "title": "指定回复", "description": "FastGPT 指定回复模块介绍" } ## 特点 * 可重复添加(防止复杂编排时线太乱,重复添加可以更美观) * 可手动输入 * 可外部输入 * 会输出结果给客户端 指定回复模块通常用户特殊状态回复,回复内容有两种: 1. 一种是手动输入固定内容。 2. 一种是通过变量引用。 ![](/imgs/specialreply.png) file: ./content/guide/build/workflow/nodes/sandbox-v2.en.mdx meta: { "title": "Code Run", "description": "FastGPT Code Run node documentation (for version 4.14.8 and above)" } > This document applies to FastGPT **version 4.14.8 and above**. ## Features The Code Run node executes JavaScript and Python code in a secure sandbox for data processing, format conversion, logic calculations, and similar tasks. **Supported Languages** * JavaScript (Bun runtime) * Python 3 **Important Notes** * Self-hosted users need to deploy the `fastgpt-sandbox` image and configure the `CODE_SANDBOX_URL` environment variable. * The sandbox has a default maximum runtime of 60s (configurable). * Code runs in isolated process pools with no access to the file system or internal network. ## Variable Input Add variables needed for code execution in custom inputs. **JavaScript** — Destructure in the main function parameters: ```js async function main({data1, data2}){ return { result: data1 + data2 } } ``` **Python** — Receive variables by name in the main function parameters: ```python def main(data1, data2): return {"result": data1 + data2} ``` ## Result Output Always return an object (JS) or dict (Python). In custom outputs, add variable names to access values by their keys. For example, if you return: ```json { "result": "hello", "count": 42 } ``` Add `result` and `count` variables in custom outputs to retrieve their values. ## Built-in Functions ### httpRequest - Make HTTP Requests Make external HTTP requests from within the sandbox. Internal network addresses are automatically blocked (SSRF protection). **JavaScript Example:** ```js async function main({url}){ const res = await SystemHelper.httpRequest(url, { method: 'GET', // Request method, default GET headers: {}, // Custom request headers body: null, // Request body (objects are auto JSON-serialized) timeout: 60 // Timeout in seconds, max 60s }) return { status: res.status, data: res.data } } ``` **Python Example:** ```python def main(url): res = SystemHelper.httpRequest(url, method="GET", headers={}, timeout=10) return {"status": res["status"], "data": res["data"]} ``` **Limitations:** * Maximum 30 requests per execution * Single request timeout: 60s * Maximum response body: 2MB * Only http/https protocols allowed * Internal IPs automatically blocked (127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, etc.) ## Available Modules ### JavaScript Whitelist The following npm modules are available via `require()`: | Module | Description | Example | | ----------- | ------------------------ | --------------------------------------- | | `lodash` | Utility library | `const _ = require('lodash')` | | `moment` | Date handling | `const moment = require('moment')` | | `dayjs` | Lightweight date library | `const dayjs = require('dayjs')` | | `crypto-js` | Encryption library | `const CryptoJS = require('crypto-js')` | | `uuid` | UUID generation | `const { v4 } = require('uuid')` | | `qs` | Query string parsing | `const qs = require('qs')` | Other modules (such as `fs`, `child_process`, `net`, etc.) are prohibited. ### Python Whitelist The following Python standard library and third-party modules can be imported directly: **Math and Numerical Computing** | Module | Description | | ------------ | --------------------------------- | | `math` | Mathematical functions | | `cmath` | Complex number math | | `decimal` | Decimal floating-point arithmetic | | `fractions` | Fraction arithmetic | | `random` | Random number generation | | `statistics` | Statistical functions | **Data Structures and Algorithms** | Module | Description | | ------------- | --------------------- | | `collections` | Container data types | | `array` | Arrays | | `heapq` | Heap queue | | `bisect` | Array bisection | | `queue` | Queues | | `copy` | Shallow and deep copy | **Functional Programming** | Module | Description | | ----------- | ---------------------- | | `itertools` | Iterator tools | | `functools` | Higher-order functions | | `operator` | Standard operators | **String and Text Processing** | Module | Description | | ------------- | ------------------- | | `string` | String constants | | `re` | Regular expressions | | `difflib` | Diff calculation | | `textwrap` | Text wrapping | | `unicodedata` | Unicode database | | `codecs` | Codec registry | **Date and Time** | Module | Description | | ---------- | ------------- | | `datetime` | Date and time | | `time` | Time access | | `calendar` | Calendar | **Data Serialization** | Module | Description | | ---------- | -------------------------- | | `json` | JSON encoding/decoding | | `csv` | CSV file handling | | `base64` | Base64 encoding/decoding | | `binascii` | Binary-to-ASCII conversion | | `struct` | Byte string parsing | **Encryption and Hashing** | Module | Description | | --------- | --------------------------- | | `hashlib` | Hash algorithms | | `hmac` | HMAC message authentication | | `secrets` | Secure random numbers | | `uuid` | UUID generation | **Types and Abstractions** | Module | Description | | ------------- | --------------------- | | `typing` | Type hints | | `abc` | Abstract base classes | | `enum` | Enumeration types | | `dataclasses` | Data classes | | `contextlib` | Context managers | **Other Utilities** | Module | Description | | --------- | --------------- | | `pprint` | Pretty printing | | `weakref` | Weak references | **Third-party Libraries** | Module | Description | | ------------ | ------------------- | | `numpy` | Numerical computing | | `pandas` | Data analysis | | `matplotlib` | Data visualization | **Prohibited modules:** `os`, `sys`, `subprocess`, `socket`, `urllib`, `http`, `requests`, and any modules involving system calls, network access, or file system operations. ## Security Restrictions The sandbox provides multiple layers of security protection: * **Module Restrictions:** Only whitelisted modules are allowed for both JS and Python * **Network Isolation:** Internal IP requests are automatically blocked (SSRF protection) * **File Isolation:** No read/write access to the container file system * **Timeout Protection:** Default 60s timeout prevents infinite loops * **Process Isolation:** Each execution runs in an independent sandbox process ## Usage Examples ### JavaScript Examples
Data Format Conversion ```js // Convert comma-separated string to array function main({input}){ const items = input.split(',').map(s => s.trim()).filter(Boolean) return { items, count: items.length } } ```
Date Calculation ```js const dayjs = require('dayjs') function main(){ const now = dayjs() return { today: now.format('YYYY-MM-DD'), nextWeek: now.add(7, 'day').format('YYYY-MM-DD'), timestamp: now.valueOf() } } ```
HTTP Request - Get Weather ```js async function main({city}){ const res = await SystemHelper.httpRequest( `https://api.example.com/weather?city=${city}`, { method: 'GET', timeout: 10 } ) return { temperature: res.data.temp, weather: res.data.condition } } ```
Data Encryption ```js const CryptoJS = require('crypto-js') function main({text, key}){ const encrypted = CryptoJS.AES.encrypt(text, key).toString() return { encrypted } } ```
### Python Examples
Data Statistics ```python import math def main(numbers): if not numbers: return {"error": "no data"} mean = sum(numbers) / len(numbers) variance = sum((x - mean)**2 for x in numbers) / len(numbers) return { "mean": mean, "max": max(numbers), "min": min(numbers), "std": math.sqrt(variance) } ```
Date Processing ```python from datetime import datetime, timedelta def main(date_str): dt = datetime.strptime(date_str, "%Y-%m-%d") next_week = dt + timedelta(days=7) return { "input": date_str, "next_week": next_week.strftime("%Y-%m-%d"), "weekday": dt.strftime("%A") } ```
HTTP Request - API Call ```python def main(api_url, api_key): res = SystemHelper.httpRequest( api_url, method="GET", headers={"Authorization": f"Bearer {api_key}"}, timeout=10 ) return { "status": res["status"], "data": res["data"] } ```
JSON Data Processing ```python import json def main(json_str): data = json.loads(json_str) # Extract specific fields result = { "names": [item["name"] for item in data if "name" in item], "count": len(data) } return result ```
Regular Expression Matching ```python import re def main(text): # Extract all email addresses emails = re.findall(r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b', text) return { "emails": emails, "count": len(emails) } ```
file: ./content/guide/build/workflow/nodes/sandbox-v2.mdx meta: { "title": "代码运行", "description": "FastGPT 代码运行节点介绍(适用于 4.14.8 及以上版本)" } > 本文档适用于 FastGPT **4.14.8 及以上版本**。 ## 功能 代码运行节点支持在安全沙盒中执行 JavaScript 和 Python 代码,用于数据处理、格式转换、逻辑计算等场景。 **支持的语言** * JavaScript(基于 Bun 运行时) * Python 3 **注意事项** * 私有化用户需要部署 `fastgpt-sandbox` 镜像,并配置 `CODE_SANDBOX_URL` 环境变量。 * 沙盒默认最大运行 60s,可通过配置调整。 * 代码运行在隔离的进程池中,无法访问文件系统和内网。 ## 变量输入 可在自定义输入中添加代码运行需要的变量。 **JavaScript** — 在 main 函数参数中解构: ```js async function main({data1, data2}){ return { result: data1 + data2 } } ``` **Python** — 在 main 函数参数中按变量名接收, 节点里输入的变量名一定要与`main`中的变量名一致,顺序可以任意: ```python def main(data1, data2): return {"result": data1 + data2} ``` ## 结果输出 务必返回一个 object 对象(JS)或 dict 字典(Python)。 自定义输出中,可以添加变量名来获取对应 key 下的值。例如返回了: ```json { "result": "hello", "count": 42 } ``` 自定义输出中添加 `result` 和 `count` 两个变量即可获取对应的值。 ## 内置函数 ### httpRequest 发起 HTTP 请求 在沙盒内发起外部 HTTP 请求。自动拦截内网地址(SSRF 防护)。 **JavaScript 示例:** ```js async function main({url}){ const res = await SystemHelper.httpRequest(url, { method: 'GET', // 请求方法,默认 GET headers: {}, // 自定义请求头 body: null, // 请求体(对象会自动 JSON 序列化) timeout: 60 // 超时秒数,最大 60s }) return { status: res.status, data: res.data } } ``` **Python 示例:** ```python def main(url): res = SystemHelper.httpRequest(url, method="GET", headers={}, timeout=10) return {"status": res["status"], "data": res["data"]} ``` **限制:** * 每次执行最多 30 个请求 * 单次请求超时 60s * 响应体最大 2MB * 仅允许 http/https 协议 * 自动拦截内网 IP(127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 等) ## 可用模块 ### JavaScript 白名单模块 以下 npm 模块可通过 `require()` 使用: | 模块 | 说明 | 示例 | | ----------- | ------- | --------------------------------------- | | `lodash` | 工具函数库 | `const _ = require('lodash')` | | `moment` | 日期处理 | `const moment = require('moment')` | | `dayjs` | 轻量日期库 | `const dayjs = require('dayjs')` | | `crypto-js` | 加密库 | `const CryptoJS = require('crypto-js')` | | `uuid` | UUID 生成 | `const { v4 } = require('uuid')` | | `qs` | 查询字符串解析 | `const qs = require('qs')` | 其他模块(如 `fs`, `child_process`, `net` 等)被禁止使用。 ### Python 白名单模块 以下 Python 标准库和第三方库可直接 import: **数学和数值计算** | 模块 | 说明 | | ------------ | ------- | | `math` | 数学函数 | | `cmath` | 复数数学 | | `decimal` | 十进制浮点运算 | | `fractions` | 分数运算 | | `random` | 随机数生成 | | `statistics` | 统计函数 | **数据结构和算法** | 模块 | 说明 | | ------------- | ------- | | `collections` | 容器数据类型 | | `array` | 数组 | | `heapq` | 堆队列 | | `bisect` | 数组二分查找 | | `queue` | 队列 | | `copy` | 浅拷贝和深拷贝 | **函数式编程** | 模块 | 说明 | | ----------- | ----- | | `itertools` | 迭代器工具 | | `functools` | 高阶函数 | | `operator` | 标准运算符 | **字符串和文本处理** | 模块 | 说明 | | ------------- | ----------- | | `string` | 字符串常量 | | `re` | 正则表达式 | | `difflib` | 差异计算 | | `textwrap` | 文本包装 | | `unicodedata` | Unicode 数据库 | | `codecs` | 编解码器 | **日期和时间** | 模块 | 说明 | | ---------- | ---- | | `datetime` | 日期时间 | | `time` | 时间访问 | | `calendar` | 日历 | **数据序列化** | 模块 | 说明 | | ---------- | ------------- | | `json` | JSON 编解码 | | `csv` | CSV 文件读写 | | `base64` | Base64 编解码 | | `binascii` | 二进制和 ASCII 转换 | | `struct` | 字节串解析 | **加密和哈希** | 模块 | 说明 | | --------- | --------- | | `hashlib` | 哈希算法 | | `hmac` | HMAC 消息认证 | | `secrets` | 安全随机数 | | `uuid` | UUID 生成 | **类型和抽象** | 模块 | 说明 | | ------------- | ------ | | `typing` | 类型提示 | | `abc` | 抽象基类 | | `enum` | 枚举类型 | | `dataclasses` | 数据类 | | `contextlib` | 上下文管理器 | **其他实用工具** | 模块 | 说明 | | --------- | ---- | | `pprint` | 美化打印 | | `weakref` | 弱引用 | **第三方库** | 模块 | 说明 | | ------------ | ----- | | `numpy` | 数值计算 | | `pandas` | 数据分析 | | `matplotlib` | 数据可视化 | **禁止使用的模块:** `os`, `sys`, `subprocess`, `socket`, `urllib`, `http`, `requests` 等涉及系统调用、网络访问、文件系统的模块。 ## 安全限制 沙盒提供多层安全防护: * **模块拦截**:JS 和 Python 均只允许使用白名单模块 * **网络隔离**:自动拦截内网 IP 请求(SSRF 防护) * **文件隔离**:无法读写容器文件系统 * **超时保护**:默认 60s 超时,防止死循环 * **进程隔离**:每次执行在独立的沙盒进程中运行 ## 使用示例 ### JavaScript 示例
数据格式转换 ```js // 将逗号分隔的字符串转为数组 function main({input}){ const items = input.split(',').map(s => s.trim()).filter(Boolean) return { items, count: items.length } } ```
日期计算 ```js const dayjs = require('dayjs') function main(){ const now = dayjs() return { today: now.format('YYYY-MM-DD'), nextWeek: now.add(7, 'day').format('YYYY-MM-DD'), timestamp: now.valueOf() } } ```
HTTP 请求 - 获取天气 ```js async function main({city}){ const res = await SystemHelper.httpRequest( `https://api.example.com/weather?city=${city}`, { method: 'GET', timeout: 10 } ) return { temperature: res.data.temp, weather: res.data.condition } } ```
数据加密 ```js const CryptoJS = require('crypto-js') function main({text, key}){ const encrypted = CryptoJS.AES.encrypt(text, key).toString() return { encrypted } } ```
### Python 示例
数据统计 ```python import math def main(numbers): if not numbers: return {"error": "no data"} mean = sum(numbers) / len(numbers) variance = sum((x - mean)**2 for x in numbers) / len(numbers) return { "mean": mean, "max": max(numbers), "min": min(numbers), "std": math.sqrt(variance) } ```
日期处理 ```python from datetime import datetime, timedelta def main(date_str): dt = datetime.strptime(date_str, "%Y-%m-%d") next_week = dt + timedelta(days=7) return { "input": date_str, "next_week": next_week.strftime("%Y-%m-%d"), "weekday": dt.strftime("%A") } ```
HTTP 请求 - API 调用 ```python def main(api_url, api_key): res = SystemHelper.httpRequest( api_url, method="GET", headers={"Authorization": f"Bearer {api_key}"}, timeout=10 ) return { "status": res["status"], "data": res["data"] } ```
JSON 数据处理 ```python import json def main(json_str): data = json.loads(json_str) # 提取特定字段 result = { "names": [item["name"] for item in data if "name" in item], "count": len(data) } return result ```
正则表达式匹配 ```python import re def main(text): # 提取所有邮箱地址 emails = re.findall(r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b', text) return { "emails": emails, "count": len(emails) } ```
file: ./content/guide/build/workflow/nodes/text_editor.en.mdx meta: { "title": "Text Concatenation", "description": "FastGPT Text Concatenation module overview" } ## Features * Can be added multiple times * Has external inputs * Trigger-based execution * Manual configuration ![](/imgs/string.png) ## Function Applies fixed text processing to inputs. Input parameters only support string and number formats, and are used as variables in the text editing area. In the example above, any input will have "The user's question is:" prepended to it. ## Use Cases Provide custom-formatted text to any module, or preprocess system prompts for AI modules. file: ./content/guide/build/workflow/nodes/text_editor.mdx meta: { "title": "文本拼接", "description": "FastGPT 文本加工模块介绍" } ## 特点 * 可重复添加 * 有外部输入 * 触发执行 * 手动配置 ![](/imgs/string.png) ## 功能 对输入文本进行固定加工处理,入参仅支持字符串和数字格式,入参以变量形式使用在文本编辑区域。 根据上方示例图的处理方式,对任何输入都会在前面拼接“用户的问题是:”。 ## 作用 给任意模块输入自定格式文本,或处理 AI 模块系统提示词。 file: ./content/guide/build/workflow/nodes/tfswitch.en.mdx meta: { "title": "Conditional (IF/ELSE)", "description": "FastGPT Conditional module overview" } ## Features * Can be added multiple times * Has external inputs * Trigger-based execution ![](/imgs/judgement1.png) ## Function Performs an `IF` evaluation on any variable. If the condition is met, the `IF` branch executes; otherwise the `ELSE` branch runs. In the example above, if the "Knowledge Base Citation" variable has a length of 0, the `IF` branch executes; otherwise the `ELSE` branch runs. You can add more conditions and branches, following the same logic as `IF` statements in programming languages. ## Use Cases Common scenarios include: having the LLM make a judgment and then output fixed content, or checking the LLM's response to decide whether to trigger downstream modules. file: ./content/guide/build/workflow/nodes/tfswitch.mdx meta: { "title": "判断器", "description": "FastGPT 判断器模块介绍" } ## 特点 * 可重复添加 * 有外部输入 * 触发执行 ![](/imgs/judgement1.png) ## 功能 对任意变量进行`IF`判断,若满足条件则执行`IF`分支,不满足条件执行`ELSE`分支。 上述例子中若「知识库引用」变量的长度等于0则执行`IF`分支,否则执行`ELSE`分支。 支持增加更多的判断条件和分支,同编程语言中的`IF`语句逻辑相同。 ## 作用 适用场景有:让大模型做判断后输出固定内容,根据大模型回复内容判断是否触发后续模块。 file: ./content/guide/build/workflow/nodes/tool.en.mdx meta: { "title": "Tool Calling & Termination", "description": "FastGPT Tool Calling module overview" } ![](/imgs/flow-tool1.png) ### What is a Tool A tool can be a built-in module (e.g., AI Chat, Knowledge Base Search, HTTP) or a plugin. Tool calling lets the LLM dynamically decide the workflow path instead of following a fixed sequence. (The trade-off is higher token consumption.) ### Tool Components 1. **Tool description.** Typically the module or plugin description that tells the LLM what the tool does. 2. **Tool parameters.** For built-in modules, parameters are fixed and require no extra configuration. For plugins, parameters are configurable. ### How Tools Work To understand how tools run, you need to know the execution prerequisites: 1. A tool description is required. It tells the LLM what the tool does, and the LLM uses contextual semantics to decide whether to invoke it. 2. Tool parameters. Some tools require special parameters when called. Each parameter has two key properties: `parameter description` and `required`. Based on the tool description, parameter descriptions, and whether parameters are required, the LLM decides whether to call the tool. The scenarios are: 1. **Tools without parameters:** The LLM decides based solely on the tool description. Example: get current time. 2. **Tools with parameters:** 1. No required parameters: The tool can still be called even without suitable context parameters, though the LLM may sometimes fabricate a value. 2. Has required parameters: If no suitable parameters are available, the LLM may skip the tool. Use prompts to guide users into providing the needed parameters. #### Tool Calling Logic Models that support `function calling` can invoke multiple tools in a single turn. The calling logic: ![](/imgs/flow-tool2.png) ### How to Use | | | | ------------------------- | ------------------------- | | ![](/imgs/flow-tool3.png) | ![](/imgs/flow-tool4.png) | In the advanced workflow editor, drag from the tool calling connection point. Eligible tools display a diamond icon at the top, which you can connect to the diamond at the bottom of the tool calling module. Connected tools automatically separate tool inputs from regular inputs. You can also edit the `description` to fine-tune when the tool gets called. Debugging tool calling is still more art than science, so start with a small number of tools, optimize them, then gradually add more. #### Use Cases By default, after the tool calling node invokes a tool, it returns the tool's output to the AI for summarization. If you don't need the AI to summarize, place this node at the end of the tool's workflow branch. In the example below, after the Knowledge Base Search runs, results are sent to an HTTP request. The search results are not returned to the tool calling node for AI summarization. ![](/imgs/flow-tool5.png) ### Additional Nodes When you use the tool calling node, a Tool Calling Termination node and a Custom Variable node also become available, further enhancing the tool calling experience. #### Tool Calling Termination Tool Calling Termination ends the current call cycle. Place it after a tool node. When the workflow reaches this node, it forcibly ends the current tool call -- no further tools are invoked, and the AI won't generate a summary based on tool results. ![](/imgs/flow-tool6.png) ### Custom Tool Variables Custom variables extend tool input capabilities. For nodes that aren't recognized as tool parameters or can't be directly tool-called, you can define custom tool variables with appropriate parameter descriptions. The tool calling node will then invoke this node and its downstream workflow accordingly. ![](/imgs/flow-tool7.png) file: ./content/guide/build/workflow/nodes/tool.mdx meta: { "title": "工具调用&终止", "description": "FastGPT 工具调用模块介绍" } ![](/imgs/flow-tool1.png) ### **什么是工具** 工具可以是一个系统模块,例如:AI 对话、知识库搜索、HTTP 模块等。也可以是一个插件。 工具调用可以让 LLM 更动态的决策流程,而不都是固定的流程。(当然,缺点就是费 tokens) ### **工具的组成** 1. 工具介绍。通常是模块的介绍或插件的介绍,这个介绍会告诉 LLM,这个工具的作用是什么。 2. 工具参数。对于系统模块来说,工具参数已经是固定的,无需额外配置。对于插件来说,工具参数是一个可配置项。 ### **工具是如何运行的** 要了解工具如何运行的,首先需要知道它的运行条件。 1. 需要工具的介绍(或者叫描述)。这个介绍会告诉 LLM,这个工具的作用是什么,LLM 会根据上下文语义,决定是否需要调用这个工具。 2. 工具的参数。有些工具调用时,可能需要一些特殊的参数。参数中有 2 个关键的值:`参数介绍` 和 `是否必须`。 结合工具的介绍、参数介绍和参数是否必须,LLM 会决定是否调用这个工具。有以下几种情况: 1. 无参数的工具:直接根据工具介绍,决定是否需要执行。例如:获取当前时间。 2. 有参数的工具: 1. 无必须的参数:尽管上下文中,没有适合的参数,也可以调用该工具。但有时候,LLM 会自己伪造一个参数。 2. 有必须的参数:如果没有适合的参数,LLM 可能不会调用该工具。可以通过提示词,引导用户提供参数。 #### **工具调用逻辑** 在支持 `函数调用` 的模型中,可以一次性调用多个工具,调用逻辑如下: ![](/imgs/flow-tool2.png) ### **怎么用** | | | | ------------------------- | ------------------------- | | ![](/imgs/flow-tool3.png) | ![](/imgs/flow-tool4.png) | 高级编排中,拖动工具调用的连接点,可用的工具头部会出现一个菱形,可以将它与工具调用模块底部的菱形相连接。 被连接的工具,会自动分离工具输入与普通的输入,并且可以编辑 `介绍`,可以通过调整介绍,使得该工具调用时机更加精确。 关于工具调用,如何调试仍然是一个玄学,所以建议,不要一次性增加太多工具,选择少量工具调优后再进一步尝试。 #### 用途 默认情况下,工具调用节点,在决定调用工具后,会将工具运行的结果,返回给 AI,让 AI 对工具运行的结果进行总结输出。有时候,如果你不需要 AI 进行进一步的总结输出,可以使用该节点,将其接入对于工具流程的末尾。 如下图,在执行知识库搜索后,发送给了 HTTP 请求,搜索将不会返回搜索的结果给工具调用进行 AI 总结。 ![](/imgs/flow-tool5.png) ### 附加节点 当您使用了工具调用节点,同时就会出现工具调用终止节点和自定义变量节点,能够进一步提升工具调用的使用体验。 #### 工具调用终止 工具调用终止可用于结束本次调用,即可以接在某个工具后面,当工作流执行到这个节点时,便会强制结束本次工具调用,不再调用其他工具,也不会再调用 AI 针对工具调用结果回答问题。 ![](/imgs/flow-tool6.png) ### 自定义工具变量 自定义变量可以扩展工具的变量输入,即对于一些未被视作工具参数或无法工具调用的节点,可以自定义工具变量,填上对应的参数描述,那么工具调用便会相对应的调用这个节点,进而调用其之后的工作流。 ![](/imgs/flow-tool7.png) file: ./content/guide/build/workflow/nodes/user-selection.en.mdx meta: { "title": "User Selection", "description": "FastGPT User Selection module usage guide" } ## Features * User interaction * Can be added multiple times * Trigger-based execution ![](/imgs/user-selection1.png) ## Function The "User Selection" node is an interactive node. When triggered, the conversation enters an "interactive" state -- the workflow state is saved and execution pauses until the user completes the interaction. ![](/imgs/user-selection2.png) In the example above, when the User Selection node triggers, the chat input is hidden and the conversation enters interactive mode. ![](/imgs/user-selection3.png) When the user makes a choice, the node evaluates the selection and executes the corresponding branch (e.g., the "Yes" branch). ## Use Cases The basic pattern is to present a question that requires a user decision, then route to different workflow paths based on the user's response. file: ./content/guide/build/workflow/nodes/user-selection.mdx meta: { "title": "用户选择", "description": "FastGPT 用户选择模块的使用说明" } ## 特点 * 用户交互 * 可重复添加 * 触发执行 ![](/imgs/user-selection1.png) ## 功能 「用户选择」节点属于用户交互节点,当触发这个节点时,对话会进入“交互”状态,会记录工作流的状态,等用户完成交互后,继续向下执行工作流 ![](/imgs/user-selection2.png) 比如上图中的例子,当触发用户选择节点时,对话框隐藏,对话进入“交互状态” ![](/imgs/user-selection3.png) 当用户做出选择时,节点会判断用户的选择,执行“是”的分支 ## 作用 基础的用法为提出需要用户做抉择的问题,然后根据用户的反馈设计不同的工作流流程 file: ./content/guide/build/workflow/nodes/variable_update.en.mdx meta: { "title": "Variable Update", "description": "FastGPT Variable Update module overview" } ## Features * Can be added multiple times * Has external inputs * Trigger-based execution * Manual configuration ![](/imgs/variable_update1.png) ## Function * Update the output value of a specified node ![](/imgs/variable_update2.png) ![](/imgs/variable_update3.png) * Update global variables ![](/imgs/variable_update4.png) ![](/imgs/variable_update5.png) ## Use Cases Common scenarios include: * Assign a value to a "Custom Variable" type global variable, so the global variable doesn't require user input * Update a workflow node's output upstream of the Variable Update node, so downstream nodes use the new value file: ./content/guide/build/workflow/nodes/variable_update.mdx meta: { "title": "变量更新", "description": "FastGPT 变量更新模块介绍" } ## 特点 * 可重复添加 * 有外部输入 * 触发执行 * 手动配置 ![](/imgs/variable_update1.png) ## 功能 * 更新指定节点的输出值 ![](/imgs/variable_update2.png) ![](/imgs/variable_update3.png) * 更新全局变量 ![](/imgs/variable_update4.png) ![](/imgs/variable_update5.png) ## 作用 最基础的使用场景为 * 给一个「自定义变量」类型的全局变量赋值,从而实现全局变量无需用户输入 * 更新「变量更新」节点前的工作流节点输出,在后续使用中,使用的节点输出值为新的输出