2025-09-20 05:22:11 +08:00
|
|
|
import { ChatListItemSchema } from '@buster/database/schema-types';
|
2025-07-24 06:35:14 +08:00
|
|
|
import { z } from 'zod';
|
2025-09-20 05:22:11 +08:00
|
|
|
import { PaginatedResponseSchema } from '../type-utilities';
|
2025-07-24 06:35:14 +08:00
|
|
|
import { ChatWithMessagesSchema } from './chat.types';
|
|
|
|
|
|
|
|
// Response for getting a single chat
|
|
|
|
export const GetChatResponseSchema = ChatWithMessagesSchema;
|
|
|
|
export type GetChatResponse = z.infer<typeof GetChatResponseSchema>;
|
|
|
|
|
|
|
|
// Response for getting a list of chats
|
|
|
|
export const GetChatsListResponseSchema = z.array(ChatListItemSchema);
|
|
|
|
export type GetChatsListResponse = z.infer<typeof GetChatsListResponseSchema>;
|
|
|
|
|
2025-09-20 05:22:11 +08:00
|
|
|
// Response for getting a list of chats v2
|
|
|
|
export const GetChatsListResponseSchemaV2 = PaginatedResponseSchema(ChatListItemSchema);
|
|
|
|
export type GetChatsListResponseV2 = z.infer<typeof GetChatsListResponseSchemaV2>;
|
|
|
|
|
2025-07-24 06:35:14 +08:00
|
|
|
// Response for getting logs list (same as chats list)
|
|
|
|
export const GetLogsListResponseSchema = GetChatsListResponseSchema;
|
2025-07-24 06:56:17 +08:00
|
|
|
export type GetLogsListResponse = z.infer<typeof GetLogsListResponseSchema>;
|
2025-07-24 06:35:14 +08:00
|
|
|
|
|
|
|
// Response for updating a chat
|
|
|
|
export const UpdateChatResponseSchema = ChatWithMessagesSchema;
|
|
|
|
export type UpdateChatResponse = z.infer<typeof UpdateChatResponseSchema>;
|
|
|
|
|
|
|
|
// Response for updating chat message feedback
|
|
|
|
export const UpdateChatMessageFeedbackResponseSchema = ChatWithMessagesSchema;
|
|
|
|
export type UpdateChatMessageFeedbackResponse = z.infer<
|
|
|
|
typeof UpdateChatMessageFeedbackResponseSchema
|
|
|
|
>;
|
|
|
|
|
|
|
|
// Response for duplicating a chat
|
|
|
|
export const DuplicateChatResponseSchema = ChatWithMessagesSchema;
|
|
|
|
export type DuplicateChatResponse = z.infer<typeof DuplicateChatResponseSchema>;
|
|
|
|
|
|
|
|
// Response for deleting chats (void)
|
|
|
|
export const DeleteChatsResponseSchema = z.void();
|
|
|
|
export type DeleteChatsResponse = z.infer<typeof DeleteChatsResponseSchema>;
|
2025-09-12 01:37:25 +08:00
|
|
|
|
|
|
|
export const ShareChatResponseSchema = ChatWithMessagesSchema;
|
|
|
|
export type ShareChatResponse = z.infer<typeof ShareChatResponseSchema>;
|
2025-10-01 06:23:47 +08:00
|
|
|
|
|
|
|
// Response for creating a CLI chat
|
|
|
|
export const CliChatCreateResponseSchema = ChatWithMessagesSchema;
|
|
|
|
export type CliChatCreateResponse = z.infer<typeof CliChatCreateResponseSchema>;
|