mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-27 01:00:27 +03:00
Merge branch 'FlowiseAI:main' into bugfix/components-can't-be-clicked-when-zoom-out
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "flowise",
|
||||
"version": "1.2.3",
|
||||
"version": "1.2.4",
|
||||
"private": true,
|
||||
"homepage": "https://flowiseai.com",
|
||||
"workspaces": [
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { OpenAIChatInput } from 'langchain/llms/openai'
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { ChatOpenAI } from 'langchain/chat_models/openai'
|
||||
import { ChatOpenAI, OpenAIChatInput } from 'langchain/chat_models/openai'
|
||||
|
||||
class ChatOpenAI_ChatModels implements INode {
|
||||
label: string
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { CohereEmbeddings } from 'langchain/embeddings/cohere'
|
||||
import { CohereEmbeddings, CohereEmbeddingsParams } from 'langchain/embeddings/cohere'
|
||||
|
||||
class CohereEmbedding_Embeddings implements INode {
|
||||
label: string
|
||||
@@ -25,14 +25,42 @@ class CohereEmbedding_Embeddings implements INode {
|
||||
label: 'Cohere API Key',
|
||||
name: 'cohereApiKey',
|
||||
type: 'password'
|
||||
},
|
||||
{
|
||||
label: 'Model Name',
|
||||
name: 'modelName',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
label: 'embed-english-v2.0',
|
||||
name: 'embed-english-v2.0'
|
||||
},
|
||||
{
|
||||
label: 'embed-english-light-v2.0',
|
||||
name: 'embed-english-light-v2.0'
|
||||
},
|
||||
{
|
||||
label: 'embed-multilingual-v2.0',
|
||||
name: 'embed-multilingual-v2.0'
|
||||
}
|
||||
],
|
||||
default: 'embed-english-v2.0',
|
||||
optional: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData): Promise<any> {
|
||||
const apiKey = nodeData.inputs?.cohereApiKey as string
|
||||
const modelName = nodeData.inputs?.modelName as string
|
||||
|
||||
const model = new CohereEmbeddings({ apiKey })
|
||||
const obj: Partial<CohereEmbeddingsParams> & { apiKey?: string } = {
|
||||
apiKey
|
||||
}
|
||||
|
||||
if (modelName) obj.modelName = modelName
|
||||
|
||||
const model = new CohereEmbeddings(obj)
|
||||
return model
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { Cohere, CohereInput } from 'langchain/llms/cohere'
|
||||
|
||||
class Cohere_LLMs implements INode {
|
||||
label: string
|
||||
name: string
|
||||
type: string
|
||||
icon: string
|
||||
category: string
|
||||
description: string
|
||||
baseClasses: string[]
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
this.label = 'Cohere'
|
||||
this.name = 'cohere'
|
||||
this.type = 'Cohere'
|
||||
this.icon = 'cohere.png'
|
||||
this.category = 'LLMs'
|
||||
this.description = 'Wrapper around Cohere large language models'
|
||||
this.baseClasses = [this.type, ...getBaseClasses(Cohere)]
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'Cohere Api Key',
|
||||
name: 'cohereApiKey',
|
||||
type: 'password'
|
||||
},
|
||||
{
|
||||
label: 'Model Name',
|
||||
name: 'modelName',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
label: 'command',
|
||||
name: 'command'
|
||||
},
|
||||
{
|
||||
label: 'command-light',
|
||||
name: 'command-light'
|
||||
},
|
||||
{
|
||||
label: 'command-nightly',
|
||||
name: 'command-nightly'
|
||||
},
|
||||
{
|
||||
label: 'command-light-nightly',
|
||||
name: 'command-light-nightly'
|
||||
},
|
||||
{
|
||||
label: 'base',
|
||||
name: 'base'
|
||||
},
|
||||
{
|
||||
label: 'base-light',
|
||||
name: 'base-light'
|
||||
}
|
||||
],
|
||||
default: 'command',
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Temperature',
|
||||
name: 'temperature',
|
||||
type: 'number',
|
||||
default: 0.7,
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Max Tokens',
|
||||
name: 'maxTokens',
|
||||
type: 'number',
|
||||
optional: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData): Promise<any> {
|
||||
const temperature = nodeData.inputs?.temperature as string
|
||||
const modelName = nodeData.inputs?.modelName as string
|
||||
const apiKey = nodeData.inputs?.cohereApiKey as string
|
||||
const maxTokens = nodeData.inputs?.maxTokens as string
|
||||
|
||||
const obj: CohereInput = {
|
||||
apiKey
|
||||
}
|
||||
|
||||
if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
|
||||
if (modelName) obj.model = modelName
|
||||
if (temperature) obj.temperature = parseInt(temperature, 10)
|
||||
|
||||
const model = new Cohere(obj)
|
||||
return model
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { nodeClass: Cohere_LLMs }
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
+63
@@ -0,0 +1,63 @@
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { CharacterTextSplitter, CharacterTextSplitterParams } from 'langchain/text_splitter'
|
||||
|
||||
class CharacterTextSplitter_TextSplitters implements INode {
|
||||
label: string
|
||||
name: string
|
||||
description: string
|
||||
type: string
|
||||
icon: string
|
||||
category: string
|
||||
baseClasses: string[]
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
this.label = 'Character Text Splitter'
|
||||
this.name = 'characterTextSplitter'
|
||||
this.type = 'CharacterTextSplitter'
|
||||
this.icon = 'textsplitter.svg'
|
||||
this.category = 'Text Splitters'
|
||||
this.description = `splits only on one type of character (defaults to "\\n\\n").`
|
||||
this.baseClasses = [this.type, ...getBaseClasses(CharacterTextSplitter)]
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'Separator',
|
||||
name: 'separator',
|
||||
type: 'string',
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Chunk Size',
|
||||
name: 'chunkSize',
|
||||
type: 'number',
|
||||
default: 1000,
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Chunk Overlap',
|
||||
name: 'chunkOverlap',
|
||||
type: 'number',
|
||||
optional: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData): Promise<any> {
|
||||
const separator = nodeData.inputs?.separator as string
|
||||
const chunkSize = nodeData.inputs?.chunkSize as string
|
||||
const chunkOverlap = nodeData.inputs?.chunkOverlap as string
|
||||
|
||||
const obj = {} as CharacterTextSplitterParams
|
||||
|
||||
if (separator) obj.separator = separator
|
||||
if (chunkSize) obj.chunkSize = parseInt(chunkSize, 10)
|
||||
if (chunkOverlap) obj.chunkOverlap = parseInt(chunkOverlap, 10)
|
||||
|
||||
const splitter = new CharacterTextSplitter(obj)
|
||||
|
||||
return splitter
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { nodeClass: CharacterTextSplitter_TextSplitters }
|
||||
@@ -0,0 +1,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-abc" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M3 16v-6a2 2 0 1 1 4 0v6"></path>
|
||||
<path d="M3 13h4"></path>
|
||||
<path d="M10 8v6a2 2 0 1 0 4 0v-1a2 2 0 1 0 -4 0v1"></path>
|
||||
<path d="M20.732 12a2 2 0 0 0 -3.732 1v1a2 2 0 0 0 3.726 1.01"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 502 B |
@@ -0,0 +1,55 @@
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { MarkdownTextSplitter, MarkdownTextSplitterParams } from 'langchain/text_splitter'
|
||||
|
||||
class MarkdownTextSplitter_TextSplitters implements INode {
|
||||
label: string
|
||||
name: string
|
||||
description: string
|
||||
type: string
|
||||
icon: string
|
||||
category: string
|
||||
baseClasses: string[]
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
this.label = 'Markdown Text Splitter'
|
||||
this.name = 'markdownTextSplitter'
|
||||
this.type = 'MarkdownTextSplitter'
|
||||
this.icon = 'markdownTextSplitter.svg'
|
||||
this.category = 'Text Splitters'
|
||||
this.description = `Split your content into documents based on the Markdown headers`
|
||||
this.baseClasses = [this.type, ...getBaseClasses(MarkdownTextSplitter)]
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'Chunk Size',
|
||||
name: 'chunkSize',
|
||||
type: 'number',
|
||||
default: 1000,
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Chunk Overlap',
|
||||
name: 'chunkOverlap',
|
||||
type: 'number',
|
||||
optional: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData): Promise<any> {
|
||||
const chunkSize = nodeData.inputs?.chunkSize as string
|
||||
const chunkOverlap = nodeData.inputs?.chunkOverlap as string
|
||||
|
||||
const obj = {} as MarkdownTextSplitterParams
|
||||
|
||||
if (chunkSize) obj.chunkSize = parseInt(chunkSize, 10)
|
||||
if (chunkOverlap) obj.chunkOverlap = parseInt(chunkOverlap, 10)
|
||||
|
||||
const splitter = new MarkdownTextSplitter(obj)
|
||||
|
||||
return splitter
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { nodeClass: MarkdownTextSplitter_TextSplitters }
|
||||
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-markdown" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M3 5m0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z"></path>
|
||||
<path d="M7 15v-6l2 2l2 -2v6"></path>
|
||||
<path d="M14 13l2 2l2 -2m-2 2v-6"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 482 B |
+1
-1
@@ -18,7 +18,7 @@ class RecursiveCharacterTextSplitter_TextSplitters implements INode {
|
||||
this.type = 'RecursiveCharacterTextSplitter'
|
||||
this.icon = 'textsplitter.svg'
|
||||
this.category = 'Text Splitters'
|
||||
this.description = `Split documents recursively by different characters - starting with "\n\n", then "\n", then " "`
|
||||
this.description = `Split documents recursively by different characters - starting with "\\n\\n", then "\\n", then " "`
|
||||
this.baseClasses = [this.type, ...getBaseClasses(RecursiveCharacterTextSplitter)]
|
||||
this.inputs = [
|
||||
{
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { TokenTextSplitter, TokenTextSplitterParams } from 'langchain/text_splitter'
|
||||
import { TiktokenEncoding } from '@dqbd/tiktoken'
|
||||
|
||||
class TokenTextSplitter_TextSplitters implements INode {
|
||||
label: string
|
||||
name: string
|
||||
description: string
|
||||
type: string
|
||||
icon: string
|
||||
category: string
|
||||
baseClasses: string[]
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
this.label = 'Token Text Splitter'
|
||||
this.name = 'tokenTextSplitter'
|
||||
this.type = 'TokenTextSplitter'
|
||||
this.icon = 'tiktoken.svg'
|
||||
this.category = 'Text Splitters'
|
||||
this.description = `Splits a raw text string by first converting the text into BPE tokens, then split these tokens into chunks and convert the tokens within a single chunk back into text.`
|
||||
this.baseClasses = [this.type, ...getBaseClasses(TokenTextSplitter)]
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'Encoding Name',
|
||||
name: 'encodingName',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
label: 'gpt2',
|
||||
name: 'gpt2'
|
||||
},
|
||||
{
|
||||
label: 'r50k_base',
|
||||
name: 'r50k_base'
|
||||
},
|
||||
{
|
||||
label: 'p50k_base',
|
||||
name: 'p50k_base'
|
||||
},
|
||||
{
|
||||
label: 'p50k_edit',
|
||||
name: 'p50k_edit'
|
||||
},
|
||||
{
|
||||
label: 'cl100k_base',
|
||||
name: 'cl100k_base'
|
||||
}
|
||||
],
|
||||
default: 'gpt2'
|
||||
},
|
||||
{
|
||||
label: 'Chunk Size',
|
||||
name: 'chunkSize',
|
||||
type: 'number',
|
||||
default: 1000,
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Chunk Overlap',
|
||||
name: 'chunkOverlap',
|
||||
type: 'number',
|
||||
optional: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData): Promise<any> {
|
||||
const encodingName = nodeData.inputs?.encodingName as string
|
||||
const chunkSize = nodeData.inputs?.chunkSize as string
|
||||
const chunkOverlap = nodeData.inputs?.chunkOverlap as string
|
||||
|
||||
const obj = {} as TokenTextSplitterParams
|
||||
|
||||
obj.encodingName = encodingName as TiktokenEncoding
|
||||
if (chunkSize) obj.chunkSize = parseInt(chunkSize, 10)
|
||||
if (chunkOverlap) obj.chunkOverlap = parseInt(chunkOverlap, 10)
|
||||
|
||||
const splitter = new TokenTextSplitter(obj)
|
||||
|
||||
return splitter
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { nodeClass: TokenTextSplitter_TextSplitters }
|
||||
@@ -0,0 +1,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-hourglass" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M6.5 7h11"></path>
|
||||
<path d="M6.5 17h11"></path>
|
||||
<path d="M6 20v-2a6 6 0 1 1 12 0v2a1 1 0 0 1 -1 1h-10a1 1 0 0 1 -1 -1z"></path>
|
||||
<path d="M6 4v2a6 6 0 1 0 12 0v-2a1 1 0 0 0 -1 -1h-10a1 1 0 0 0 -1 1z"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 524 B |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "flowise-components",
|
||||
"version": "1.2.4",
|
||||
"version": "1.2.5",
|
||||
"description": "Flowiseai Components",
|
||||
"main": "dist/src/index",
|
||||
"types": "dist/src/index.d.ts",
|
||||
@@ -16,7 +16,7 @@
|
||||
},
|
||||
"license": "SEE LICENSE IN LICENSE.md",
|
||||
"dependencies": {
|
||||
"@dqbd/tiktoken": "^1.0.4",
|
||||
"@dqbd/tiktoken": "^1.0.7",
|
||||
"@huggingface/inference": "^1.6.3",
|
||||
"@pinecone-database/pinecone": "^0.0.12",
|
||||
"@supabase/supabase-js": "^2.21.0",
|
||||
@@ -29,7 +29,7 @@
|
||||
"express": "^4.17.3",
|
||||
"form-data": "^4.0.0",
|
||||
"graphql": "^16.6.0",
|
||||
"langchain": "^0.0.66",
|
||||
"langchain": "^0.0.73",
|
||||
"mammoth": "^1.5.1",
|
||||
"moment": "^2.29.3",
|
||||
"node-fetch": "2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "flowise",
|
||||
"version": "1.2.3",
|
||||
"version": "1.2.4",
|
||||
"description": "Flowiseai Server",
|
||||
"main": "dist/index",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -368,7 +368,11 @@ export class App {
|
||||
if (
|
||||
Object.prototype.hasOwnProperty.call(this.chatflowPool.activeChatflows, chatflowid) &&
|
||||
this.chatflowPool.activeChatflows[chatflowid].inSync &&
|
||||
isSameOverrideConfig(this.chatflowPool.activeChatflows[chatflowid].overrideConfig, incomingInput.overrideConfig) &&
|
||||
isSameOverrideConfig(
|
||||
isInternal,
|
||||
this.chatflowPool.activeChatflows[chatflowid].overrideConfig,
|
||||
incomingInput.overrideConfig
|
||||
) &&
|
||||
!isStartNodeDependOnInput(this.chatflowPool.activeChatflows[chatflowid].startingNodes)
|
||||
) {
|
||||
nodeToExecuteData = this.chatflowPool.activeChatflows[chatflowid].endingNodeData
|
||||
|
||||
@@ -388,11 +388,17 @@ export const isStartNodeDependOnInput = (startingNodes: IReactFlowNode[]): boole
|
||||
|
||||
/**
|
||||
* Rebuild flow if new override config is provided
|
||||
* @param {boolean} isInternal
|
||||
* @param {ICommonObject} existingOverrideConfig
|
||||
* @param {ICommonObject} newOverrideConfig
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export const isSameOverrideConfig = (existingOverrideConfig?: ICommonObject, newOverrideConfig?: ICommonObject): boolean => {
|
||||
export const isSameOverrideConfig = (
|
||||
isInternal: boolean,
|
||||
existingOverrideConfig?: ICommonObject,
|
||||
newOverrideConfig?: ICommonObject
|
||||
): boolean => {
|
||||
if (isInternal) return true
|
||||
if (
|
||||
existingOverrideConfig &&
|
||||
Object.keys(existingOverrideConfig).length &&
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "flowise-ui",
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.3",
|
||||
"license": "SEE LICENSE IN LICENSE.md",
|
||||
"homepage": "https://flowiseai.com",
|
||||
"author": {
|
||||
|
||||
@@ -89,7 +89,7 @@ const CanvasHeader = ({ chatflow, handleSaveFlow, handleDeleteFlow, handleLoadFl
|
||||
}
|
||||
|
||||
const onSaveChatflowClick = () => {
|
||||
if (chatflow.id) handleSaveFlow(chatflow.name)
|
||||
if (chatflow.id) handleSaveFlow(flowName)
|
||||
else setFlowDialogOpen(true)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user