2025-01-31 07:29:06 +08:00
|
|
|
import type { BusterSocketRequestBase } from '../base_interfaces';
|
2025-01-28 04:21:42 +08:00
|
|
|
|
2025-02-05 02:01:00 +08:00
|
|
|
/**
|
|
|
|
* Request type for creating a new chat session or continuing an existing one.
|
|
|
|
* @interface ChatCreateNewChat
|
|
|
|
* @extends BusterSocketRequestBase
|
|
|
|
*/
|
2025-01-28 04:21:42 +08:00
|
|
|
export type ChatCreateNewChat = BusterSocketRequestBase<
|
|
|
|
'/chats/post',
|
|
|
|
{
|
2025-02-05 02:01:00 +08:00
|
|
|
/** The ID of the dataset to associate with the chat. Null if no dataset is associated */
|
2025-01-28 04:21:42 +08:00
|
|
|
dataset_id: string | null;
|
2025-02-05 02:01:00 +08:00
|
|
|
/** The initial message or prompt to start the chat conversation */
|
|
|
|
prompt: string;
|
|
|
|
/** Optional ID of an existing chat for follow-up messages. Null for new chats */
|
|
|
|
chat_id?: string | null;
|
|
|
|
/** Optional ID of a clicked suggestion. If provided, returns that specific chat */
|
|
|
|
suggestion_id?: string | null;
|
|
|
|
/** Optional ID of a message to replace in an existing chat */
|
|
|
|
message_id?: string;
|
|
|
|
/** Optional ID of a metric to initialize the chat from */
|
|
|
|
metric_id?: string;
|
2025-02-05 13:04:26 +08:00
|
|
|
/** Optional ID of a dashboard to initialize the chat from */
|
|
|
|
dashboard_id?: string;
|
2025-01-28 04:21:42 +08:00
|
|
|
}
|
|
|
|
>;
|
|
|
|
|
2025-02-05 02:01:00 +08:00
|
|
|
/**
|
|
|
|
* Request type for stopping an active chat or message generation.
|
|
|
|
* @interface ChatStopChat
|
|
|
|
* @extends BusterSocketRequestBase
|
|
|
|
*/
|
|
|
|
export type ChatStopChat = BusterSocketRequestBase<
|
|
|
|
'/chats/stop',
|
|
|
|
{
|
|
|
|
/** The unique identifier of the chat to stop */
|
|
|
|
id: string;
|
|
|
|
/** The ID of the specific message to stop generating */
|
|
|
|
message_id: string;
|
|
|
|
}
|
|
|
|
>;
|
2025-01-28 04:21:42 +08:00
|
|
|
|
2025-02-05 02:01:00 +08:00
|
|
|
/**
|
|
|
|
* Request type for retrieving a specific chat by its ID.
|
|
|
|
* @interface ChatGetChat
|
|
|
|
* @extends BusterSocketRequestBase
|
|
|
|
*/
|
|
|
|
export type ChatGetChat = BusterSocketRequestBase<
|
|
|
|
'/chats/get',
|
|
|
|
{
|
|
|
|
/** The unique identifier of the chat to retrieve */
|
|
|
|
id: string;
|
|
|
|
}
|
|
|
|
>;
|
2025-01-28 04:21:42 +08:00
|
|
|
|
2025-02-05 02:01:00 +08:00
|
|
|
/**
|
|
|
|
* Request type for unsubscribing from real-time updates of a specific chat.
|
|
|
|
* @interface ChatUnsubscribeFromChat
|
|
|
|
* @extends BusterSocketRequestBase
|
|
|
|
*/
|
|
|
|
export type ChatUnsubscribeFromChat = BusterSocketRequestBase<
|
|
|
|
'/chats/unsubscribe',
|
|
|
|
{
|
|
|
|
/** The unique identifier of the chat to unsubscribe from */
|
|
|
|
id: string;
|
|
|
|
}
|
|
|
|
>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request type for retrieving a paginated list of chats.
|
|
|
|
* @interface ChatListEmitPayload
|
|
|
|
* @extends BusterSocketRequestBase
|
|
|
|
*/
|
2025-01-28 04:21:42 +08:00
|
|
|
export type ChatListEmitPayload = BusterSocketRequestBase<
|
|
|
|
'/chats/list',
|
|
|
|
{
|
2025-02-05 02:01:00 +08:00
|
|
|
/** Pagination token indicating the page number */
|
2025-01-28 04:21:42 +08:00
|
|
|
page_token: number;
|
2025-02-05 02:01:00 +08:00
|
|
|
/** Number of chat items to return per page */
|
2025-01-28 04:21:42 +08:00
|
|
|
page_size: number;
|
2025-02-05 02:01:00 +08:00
|
|
|
/** When true, shows all organization chats (admin only). When false, shows only user's chats */
|
2025-01-28 04:21:42 +08:00
|
|
|
admin_view: boolean;
|
|
|
|
}
|
|
|
|
>;
|
|
|
|
|
2025-02-05 02:01:00 +08:00
|
|
|
/**
|
|
|
|
* Request type for deleting a specific chat.
|
|
|
|
* @interface ChatDeleteChat
|
|
|
|
* @extends BusterSocketRequestBase
|
|
|
|
*/
|
|
|
|
export type ChatDeleteChat = BusterSocketRequestBase<
|
|
|
|
'/chats/delete',
|
|
|
|
{
|
|
|
|
/** The unique identifier of the chat to delete */
|
|
|
|
id: string;
|
|
|
|
}
|
|
|
|
>;
|
2025-01-28 04:21:42 +08:00
|
|
|
|
2025-02-05 02:01:00 +08:00
|
|
|
/**
|
|
|
|
* Request type for updating chat properties.
|
|
|
|
* @interface ChatUpdateChat
|
|
|
|
* @extends BusterSocketRequestBase
|
|
|
|
*/
|
2025-01-28 04:21:42 +08:00
|
|
|
export type ChatUpdateChat = BusterSocketRequestBase<
|
|
|
|
'/chats/update',
|
2025-02-05 02:01:00 +08:00
|
|
|
{
|
|
|
|
/** 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;
|
|
|
|
}
|
2025-01-28 04:21:42 +08:00
|
|
|
>;
|
|
|
|
|
2025-02-05 02:01:00 +08:00
|
|
|
/**
|
|
|
|
* Request type for searching through chats using a text prompt.
|
|
|
|
* @interface ChatsSearch
|
|
|
|
* @extends BusterSocketRequestBase
|
|
|
|
*/
|
|
|
|
export type ChatsSearch = BusterSocketRequestBase<
|
|
|
|
'/chats/search',
|
|
|
|
{
|
|
|
|
/** The search query string to match against chats */
|
|
|
|
prompt: string;
|
|
|
|
}
|
|
|
|
>;
|
2025-01-28 04:21:42 +08:00
|
|
|
|
2025-02-05 02:01:00 +08:00
|
|
|
/**
|
|
|
|
* Request type for duplicating an existing chat.
|
|
|
|
* @interface ChatsDuplicateChat
|
|
|
|
* @extends BusterSocketRequestBase
|
|
|
|
*/
|
2025-01-28 04:21:42 +08:00
|
|
|
export type ChatsDuplicateChat = BusterSocketRequestBase<
|
|
|
|
'/chats/duplicate',
|
|
|
|
{
|
2025-02-05 02:01:00 +08:00
|
|
|
/** The unique identifier of the source chat to duplicate */
|
2025-01-28 04:21:42 +08:00
|
|
|
id: string;
|
2025-02-05 02:01:00 +08:00
|
|
|
/** The message ID to start the duplication from */
|
|
|
|
message_id: string;
|
|
|
|
/** The target chat ID to duplicate content to */
|
|
|
|
chat_id: string;
|
2025-01-28 04:21:42 +08:00
|
|
|
}
|
|
|
|
>;
|
|
|
|
|
2025-02-05 02:01:00 +08:00
|
|
|
/**
|
|
|
|
* Union type of all possible chat-related request types.
|
|
|
|
*/
|
2025-01-28 04:21:42 +08:00
|
|
|
export type ChatEmits =
|
|
|
|
| ChatCreateNewChat
|
|
|
|
| ChatGetChat
|
|
|
|
| ChatUnsubscribeFromChat
|
|
|
|
| ChatListEmitPayload
|
|
|
|
| ChatDeleteChat
|
|
|
|
| ChatUpdateChat
|
|
|
|
| ChatsSearch
|
|
|
|
| ChatsDuplicateChat;
|