From 631199afa42c660d440bec669dce26301a139178 Mon Sep 17 00:00:00 2001 From: blinko Date: Mon, 11 Nov 2024 10:13:27 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9Efix:=20type=20output=20validation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/routers/public.ts | 6 +++--- src/server/types.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/server/routers/public.ts b/src/server/routers/public.ts index d56973c..1710e7d 100644 --- a/src/server/routers/public.ts +++ b/src/server/routers/public.ts @@ -47,9 +47,9 @@ export const publicRouter = router({ try { const result: Metadata = await unfurl(input.url) return { - title: result.title ?? '', - favicon: result.favicon ?? '', - description: result.description ?? '' + title: result?.title ?? '', + favicon: result?.favicon ?? '', + description: result?.description ?? '' } } catch (error) { return null diff --git a/src/server/types.ts b/src/server/types.ts index 86f1074..cd47411 100644 --- a/src/server/types.ts +++ b/src/server/types.ts @@ -28,10 +28,10 @@ export const ZConfigSchema = z.object({ isAutoArchived: z.boolean().optional(), autoArchivedDays: z.number().optional(), isUseAI: z.boolean().optional(), - aiModelProvider: z.enum(['OpenAI']).optional(), - aiApiKey: z.string().optional(), - aiApiEndpoint: z.string().optional(), - aiModel: z.string().optional(), + aiModelProvider: z.any(), + aiApiKey: z.any(), + aiApiEndpoint: z.any(), + aiModel: z.any(), isHiddenMobileBar: z.boolean().optional(), });