Skip to content

Commit 223a4eb

Browse files
HenryHengZJYshayy
authored andcommitted
Feature/add disabled nodes env variable (FlowiseAI#3797)
* add disabled nodes env variable * add bugfix to speech to text
1 parent 069a24b commit 223a4eb

File tree

8 files changed

+16
-4
lines changed

8 files changed

+16
-4
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ Flowise support different environment variables to configure your instance. You
159159
| S3_ENDPOINT_URL | Custom Endpoint for S3 | String | |
160160
| S3_FORCE_PATH_STYLE | Set this to true to force the request to use path-style addressing | Boolean | false |
161161
| SHOW_COMMUNITY_NODES | Show nodes created by community | Boolean | |
162+
| DISABLED_NODES | Hide nodes from UI (comma separated list of node names) | String | |
162163

163164
You can also specify the env variables when using `npx`. For example:
164165

docker/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ BLOB_STORAGE_PATH=/root/.flowise/storage
5252

5353
# APIKEY_STORAGE_TYPE=json (json | db)
5454
# SHOW_COMMUNITY_NODES=true
55+
# DISABLED_NODES=bufferMemory,chatOpenAI (comma separated list of node names to disable)
5556

5657
######################
5758
# METRICS COLLECTION

docker/docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ services:
3333
- GLOBAL_AGENT_HTTP_PROXY=${GLOBAL_AGENT_HTTP_PROXY}
3434
- GLOBAL_AGENT_HTTPS_PROXY=${GLOBAL_AGENT_HTTPS_PROXY}
3535
- GLOBAL_AGENT_NO_PROXY=${GLOBAL_AGENT_NO_PROXY}
36+
- DISABLED_NODES=${DISABLED_NODES}
37+
ports:
38+
- '${PORT}:${PORT}'
3639
volumes:
3740
- ~/.flowise:/root/.flowise
3841
networks:

i18n/CONTRIBUTING-ZH.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,9 @@ Flowise 支持不同的环境变量来配置您的实例。您可以在 `package
150150
| S3_STORAGE_SECRET_ACCESS_KEY | AWS 密钥 (Secret Key) | 字符串 | |
151151
| S3_STORAGE_REGION | S3 存储地区 | 字符串 | |
152152
| S3_ENDPOINT_URL | S3 端点 URL | 字符串 | |
153-
| S3_FORCE_PATH_STYLE | 将其设置为 true 以强制请求使用路径样式寻址 | Boolean | false |
153+
| S3_FORCE_PATH_STYLE | 将其设置为 true 以强制请求使用路径样式寻址 | 布尔值 | false |
154154
| SHOW_COMMUNITY_NODES | 显示由社区创建的节点 | 布尔值 | |
155+
| DISABLED_NODES | 从界面中隐藏节点(以逗号分隔的节点名称列表) | 字符串 | |
155156

156157
您也可以在使用 `npx` 时指定环境变量。例如:
157158

packages/server/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ PORT=3000
5252

5353
# APIKEY_STORAGE_TYPE=json (json | db)
5454
# SHOW_COMMUNITY_NODES=true
55+
# DISABLED_NODES=bufferMemory,chatOpenAI (comma separated list of node names to disable)
5556

5657
######################
5758
# METRICS COLLECTION

packages/server/src/NodesPool.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export class NodesPool {
2424
* Initialize nodes
2525
*/
2626
private async initializeNodes() {
27+
const disabled_nodes = process.env.DISABLED_NODES ? process.env.DISABLED_NODES.split(',') : []
2728
const packagePath = getNodeModulesPackagePath('flowise-components')
2829
const nodesPath = path.join(packagePath, 'dist', 'nodes')
2930
const nodeFiles = await this.getFiles(nodesPath)
@@ -65,7 +66,9 @@ export class NodesPool {
6566
let conditionTwo = true
6667
if (!isCommunityNodesAllowed && isAuthorPresent) conditionTwo = false
6768

68-
if (conditionOne && conditionTwo) {
69+
const isDisabled = disabled_nodes.includes(newNodeInstance.name)
70+
71+
if (conditionOne && conditionTwo && !isDisabled) {
6972
this.componentNodes[newNodeInstance.name] = newNodeInstance
7073
}
7174
}

packages/server/src/commands/start.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ export default class Start extends Command {
5656
S3_STORAGE_REGION: Flags.string(),
5757
S3_ENDPOINT_URL: Flags.string(),
5858
S3_FORCE_PATH_STYLE: Flags.string(),
59-
SHOW_COMMUNITY_NODES: Flags.string()
59+
SHOW_COMMUNITY_NODES: Flags.string(),
60+
DISABLED_NODES: Flags.string()
6061
}
6162

6263
async stopProcess() {
@@ -100,6 +101,7 @@ export default class Start extends Command {
100101
if (flags.NUMBER_OF_PROXIES) process.env.NUMBER_OF_PROXIES = flags.NUMBER_OF_PROXIES
101102
if (flags.DISABLE_CHATFLOW_REUSE) process.env.DISABLE_CHATFLOW_REUSE = flags.DISABLE_CHATFLOW_REUSE
102103
if (flags.SHOW_COMMUNITY_NODES) process.env.SHOW_COMMUNITY_NODES = flags.SHOW_COMMUNITY_NODES
104+
if (flags.DISABLED_NODES) process.env.DISABLED_NODES = flags.DISABLED_NODES
103105

104106
// Authorization
105107
if (flags.FLOWISE_USERNAME) process.env.FLOWISE_USERNAME = flags.FLOWISE_USERNAME

packages/ui/src/ui-component/extended/SpeechToText.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ const SpeechToText = ({ dialogProps }) => {
306306
newVal[provider.name] = { ...speechToText[provider.name], status: false }
307307
}
308308
})
309-
if (providerName !== 'none') {
309+
if (providerName !== 'none' && newVal['none']) {
310310
newVal['none'].status = false
311311
}
312312
}

0 commit comments

Comments
 (0)