feat: only send user message as part of request (#957)
This commit is contained in:
parent
9279135355
commit
f18af236a0
8 changed files with 90 additions and 54 deletions
29
app/(chat)/api/chat/schema.ts
Normal file
29
app/(chat)/api/chat/schema.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { z } from 'zod';
|
||||
|
||||
const textPartSchema = z.object({
|
||||
text: z.string().min(1).max(2000),
|
||||
type: z.enum(['text']),
|
||||
});
|
||||
|
||||
export const postRequestBodySchema = z.object({
|
||||
id: z.string().uuid(),
|
||||
message: z.object({
|
||||
id: z.string().uuid(),
|
||||
createdAt: z.coerce.date(),
|
||||
role: z.enum(['user']),
|
||||
content: z.string().min(1).max(2000),
|
||||
parts: z.array(textPartSchema),
|
||||
experimental_attachments: z
|
||||
.array(
|
||||
z.object({
|
||||
url: z.string().url(),
|
||||
name: z.string().min(1).max(2000),
|
||||
contentType: z.enum(['image/png', 'image/jpg', 'image/jpeg']),
|
||||
}),
|
||||
)
|
||||
.optional(),
|
||||
}),
|
||||
selectedChatModel: z.enum(['chat-model', 'chat-model-reasoning']),
|
||||
});
|
||||
|
||||
export type PostRequestBody = z.infer<typeof postRequestBodySchema>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue