Skip to content

An AI-powered search engine with a generative UI

fix: handle null value for exclude_domains and include_domains (#762)

Yoshiki Miura03462868d43a
diff --git a/lib/schema/search.tsx b/lib/schema/search.tsx
index ff13a19e..be5e25a8 100644
--- a/lib/schema/search.tsx
+++ b/lib/schema/search.tsx
@@ -31,15 +31,15 @@ export const searchSchema = z.object({
),
include_domains: z
.array(z.string())
- .optional()
- .default([])
+ .nullish()
+ .transform(val => val ?? [])
.describe(
'A list of domains to specifically include in the search results. Default is None, which includes all domains.'
),
exclude_domains: z
.array(z.string())
- .optional()
- .default([])
+ .nullish()
+ .transform(val => val ?? [])
.describe(
"A list of domains to specifically exclude from the search results. Default is None, which doesn't exclude any domains."
)
@@ -60,11 +60,15 @@ export const strictSearchSchema = z.object({
.describe('The depth of the search'),
include_domains: z
.array(z.string())
+ .nullish()
+ .transform(val => val ?? [])
.describe(
'A list of domains to specifically include in the search results. Default is None, which includes all domains.'
),
exclude_domains: z
.array(z.string())
+ .nullish()
+ .transform(val => val ?? [])
.describe(
"A list of domains to specifically exclude from the search results. Default is None, which doesn't exclude any domains."
)