diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fb01f3c7010..965541a2bf0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -159,6 +159,7 @@ Flowise support different environment variables to configure your instance. You | S3_ENDPOINT_URL | Custom Endpoint for S3 | String | | | S3_FORCE_PATH_STYLE | Set this to true to force the request to use path-style addressing | Boolean | false | | SHOW_COMMUNITY_NODES | Show nodes created by community | Boolean | | +| DISABLED_NODES | Hide nodes from UI (comma separated list of node names) | String | | You can also specify the env variables when using `npx`. For example: diff --git a/docker/.env.example b/docker/.env.example index bb7f8c1a91d..708431f75de 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -52,6 +52,7 @@ BLOB_STORAGE_PATH=/root/.flowise/storage # APIKEY_STORAGE_TYPE=json (json | db) # SHOW_COMMUNITY_NODES=true +# DISABLED_NODES=bufferMemory,chatOpenAI (comma separated list of node names to disable) ###################### # METRICS COLLECTION diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 38d4dc3c60f..2712e9f1419 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -33,6 +33,7 @@ services: - GLOBAL_AGENT_HTTP_PROXY=${GLOBAL_AGENT_HTTP_PROXY} - GLOBAL_AGENT_HTTPS_PROXY=${GLOBAL_AGENT_HTTPS_PROXY} - GLOBAL_AGENT_NO_PROXY=${GLOBAL_AGENT_NO_PROXY} + - DISABLED_NODES=${DISABLED_NODES} ports: - '${PORT}:${PORT}' volumes: diff --git a/i18n/CONTRIBUTING-ZH.md b/i18n/CONTRIBUTING-ZH.md index c84f0f3613d..81d94f0d17f 100644 --- a/i18n/CONTRIBUTING-ZH.md +++ b/i18n/CONTRIBUTING-ZH.md @@ -150,8 +150,9 @@ Flowise 支持不同的环境变量来配置您的实例。您可以在 `package | S3_STORAGE_SECRET_ACCESS_KEY | AWS 密钥 (Secret Key) | 字符串 | | | S3_STORAGE_REGION | S3 存储地区 | 字符串 | | | S3_ENDPOINT_URL | S3 端点 URL | 字符串 | | -| S3_FORCE_PATH_STYLE | 将其设置为 true 以强制请求使用路径样式寻址 | Boolean | false | +| S3_FORCE_PATH_STYLE | 将其设置为 true 以强制请求使用路径样式寻址 | 布尔值 | false | | SHOW_COMMUNITY_NODES | 显示由社区创建的节点 | 布尔值 | | +| DISABLED_NODES | 从界面中隐藏节点(以逗号分隔的节点名称列表) | 字符串 | | 您也可以在使用 `npx` 时指定环境变量。例如: diff --git a/packages/server/.env.example b/packages/server/.env.example index 29d8f438f61..bd7845846ff 100644 --- a/packages/server/.env.example +++ b/packages/server/.env.example @@ -52,6 +52,7 @@ PORT=3000 # APIKEY_STORAGE_TYPE=json (json | db) # SHOW_COMMUNITY_NODES=true +# DISABLED_NODES=bufferMemory,chatOpenAI (comma separated list of node names to disable) ###################### # METRICS COLLECTION diff --git a/packages/server/src/NodesPool.ts b/packages/server/src/NodesPool.ts index 16604c34598..0ec14b86ffa 100644 --- a/packages/server/src/NodesPool.ts +++ b/packages/server/src/NodesPool.ts @@ -24,6 +24,7 @@ export class NodesPool { * Initialize nodes */ private async initializeNodes() { + const disabled_nodes = process.env.DISABLED_NODES ? process.env.DISABLED_NODES.split(',') : [] const packagePath = getNodeModulesPackagePath('flowise-components') const nodesPath = path.join(packagePath, 'dist', 'nodes') const nodeFiles = await this.getFiles(nodesPath) @@ -65,7 +66,9 @@ export class NodesPool { let conditionTwo = true if (!isCommunityNodesAllowed && isAuthorPresent) conditionTwo = false - if (conditionOne && conditionTwo) { + const isDisabled = disabled_nodes.includes(newNodeInstance.name) + + if (conditionOne && conditionTwo && !isDisabled) { this.componentNodes[newNodeInstance.name] = newNodeInstance } } diff --git a/packages/server/src/commands/start.ts b/packages/server/src/commands/start.ts index 95e45f81448..14478adab79 100644 --- a/packages/server/src/commands/start.ts +++ b/packages/server/src/commands/start.ts @@ -56,7 +56,8 @@ export default class Start extends Command { S3_STORAGE_REGION: Flags.string(), S3_ENDPOINT_URL: Flags.string(), S3_FORCE_PATH_STYLE: Flags.string(), - SHOW_COMMUNITY_NODES: Flags.string() + SHOW_COMMUNITY_NODES: Flags.string(), + DISABLED_NODES: Flags.string() } async stopProcess() { @@ -100,6 +101,7 @@ export default class Start extends Command { if (flags.NUMBER_OF_PROXIES) process.env.NUMBER_OF_PROXIES = flags.NUMBER_OF_PROXIES if (flags.DISABLE_CHATFLOW_REUSE) process.env.DISABLE_CHATFLOW_REUSE = flags.DISABLE_CHATFLOW_REUSE if (flags.SHOW_COMMUNITY_NODES) process.env.SHOW_COMMUNITY_NODES = flags.SHOW_COMMUNITY_NODES + if (flags.DISABLED_NODES) process.env.DISABLED_NODES = flags.DISABLED_NODES // Authorization if (flags.FLOWISE_USERNAME) process.env.FLOWISE_USERNAME = flags.FLOWISE_USERNAME diff --git a/packages/ui/src/ui-component/extended/SpeechToText.jsx b/packages/ui/src/ui-component/extended/SpeechToText.jsx index 145f7baa8e5..23a5a1e9a09 100644 --- a/packages/ui/src/ui-component/extended/SpeechToText.jsx +++ b/packages/ui/src/ui-component/extended/SpeechToText.jsx @@ -306,7 +306,7 @@ const SpeechToText = ({ dialogProps }) => { newVal[provider.name] = { ...speechToText[provider.name], status: false } } }) - if (providerName !== 'none') { + if (providerName !== 'none' && newVal['none']) { newVal['none'].status = false } }