Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add disabled nodes env variable #3797

Merged
merged 2 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
1 change: 1 addition & 0 deletions docker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion i18n/CONTRIBUTING-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` 时指定环境变量。例如:

Expand Down
1 change: 1 addition & 0 deletions packages/server/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion packages/server/src/NodesPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
}
Expand Down
4 changes: 3 additions & 1 deletion packages/server/src/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/ui-component/extended/SpeechToText.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
Loading