Bugfix/Circular Dependency of updateStorageUsage and checkStorage in utils (#4717)
fix circular dependency of updateStorageUsage and checkStorage in utils
This commit is contained in:
parent
4038eb13fc
commit
397ba63d60
|
|
@ -28,6 +28,9 @@
|
||||||
"start:default": "cd bin && ./run start",
|
"start:default": "cd bin && ./run start",
|
||||||
"start-worker:windows": "cd bin && run worker",
|
"start-worker:windows": "cd bin && run worker",
|
||||||
"start-worker:default": "cd bin && ./run worker",
|
"start-worker:default": "cd bin && ./run worker",
|
||||||
|
"user": "run-script-os",
|
||||||
|
"user:windows": "cd bin && run user",
|
||||||
|
"user:default": "cd bin && ./run user",
|
||||||
"dev": "nodemon",
|
"dev": "nodemon",
|
||||||
"oclif-dev": "run-script-os",
|
"oclif-dev": "run-script-os",
|
||||||
"oclif-dev:windows": "cd bin && dev start",
|
"oclif-dev:windows": "cd bin && dev start",
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import {
|
||||||
getStartingNodes,
|
getStartingNodes,
|
||||||
resolveVariables
|
resolveVariables
|
||||||
} from '../../utils'
|
} from '../../utils'
|
||||||
|
import { checkStorage, updateStorageUsage } from '../../utils/quotaUsage'
|
||||||
import { getRunningExpressApp } from '../../utils/getRunningExpressApp'
|
import { getRunningExpressApp } from '../../utils/getRunningExpressApp'
|
||||||
import { ChatFlow } from '../../database/entities/ChatFlow'
|
import { ChatFlow } from '../../database/entities/ChatFlow'
|
||||||
import { IDepthQueue, IReactFlowNode } from '../../Interface'
|
import { IDepthQueue, IReactFlowNode } from '../../Interface'
|
||||||
|
|
@ -110,7 +111,9 @@ const buildAndInitTool = async (chatflowid: string, _chatId?: string, _apiMessag
|
||||||
variableOverrides,
|
variableOverrides,
|
||||||
orgId,
|
orgId,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
subscriptionId
|
subscriptionId,
|
||||||
|
updateStorageUsage,
|
||||||
|
checkStorage
|
||||||
})
|
})
|
||||||
|
|
||||||
const nodeToExecute =
|
const nodeToExecute =
|
||||||
|
|
|
||||||
|
|
@ -515,7 +515,9 @@ export const executeFlow = async ({
|
||||||
baseURL,
|
baseURL,
|
||||||
orgId,
|
orgId,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
subscriptionId
|
subscriptionId,
|
||||||
|
updateStorageUsage,
|
||||||
|
checkStorage
|
||||||
})
|
})
|
||||||
|
|
||||||
const setVariableNodesOutput = getSetVariableNodesOutput(reactFlowNodes)
|
const setVariableNodesOutput = getSetVariableNodesOutput(reactFlowNodes)
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,6 @@ import {
|
||||||
SecretsManagerClient,
|
SecretsManagerClient,
|
||||||
SecretsManagerClientConfig
|
SecretsManagerClientConfig
|
||||||
} from '@aws-sdk/client-secrets-manager'
|
} from '@aws-sdk/client-secrets-manager'
|
||||||
import { checkStorage, updateStorageUsage } from './quotaUsage'
|
|
||||||
import { UsageCacheManager } from '../UsageCacheManager'
|
|
||||||
|
|
||||||
export const QUESTION_VAR_PREFIX = 'question'
|
export const QUESTION_VAR_PREFIX = 'question'
|
||||||
export const FILE_ATTACHMENT_PREFIX = 'file_attachment'
|
export const FILE_ATTACHMENT_PREFIX = 'file_attachment'
|
||||||
|
|
@ -504,8 +502,10 @@ type BuildFlowParams = {
|
||||||
orgId?: string
|
orgId?: string
|
||||||
workspaceId?: string
|
workspaceId?: string
|
||||||
subscriptionId?: string
|
subscriptionId?: string
|
||||||
usageCacheManager?: UsageCacheManager
|
usageCacheManager?: any
|
||||||
uploadedFilesContent?: string
|
uploadedFilesContent?: string
|
||||||
|
updateStorageUsage?: (orgId: string, workspaceId: string, totalSize: number, usageCacheManager?: any) => void
|
||||||
|
checkStorage?: (orgId: string, subscriptionId: string, usageCacheManager: any) => Promise<any>
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -540,7 +540,9 @@ export const buildFlow = async ({
|
||||||
orgId,
|
orgId,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
subscriptionId,
|
subscriptionId,
|
||||||
usageCacheManager
|
usageCacheManager,
|
||||||
|
updateStorageUsage,
|
||||||
|
checkStorage
|
||||||
}: BuildFlowParams) => {
|
}: BuildFlowParams) => {
|
||||||
const flowNodes = cloneDeep(reactFlowNodes)
|
const flowNodes = cloneDeep(reactFlowNodes)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,9 @@ export const executeUpsert = async ({
|
||||||
variableOverrides,
|
variableOverrides,
|
||||||
orgId,
|
orgId,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
subscriptionId
|
subscriptionId,
|
||||||
|
updateStorageUsage,
|
||||||
|
checkStorage
|
||||||
})
|
})
|
||||||
|
|
||||||
// Save to DB
|
// Save to DB
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue