From a8d74336ddfefc4722737a34ffb39784e0c3838f Mon Sep 17 00:00:00 2001 From: Henry Heng Date: Wed, 26 Feb 2025 15:37:25 +0000 Subject: [PATCH] Bugfix/Add date input type for custom tool (#4087) add date input type for custom tool --- packages/components/src/utils.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/components/src/utils.ts b/packages/components/src/utils.ts index 7fc8426b1..195033e77 100644 --- a/packages/components/src/utils.ts +++ b/packages/components/src/utils.ts @@ -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