buster/web/src/api/buster_socket/chats/chatMessageInterfaces.ts

61 lines
1.5 KiB
TypeScript
Raw Normal View History

2025-01-28 04:21:42 +08:00
import type { FileType } from './config';
export type BusterChatMessage = {
id: string;
request_message: BusterChatMessageRequest;
response_messages: BusterChatMessageResponse[];
created_at: string;
};
export type BusterChatMessageRequest = {
request: string;
sender_id: string;
sender_name: string;
sender_avatar: string | null;
};
export type BusterChatMessageResponse =
| BusterChatMessage_text
| BusterChatMessage_thought
| BusterChatMessage_file;
export type BusterChatMessage_text = {
id: string;
type: 'text';
message: string;
message_chunk: string;
};
export type BusterChatMessage_thoughtPill = {
text: string;
type: FileType;
id: string;
};
export type BusterChatMessage_thought = {
id: string;
type: 'thought';
thought_title: string;
thought_secondary_title: string;
2025-01-29 01:57:26 +08:00
thought_pills?: BusterChatMessage_thoughtPill[];
2025-01-28 04:21:42 +08:00
hidden?: boolean; //if left undefined, will automatically be set to false if stream has ended
2025-01-29 06:21:07 +08:00
status?: 'loading' | 'completed' | 'failed'; //if left undefined, will automatically be set to 'loading' if the chat stream is in progress AND there is no message after it
2025-01-28 04:21:42 +08:00
};
export type BusterChatMessage_fileMetadata = {
status: 'loading' | 'completed' | 'failed';
message: string;
2025-01-29 06:38:43 +08:00
timestamp?: number;
2025-01-28 04:21:42 +08:00
};
export type BusterChatMessage_file = {
id: string;
type: 'file';
file_type: FileType;
2025-01-29 06:21:07 +08:00
file_name: string;
2025-01-28 04:21:42 +08:00
version_number: number;
version_id: string;
metadata?: BusterChatMessage_fileMetadata[];
hidden?: boolean; //if left undefined, will automatically be set to true
};