mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 23:01:09 +03:00
Merge branch 'main' into feature/CustomTool
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# These are supported funding model platforms
|
# These are supported funding model platforms
|
||||||
|
|
||||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
github: [FlowiseAI] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||||
patreon: # Replace with a single Patreon username
|
patreon: # Replace with a single Patreon username
|
||||||
open_collective: # Replace with a single Open Collective username
|
open_collective: # Replace with a single Open Collective username
|
||||||
ko_fi: # Replace with a single Ko-fi username
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
PORT=3000
|
PORT=3000
|
||||||
# FLOWISE_USERNAME=user
|
# FLOWISE_USERNAME=user
|
||||||
# FLOWISE_PASSWORD=1234
|
# FLOWISE_PASSWORD=1234
|
||||||
|
# DATABASE_PATH=/your_database_path/.flowise
|
||||||
|
# EXECUTION_MODE=child or main
|
||||||
@@ -8,6 +8,8 @@ services:
|
|||||||
- PORT=${PORT}
|
- PORT=${PORT}
|
||||||
- FLOWISE_USERNAME=${FLOWISE_USERNAME}
|
- FLOWISE_USERNAME=${FLOWISE_USERNAME}
|
||||||
- FLOWISE_PASSWORD=${FLOWISE_PASSWORD}
|
- FLOWISE_PASSWORD=${FLOWISE_PASSWORD}
|
||||||
|
- DATABASE_PATH=${DATABASE_PATH}
|
||||||
|
- EXECUTION_MODE=${EXECUTION_MODE}
|
||||||
ports:
|
ports:
|
||||||
- '${PORT}:${PORT}'
|
- '${PORT}:${PORT}'
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
|
import { TextSplitter } from 'langchain/text_splitter'
|
||||||
|
import { JSONLinesLoader } from 'langchain/document_loaders/fs/json'
|
||||||
|
|
||||||
|
class Jsonlines_DocumentLoaders implements INode {
|
||||||
|
label: string
|
||||||
|
name: string
|
||||||
|
description: string
|
||||||
|
type: string
|
||||||
|
icon: string
|
||||||
|
category: string
|
||||||
|
baseClasses: string[]
|
||||||
|
inputs: INodeParams[]
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.label = 'Json Lines File'
|
||||||
|
this.name = 'jsonlinesFile'
|
||||||
|
this.type = 'Document'
|
||||||
|
this.icon = 'jsonlines.svg'
|
||||||
|
this.category = 'Document Loaders'
|
||||||
|
this.description = `Load data from JSON Lines files`
|
||||||
|
this.baseClasses = [this.type]
|
||||||
|
this.inputs = [
|
||||||
|
{
|
||||||
|
label: 'Jsonlines File',
|
||||||
|
name: 'jsonlinesFile',
|
||||||
|
type: 'file',
|
||||||
|
fileType: '.jsonl'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Text Splitter',
|
||||||
|
name: 'textSplitter',
|
||||||
|
type: 'TextSplitter',
|
||||||
|
optional: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Pointer Extraction',
|
||||||
|
name: 'pointerName',
|
||||||
|
type: 'string',
|
||||||
|
placeholder: 'Enter pointer name',
|
||||||
|
optional: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Metadata',
|
||||||
|
name: 'metadata',
|
||||||
|
type: 'json',
|
||||||
|
optional: true,
|
||||||
|
additionalParams: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
async init(nodeData: INodeData): Promise<any> {
|
||||||
|
const textSplitter = nodeData.inputs?.textSplitter as TextSplitter
|
||||||
|
const jsonLinesFileBase64 = nodeData.inputs?.jsonlinesFile as string
|
||||||
|
const pointerName = nodeData.inputs?.pointerName as string
|
||||||
|
const metadata = nodeData.inputs?.metadata
|
||||||
|
|
||||||
|
let alldocs = []
|
||||||
|
let files: string[] = []
|
||||||
|
|
||||||
|
let pointer = '/' + pointerName.trim()
|
||||||
|
|
||||||
|
if (jsonLinesFileBase64.startsWith('[') && jsonLinesFileBase64.endsWith(']')) {
|
||||||
|
files = JSON.parse(jsonLinesFileBase64)
|
||||||
|
} else {
|
||||||
|
files = [jsonLinesFileBase64]
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const file of files) {
|
||||||
|
const splitDataURI = file.split(',')
|
||||||
|
splitDataURI.pop()
|
||||||
|
const bf = Buffer.from(splitDataURI.pop() || '', 'base64')
|
||||||
|
const blob = new Blob([bf])
|
||||||
|
const loader = new JSONLinesLoader(blob, pointer)
|
||||||
|
|
||||||
|
if (textSplitter) {
|
||||||
|
const docs = await loader.loadAndSplit(textSplitter)
|
||||||
|
alldocs.push(...docs)
|
||||||
|
} else {
|
||||||
|
const docs = await loader.load()
|
||||||
|
alldocs.push(...docs)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (metadata) {
|
||||||
|
const parsedMetadata = typeof metadata === 'object' ? metadata : JSON.parse(metadata)
|
||||||
|
let finaldocs = []
|
||||||
|
for (const doc of alldocs) {
|
||||||
|
const newdoc = {
|
||||||
|
...doc,
|
||||||
|
metadata: {
|
||||||
|
...doc.metadata,
|
||||||
|
...parsedMetadata
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finaldocs.push(newdoc)
|
||||||
|
}
|
||||||
|
return finaldocs
|
||||||
|
}
|
||||||
|
|
||||||
|
return alldocs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { nodeClass: Jsonlines_DocumentLoaders }
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<!-- Created with Method Draw - http://github.com/duopixel/Method-Draw/ -->
|
||||||
|
|
||||||
|
<g>
|
||||||
|
<title>background</title>
|
||||||
|
<rect fill="none" id="canvas_background" height="26" width="26" y="-1" x="-1"/>
|
||||||
|
<g display="none" overflow="visible" y="0" x="0" height="100%" width="100%" id="canvasGrid">
|
||||||
|
<rect fill="url(#gridpattern)" stroke-width="0" y="0" x="0" height="100%" width="100%"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<title>Layer 1</title>
|
||||||
|
<text font-weight="bold" stroke="#000" transform="matrix(8.682896011956823,0,0,10.412942243751806,-30.866304860177404,-63.784276261342) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="1" id="svg_2" y="7.062874" x="3.579384" stroke-opacity="null" stroke-width="0" fill="#000000">JSON</text>
|
||||||
|
<text font-weight="bold" stroke="#000" transform="matrix(9.059566511875573,0,0,9.893934811310315,-1.3962337706973242,-106.08964247698567) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="1" id="svg_3" y="12.90427" x="0.172236" stroke-opacity="null" stroke-width="0" fill="#000000">Lines</text>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -1,4 +1,5 @@
|
|||||||
PORT=3000
|
PORT=3000
|
||||||
# FLOWISE_USERNAME=user
|
# FLOWISE_USERNAME=user
|
||||||
# FLOWISE_PASSWORD=1234
|
# FLOWISE_PASSWORD=1234
|
||||||
|
# DATABASE_PATH=/your_database_path/.flowise
|
||||||
# EXECUTION_MODE=child or main
|
# EXECUTION_MODE=child or main
|
||||||
@@ -31,14 +31,28 @@ FLOWISE_PASSWORD=1234
|
|||||||
|
|
||||||
## 📖 Documentation
|
## 📖 Documentation
|
||||||
|
|
||||||
Coming Soon
|
[Flowise Docs](https://docs.flowiseai.com/)
|
||||||
|
|
||||||
## 💻 Cloud Hosted
|
|
||||||
|
|
||||||
Coming Soon
|
|
||||||
|
|
||||||
## 🌐 Self Host
|
## 🌐 Self Host
|
||||||
|
|
||||||
|
### [Railway](https://docs.flowiseai.com/deployment/railway)
|
||||||
|
|
||||||
|
[](https://railway.app/template/YK7J0v)
|
||||||
|
|
||||||
|
### [Render](https://docs.flowiseai.com/deployment/render)
|
||||||
|
|
||||||
|
[](https://docs.flowiseai.com/deployment/render)
|
||||||
|
|
||||||
|
### [AWS](https://docs.flowiseai.com/deployment/aws)
|
||||||
|
|
||||||
|
### [Azure](https://docs.flowiseai.com/deployment/azure)
|
||||||
|
|
||||||
|
### [DigitalOcean](https://docs.flowiseai.com/deployment/digital-ocean)
|
||||||
|
|
||||||
|
### [GCP](https://docs.flowiseai.com/deployment/gcp)
|
||||||
|
|
||||||
|
## 💻 Cloud Hosted
|
||||||
|
|
||||||
Coming Soon
|
Coming Soon
|
||||||
|
|
||||||
## 🙋 Support
|
## 🙋 Support
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { getUserHome } from './utils'
|
|||||||
let appDataSource: DataSource
|
let appDataSource: DataSource
|
||||||
|
|
||||||
export const init = async (): Promise<void> => {
|
export const init = async (): Promise<void> => {
|
||||||
const homePath = path.join(getUserHome(), '.flowise')
|
const homePath = process.env.DATABASE_PATH ?? path.join(getUserHome(), '.flowise')
|
||||||
|
|
||||||
appDataSource = new DataSource({
|
appDataSource = new DataSource({
|
||||||
type: 'sqlite',
|
type: 'sqlite',
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export default class Start extends Command {
|
|||||||
FLOWISE_USERNAME: Flags.string(),
|
FLOWISE_USERNAME: Flags.string(),
|
||||||
FLOWISE_PASSWORD: Flags.string(),
|
FLOWISE_PASSWORD: Flags.string(),
|
||||||
PORT: Flags.string(),
|
PORT: Flags.string(),
|
||||||
|
DATABASE_PATH: Flags.string(),
|
||||||
EXECUTION_MODE: Flags.string()
|
EXECUTION_MODE: Flags.string()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,6 +54,7 @@ export default class Start extends Command {
|
|||||||
if (flags.FLOWISE_USERNAME) process.env.FLOWISE_USERNAME = flags.FLOWISE_USERNAME
|
if (flags.FLOWISE_USERNAME) process.env.FLOWISE_USERNAME = flags.FLOWISE_USERNAME
|
||||||
if (flags.FLOWISE_PASSWORD) process.env.FLOWISE_PASSWORD = flags.FLOWISE_PASSWORD
|
if (flags.FLOWISE_PASSWORD) process.env.FLOWISE_PASSWORD = flags.FLOWISE_PASSWORD
|
||||||
if (flags.PORT) process.env.PORT = flags.PORT
|
if (flags.PORT) process.env.PORT = flags.PORT
|
||||||
|
if (flags.DATABASE_PATH) process.env.DATABASE_PATH = flags.DATABASE_PATH
|
||||||
if (flags.EXECUTION_MODE) process.env.EXECUTION_MODE = flags.EXECUTION_MODE
|
if (flags.EXECUTION_MODE) process.env.EXECUTION_MODE = flags.EXECUTION_MODE
|
||||||
|
|
||||||
await (async () => {
|
await (async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user