← All changes
|
src/Agent/workflows/abilities/tools/execute-ability.js
+8
-1
3.1.3
→
3.2.1
View file →
| @@ -41,10 +41,17 @@ | ||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // Optional inputs the model didn't fill come through as null at any depth — |
| 44 | 44 | // drop them so schema defaults stand in and the ability sees only real values. |
| 45 | + const isEmptyEntry = (value) => | |
| 46 | + !!value && | |
| 47 | + typeof value === 'object' && | |
| 48 | + !Array.isArray(value) && | |
| 49 | + !Object.keys(value).length; | |
| 45 | 50 | const withoutNulls = (value) => { |
| 46 | - if (Array.isArray(value)) return value.map(withoutNulls); | |
| 51 | + // An entry the model left blank still has to satisfy the item schema. | |
| 52 | + if (Array.isArray(value)) | |
| 53 | + return value.map(withoutNulls).filter((entry) => !isEmptyEntry(entry)); | |
| 47 | 54 | if (value && typeof value === 'object') { |
| 48 | 55 | return Object.fromEntries( |
| 49 | 56 | Object.entries(value) |
| 50 | 57 | .filter(([, v]) => v != null) |