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