File size: 755 Bytes
867b17d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import { z } from 'zod';
const textPartSchema = z.object({
type: z.enum(['text']),
text: z.string().min(1).max(2000),
});
const filePartSchema = z.object({
type: z.enum(['file']),
mediaType: z.enum(['image/jpeg', 'image/png']),
name: z.string().min(1).max(100),
url: z.string().url(),
});
const partSchema = z.union([textPartSchema, filePartSchema]);
export const postRequestBodySchema = z.object({
id: z.string().uuid(),
message: z.object({
id: z.string().uuid(),
role: z.enum(['user']),
parts: z.array(partSchema),
}),
selectedChatModel: z.enum(['chat-model', 'chat-model-reasoning']),
selectedVisibilityType: z.enum(['public', 'private']),
});
export type PostRequestBody = z.infer<typeof postRequestBodySchema>;
|