parent
9839009823
commit
8a6b95ef0e
|
|
@ -943,10 +943,13 @@ export const getVars = async (
|
|||
nodeData: INodeData,
|
||||
options: ICommonObject
|
||||
) => {
|
||||
if (!options.workspaceId) {
|
||||
return []
|
||||
}
|
||||
const variables =
|
||||
((await appDataSource
|
||||
.getRepository(databaseEntities['Variable'])
|
||||
.findBy(options.workspaceId ? { workspaceId: Equal(options.workspaceId) } : {})) as IVariable[]) ?? []
|
||||
.findBy({ workspaceId: Equal(options.workspaceId) })) as IVariable[]) ?? []
|
||||
|
||||
// override variables defined in overrideConfig
|
||||
// nodeData.inputs.vars is an Object, check each property and override the variable
|
||||
|
|
|
|||
|
|
@ -86,7 +86,8 @@ const executeCustomFunction = async (req: Request, res: Response, next: NextFunc
|
|||
)
|
||||
}
|
||||
const orgId = req.user?.activeOrganizationId
|
||||
const apiResponse = await nodesService.executeCustomFunction(req.body, orgId)
|
||||
const workspaceId = req.user?.activeWorkspaceId
|
||||
const apiResponse = await nodesService.executeCustomFunction(req.body, workspaceId, orgId)
|
||||
return res.json(apiResponse)
|
||||
} catch (error) {
|
||||
next(error)
|
||||
|
|
|
|||
|
|
@ -122,14 +122,15 @@ const getSingleNodeAsyncOptions = async (nodeName: string, requestBody: any): Pr
|
|||
}
|
||||
|
||||
// execute custom function node
|
||||
const executeCustomFunction = async (requestBody: any, orgId?: string) => {
|
||||
const executeCustomFunction = async (requestBody: any, workspaceId?: string, orgId?: string) => {
|
||||
const appServer = getRunningExpressApp()
|
||||
const executeData = {
|
||||
appDataSource: appServer.AppDataSource,
|
||||
componentNodes: appServer.nodesPool.componentNodes,
|
||||
data: requestBody,
|
||||
isExecuteCustomFunction: true,
|
||||
orgId
|
||||
orgId,
|
||||
workspaceId
|
||||
}
|
||||
|
||||
if (process.env.MODE === MODE.QUEUE) {
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@ const buildAndInitTool = async (chatflowid: string, _chatId?: string, _apiMessag
|
|||
chatflowid,
|
||||
chatId,
|
||||
orgId,
|
||||
workspaceId,
|
||||
appDataSource: appServer.AppDataSource,
|
||||
databaseEntities,
|
||||
analytic: chatflow.analytic
|
||||
|
|
|
|||
|
|
@ -750,6 +750,8 @@ export const executeFlow = async ({
|
|||
rawOutput: resultText,
|
||||
appDataSource,
|
||||
databaseEntities,
|
||||
workspaceId,
|
||||
orgId,
|
||||
logger
|
||||
}
|
||||
const customFuncNodeInstance = new nodeModule.nodeClass()
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ export const createFileAttachment = async (req: Request) => {
|
|||
const options = {
|
||||
retrieveAttachmentChatId: true,
|
||||
orgId,
|
||||
workspaceId,
|
||||
chatflowid,
|
||||
chatId
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,11 +9,15 @@ import { IComponentNodes } from '../Interface'
|
|||
export const executeCustomNodeFunction = async ({
|
||||
appDataSource,
|
||||
componentNodes,
|
||||
data
|
||||
data,
|
||||
workspaceId,
|
||||
orgId
|
||||
}: {
|
||||
appDataSource: DataSource
|
||||
componentNodes: IComponentNodes
|
||||
data: any
|
||||
workspaceId?: string
|
||||
orgId?: string
|
||||
}) => {
|
||||
try {
|
||||
const body = data
|
||||
|
|
@ -37,7 +41,9 @@ export const executeCustomNodeFunction = async ({
|
|||
|
||||
const options: ICommonObject = {
|
||||
appDataSource,
|
||||
databaseEntities
|
||||
databaseEntities,
|
||||
workspaceId,
|
||||
orgId
|
||||
}
|
||||
|
||||
const returnData = await newNodeInstance.init(nodeData, '', options)
|
||||
|
|
|
|||
Loading…
Reference in New Issue