From 5874bfeef650fc58b1c86344c2f4a9e0911fa9dd Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Wed, 19 Mar 2025 23:08:45 -0600 Subject: [PATCH] remove some unused types --- web/src/api/buster_rest/chats/requests.ts | 26 ++++++---- .../api/buster_socket/chats/chatRequests.ts | 30 +----------- .../api/buster_socket/chats/chatResponses.ts | 8 ---- .../request_interfaces/chats/interfaces.ts | 47 ------------------- 4 files changed, 19 insertions(+), 92 deletions(-) diff --git a/web/src/api/buster_rest/chats/requests.ts b/web/src/api/buster_rest/chats/requests.ts index ba774c502..c1e913044 100644 --- a/web/src/api/buster_rest/chats/requests.ts +++ b/web/src/api/buster_rest/chats/requests.ts @@ -1,11 +1,6 @@ import { mainApi } from '../instances'; import { serverFetch } from '../../createServerInstance'; import type { BusterChatListItem, BusterChat } from '@/api/asset_interfaces/chat'; -import type { - DuplicateChatParams, - GetChatParams, - UpdateChatParams -} from '../../request_interfaces/chats'; const CHATS_BASE = '/chats'; @@ -44,16 +39,24 @@ export const getListChats_server = async ( }; // Client-side fetch version -export const getChat = async ({ id }: GetChatParams): Promise => { +export const getChat = async ({ id }: { id: string }): Promise => { return mainApi.get(`${CHATS_BASE}/${id}`).then((res) => res.data); }; // Server-side fetch version -export const getChat_server = async ({ id }: GetChatParams): Promise => { +export const getChat_server = async ({ id }: { id: string }): Promise => { return await serverFetch(`${CHATS_BASE}/${id}`); }; -export const updateChat = async ({ id, ...data }: UpdateChatParams): Promise => { +export const updateChat = async ({ + id, + ...data +}: { + id: string; + title?: string; + is_favorited?: boolean; + feedback?: 'negative' | null; +}): Promise => { return mainApi.put(`${CHATS_BASE}/${id}`, data).then((res) => res.data); }; @@ -65,7 +68,12 @@ export const duplicateChat = async ({ id, message_id, share_with_same_people -}: DuplicateChatParams): Promise => { +}: { + id: string; + /** The message ID to start the duplication from */ + message_id: string; + share_with_same_people: boolean; +}): Promise => { return mainApi .post(`${CHATS_BASE}/duplicate`, { id, message_id, share_with_same_people }) .then((res) => res.data); diff --git a/web/src/api/buster_socket/chats/chatRequests.ts b/web/src/api/buster_socket/chats/chatRequests.ts index 59ca4cdee..2b83e1db3 100644 --- a/web/src/api/buster_socket/chats/chatRequests.ts +++ b/web/src/api/buster_socket/chats/chatRequests.ts @@ -1,9 +1,4 @@ -import type { - CreateNewChatParams, - StopChatParams, - UnsubscribeFromChatParams, - DuplicateChatParams -} from '../../request_interfaces/chats'; +import type { CreateNewChatParams, StopChatParams } from '../../request_interfaces/chats'; import type { BusterSocketRequestBase } from '../base_interfaces'; /** @@ -20,28 +15,7 @@ export type ChatCreateNewChat = BusterSocketRequestBase<'/chats/post', CreateNew */ export type ChatStopChat = BusterSocketRequestBase<'/chats/stop', StopChatParams>; -/** - * Request type for unsubscribing from real-time updates of a specific chat. - * @interface ChatUnsubscribeFromChat - * @extends BusterSocketRequestBase - */ -export type ChatUnsubscribeFromChat = BusterSocketRequestBase< - '/chats/unsubscribe', - UnsubscribeFromChatParams ->; - -/** - * Request type for duplicating an existing chat. - * @interface ChatsDuplicateChat - * @extends BusterSocketRequestBase - */ -export type ChatsDuplicateChat = BusterSocketRequestBase<'/chats/duplicate', DuplicateChatParams>; - /** * Union type of all possible chat-related request types. */ -export type ChatEmits = - | ChatCreateNewChat - | ChatUnsubscribeFromChat - | ChatsDuplicateChat - | ChatStopChat; +export type ChatEmits = ChatCreateNewChat | ChatStopChat; diff --git a/web/src/api/buster_socket/chats/chatResponses.ts b/web/src/api/buster_socket/chats/chatResponses.ts index cd0b21876..f50ad8a75 100644 --- a/web/src/api/buster_socket/chats/chatResponses.ts +++ b/web/src/api/buster_socket/chats/chatResponses.ts @@ -7,7 +7,6 @@ import { } from './eventInterfaces'; export enum ChatsResponses { - '/chats/unsubscribe:unsubscribe' = '/chats/unsubscribe:unsubscribe', '/chats/get:getChat' = '/chats/get:getChat', '/chats/post:initializeChat' = '/chats/post:initializeChat', '/chats/post:generatingTitle' = '/chats/post:generatingTitle', @@ -29,12 +28,6 @@ export type Chat_getChat = { onError?: (error: RustApiError) => void; }; -export type Chat_unsubscribe = { - route: '/chats/unsubscribe:unsubscribe'; - callback: (d: { id: string }[]) => void; - onError?: (d: unknown | RustApiError) => void; -}; - /***** CHAT PROGRESS EVENTS START ******/ export type ChatPost_initializeChat = { @@ -70,7 +63,6 @@ export type ChatPost_complete = { /***** CHAT PROGRESS EVENTS END ******/ export type ChatResponseTypes = - | Chat_unsubscribe | Chat_getChat | ChatPost_initializeChat | ChatPost_generatingTitle diff --git a/web/src/api/request_interfaces/chats/interfaces.ts b/web/src/api/request_interfaces/chats/interfaces.ts index b6757c23f..15c4f04d3 100644 --- a/web/src/api/request_interfaces/chats/interfaces.ts +++ b/web/src/api/request_interfaces/chats/interfaces.ts @@ -1,8 +1,3 @@ -export interface GetChatParams { - /** The unique identifier of the chat to retrieve */ - id: string; -} - export interface CreateNewChatParams { /** The ID of the dataset to associate with the chat. Null if no dataset is associated */ dataset_id?: string | null; @@ -26,45 +21,3 @@ export interface StopChatParams { /** The ID of the specific message to stop generating */ message_id: string; } - -export interface UnsubscribeFromChatParams { - /** The unique identifier of the chat to unsubscribe from */ - id: string; -} - -export interface DeleteChatParams { - /** The unique identifier of the chat to delete */ - id: string; -} - -export interface UpdateChatParams { - /** The unique identifier of the chat to update */ - id: string; - /** Optional new title to set for the chat */ - title?: string; - /** Optional flag to set the chat's favorite status */ - is_favorited?: boolean; - /** Optional feedback to set for the chat */ - feedback?: 'negative' | null; -} - -export interface ChatsSearchParams { - /** The search query string to match against chats */ - prompt: string; -} - -export interface DuplicateChatParams { - /** The unique identifier of the source chat to duplicate */ - id: string; - /** The message ID to start the duplication from */ - message_id: string; - /** Whether to share the duplicated chat with the same people as the source chat */ - share_with_same_people: boolean; -} - -export interface DuplicateChatResponse { - /** The unique identifier of the duplicated chat */ - id: string; - /** The title of the duplicated chat */ - title: string; -}