Feature/Community Node (#2902)

add feature to enable community node
This commit is contained in:
Henry Heng
2024-07-29 16:52:47 +01:00
committed by GitHub
parent b5d969b2bb
commit 27cb143fef
9 changed files with 61 additions and 31 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
export const appConfig = {
apiKeys: {
storageType: process.env.APIKEY_STORAGE_TYPE ? process.env.APIKEY_STORAGE_TYPE.toLowerCase() : 'json'
}
},
showCommunityNodes: process.env.SHOW_COMMUNITY_NODES ? process.env.SHOW_COMMUNITY_NODES.toLowerCase() === 'true' : false
// todo: add more config options here like database, log, storage, credential and allow modification from UI
}
+9 -1
View File
@@ -5,6 +5,7 @@ import { getNodeModulesPackagePath } from './utils'
import { promises } from 'fs'
import { ICommonObject } from 'flowise-components'
import logger from './utils/logger'
import { appConfig } from './AppConfig'
export class NodesPool {
componentNodes: IComponentNodes = {}
@@ -57,7 +58,14 @@ export class NodesPool {
}
const skipCategories = ['Analytic', 'SpeechToText']
if (!skipCategories.includes(newNodeInstance.category)) {
const conditionOne = !skipCategories.includes(newNodeInstance.category)
const isCommunityNodesAllowed = appConfig.showCommunityNodes
const isAuthorPresent = newNodeInstance.author
let conditionTwo = true
if (!isCommunityNodesAllowed && isAuthorPresent) conditionTwo = false
if (conditionOne && conditionTwo) {
this.componentNodes[newNodeInstance.name] = newNodeInstance
}
}
+3 -1
View File
@@ -54,7 +54,8 @@ export default class Start extends Command {
S3_STORAGE_ACCESS_KEY_ID: Flags.string(),
S3_STORAGE_SECRET_ACCESS_KEY: Flags.string(),
S3_STORAGE_REGION: Flags.string(),
S3_ENDPOINT_URL: Flags.string()
S3_ENDPOINT_URL: Flags.string(),
SHOW_COMMUNITY_NODES: Flags.string()
}
async stopProcess() {
@@ -97,6 +98,7 @@ export default class Start extends Command {
if (flags.DEBUG) process.env.DEBUG = flags.DEBUG
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
// Authorization
if (flags.FLOWISE_USERNAME) process.env.FLOWISE_USERNAME = flags.FLOWISE_USERNAME