Skip to content

Commit

Permalink
Chore/changed vm2 to @flowiseai/nodevm (FlowiseAI#3200)
Browse files Browse the repository at this point in the history
* changed vm2 to @flowiseai/nodevm

* update set-value and lunary version
  • Loading branch information
HenryHengZJ authored Sep 17, 2024
1 parent 1ceea81 commit 7a4c7ef
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 3,340 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@
"onlyBuiltDependencies": [
"faiss-node",
"sqlite3"
]
],
"overrides": {
"set-value": "^3.0.3"
}
},
"engines": {
"node": ">=18.15.0 <19.0.0 || ^20",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ICommonObject, IDatabaseEntity, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { NodeVM } from 'vm2'
import { NodeVM } from '@flowiseai/nodevm'
import { DataSource } from 'typeorm'
import { availableDependencies, defaultAllowBuiltInDep, getVars, handleEscapeCharacters, prepareSandboxVars } from '../../../src/utils'

Expand Down
4 changes: 2 additions & 2 deletions packages/components/nodes/sequentialagents/State/State.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { START } from '@langchain/langgraph'
import { NodeVM } from '@flowiseai/nodevm'
import { DataSource } from 'typeorm'
import { ICommonObject, IDatabaseEntity, INode, INodeData, INodeParams, ISeqAgentNode } from '../../../src/Interface'
import { availableDependencies, defaultAllowBuiltInDep, getVars, prepareSandboxVars } from '../../../src/utils'
import { NodeVM } from 'vm2'
import { DataSource } from 'typeorm'

const defaultFunc = `{
aggregate: {
Expand Down
2 changes: 1 addition & 1 deletion packages/components/nodes/sequentialagents/commonUtils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { get } from 'lodash'
import { z } from 'zod'
import { DataSource } from 'typeorm'
import { NodeVM } from 'vm2'
import { NodeVM } from '@flowiseai/nodevm'
import { StructuredTool } from '@langchain/core/tools'
import { ChatMistralAI } from '@langchain/mistralai'
import { ChatAnthropic } from '@langchain/anthropic'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DataSource } from 'typeorm'
import { z } from 'zod'
import { NodeVM } from 'vm2'
import { NodeVM } from '@flowiseai/nodevm'
import { RunnableConfig } from '@langchain/core/runnables'
import { CallbackManagerForToolRun, Callbacks, CallbackManager, parseCallbackConfigArg } from '@langchain/core/callbacks/manager'
import { StructuredTool } from '@langchain/core/tools'
Expand Down
2 changes: 1 addition & 1 deletion packages/components/nodes/tools/CustomTool/core.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from 'zod'
import { NodeVM } from 'vm2'
import { NodeVM } from '@flowiseai/nodevm'
import { RunnableConfig } from '@langchain/core/runnables'
import { StructuredTool, ToolParams } from '@langchain/core/tools'
import { CallbackManagerForToolRun, Callbacks, CallbackManager, parseCallbackConfigArg } from '@langchain/core/callbacks/manager'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { flatten } from 'lodash'
import { type StructuredTool } from '@langchain/core/tools'
import { ICommonObject, IDatabaseEntity, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { NodeVM } from 'vm2'
import { NodeVM } from '@flowiseai/nodevm'
import { DataSource } from 'typeorm'
import { availableDependencies, defaultAllowBuiltInDep, getVars, handleEscapeCharacters, prepareSandboxVars } from '../../../src/utils'
import { ICommonObject, IDatabaseEntity, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'

class CustomFunction_Utilities implements INode {
label: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ICommonObject, IDatabaseEntity, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { NodeVM } from 'vm2'
import { NodeVM } from '@flowiseai/nodevm'
import { DataSource } from 'typeorm'
import { availableDependencies, defaultAllowBuiltInDep, getVars, handleEscapeCharacters, prepareSandboxVars } from '../../../src/utils'
import { ICommonObject, IDatabaseEntity, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'

class IfElseFunction_Utilities implements INode {
label: string
Expand Down
4 changes: 2 additions & 2 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@dqbd/tiktoken": "^1.0.7",
"@e2b/code-interpreter": "^0.0.5",
"@elastic/elasticsearch": "^8.9.0",
"@flowiseai/nodevm": "^3.9.25",
"@getzep/zep-cloud": "~1.0.7",
"@getzep/zep-js": "^0.9.0",
"@gomomento/sdk": "^1.51.1",
Expand Down Expand Up @@ -92,7 +93,7 @@
"linkifyjs": "^4.1.1",
"llamaindex": "^0.3.13",
"lodash": "^4.17.21",
"lunary": "^0.6.16",
"lunary": "^0.7.10",
"mammoth": "^1.5.1",
"meilisearch": "^0.41.0",
"moment": "^2.29.3",
Expand All @@ -115,7 +116,6 @@
"socket.io": "^4.6.1",
"srt-parser-2": "^1.2.3",
"typeorm": "^0.3.6",
"vm2": "^3.9.19",
"weaviate-ts-client": "^1.1.0",
"winston": "^3.9.0",
"ws": "^8.9.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const notEmptyRegex = '(.|\\s)*\\S(.|\\s)*' //return true if string is no
export const FLOWISE_CHATID = 'flowise_chatId'

/*
* List of dependencies allowed to be import in vm2
* List of dependencies allowed to be import in @flowiseai/nodevm
*/
export const availableDependencies = [
'@aws-sdk/client-bedrock-runtime',
Expand Down
Loading

0 comments on commit 7a4c7ef

Please sign in to comment.