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:
@@ -40,7 +40,8 @@ import {
|
||||
getGlobalVariable,
|
||||
getStartingNode,
|
||||
getTelemetryFlowObj,
|
||||
QUESTION_VAR_PREFIX
|
||||
QUESTION_VAR_PREFIX,
|
||||
CURRENT_DATE_TIME_VAR_PREFIX
|
||||
} from '.'
|
||||
import { ChatFlow } from '../database/entities/ChatFlow'
|
||||
import { Variable } from '../database/entities/Variable'
|
||||
@@ -294,9 +295,18 @@ export const resolveVariables = async (
|
||||
resolvedValue = resolvedValue.replace(match, flowConfig?.runtimeChatHistoryLength ?? 0)
|
||||
}
|
||||
|
||||
if (variableFullPath === CURRENT_DATE_TIME_VAR_PREFIX) {
|
||||
resolvedValue = resolvedValue.replace(match, new Date().toISOString())
|
||||
}
|
||||
|
||||
if (variableFullPath.startsWith('$iteration')) {
|
||||
if (iterationContext && iterationContext.value) {
|
||||
if (typeof iterationContext.value === 'string') {
|
||||
if (variableFullPath === '$iteration') {
|
||||
// If it's exactly $iteration, stringify the entire value
|
||||
const formattedValue =
|
||||
typeof iterationContext.value === 'object' ? JSON.stringify(iterationContext.value) : iterationContext.value
|
||||
resolvedValue = resolvedValue.replace(match, formattedValue)
|
||||
} else if (typeof iterationContext.value === 'string') {
|
||||
resolvedValue = resolvedValue.replace(match, iterationContext?.value)
|
||||
} else if (typeof iterationContext.value === 'object') {
|
||||
const iterationValue = get(iterationContext.value, variableFullPath.replace('$iteration.', ''))
|
||||
@@ -342,8 +352,10 @@ export const resolveVariables = async (
|
||||
const [, nodeIdPart, outputPath] = outputMatch
|
||||
// Clean nodeId (handle escaped underscores)
|
||||
const cleanNodeId = nodeIdPart.replace('\\', '')
|
||||
|
||||
// Find the last (most recent) matching node data instead of the first one
|
||||
const nodeData = [...agentFlowExecutedData].reverse().find((d) => d.nodeId === cleanNodeId)
|
||||
|
||||
if (nodeData?.data?.output && outputPath.trim()) {
|
||||
const variableValue = get(nodeData.data.output, outputPath)
|
||||
if (variableValue !== undefined) {
|
||||
@@ -1234,6 +1246,20 @@ const checkForMultipleStartNodes = (startingNodeIds: string[], isRecursive: bool
|
||||
}
|
||||
}
|
||||
|
||||
const parseFormStringToJson = (formString: string): Record<string, string> => {
|
||||
const result: Record<string, string> = {}
|
||||
const lines = formString.split('\n')
|
||||
|
||||
for (const line of lines) {
|
||||
const [key, value] = line.split(': ').map((part) => part.trim())
|
||||
if (key && value) {
|
||||
result[key] = value
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
/*
|
||||
* Function to traverse the flow graph and execute the nodes
|
||||
*/
|
||||
@@ -1376,7 +1402,12 @@ export const executeAgentFlow = async ({
|
||||
if (previousStartAgent) {
|
||||
const previousStartAgentOutput = previousStartAgent.data.output
|
||||
if (previousStartAgentOutput && typeof previousStartAgentOutput === 'object' && 'form' in previousStartAgentOutput) {
|
||||
agentflowRuntime.form = previousStartAgentOutput.form
|
||||
const formValues = previousStartAgentOutput.form
|
||||
if (typeof formValues === 'string') {
|
||||
agentflowRuntime.form = parseFormStringToJson(formValues)
|
||||
} else {
|
||||
agentflowRuntime.form = formValues
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user