Bugfix/Add date input type for custom tool (#4087)

add date input type for custom tool
This commit is contained in:
Henry Heng
2025-02-26 15:37:25 +00:00
committed by GitHub
parent 97a196e11a
commit a8d74336dd
+6
View File
@@ -820,6 +820,12 @@ export const convertSchemaToZod = (schema: string | object): ICommonObject => {
} else {
zodObj[sch.property] = z.boolean().describe(sch.description).optional()
}
} else if (sch.type === 'date') {
if (sch.required) {
zodObj[sch.property] = z.date({ required_error: `${sch.property} required` }).describe(sch.description)
} else {
zodObj[sch.property] = z.date().describe(sch.description).optional()
}
}
}
return zodObj