Feature/add disabled nodes env variable (#3797)

* add disabled nodes env variable

* add bugfix to speech to text
This commit is contained in:
Henry Heng 2025-01-02 16:49:41 +00:00 committed by GitHub
parent b34a82335d
commit 50475f1fe5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 14 additions and 4 deletions

View File

@ -159,6 +159,7 @@ Flowise support different environment variables to configure your instance. You
| S3_ENDPOINT_URL | Custom Endpoint for S3 | String | | | 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 | | 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 | | | 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: You can also specify the env variables when using `npx`. For example:

View File

@ -52,6 +52,7 @@ BLOB_STORAGE_PATH=/root/.flowise/storage
# APIKEY_STORAGE_TYPE=json (json | db) # APIKEY_STORAGE_TYPE=json (json | db)
# SHOW_COMMUNITY_NODES=true # SHOW_COMMUNITY_NODES=true
# DISABLED_NODES=bufferMemory,chatOpenAI (comma separated list of node names to disable)
###################### ######################
# METRICS COLLECTION # METRICS COLLECTION

View File

@ -33,6 +33,7 @@ services:
- GLOBAL_AGENT_HTTP_PROXY=${GLOBAL_AGENT_HTTP_PROXY} - GLOBAL_AGENT_HTTP_PROXY=${GLOBAL_AGENT_HTTP_PROXY}
- GLOBAL_AGENT_HTTPS_PROXY=${GLOBAL_AGENT_HTTPS_PROXY} - GLOBAL_AGENT_HTTPS_PROXY=${GLOBAL_AGENT_HTTPS_PROXY}
- GLOBAL_AGENT_NO_PROXY=${GLOBAL_AGENT_NO_PROXY} - GLOBAL_AGENT_NO_PROXY=${GLOBAL_AGENT_NO_PROXY}
- DISABLED_NODES=${DISABLED_NODES}
ports: ports:
- '${PORT}:${PORT}' - '${PORT}:${PORT}'
volumes: volumes:

View File

@ -150,8 +150,9 @@ Flowise 支持不同的环境变量来配置您的实例。您可以在 `package
| S3_STORAGE_SECRET_ACCESS_KEY | AWS 密钥 (Secret Key) | 字符串 | | | S3_STORAGE_SECRET_ACCESS_KEY | AWS 密钥 (Secret Key) | 字符串 | |
| S3_STORAGE_REGION | S3 存储地区 | 字符串 | | | S3_STORAGE_REGION | S3 存储地区 | 字符串 | |
| S3_ENDPOINT_URL | S3 端点 URL | 字符串 | | | S3_ENDPOINT_URL | S3 端点 URL | 字符串 | |
| S3_FORCE_PATH_STYLE | 将其设置为 true 以强制请求使用路径样式寻址 | Boolean | false | | S3_FORCE_PATH_STYLE | 将其设置为 true 以强制请求使用路径样式寻址 | 布尔值 | false |
| SHOW_COMMUNITY_NODES | 显示由社区创建的节点 | 布尔值 | | | SHOW_COMMUNITY_NODES | 显示由社区创建的节点 | 布尔值 | |
| DISABLED_NODES | 从界面中隐藏节点(以逗号分隔的节点名称列表) | 字符串 | |
您也可以在使用 `npx` 时指定环境变量。例如: 您也可以在使用 `npx` 时指定环境变量。例如:

View File

@ -52,6 +52,7 @@ PORT=3000
# APIKEY_STORAGE_TYPE=json (json | db) # APIKEY_STORAGE_TYPE=json (json | db)
# SHOW_COMMUNITY_NODES=true # SHOW_COMMUNITY_NODES=true
# DISABLED_NODES=bufferMemory,chatOpenAI (comma separated list of node names to disable)
###################### ######################
# METRICS COLLECTION # METRICS COLLECTION

View File

@ -24,6 +24,7 @@ export class NodesPool {
* Initialize nodes * Initialize nodes
*/ */
private async initializeNodes() { private async initializeNodes() {
const disabled_nodes = process.env.DISABLED_NODES ? process.env.DISABLED_NODES.split(',') : []
const packagePath = getNodeModulesPackagePath('flowise-components') const packagePath = getNodeModulesPackagePath('flowise-components')
const nodesPath = path.join(packagePath, 'dist', 'nodes') const nodesPath = path.join(packagePath, 'dist', 'nodes')
const nodeFiles = await this.getFiles(nodesPath) const nodeFiles = await this.getFiles(nodesPath)
@ -65,7 +66,9 @@ export class NodesPool {
let conditionTwo = true let conditionTwo = true
if (!isCommunityNodesAllowed && isAuthorPresent) conditionTwo = false if (!isCommunityNodesAllowed && isAuthorPresent) conditionTwo = false
if (conditionOne && conditionTwo) { const isDisabled = disabled_nodes.includes(newNodeInstance.name)
if (conditionOne && conditionTwo && !isDisabled) {
this.componentNodes[newNodeInstance.name] = newNodeInstance this.componentNodes[newNodeInstance.name] = newNodeInstance
} }
} }

View File

@ -56,7 +56,8 @@ export default class Start extends Command {
S3_STORAGE_REGION: Flags.string(), S3_STORAGE_REGION: Flags.string(),
S3_ENDPOINT_URL: Flags.string(), S3_ENDPOINT_URL: Flags.string(),
S3_FORCE_PATH_STYLE: Flags.string(), S3_FORCE_PATH_STYLE: Flags.string(),
SHOW_COMMUNITY_NODES: Flags.string() SHOW_COMMUNITY_NODES: Flags.string(),
DISABLED_NODES: Flags.string()
} }
async stopProcess() { 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.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.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.SHOW_COMMUNITY_NODES) process.env.SHOW_COMMUNITY_NODES = flags.SHOW_COMMUNITY_NODES
if (flags.DISABLED_NODES) process.env.DISABLED_NODES = flags.DISABLED_NODES
// Authorization // Authorization
if (flags.FLOWISE_USERNAME) process.env.FLOWISE_USERNAME = flags.FLOWISE_USERNAME if (flags.FLOWISE_USERNAME) process.env.FLOWISE_USERNAME = flags.FLOWISE_USERNAME

View File

@ -306,7 +306,7 @@ const SpeechToText = ({ dialogProps }) => {
newVal[provider.name] = { ...speechToText[provider.name], status: false } newVal[provider.name] = { ...speechToText[provider.name], status: false }
} }
}) })
if (providerName !== 'none') { if (providerName !== 'none' && newVal['none']) {
newVal['none'].status = false newVal['none'].status = false
} }
} }