mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-25 23:01:12 +03:00
Bugfix/pass execute custom function to worker (#4432)
pass execute custom function to worker
This commit is contained in:
@@ -10,6 +10,7 @@ import { RedisOptions } from 'bullmq'
|
||||
import logger from '../utils/logger'
|
||||
import { generateAgentflowv2 as generateAgentflowv2_json } from 'flowise-components'
|
||||
import { databaseEntities } from '../utils'
|
||||
import { executeCustomNodeFunction } from '../utils/executeCustomNodeFunction'
|
||||
|
||||
interface PredictionQueueOptions {
|
||||
appDataSource: DataSource
|
||||
@@ -65,7 +66,7 @@ export class PredictionQueue extends BaseQueue {
|
||||
if (this.redisPublisher) data.sseStreamer = this.redisPublisher
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(data, 'isAgentFlowGenerator')) {
|
||||
logger.info('Generating Agentflow...')
|
||||
logger.info(`Generating Agentflow...`)
|
||||
const { prompt, componentNodes, toolNodes, selectedChatModel, question } = data as IGenerateAgentflowv2Params
|
||||
const options: Record<string, any> = {
|
||||
appDataSource: this.appDataSource,
|
||||
@@ -75,6 +76,15 @@ export class PredictionQueue extends BaseQueue {
|
||||
return await generateAgentflowv2_json({ prompt, componentNodes, toolNodes, selectedChatModel }, question, options)
|
||||
}
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(data, 'isExecuteCustomFunction')) {
|
||||
logger.info(`Executing Custom Function...`)
|
||||
return await executeCustomNodeFunction({
|
||||
appDataSource: this.appDataSource,
|
||||
componentNodes: this.componentNodes,
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
if (this.abortControllerPool) {
|
||||
const abortControllerId = `${data.chatflow.id}_${data.chatId}`
|
||||
const signal = new AbortController()
|
||||
|
||||
Reference in New Issue
Block a user