mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
Chore/Update issue templates and add new tools (#4687)
* Enhancement: Update issue templates and add new tools - Updated bug report template to include a default label of 'bug'. - Updated feature request template to include a default label of 'enhancement'. - Added new credential class for Agentflow API. - Enhanced Agent and HTTP nodes to improve tool management and error handling. - Added deprecation badges to several agent and chain classes. - Introduced new tools for handling requests (GET, POST, DELETE, PUT) with improved error handling. - Added new chatflows and agentflows for various use cases, including document QnA and translation. - Updated UI components for better handling of agent flows and marketplace interactions. - Refactored utility functions for improved functionality and clarity. * Refactor: Remove beta badge and streamline template title assignment - Removed the 'BETA' badge from the ExtractMetadataRetriever class. - Simplified the title assignment in the agentflowv2 generator by using a variable instead of inline string manipulation.
This commit is contained in:
@@ -1,7 +1,19 @@
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { getBaseClasses, stripHTMLFromToolInput } from '../../../src/utils'
|
||||
import { RequestParameters, desc, RequestsPostTool } from './core'
|
||||
|
||||
const codeExample = `{
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"description": "Name of the item"
|
||||
},
|
||||
"date": {
|
||||
"type": "string",
|
||||
"description": "Date of the item"
|
||||
}
|
||||
}`
|
||||
|
||||
class RequestsPost_Tools implements INode {
|
||||
label: string
|
||||
name: string
|
||||
@@ -16,62 +28,119 @@ class RequestsPost_Tools implements INode {
|
||||
constructor() {
|
||||
this.label = 'Requests Post'
|
||||
this.name = 'requestsPost'
|
||||
this.version = 1.0
|
||||
this.version = 2.0
|
||||
this.type = 'RequestsPost'
|
||||
this.icon = 'requestspost.svg'
|
||||
this.icon = 'post.png'
|
||||
this.category = 'Tools'
|
||||
this.description = 'Execute HTTP POST requests'
|
||||
this.baseClasses = [this.type, ...getBaseClasses(RequestsPostTool)]
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'URL',
|
||||
name: 'url',
|
||||
name: 'requestsPostUrl',
|
||||
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
|
||||
acceptVariable: 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',
|
||||
label: 'Name',
|
||||
name: 'requestsPostName',
|
||||
type: 'string',
|
||||
default: 'requests_post',
|
||||
description: 'Name of the tool',
|
||||
additionalParams: true,
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Description',
|
||||
name: 'description',
|
||||
name: 'requestsPostDescription',
|
||||
type: 'string',
|
||||
rows: 4,
|
||||
default: desc,
|
||||
description: 'Acts like a prompt to tell agent when it should use this tool',
|
||||
description: 'Describe to LLM when it should use this tool',
|
||||
additionalParams: true,
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Headers',
|
||||
name: 'headers',
|
||||
type: 'json',
|
||||
name: 'requestsPostHeaders',
|
||||
type: 'string',
|
||||
rows: 4,
|
||||
acceptVariable: true,
|
||||
additionalParams: true,
|
||||
optional: true
|
||||
optional: true,
|
||||
placeholder: `{
|
||||
"Authorization": "Bearer <token>"
|
||||
}`
|
||||
},
|
||||
{
|
||||
label: 'Body',
|
||||
name: 'requestPostBody',
|
||||
type: 'string',
|
||||
rows: 4,
|
||||
description: 'JSON body for the POST request. This will override the body generated by the LLM',
|
||||
additionalParams: true,
|
||||
acceptVariable: true,
|
||||
optional: true,
|
||||
placeholder: `{
|
||||
"name": "John Doe",
|
||||
"age": 30
|
||||
}`
|
||||
},
|
||||
{
|
||||
label: 'Body Schema',
|
||||
name: 'requestsPostBodySchema',
|
||||
type: 'code',
|
||||
description: 'Description of the available body params to enable LLM to figure out which body params to use',
|
||||
placeholder: `{
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"description": "Name of the item"
|
||||
},
|
||||
"date": {
|
||||
"type": "string",
|
||||
"description": "Date of the item"
|
||||
}
|
||||
}`,
|
||||
optional: true,
|
||||
hideCodeExecute: true,
|
||||
additionalParams: true,
|
||||
codeExample: codeExample
|
||||
},
|
||||
{
|
||||
label: 'Max Output Length',
|
||||
name: 'requestsPostMaxOutputLength',
|
||||
type: 'number',
|
||||
description: 'Max length of the output. Remove this if you want to return the entire response',
|
||||
default: '2000',
|
||||
step: 1,
|
||||
optional: true,
|
||||
additionalParams: 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 headers = (nodeData.inputs?.headers as string) || (nodeData.inputs?.requestsPostHeaders as string)
|
||||
const url = (nodeData.inputs?.url as string) || (nodeData.inputs?.requestsPostUrl as string)
|
||||
const name = (nodeData.inputs?.name as string) || (nodeData.inputs?.requestsPostName as string)
|
||||
const description = (nodeData.inputs?.description as string) || (nodeData.inputs?.requestsPostDescription as string)
|
||||
const body = (nodeData.inputs?.body as string) || (nodeData.inputs?.requestPostBody as string)
|
||||
const bodySchema = nodeData.inputs?.requestsPostBodySchema as string
|
||||
const maxOutputLength = (nodeData.inputs?.maxOutputLength as string) || (nodeData.inputs?.requestsPostMaxOutputLength as string)
|
||||
|
||||
const obj: RequestParameters = {}
|
||||
if (url) obj.url = url
|
||||
if (url) obj.url = stripHTMLFromToolInput(url)
|
||||
if (description) obj.description = description
|
||||
if (name)
|
||||
obj.name = name
|
||||
.toLowerCase()
|
||||
.replace(/ /g, '_')
|
||||
.replace(/[^a-z0-9_-]/g, '')
|
||||
if (bodySchema) obj.bodySchema = stripHTMLFromToolInput(bodySchema)
|
||||
if (maxOutputLength) obj.maxOutputLength = parseInt(maxOutputLength, 10)
|
||||
if (headers) {
|
||||
const parsedHeaders = typeof headers === 'object' ? headers : JSON.parse(headers)
|
||||
const parsedHeaders = typeof headers === 'object' ? headers : JSON.parse(stripHTMLFromToolInput(headers))
|
||||
obj.headers = parsedHeaders
|
||||
}
|
||||
if (body) {
|
||||
|
||||
Reference in New Issue
Block a user