feat: multimodal AI event creation with image support #1
@@ -1,3 +1,34 @@
|
|||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
|
export const AiEventRequestSchema = z
|
||||||
|
.object({
|
||||||
|
prompt: z.string().trim().max(2000).optional(),
|
||||||
|
imageBase64: z
|
||||||
|
.string()
|
||||||
|
.startsWith("data:", "Must be a valid data URL")
|
||||||
|
.max(10 * 1024 * 1024 * 1.37, "Image must be less than 10MB")
|
||||||
|
.optional(),
|
||||||
|
})
|
||||||
|
.refine((data) => data.prompt || data.imageBase64, {
|
||||||
|
message: "Either a prompt or an image is required",
|
||||||
|
});
|
||||||
|
|
||||||
|
export type AiEventRequest = z.infer<typeof AiEventRequestSchema>;
|
||||||
|
|
||||||
|
export const AiEventResponseItemSchema = z.object({
|
||||||
|
id: z.string().optional(),
|
||||||
|
title: z.string().min(1),
|
||||||
|
description: z.string().optional(),
|
||||||
|
location: z.string().optional(),
|
||||||
|
url: z.string().optional(),
|
||||||
|
start: z.string(),
|
||||||
|
end: z.string().optional(),
|
||||||
|
allDay: z.boolean().optional(),
|
||||||
|
recurrenceRule: z.string().optional(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const AiEventResponseSchema = z.array(AiEventResponseItemSchema);
|
||||||
|
|
||||||
export type CalendarEvent = {
|
export type CalendarEvent = {
|
||||||
id: string;
|
id: string;
|
||||||
title: string;
|
title: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user