Skip to content

Open-source status page, incident response and uptime monitoring

1.1 KB
Raw Blame
import {
  CHAT_TITLE_MAX_LENGTH,
  storedMessageSchema,
} from "@openstatus/db/src/schema";
import { z } from "zod";

export const CreateChatSessionInput = z.object({
  firstMessage: storedMessageSchema,
});
export type CreateChatSessionInput = z.infer<typeof CreateChatSessionInput>;

export const SetChatSessionMessagesInput = z.object({
  sessionId: z.number().int(),
  // No `.min(1)` — replacing a session with an empty list is valid
  // (e.g. user wipes the conversation).
  messages: z.array(storedMessageSchema),
});
export type SetChatSessionMessagesInput = z.infer<
  typeof SetChatSessionMessagesInput
>;

export const GetChatSessionInput = z.object({
  sessionId: z.number().int(),
});
export type GetChatSessionInput = z.infer<typeof GetChatSessionInput>;

export const ListChatSessionsInput = z.object({}).strict();
export type ListChatSessionsInput = z.infer<typeof ListChatSessionsInput>;

export const DeleteChatSessionInput = z.object({
  sessionId: z.number().int(),
});
export type DeleteChatSessionInput = z.infer<typeof DeleteChatSessionInput>;

export { CHAT_TITLE_MAX_LENGTH };