mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
added warning message for running with missing text input
this is because if a node is missing a hardcoded input the backend has an error, this is to prevent that
This commit is contained in:
@@ -266,6 +266,22 @@ const Flow: React.FC = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const validateNodeInputs = (nodes: Node[], edges: Edge[]): boolean => {
|
||||
for (const node of nodes) {
|
||||
const nodeSchema = availableNodes.find(n => n.id === node.data.block_id);
|
||||
if (nodeSchema && nodeSchema.inputSchema) {
|
||||
const inputProperties = nodeSchema.inputSchema.properties;
|
||||
for (const prop of Object.keys(inputProperties)) {
|
||||
const inputEdges = edges.filter(edge => edge.target === node.id && edge.targetHandle === prop);
|
||||
if (inputEdges.length === 0 && !node.data.hardcodedValues[prop]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const runAgent = async () => {
|
||||
if (nodes.length === 0) {
|
||||
setFlashMessage("Please add nodes before pressing run");
|
||||
@@ -273,6 +289,12 @@ const Flow: React.FC = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!validateNodeInputs(nodes, edges)) {
|
||||
setFlashMessage("Please make sure you have added values to all inputs");
|
||||
setTimeout(() => setFlashMessage(null), 3000); // Ensure the flash message disappears after 3 seconds
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const formattedNodes = nodes.map(node => {
|
||||
const inputDefault = prepareNodeInputData(node, nodes, edges);
|
||||
|
||||
Reference in New Issue
Block a user