feat: added attachment support

This commit is contained in:
DESKTOP-RTLN3BA\$punk 2025-12-21 22:26:33 -08:00
parent bb971460fc
commit c2dcb2045d
62 changed files with 1166 additions and 9012 deletions

View file

@ -1,63 +0,0 @@
import type { Message } from "@ai-sdk/react";
import { z } from "zod";
import { paginationQueryParams } from ".";
export const chatTypeEnum = z.enum(["QNA"]);
export const chatSummary = z.object({
created_at: z.string(),
id: z.number(),
type: chatTypeEnum,
title: z.string(),
search_space_id: z.number(),
state_version: z.number(),
});
export const chatDetails = chatSummary.extend({
initial_connectors: z.array(z.string()).nullable().optional(),
messages: z.array(z.any()),
});
export const getChatDetailsRequest = chatSummary.pick({ id: true });
export const getChatsRequest = z.object({
queryParams: paginationQueryParams
.extend({
search_space_id: z.number().or(z.string()).optional(),
})
.nullish(),
});
export const searchChatsRequest = z.object({
queryParams: paginationQueryParams.extend({
title: z.string(),
search_space_id: z.number().or(z.string()).optional(),
}),
});
export const deleteChatResponse = z.object({
message: z.literal("Chat deleted successfully"),
});
export const deleteChatRequest = chatSummary.pick({ id: true });
export const createChatRequest = chatDetails.omit({
created_at: true,
id: true,
state_version: true,
});
export const updateChatRequest = chatDetails.omit({
created_at: true,
state_version: true,
});
export type ChatSummary = z.infer<typeof chatSummary>;
export type ChatDetails = z.infer<typeof chatDetails> & { messages: Message[] };
export type GetChatDetailsRequest = z.infer<typeof getChatDetailsRequest>;
export type GetChatsRequest = z.infer<typeof getChatsRequest>;
export type SearchChatsRequest = z.infer<typeof searchChatsRequest>;
export type DeleteChatResponse = z.infer<typeof deleteChatResponse>;
export type DeleteChatRequest = z.infer<typeof deleteChatRequest>;
export type CreateChatRequest = z.infer<typeof createChatRequest>;
export type UpdateChatRequest = z.infer<typeof updateChatRequest>;

View file

@ -1,57 +0,0 @@
import { z } from "zod";
import { paginationQueryParams } from ".";
export const podcastTranscriptEntry = z.object({
speaker_id: z.number(),
dialog: z.string(),
});
export const podcast = z.object({
id: z.number(),
title: z.string(),
created_at: z.string(),
file_location: z.string(),
podcast_transcript: z.array(podcastTranscriptEntry),
search_space_id: z.number(),
chat_state_version: z.number().nullable(),
});
export const generatePodcastRequest = z.object({
type: z.enum(["CHAT", "DOCUMENT"]),
ids: z.array(z.number()),
search_space_id: z.number(),
podcast_title: z.string().optional(),
user_prompt: z.string().optional(),
});
export const getPodcastByChatIdRequest = z.object({
chat_id: z.number(),
});
export const getPodcastByChaIdResponse = podcast.nullish();
export const deletePodcastRequest = z.object({
id: z.number(),
});
export const deletePodcastResponse = z.object({
message: z.literal("Podcast deleted successfully"),
});
export const loadPodcastRequest = z.object({
id: z.number(),
});
export const getPodcastsRequest = z.object({
queryParams: paginationQueryParams.nullish(),
});
export type PodcastTranscriptEntry = z.infer<typeof podcastTranscriptEntry>;
export type GeneratePodcastRequest = z.infer<typeof generatePodcastRequest>;
export type GetPodcastByChatIdRequest = z.infer<typeof getPodcastByChatIdRequest>;
export type GetPodcastByChatIdResponse = z.infer<typeof getPodcastByChaIdResponse>;
export type DeletePodcastRequest = z.infer<typeof deletePodcastRequest>;
export type DeletePodcastResponse = z.infer<typeof deletePodcastResponse>;
export type LoadPodcastRequest = z.infer<typeof loadPodcastRequest>;
export type Podcast = z.infer<typeof podcast>;
export type GetPodcastsRequest = z.infer<typeof getPodcastsRequest>;