Merge branch 'maintenance/pnpm-vite-jsx' of https://github.com/use-the-fork/Flowise into maintenance/vite-pnpm-tsup

# Conflicts:
#	packages/ui/pnpm-lock.yaml
#	packages/ui/vite.config.js
This commit is contained in:
Greg L
2023-12-05 17:03:37 -05:00
42 changed files with 25902 additions and 36945 deletions
+2 -1
View File
@@ -27,7 +27,8 @@ If applicable, add screenshots to help explain your problem.
If applicable, add exported flow in order to help replicating the problem. If applicable, add exported flow in order to help replicating the problem.
**Setup** **Setup**
- Installation [e.g. docker, `npx flowise start`, `yarn start`]
- Installation [e.g. docker, `npx flowise start`, `pnpm start`]
- Flowise Version [e.g. 1.2.11] - Flowise Version [e.g. 1.2.11]
- OS: [e.g. macOS, Windows, Linux] - OS: [e.g. macOS, Windows, Linux]
- Browser [e.g. chrome, safari] - Browser [e.g. chrome, safari]
+6 -4
View File
@@ -1,4 +1,6 @@
shared-workspace-lockfile=false auto-install-peers = true
public-hoist-pattern[]=*eslint* strict-peer-dependencies = false
public-hoist-pattern[]=*prettier* prefer-workspace-packages = true
public-hoist-pattern[]=@types* link-workspace-packages = deep
hoist = true
shamefully-hoist = true
+10 -10
View File
@@ -44,9 +44,9 @@ Flowise 在一个单一的单体存储库中有 3 个不同的模块。
#### 先决条件 #### 先决条件
- 安装 [Yarn v1](https://classic.yarnpkg.com/en/docs/install) - 安装 [PNPM](https://pnpm.io/installation)
```bash ```bash
npm i -g yarn npm i -g pnpm
``` ```
#### 逐步指南 #### 逐步指南
@@ -71,45 +71,45 @@ Flowise 在一个单一的单体存储库中有 3 个不同的模块。
6. 安装所有模块的依赖项: 6. 安装所有模块的依赖项:
```bash ```bash
yarn install pnpm install
``` ```
7. 构建所有代码: 7. 构建所有代码:
```bash ```bash
yarn build pnpm build
``` ```
8. 在[http://localhost:3000](http://localhost:3000)上启动应用程序 8. 在[http://localhost:3000](http://localhost:3000)上启动应用程序
```bash ```bash
yarn start pnpm start
``` ```
9. 开发时: 9. 开发时:
- 在`packages/ui`中创建`.env`文件并指定`PORT`(参考`.env.example` - 在`packages/ui`中创建`.env`文件并指定`VITE_PORT`(参考`.env.example`
- 在`packages/server`中创建`.env`文件并指定`PORT`(参考`.env.example` - 在`packages/server`中创建`.env`文件并指定`PORT`(参考`.env.example`
- 运行 - 运行
```bash ```bash
yarn dev pnpm dev
``` ```
对`packages/ui`或`packages/server`进行的任何更改都将反映在[http://localhost:8080](http://localhost:8080)上 对`packages/ui`或`packages/server`进行的任何更改都将反映在[http://localhost:8080](http://localhost:8080)上
对于`packages/components`中进行的更改,再次运行`yarn build`以应用更改。 对于`packages/components`中进行的更改,再次运行`pnpm build`以应用更改。
10. 做完所有的更改后,运行以下命令来确保在生产环境中一切正常: 10. 做完所有的更改后,运行以下命令来确保在生产环境中一切正常:
```bash ```bash
yarn build pnpm build
``` ```
```bash ```bash
yarn start pnpm start
``` ```
11. 提交代码并从指向 [Flowise 主分支](https://github.com/FlowiseAI/Flowise/tree/master) 的分叉分支上提交 Pull Request。 11. 提交代码并从指向 [Flowise 主分支](https://github.com/FlowiseAI/Flowise/tree/master) 的分叉分支上提交 Pull Request。
+2 -2
View File
@@ -88,7 +88,7 @@ Flowise has 3 different modules in a single mono repository.
9. For development: 9. For development:
- Create `.env` file and specify the `PORT` (refer to `.env.example`) in `packages/ui` - Create `.env` file and specify the `VITE_PORT` (refer to `.env.example`) in `packages/ui`
- Create `.env` file and specify the `PORT` (refer to `.env.example`) in `packages/server` - Create `.env` file and specify the `PORT` (refer to `.env.example`) in `packages/server`
- Run - Run
@@ -96,7 +96,7 @@ Flowise has 3 different modules in a single mono repository.
pnpm dev pnpm dev
``` ```
Any changes made in `packages/ui` or `packages/server` will be reflected on [http://localhost:5173](http://localhost:5173) Any changes made in `packages/ui` or `packages/server` will be reflected on [http://localhost:8080](http://localhost:8080)
For changes made in `packages/components`, run `pnpm build` again to pickup the changes. For changes made in `packages/components`, run `pnpm build` again to pickup the changes.
+7 -7
View File
@@ -75,9 +75,9 @@ Flowise 在一个单一的代码库中有 3 个不同的模块。
### 先决条件 ### 先决条件
- 安装 [Yarn v1](https://classic.yarnpkg.com/en/docs/install) - 安装 [PNPM](https://pnpm.io/installation)
```bash ```bash
npm i -g yarn npm i -g pnpm
``` ```
### 设置 ### 设置
@@ -97,31 +97,31 @@ Flowise 在一个单一的代码库中有 3 个不同的模块。
3. 安装所有模块的依赖: 3. 安装所有模块的依赖:
```bash ```bash
yarn install pnpm install
``` ```
4. 构建所有代码: 4. 构建所有代码:
```bash ```bash
yarn build pnpm build
``` ```
5. 启动应用: 5. 启动应用:
```bash ```bash
yarn start pnpm start
``` ```
现在可以在 [http://localhost:3000](http://localhost:3000) 访问应用 现在可以在 [http://localhost:3000](http://localhost:3000) 访问应用
6. 用于开发构建: 6. 用于开发构建:
- 在 `packages/ui` 中创建 `.env` 文件并指定 `PORT`(参考 `.env.example` - 在 `packages/ui` 中创建 `.env` 文件并指定 `VITE_PORT`(参考 `.env.example`
- 在 `packages/server` 中创建 `.env` 文件并指定 `PORT`(参考 `.env.example` - 在 `packages/server` 中创建 `.env` 文件并指定 `PORT`(参考 `.env.example`
- 运行 - 运行
```bash ```bash
yarn dev pnpm dev
``` ```
任何代码更改都会自动重新加载应用程序,访问 [http://localhost:8080](http://localhost:8080) 任何代码更改都会自动重新加载应用程序,访问 [http://localhost:8080](http://localhost:8080)
+7 -7
View File
@@ -75,9 +75,9 @@ Flowise has 3 different modules in a single mono repository.
### Prerequisite ### Prerequisite
- Install [Yarn v1](https://classic.yarnpkg.com/en/docs/install) - Install [Yarn v1](https://pnpm.io/installation)
```bash ```bash
npm i -g yarn npm i -g pnpm
``` ```
### Setup ### Setup
@@ -97,31 +97,31 @@ Flowise has 3 different modules in a single mono repository.
3. Install all dependencies of all modules: 3. Install all dependencies of all modules:
```bash ```bash
yarn install pnpm install
``` ```
4. Build all the code: 4. Build all the code:
```bash ```bash
yarn build pnpm build
``` ```
5. Start the app: 5. Start the app:
```bash ```bash
yarn start pnpm start
``` ```
You can now access the app on [http://localhost:3000](http://localhost:3000) You can now access the app on [http://localhost:3000](http://localhost:3000)
6. For development build: 6. For development build:
- Create `.env` file and specify the `PORT` (refer to `.env.example`) in `packages/ui` - Create `.env` file and specify the `VITE_PORT` (refer to `.env.example`) in `packages/ui`
- Create `.env` file and specify the `PORT` (refer to `.env.example`) in `packages/server` - Create `.env` file and specify the `PORT` (refer to `.env.example`) in `packages/server`
- Run - Run
```bash ```bash
yarn dev pnpm dev
``` ```
Any code changes will reload the app automatically on [http://localhost:8080](http://localhost:8080) Any code changes will reload the app automatically on [http://localhost:8080](http://localhost:8080)
+15 -8
View File
@@ -1,6 +1,6 @@
{ {
"name": "flowise", "name": "flowise",
"version": "1.4.2", "version": "1.4.3",
"private": true, "private": true,
"homepage": "https://flowiseai.com", "homepage": "https://flowiseai.com",
"workspaces": [ "workspaces": [
@@ -10,14 +10,14 @@
"components" "components"
], ],
"scripts": { "scripts": {
"preinstall": "npx only-allow pnpm", "build": "turbo run build",
"dev": "kill-port 3000 5173 && pnpm --filter './packages/**' dev", "build-force": "pnpm clean && turbo run build --force",
"build": "pnpm clean && pnpm -r --filter \"./packages/**\" build", "dev": "turbo run dev --parallel",
"start": "kill-port 3000 && run-script-os", "start": "run-script-os",
"start:windows": "cd packages/server/bin && run start", "start:windows": "cd packages/server/bin && run start",
"start:default": "cd packages/server/bin && ./run start", "start:default": "cd packages/server/bin && ./run start",
"clean": " pnpm --filter './packages/**' clean", "clean": "pnpm --filter \"./packages/**\" clean",
"nuke": " pnpm --filter './packages/**' nuke && rimraf node_modules", "nuke": "pnpm --filter \"./packages/**\" nuke && rimraf node_modules",
"format": "prettier --write \"**/*.{ts,tsx,md}\"", "format": "prettier --write \"**/*.{ts,tsx,md}\"",
"lint": "eslint \"**/*.{js,jsx,ts,tsx,json,md}\"", "lint": "eslint \"**/*.{js,jsx,ts,tsx,json,md}\"",
"lint-fix": "pnpm lint --fix", "lint-fix": "pnpm lint --fix",
@@ -49,9 +49,16 @@
"pretty-quick": "^3.1.3", "pretty-quick": "^3.1.3",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"run-script-os": "^1.1.6", "run-script-os": "^1.1.6",
"turbo": "1.10.16",
"typescript": "^4.8.4" "typescript": "^4.8.4"
}, },
"packageManager": "pnpm@8.10.5",
"pnpm": {
"onlyBuiltDependencies": [
"sqlite3"
]
},
"engines": { "engines": {
"node": ">=18.15.0" "node": ">=18.15.0 <19.0.0 || ^20"
} }
} }
@@ -12,7 +12,7 @@ class LangfuseApi implements INodeCredential {
this.name = 'langfuseApi' this.name = 'langfuseApi'
this.version = 1.0 this.version = 1.0
this.description = this.description =
'Refer to <a target="_blank" href="https://langfuse.com/docs/get-started/">official guide</a> on how to get API key on Langfuse' 'Refer to <a target="_blank" href="https://langfuse.com/docs/flowise">integration guide</a> on how to get API keys on Langfuse'
this.inputs = [ this.inputs = [
{ {
label: 'Secret Key', label: 'Secret Key',
-1
View File
@@ -1 +0,0 @@
export * from '.'
@@ -21,7 +21,7 @@ class ConversationalRetrievalAgent_Agents implements INode {
constructor() { constructor() {
this.label = 'Conversational Retrieval Agent' this.label = 'Conversational Retrieval Agent'
this.name = 'conversationalRetrievalAgent' this.name = 'conversationalRetrievalAgent'
this.version = 1.0 this.version = 2.0
this.type = 'AgentExecutor' this.type = 'AgentExecutor'
this.category = 'Agents' this.category = 'Agents'
this.icon = 'agent.svg' this.icon = 'agent.svg'
@@ -40,9 +40,9 @@ class ConversationalRetrievalAgent_Agents implements INode {
type: 'BaseChatMemory' type: 'BaseChatMemory'
}, },
{ {
label: 'OpenAI Chat Model', label: 'OpenAI/Azure Chat Model',
name: 'model', name: 'model',
type: 'ChatOpenAI' type: 'ChatOpenAI | AzureChatOpenAI'
}, },
{ {
label: 'System Message', label: 'System Message',
@@ -20,11 +20,11 @@ class OpenAIFunctionAgent_Agents implements INode {
constructor() { constructor() {
this.label = 'OpenAI Function Agent' this.label = 'OpenAI Function Agent'
this.name = 'openAIFunctionAgent' this.name = 'openAIFunctionAgent'
this.version = 1.0 this.version = 2.0
this.type = 'AgentExecutor' this.type = 'AgentExecutor'
this.category = 'Agents' this.category = 'Agents'
this.icon = 'openai.png' this.icon = 'openai.png'
this.description = `An agent that uses OpenAI's Function Calling functionality to pick the tool and args to call` this.description = `An agent that uses Function Calling to pick the tool and args to call`
this.baseClasses = [this.type, ...getBaseClasses(AgentExecutor)] this.baseClasses = [this.type, ...getBaseClasses(AgentExecutor)]
this.inputs = [ this.inputs = [
{ {
@@ -39,11 +39,9 @@ class OpenAIFunctionAgent_Agents implements INode {
type: 'BaseChatMemory' type: 'BaseChatMemory'
}, },
{ {
label: 'OpenAI Chat Model', label: 'OpenAI/Azure Chat Model',
name: 'model', name: 'model',
description: type: 'ChatOpenAI | AzureChatOpenAI'
'Only works with gpt-3.5-turbo-0613 and gpt-4-0613. Refer <a target="_blank" href="https://platform.openai.com/docs/guides/gpt/function-calling">docs</a> for more info',
type: 'BaseChatModel'
}, },
{ {
label: 'System Message', label: 'System Message',
@@ -1,7 +1,7 @@
import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { getBaseClasses, handleEscapeCharacters } from '../../../src/utils' import { getBaseClasses, handleEscapeCharacters } from '../../../src/utils'
import { LLMChain } from 'langchain/chains' import { LLMChain } from 'langchain/chains'
import { BaseLanguageModel } from 'langchain/base_language' import { BaseLanguageModel, BaseLanguageModelCallOptions } from 'langchain/base_language'
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler' import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
import { BaseOutputParser } from 'langchain/schema/output_parser' import { BaseOutputParser } from 'langchain/schema/output_parser'
import { formatResponse, injectOutputParser } from '../../outputparsers/OutputParserHelpers' import { formatResponse, injectOutputParser } from '../../outputparsers/OutputParserHelpers'
@@ -141,7 +141,7 @@ class LLMChain_Chains implements INode {
const runPrediction = async ( const runPrediction = async (
inputVariables: string[], inputVariables: string[],
chain: LLMChain<string | object>, chain: LLMChain<string | object | BaseLanguageModel<any, BaseLanguageModelCallOptions>>,
input: string, input: string,
promptValuesRaw: ICommonObject | undefined, promptValuesRaw: ICommonObject | undefined,
options: ICommonObject, options: ICommonObject,
@@ -164,7 +164,7 @@ const runPrediction = async (
if (moderations && moderations.length > 0) { if (moderations && moderations.length > 0) {
try { try {
// Use the output of the moderation chain as input for the LLM chain // Use the output of the moderation chain as input for the LLM chain
input = await checkInputs(moderations, chain.llm, input) input = await checkInputs(moderations, input)
} catch (e) { } catch (e) {
await new Promise((resolve) => setTimeout(resolve, 500)) await new Promise((resolve) => setTimeout(resolve, 500))
streamResponse(isStreaming, e.message, socketIO, socketIOClientId) streamResponse(isStreaming, e.message, socketIO, socketIOClientId)
@@ -27,7 +27,7 @@ class AWSChatBedrock_ChatModels implements INode {
constructor() { constructor() {
this.label = 'AWS Bedrock' this.label = 'AWS Bedrock'
this.name = 'awsChatBedrock' this.name = 'awsChatBedrock'
this.version = 2.0 this.version = 3.0
this.type = 'AWSChatBedrock' this.type = 'AWSChatBedrock'
this.icon = 'awsBedrock.png' this.icon = 'awsBedrock.png'
this.category = 'Chat Models' this.category = 'Chat Models'
@@ -97,7 +97,8 @@ class AWSChatBedrock_ChatModels implements INode {
options: [ options: [
{ label: 'anthropic.claude-instant-v1', name: 'anthropic.claude-instant-v1' }, { label: 'anthropic.claude-instant-v1', name: 'anthropic.claude-instant-v1' },
{ label: 'anthropic.claude-v1', name: 'anthropic.claude-v1' }, { label: 'anthropic.claude-v1', name: 'anthropic.claude-v1' },
{ label: 'anthropic.claude-v2', name: 'anthropic.claude-v2' } { label: 'anthropic.claude-v2', name: 'anthropic.claude-v2' },
{ label: 'meta.llama2-13b-chat-v1', name: 'meta.llama2-13b-chat-v1' }
], ],
default: 'anthropic.claude-v2' default: 'anthropic.claude-v2'
}, },
@@ -128,12 +129,14 @@ class AWSChatBedrock_ChatModels implements INode {
const iTemperature = nodeData.inputs?.temperature as string const iTemperature = nodeData.inputs?.temperature as string
const iMax_tokens_to_sample = nodeData.inputs?.max_tokens_to_sample as string const iMax_tokens_to_sample = nodeData.inputs?.max_tokens_to_sample as string
const cache = nodeData.inputs?.cache as BaseCache const cache = nodeData.inputs?.cache as BaseCache
const streaming = nodeData.inputs?.streaming as boolean
const obj: BaseBedrockInput & BaseLLMParams = { const obj: BaseBedrockInput & BaseLLMParams = {
region: iRegion, region: iRegion,
model: iModel, model: iModel,
maxTokens: parseInt(iMax_tokens_to_sample, 10), maxTokens: parseInt(iMax_tokens_to_sample, 10),
temperature: parseFloat(iTemperature) temperature: parseFloat(iTemperature),
streaming: streaming ?? true
} }
/** /**
@@ -107,7 +107,7 @@ export class HuggingFaceInference extends LLM implements HFInput {
const { HfInference } = await import('@huggingface/inference') const { HfInference } = await import('@huggingface/inference')
return { HfInference } return { HfInference }
} catch (e) { } catch (e) {
throw new Error('Please install huggingface as a dependency with, e.g. `yarn add @huggingface/inference`') throw new Error('Please install huggingface as a dependency with, e.g. `pnpm install @huggingface/inference`')
} }
} }
} }
@@ -18,7 +18,7 @@ class AWSBedrockEmbedding_Embeddings implements INode {
constructor() { constructor() {
this.label = 'AWS Bedrock Embeddings' this.label = 'AWS Bedrock Embeddings'
this.name = 'AWSBedrockEmbeddings' this.name = 'AWSBedrockEmbeddings'
this.version = 1.0 this.version = 2.0
this.type = 'AWSBedrockEmbeddings' this.type = 'AWSBedrockEmbeddings'
this.icon = 'awsBedrock.png' this.icon = 'awsBedrock.png'
this.category = 'Embeddings' this.category = 'Embeddings'
@@ -81,7 +81,9 @@ class AWSBedrockEmbedding_Embeddings implements INode {
type: 'options', type: 'options',
options: [ options: [
{ label: 'amazon.titan-embed-text-v1', name: 'amazon.titan-embed-text-v1' }, { label: 'amazon.titan-embed-text-v1', name: 'amazon.titan-embed-text-v1' },
{ label: 'amazon.titan-embed-g1-text-02', name: 'amazon.titan-embed-g1-text-02' } { label: 'amazon.titan-embed-g1-text-02', name: 'amazon.titan-embed-g1-text-02' },
{ label: 'cohere.embed-english-v3', name: 'cohere.embed-english-v3' },
{ label: 'cohere.embed-multilingual-v3', name: 'cohere.embed-multilingual-v3' }
], ],
default: 'amazon.titan-embed-text-v1' default: 'amazon.titan-embed-text-v1'
} }
@@ -27,7 +27,7 @@ class AWSBedrock_LLMs implements INode {
constructor() { constructor() {
this.label = 'AWS Bedrock' this.label = 'AWS Bedrock'
this.name = 'awsBedrock' this.name = 'awsBedrock'
this.version = 1.2 this.version = 2.0
this.type = 'AWSBedrock' this.type = 'AWSBedrock'
this.icon = 'awsBedrock.png' this.icon = 'awsBedrock.png'
this.category = 'LLMs' this.category = 'LLMs'
@@ -98,6 +98,7 @@ class AWSBedrock_LLMs implements INode {
{ label: 'amazon.titan-tg1-large', name: 'amazon.titan-tg1-large' }, { label: 'amazon.titan-tg1-large', name: 'amazon.titan-tg1-large' },
{ label: 'amazon.titan-e1t-medium', name: 'amazon.titan-e1t-medium' }, { label: 'amazon.titan-e1t-medium', name: 'amazon.titan-e1t-medium' },
{ label: 'cohere.command-text-v14', name: 'cohere.command-text-v14' }, { label: 'cohere.command-text-v14', name: 'cohere.command-text-v14' },
{ label: 'cohere.command-light-text-v14', name: 'cohere.command-light-text-v14' },
{ label: 'ai21.j2-grande-instruct', name: 'ai21.j2-grande-instruct' }, { label: 'ai21.j2-grande-instruct', name: 'ai21.j2-grande-instruct' },
{ label: 'ai21.j2-jumbo-instruct', name: 'ai21.j2-jumbo-instruct' }, { label: 'ai21.j2-jumbo-instruct', name: 'ai21.j2-jumbo-instruct' },
{ label: 'ai21.j2-mid', name: 'ai21.j2-mid' }, { label: 'ai21.j2-mid', name: 'ai21.j2-mid' },
@@ -72,7 +72,7 @@ export class Cohere extends LLM implements CohereInput {
const { default: cohere } = await import('cohere-ai') const { default: cohere } = await import('cohere-ai')
return { cohere } return { cohere }
} catch (e) { } catch (e) {
throw new Error('Please install cohere-ai as a dependency with, e.g. `yarn add cohere-ai`') throw new Error('Please install cohere-ai as a dependency with, e.g. `pnpm install cohere-ai`')
} }
} }
} }
@@ -1,13 +1,12 @@
import { BaseLanguageModel } from 'langchain/base_language'
import { Server } from 'socket.io' import { Server } from 'socket.io'
export abstract class Moderation { export abstract class Moderation {
abstract checkForViolations(llm: BaseLanguageModel, input: string): Promise<string> abstract checkForViolations(input: string): Promise<string>
} }
export const checkInputs = async (inputModerations: Moderation[], llm: BaseLanguageModel, input: string): Promise<string> => { export const checkInputs = async (inputModerations: Moderation[], input: string): Promise<string> => {
for (const moderation of inputModerations) { for (const moderation of inputModerations) {
input = await moderation.checkForViolations(llm, input) input = await moderation.checkForViolations(input)
} }
return input return input
} }
@@ -1,5 +1,5 @@
import { INode, INodeData, INodeParams } from '../../../src/Interface' import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
import { getBaseClasses } from '../../../src' import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src'
import { Moderation } from '../Moderation' import { Moderation } from '../Moderation'
import { OpenAIModerationRunner } from './OpenAIModerationRunner' import { OpenAIModerationRunner } from './OpenAIModerationRunner'
@@ -12,6 +12,7 @@ class OpenAIModeration implements INode {
icon: string icon: string
category: string category: string
baseClasses: string[] baseClasses: string[]
credential: INodeParams
inputs: INodeParams[] inputs: INodeParams[]
constructor() { constructor() {
@@ -23,6 +24,12 @@ class OpenAIModeration implements INode {
this.category = 'Moderation' this.category = 'Moderation'
this.description = 'Check whether content complies with OpenAI usage policies.' this.description = 'Check whether content complies with OpenAI usage policies.'
this.baseClasses = [this.type, ...getBaseClasses(Moderation)] this.baseClasses = [this.type, ...getBaseClasses(Moderation)]
this.credential = {
label: 'Connect Credential',
name: 'credential',
type: 'credential',
credentialNames: ['openAIApi']
}
this.inputs = [ this.inputs = [
{ {
label: 'Error Message', label: 'Error Message',
@@ -35,8 +42,11 @@ class OpenAIModeration implements INode {
] ]
} }
async init(nodeData: INodeData): Promise<any> { async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
const runner = new OpenAIModerationRunner() const credentialData = await getCredentialData(nodeData.credential ?? '', options)
const openAIApiKey = getCredentialParam('openAIApiKey', credentialData, nodeData)
const runner = new OpenAIModerationRunner(openAIApiKey)
const moderationErrorMessage = nodeData.inputs?.moderationErrorMessage as string const moderationErrorMessage = nodeData.inputs?.moderationErrorMessage as string
if (moderationErrorMessage) runner.setErrorMessage(moderationErrorMessage) if (moderationErrorMessage) runner.setErrorMessage(moderationErrorMessage)
return runner return runner
@@ -1,18 +1,21 @@
import { Moderation } from '../Moderation' import { Moderation } from '../Moderation'
import { BaseLanguageModel } from 'langchain/base_language'
import { OpenAIModerationChain } from 'langchain/chains' import { OpenAIModerationChain } from 'langchain/chains'
export class OpenAIModerationRunner implements Moderation { export class OpenAIModerationRunner implements Moderation {
private openAIApiKey = ''
private moderationErrorMessage: string = "Text was found that violates OpenAI's content policy." private moderationErrorMessage: string = "Text was found that violates OpenAI's content policy."
async checkForViolations(llm: BaseLanguageModel, input: string): Promise<string> { constructor(openAIApiKey: string) {
const openAIApiKey = (llm as any).openAIApiKey this.openAIApiKey = openAIApiKey
if (!openAIApiKey) { }
async checkForViolations(input: string): Promise<string> {
if (!this.openAIApiKey) {
throw Error('OpenAI API key not found') throw Error('OpenAI API key not found')
} }
// Create a new instance of the OpenAIModerationChain // Create a new instance of the OpenAIModerationChain
const moderation = new OpenAIModerationChain({ const moderation = new OpenAIModerationChain({
openAIApiKey: openAIApiKey, openAIApiKey: this.openAIApiKey,
throwError: false // If set to true, the call will throw an error when the moderation chain detects violating content. If set to false, violating content will return "Text was found that violates OpenAI's content policy.". throwError: false // If set to true, the call will throw an error when the moderation chain detects violating content. If set to false, violating content will return "Text was found that violates OpenAI's content policy.".
}) })
// Send the user's input to the moderation chain and wait for the result // Send the user's input to the moderation chain and wait for the result
@@ -1,5 +1,4 @@
import { Moderation } from '../Moderation' import { Moderation } from '../Moderation'
import { BaseLanguageModel } from 'langchain/base_language'
export class SimplePromptModerationRunner implements Moderation { export class SimplePromptModerationRunner implements Moderation {
private readonly denyList: string = '' private readonly denyList: string = ''
@@ -13,7 +12,7 @@ export class SimplePromptModerationRunner implements Moderation {
this.moderationErrorMessage = moderationErrorMessage this.moderationErrorMessage = moderationErrorMessage
} }
async checkForViolations(_: BaseLanguageModel, input: string): Promise<string> { async checkForViolations(input: string): Promise<string> {
this.denyList.split('\n').forEach((denyListItem) => { this.denyList.split('\n').forEach((denyListItem) => {
if (denyListItem && denyListItem !== '' && input.includes(denyListItem)) { if (denyListItem && denyListItem !== '' && input.includes(denyListItem)) {
throw Error(this.moderationErrorMessage) throw Error(this.moderationErrorMessage)
@@ -1,6 +1,6 @@
import { BaseOutputParser } from 'langchain/schema/output_parser' import { BaseOutputParser } from 'langchain/schema/output_parser'
import { LLMChain } from 'langchain/chains' import { LLMChain } from 'langchain/chains'
import { BaseLanguageModel } from 'langchain/base_language' import { BaseLanguageModel, BaseLanguageModelCallOptions } from 'langchain/base_language'
import { ICommonObject } from '../../src' import { ICommonObject } from '../../src'
import { ChatPromptTemplate, FewShotPromptTemplate, PromptTemplate, SystemMessagePromptTemplate } from 'langchain/prompts' import { ChatPromptTemplate, FewShotPromptTemplate, PromptTemplate, SystemMessagePromptTemplate } from 'langchain/prompts'
@@ -15,7 +15,7 @@ export const formatResponse = (response: string | object): string | object => {
export const injectOutputParser = ( export const injectOutputParser = (
outputParser: BaseOutputParser<unknown>, outputParser: BaseOutputParser<unknown>,
chain: LLMChain<string, BaseLanguageModel>, chain: LLMChain<string | object | BaseLanguageModel<any, BaseLanguageModelCallOptions>>,
promptValues: ICommonObject | undefined = undefined promptValues: ICommonObject | undefined = undefined
) => { ) => {
if (outputParser && chain.prompt) { if (outputParser && chain.prompt) {
@@ -31,7 +31,8 @@ class InMemoryVectorStore_VectorStores implements INode {
label: 'Document', label: 'Document',
name: 'document', name: 'document',
type: 'Document', type: 'Document',
list: true list: true,
optional: true
}, },
{ {
label: 'Embeddings', label: 'Embeddings',
+4 -4
View File
@@ -1,11 +1,10 @@
{ {
"name": "flowise-components", "name": "flowise-components",
"version": "1.4.2", "version": "1.4.3",
"description": "Flowiseai Components", "description": "Flowiseai Components",
"main": "dist/src/index", "main": "dist/src/index",
"types": "dist/src/index.d.ts", "types": "dist/src/index.d.ts",
"scripts": { "scripts": {
"preinstall": "npx only-allow pnpm",
"build": "tsc && gulp", "build": "tsc && gulp",
"dev": "tsc --watch", "dev": "tsc --watch",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
@@ -26,7 +25,8 @@
"@dqbd/tiktoken": "^1.0.7", "@dqbd/tiktoken": "^1.0.7",
"@elastic/elasticsearch": "^8.9.0", "@elastic/elasticsearch": "^8.9.0",
"@getzep/zep-js": "^0.6.3", "@getzep/zep-js": "^0.6.3",
"@gomomento/sdk": "^1.40.2", "@gomomento/sdk": "^1.51.1",
"@gomomento/sdk-core": "^1.51.1",
"@google-ai/generativelanguage": "^0.2.1", "@google-ai/generativelanguage": "^0.2.1",
"@huggingface/inference": "^2.6.1", "@huggingface/inference": "^2.6.1",
"@notionhq/client": "^2.2.8", "@notionhq/client": "^2.2.8",
@@ -55,7 +55,7 @@
"html-to-text": "^9.0.5", "html-to-text": "^9.0.5",
"ioredis": "^5.3.2", "ioredis": "^5.3.2",
"jsdom": "^22.1.0", "jsdom": "^22.1.0",
"langchain": "^0.0.165", "langchain": "^0.0.196",
"langfuse-langchain": "^1.0.31", "langfuse-langchain": "^1.0.31",
"langsmith": "^0.0.32", "langsmith": "^0.0.32",
"linkifyjs": "^4.1.1", "linkifyjs": "^4.1.1",
-11713
View File
File diff suppressed because it is too large Load Diff
@@ -334,7 +334,7 @@
"id": "openAIFunctionAgent_0", "id": "openAIFunctionAgent_0",
"label": "OpenAI Function Agent", "label": "OpenAI Function Agent",
"name": "openAIFunctionAgent", "name": "openAIFunctionAgent",
"version": 1, "version": 2,
"type": "AgentExecutor", "type": "AgentExecutor",
"baseClasses": ["AgentExecutor", "BaseChain"], "baseClasses": ["AgentExecutor", "BaseChain"],
"category": "Agents", "category": "Agents",
@@ -365,11 +365,10 @@
"id": "openAIFunctionAgent_0-input-memory-BaseChatMemory" "id": "openAIFunctionAgent_0-input-memory-BaseChatMemory"
}, },
{ {
"label": "OpenAI Chat Model", "label": "OpenAI/Azure Chat Model",
"name": "model", "name": "model",
"description": "Only works with gpt-3.5-turbo-0613 and gpt-4-0613. Refer <a target=\"_blank\" href=\"https://platform.openai.com/docs/guides/gpt/function-calling\">docs</a> for more info", "type": "ChatOpenAI | AzureChatOpenAI",
"type": "BaseChatModel", "id": "openAIFunctionAgent_0-input-model-ChatOpenAI | AzureChatOpenAI"
"id": "openAIFunctionAgent_0-input-model-BaseChatModel"
} }
], ],
"inputs": { "inputs": {
@@ -98,7 +98,7 @@
"data": { "data": {
"id": "conversationalRetrievalAgent_0", "id": "conversationalRetrievalAgent_0",
"label": "Conversational Retrieval Agent", "label": "Conversational Retrieval Agent",
"version": 1, "version": 2,
"name": "conversationalRetrievalAgent", "name": "conversationalRetrievalAgent",
"type": "AgentExecutor", "type": "AgentExecutor",
"baseClasses": ["AgentExecutor", "BaseChain", "Runnable"], "baseClasses": ["AgentExecutor", "BaseChain", "Runnable"],
@@ -130,10 +130,10 @@
"id": "conversationalRetrievalAgent_0-input-memory-BaseChatMemory" "id": "conversationalRetrievalAgent_0-input-memory-BaseChatMemory"
}, },
{ {
"label": "OpenAI Chat Model", "label": "OpenAI/Azure Chat Model",
"name": "model", "name": "model",
"type": "ChatOpenAI", "type": "ChatOpenAI | AzureChatOpenAI",
"id": "conversationalRetrievalAgent_0-input-model-ChatOpenAI" "id": "conversationalRetrievalAgent_0-input-model-ChatOpenAI | AzureChatOpenAI"
} }
], ],
"inputs": { "inputs": {
@@ -206,7 +206,7 @@
"id": "openAIFunctionAgent_0", "id": "openAIFunctionAgent_0",
"label": "OpenAI Function Agent", "label": "OpenAI Function Agent",
"name": "openAIFunctionAgent", "name": "openAIFunctionAgent",
"version": 1, "version": 2,
"type": "AgentExecutor", "type": "AgentExecutor",
"baseClasses": ["AgentExecutor", "BaseChain"], "baseClasses": ["AgentExecutor", "BaseChain"],
"category": "Agents", "category": "Agents",
@@ -237,11 +237,10 @@
"id": "openAIFunctionAgent_0-input-memory-BaseChatMemory" "id": "openAIFunctionAgent_0-input-memory-BaseChatMemory"
}, },
{ {
"label": "OpenAI Chat Model", "label": "OpenAI/Azure Chat Model",
"name": "model", "name": "model",
"description": "Only works with gpt-3.5-turbo-0613 and gpt-4-0613. Refer <a target=\"_blank\" href=\"https://platform.openai.com/docs/guides/gpt/function-calling\">docs</a> for more info", "type": "ChatOpenAI | AzureChatOpenAI",
"type": "BaseChatModel", "id": "openAIFunctionAgent_0-input-model-ChatOpenAI | AzureChatOpenAI"
"id": "openAIFunctionAgent_0-input-model-BaseChatModel"
} }
], ],
"inputs": { "inputs": {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"ignore": ["**/*.spec.ts", ".git", "node_modules"], "ignore": ["**/*.spec.ts", ".git", "node_modules"],
"watch": ["commands", "index.ts", "src", "../components/nodes", "../components/src"], "watch": ["commands", "index.ts", "src", "../components/nodes", "../components/src"],
"exec": "./bin/dev start", "exec": "npm start",
"ext": "ts" "ext": "ts"
} }
+2 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "flowise", "name": "flowise",
"version": "1.4.2", "version": "1.4.3",
"description": "Flowiseai Server", "description": "Flowiseai Server",
"main": "dist/index", "main": "dist/index",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
@@ -20,7 +20,6 @@
"commands": "./dist/commands" "commands": "./dist/commands"
}, },
"scripts": { "scripts": {
"preinstall": "npx only-allow pnpm",
"build": "tsc", "build": "tsc",
"start": "run-script-os", "start": "run-script-os",
"clean": "rimraf dist", "clean": "rimraf dist",
@@ -44,7 +43,7 @@
"email": "henryheng@flowiseai.com" "email": "henryheng@flowiseai.com"
}, },
"engines": { "engines": {
"node": ">=18.15.0" "node": ">=18.15.0 <19.0.0 || ^20"
}, },
"license": "SEE LICENSE IN LICENSE.md", "license": "SEE LICENSE IN LICENSE.md",
"dependencies": { "dependencies": {
-5607
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -844,7 +844,7 @@ export const findAvailableConfigs = (reactFlowNodes: IReactFlowNode[], component
*/ */
export const isFlowValidForStream = (reactFlowNodes: IReactFlowNode[], endingNodeData: INodeData) => { export const isFlowValidForStream = (reactFlowNodes: IReactFlowNode[], endingNodeData: INodeData) => {
const streamAvailableLLMs = { const streamAvailableLLMs = {
'Chat Models': ['azureChatOpenAI', 'chatOpenAI', 'chatAnthropic', 'chatOllama'], 'Chat Models': ['azureChatOpenAI', 'chatOpenAI', 'chatAnthropic', 'chatOllama', 'awsChatBedrock'],
LLMs: ['azureOpenAI', 'openAI', 'ollama'] LLMs: ['azureOpenAI', 'openAI', 'ollama']
} }
+1 -1
View File
@@ -1 +1 @@
PORT=8080 VITE_PORT=8080
+20 -18
View File
@@ -1,6 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<title>Flowise - Low-code LLM apps builder</title> <title>Flowise - Low-code LLM apps builder</title>
<link rel="icon" href="favicon.ico" /> <link rel="icon" href="favicon.ico" />
<!-- Meta Tags--> <!-- Meta Tags-->
@@ -8,37 +8,39 @@
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#2296f3" /> <meta name="theme-color" content="#2296f3" />
<meta name="title" content="Flowise - Low-code LLM apps builder" /> <meta name="title" content="Flowise - Low-code LLM apps builder" />
<meta name="description" content="Flowise helps you to better integrate Web3 with existing Web2 applications" /> <meta name="description" content="Drag & drop UI to build your customized LLM flow" />
<meta name="keywords" content="react, material-ui, reactjs, reactjs, workflow automation, web3, web2, blockchain" /> <meta name="keywords" content="react, material-ui, workflow automation, llm, artificial-intelligence" />
<meta name="author" content="CodedThemes" /> <meta name="author" content="FlowiseAI" />
<!-- Open Graph / Facebook --> <!-- Open Graph / Facebook -->
<meta property="og:locale" content="en_US" /> <meta property="og:locale" content="en_US" />
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
<meta property="og:url" content="https://flowiseai.com/" /> <meta property="og:url" content="https://flowiseai.com/" />
<meta property="og:site_name" content="flowiseai.com" /> <meta property="og:site_name" content="flowiseai.com" />
<meta property="article:publisher" content="https://www.facebook.com/codedthemes" />
<meta property="og:title" content="Flowise - Low-code LLM apps builder" /> <meta property="og:title" content="Flowise - Low-code LLM apps builder" />
<meta property="og:description" content="Flowise helps you to better build LLM flows using Langchain in simple GUI" /> <meta property="og:description" content="Drag & drop UI to build your customized LLM flow" />
<meta property="og:image" content="https://flowiseai.com/og-image/og-facebook.png" />
<!-- Twitter --> <!-- Twitter -->
<meta property="twitter:card" content="summary_large_image" /> <meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:url" content="https://flowiseai.com" /> <meta property="twitter:url" content="https://twitter.com/FlowiseAI" />
<meta property="twitter:title" content="Flowise - Low-code LLM apps builder" /> <meta property="twitter:title" content="Flowise - Low-code LLM apps builder" />
<meta property="twitter:description" content="Flowise helps you to better build LLM flows using Langchain in simple GUI" /> <meta property="twitter:description" content="Drag & drop UI to build your customized LLM flow" />
<meta property="twitter:image" content="https://flowiseai.com/og-image/og-twitter.png" /> <meta name="twitter:creator" content="@FlowiseAI" />
<meta name="twitter:creator" content="@codedthemes" />
<link rel="preconnect" href="https://fonts.gstatic.com" /> <link rel="preconnect" href="https://fonts.gstatic.com" />
<link <link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@400;500;600;700&family=Roboto:wght@400;500;700&display=swap" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@400;500;600;700&family=Roboto:wght@400;500;700&display=swap"
rel="stylesheet" rel="stylesheet"
/> />
</head> </head>
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div> <div id="root"></div>
<div id="portal"></div> <div id="portal"></div>
<script type="module" src="src/index.jsx"></script> <script type="module" src="src/index.jsx"></script>
</body> <script>
if (global === undefined) {
var global = window
}
</script>
</body>
</html> </html>
+1 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "flowise-ui", "name": "flowise-ui",
"version": "1.4.0", "version": "1.4.1",
"license": "SEE LICENSE IN LICENSE.md", "license": "SEE LICENSE IN LICENSE.md",
"homepage": "https://flowiseai.com", "homepage": "https://flowiseai.com",
"author": { "author": {
@@ -59,7 +59,6 @@
"yup": "^0.32.9" "yup": "^0.32.9"
}, },
"scripts": { "scripts": {
"preinstall": "npx only-allow pnpm",
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "vite build",
"clean": "rimraf build", "clean": "rimraf build",
-14911
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -55,8 +55,8 @@
You can add webfonts, meta tags, or analytics to this file. You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag. The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`. To begin the development, run `pnpm start`.
To create a production bundle, use `npm run build` or `yarn build`. To create a production bundle, use `pnpm build`.
--> -->
</body> </body>
</html> </html>
+3 -1
View File
@@ -4,7 +4,9 @@ export const drawerWidth = 260
export const appDrawerWidth = 320 export const appDrawerWidth = 320
export const maxScroll = 100000 export const maxScroll = 100000
export const baseURL = export const baseURL =
import.meta.env.PROD === true ? window.location.protocol : window.location.protocol + '//' + window.location.hostname + ':3000' import.meta.env.PROD === true
? window.location.origin
: window.location.origin.replace(`:${import.meta.env.VITE_PORT ?? '8080'}`, ':3000')
export const uiBaseURL = window.location.origin export const uiBaseURL = window.location.origin
export const FLOWISE_CREDENTIAL_ID = 'FLOWISE_CREDENTIAL_ID' export const FLOWISE_CREDENTIAL_ID = 'FLOWISE_CREDENTIAL_ID'
export const REDACTED_CREDENTIAL_VALUE = '_FLOWISE_BLANK_07167752-1a71-43b1-bf8f-4f32252165db' export const REDACTED_CREDENTIAL_VALUE = '_FLOWISE_BLANK_07167752-1a71-43b1-bf8f-4f32252165db'
@@ -68,10 +68,14 @@ const AddNodes = ({ nodesData, node }) => {
else newNodes.push(vsNode) else newNodes.push(vsNode)
} }
delete obj['Vector Stores'] delete obj['Vector Stores']
if (deprecatingNodes.length) {
obj['Vector Stores;DEPRECATING'] = deprecatingNodes obj['Vector Stores;DEPRECATING'] = deprecatingNodes
accordianCategories['Vector Stores;DEPRECATING'] = isFilter ? true : false accordianCategories['Vector Stores;DEPRECATING'] = isFilter ? true : false
}
if (newNodes.length) {
obj['Vector Stores;NEW'] = newNodes obj['Vector Stores;NEW'] = newNodes
accordianCategories['Vector Stores;NEW'] = isFilter ? true : false accordianCategories['Vector Stores;NEW'] = isFilter ? true : false
}
setNodes(obj) setNodes(obj)
} }
+11 -18
View File
@@ -1,30 +1,23 @@
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react' import react from '@vitejs/plugin-react'
import { VitePWA } from 'vite-plugin-pwa'
import { resolve } from 'path' import { resolve } from 'path'
import dotenv from 'dotenv'
dotenv.config()
export default defineConfig({ export default defineConfig({
plugins: [react()],
resolve: { resolve: {
alias: { alias: {
'@': resolve(__dirname, 'src') '@': resolve(__dirname, 'src')
} }
}, },
plugins: [ root: resolve(__dirname),
react(), build: {
VitePWA({ outDir: './build'
manifest: { },
name: 'FlowiseAI - Build LLMs Apps Easily', server: {
short_name: 'Flowise', open: true,
theme_color: '#00000000', port: process.env.VITE_PORT ?? 8080
icons: [
{
src: '/public/favicon-32x32.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any maskable'
} }
]
}
})
]
}) })
+22299 -1146
View File
File diff suppressed because it is too large Load Diff
+13
View File
@@ -0,0 +1,13 @@
{
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**"]
},
"test": {},
"dev": {
"cache": false
}
}
}