2025-04-26 01:09:01 -07:00
|
|
|
import { z } from 'zod';
|
|
|
|
|
|
|
|
|
|
const textPartSchema = z.object({
|
|
|
|
|
type: z.enum(['text']),
|
2025-07-03 02:26:34 -07:00
|
|
|
text: z.string().min(1).max(2000),
|
2025-04-26 01:09:01 -07:00
|
|
|
});
|
|
|
|
|
|
2025-07-03 02:26:34 -07:00
|
|
|
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]);
|
|
|
|
|
|
2025-04-26 01:09:01 -07:00
|
|
|
export const postRequestBodySchema = z.object({
|
|
|
|
|
id: z.string().uuid(),
|
|
|
|
|
message: z.object({
|
|
|
|
|
id: z.string().uuid(),
|
|
|
|
|
role: z.enum(['user']),
|
2025-07-03 02:26:34 -07:00
|
|
|
parts: z.array(partSchema),
|
2025-04-26 01:09:01 -07:00
|
|
|
}),
|
|
|
|
|
selectedChatModel: z.enum(['chat-model', 'chat-model-reasoning']),
|
2025-05-01 17:47:48 -07:00
|
|
|
selectedVisibilityType: z.enum(['public', 'private']),
|
2025-04-26 01:09:01 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type PostRequestBody = z.infer<typeof postRequestBodySchema>;
|