mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 17:01:00 +03:00
Feature/lang graph (#2319)
* add langgraph * datasource: initial commit * datasource: datasource details and chunks * datasource: Document Store Node * more changes * Document Store - Base functionality * Document Store Loader Component * Document Store Loader Component * before merging the modularity PR * after merging the modularity PR * preview mode * initial draft PR * fixes * minor updates and fixes * preview with loader and splitter * preview with credential * show stored chunks * preview update... * edit config * save, preview and other changes * save, preview and other changes * save, process and other changes * save, process and other changes * alpha1 - for internal testing * rerouting urls * bug fix on new leader create * pagination support for chunks * delete document store * Update pnpm-lock.yaml * doc store card view * Update store files to use updated storage functions, Document Store Table View and other changes * ui changes * add expanded chunk dialog, improve ui * change throw Error to InternalError * Bug Fixes and removal of subFolder, adding of view chunks for store * lint fixes * merge changes * DocumentStoreStatus component * ui changes for doc store * add remove metadata key field, add custom document loader * add chatflows used doc store chips * add types/interfaces to DocumentStore Services * document loader list dialog title bar color change * update interfaces * Whereused Chatflow Name and Added chunkNo to retain order of created chunks. * use typeorm order chunkNo, ui changes * update tabler icons react * cleanup agents * add pysandbox tool * add abort functionality, loading next agent * add empty view svg * update chatflow tool with chatId * rename to agentflows * update worker for prompt input values * update dashboard to agentflows, agentcanvas * fix marketplace use template * add agentflow templates * resolve merge conflict * update baseURL --------- Co-authored-by: vinodkiran <vinodkiran@usa.net> Co-authored-by: Vinod Paidimarry <vinodkiran@outlook.in>
This commit is contained in:
@@ -1,86 +0,0 @@
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { RequestParameters, desc, RequestsPostTool } from './core'
|
||||
|
||||
class RequestsPost_Tools implements INode {
|
||||
label: string
|
||||
name: string
|
||||
version: number
|
||||
description: string
|
||||
type: string
|
||||
icon: string
|
||||
category: string
|
||||
baseClasses: string[]
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
this.label = 'Requests Post'
|
||||
this.name = 'requestsPost'
|
||||
this.version = 1.0
|
||||
this.type = 'RequestsPost'
|
||||
this.icon = 'requestspost.svg'
|
||||
this.category = 'Tools'
|
||||
this.description = 'Execute HTTP POST requests'
|
||||
this.baseClasses = [this.type, ...getBaseClasses(RequestsPostTool)]
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'URL',
|
||||
name: 'url',
|
||||
type: 'string',
|
||||
description:
|
||||
'Agent will make call to this exact URL. If not specified, agent will try to figure out itself from AIPlugin if provided',
|
||||
additionalParams: true,
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Body',
|
||||
name: 'body',
|
||||
type: 'json',
|
||||
description:
|
||||
'JSON body for the POST request. If not specified, agent will try to figure out itself from AIPlugin if provided',
|
||||
additionalParams: true,
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
rows: 4,
|
||||
default: desc,
|
||||
description: 'Acts like a prompt to tell agent when it should use this tool',
|
||||
additionalParams: true,
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Headers',
|
||||
name: 'headers',
|
||||
type: 'json',
|
||||
additionalParams: true,
|
||||
optional: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData): Promise<any> {
|
||||
const headers = nodeData.inputs?.headers as string
|
||||
const url = nodeData.inputs?.url as string
|
||||
const description = nodeData.inputs?.description as string
|
||||
const body = nodeData.inputs?.body as string
|
||||
|
||||
const obj: RequestParameters = {}
|
||||
if (url) obj.url = url
|
||||
if (description) obj.description = description
|
||||
if (headers) {
|
||||
const parsedHeaders = typeof headers === 'object' ? headers : JSON.parse(headers)
|
||||
obj.headers = parsedHeaders
|
||||
}
|
||||
if (body) {
|
||||
const parsedBody = typeof body === 'object' ? body : JSON.parse(body)
|
||||
obj.body = parsedBody
|
||||
}
|
||||
|
||||
return new RequestsPostTool(obj)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { nodeClass: RequestsPost_Tools }
|
||||
@@ -1,72 +0,0 @@
|
||||
import { Tool } from '@langchain/core/tools'
|
||||
import fetch from 'node-fetch'
|
||||
|
||||
export const desc = `Use this when you want to POST to a website.
|
||||
Input should be a json string with two keys: "url" and "data".
|
||||
The value of "url" should be a string, and the value of "data" should be a dictionary of
|
||||
key-value pairs you want to POST to the url as a JSON body.
|
||||
Be careful to always use double quotes for strings in the json string
|
||||
The output will be the text response of the POST request.`
|
||||
|
||||
export interface Headers {
|
||||
[key: string]: string
|
||||
}
|
||||
|
||||
export interface Body {
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export interface RequestParameters {
|
||||
headers?: Headers
|
||||
body?: Body
|
||||
url?: string
|
||||
description?: string
|
||||
maxOutputLength?: number
|
||||
}
|
||||
|
||||
export class RequestsPostTool extends Tool {
|
||||
name = 'requests_post'
|
||||
url = ''
|
||||
description = desc
|
||||
maxOutputLength = Infinity
|
||||
headers = {}
|
||||
body = {}
|
||||
|
||||
constructor(args?: RequestParameters) {
|
||||
super()
|
||||
this.url = args?.url ?? this.url
|
||||
this.headers = args?.headers ?? this.headers
|
||||
this.body = args?.body ?? this.body
|
||||
this.description = args?.description ?? this.description
|
||||
this.maxOutputLength = args?.maxOutputLength ?? this.maxOutputLength
|
||||
}
|
||||
|
||||
/** @ignore */
|
||||
async _call(input: string) {
|
||||
try {
|
||||
let inputUrl = ''
|
||||
let inputBody = {}
|
||||
if (Object.keys(this.body).length || this.url) {
|
||||
if (this.url) inputUrl = this.url
|
||||
if (Object.keys(this.body).length) inputBody = this.body
|
||||
} else {
|
||||
const { url, data } = JSON.parse(input)
|
||||
inputUrl = url
|
||||
inputBody = data
|
||||
}
|
||||
|
||||
if (process.env.DEBUG === 'true') console.info(`Making POST API call to ${inputUrl} with body ${JSON.stringify(inputBody)}`)
|
||||
|
||||
const res = await fetch(inputUrl, {
|
||||
method: 'POST',
|
||||
headers: this.headers,
|
||||
body: JSON.stringify(inputBody)
|
||||
})
|
||||
|
||||
const text = await res.text()
|
||||
return text.slice(0, this.maxOutputLength)
|
||||
} catch (error) {
|
||||
return `${error}`
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M4 27V20H6.5C7.60457 20 8.5 20.8954 8.5 22C8.5 23.1046 7.60457 24 6.5 24H4" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M27 27V20M25 20H29" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M22.5644 20.4399C21.6769 19.7608 19 19.6332 19 21.7961C19 24.1915 23 22.5657 23 25.0902C23 26.9875 20.33 27.5912 19 26.3537" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M11 23.5C11 20.7 12.6667 20 13.5 20C14.3333 20 16 20.7 16 23.5C16 26.3 14.3333 27 13.5 27C12.6667 27 11 26.3 11 23.5Z" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M19.1112 15.2076L17.482 13.3556C15.4506 14.3228 13.0464 14.0464 11.477 12.477C10.1962 11.1962 9.77656 9.35939 10.1913 7.62299C10.3492 6.9619 11.1601 6.82676 11.6407 7.30737L13.5196 9.18628C14.1962 9.86283 15.3416 9.81433 16.078 9.07795C16.8143 8.34157 16.8628 7.19616 16.1863 6.51961L14.3074 4.64071C13.8268 4.16009 13.9619 3.34916 14.623 3.19127C16.3594 2.77656 18.1962 3.19622 19.477 4.477C21.0464 6.04639 21.3228 8.45065 20.3556 10.482L22.2076 12.1112" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
Reference in New Issue
Block a user