buster/web/src/api/asset_interfaces/chat/chatMessageInterfaces.ts

98 lines
2.5 KiB
TypeScript
Raw Normal View History

2025-02-08 13:24:18 +08:00
import type { FileType, ThoughtFileType } from './config';
2025-01-28 04:21:42 +08:00
export type BusterChatMessage = {
id: string;
request_message: BusterChatMessageRequest;
response_messages: BusterChatMessageResponse[];
2025-02-08 13:24:18 +08:00
reasoning: BusterChatMessageReasoning[];
2025-01-28 04:21:42 +08:00
created_at: string;
2025-03-01 02:30:39 +08:00
final_reasoning_message: string | null;
2025-01-28 04:21:42 +08:00
};
export type BusterChatMessageRequest = null | {
2025-01-28 04:21:42 +08:00
request: string;
sender_id: string;
sender_name: string;
sender_avatar: string | null;
};
2025-02-08 13:24:18 +08:00
export type BusterChatMessageResponse = BusterChatMessage_text | BusterChatMessage_file;
2025-01-28 04:21:42 +08:00
export type BusterChatMessage_text = {
id: string;
type: 'text';
message: string;
message_chunk?: string;
2025-02-12 06:02:02 +08:00
is_final_message?: boolean; //defaults to false
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;
2025-02-13 02:01:54 +08:00
filter_version_id: string | null;
2025-01-28 04:21:42 +08:00
metadata?: BusterChatMessage_fileMetadata[];
};
2025-02-08 13:24:18 +08:00
export type BusterChatMessageReasoning =
2025-03-01 02:30:39 +08:00
| BusterChatMessageReasoning_pills
2025-02-11 01:42:02 +08:00
| BusterChatMessageReasoning_text
| BusterChatMessageReasoning_file;
2025-02-08 13:24:18 +08:00
2025-03-04 01:40:32 +08:00
export type BusterChatMessageReasoning_Pill = {
2025-02-08 13:24:18 +08:00
text: string;
2025-03-01 02:30:39 +08:00
type: ThoughtFileType | null; //if null then the pill will not link anywhere
2025-02-08 13:24:18 +08:00
id: string;
};
2025-03-04 01:40:32 +08:00
export type BusterChatMessageReasoning_PillsContainer = {
2025-02-11 00:59:54 +08:00
title: string;
2025-03-04 01:40:32 +08:00
pills: BusterChatMessageReasoning_Pill[];
2025-02-11 00:59:54 +08:00
};
2025-02-12 01:22:46 +08:00
export type BusterChatMessageReasoning_status = 'loading' | 'completed' | 'failed';
2025-03-01 02:30:39 +08:00
export type BusterChatMessageReasoning_pills = {
2025-02-08 13:24:18 +08:00
id: string;
2025-03-01 02:30:39 +08:00
type: 'pills';
title: string;
2025-03-04 01:40:32 +08:00
secondary_title?: string;
pill_containers?: BusterChatMessageReasoning_PillsContainer[];
2025-02-12 01:22:46 +08:00
status?: BusterChatMessageReasoning_status; //if left undefined, will automatically be set to 'loading' if the chat stream is in progress AND there is no message after it
2025-02-08 13:24:18 +08:00
};
export type BusterChatMessageReasoning_text = {
id: string;
type: 'text';
2025-03-01 02:30:39 +08:00
title: string;
2025-03-04 01:40:32 +08:00
secondary_title?: string;
2025-03-01 02:30:39 +08:00
message?: string;
2025-02-08 13:24:18 +08:00
message_chunk?: string;
2025-02-12 01:22:46 +08:00
status?: BusterChatMessageReasoning_status;
2025-02-08 13:24:18 +08:00
};
2025-02-11 01:42:02 +08:00
export type BusterChatMessageReasoning_file = {
id: string;
2025-02-11 02:41:59 +08:00
type: 'file';
file_type: FileType;
2025-02-11 01:42:02 +08:00
file_name: string;
version_number: number;
version_id: string;
2025-03-04 15:23:22 +08:00
secondary_title?: string;
2025-02-12 01:22:46 +08:00
status?: BusterChatMessageReasoning_status;
2025-02-11 01:42:02 +08:00
file?: {
text: string;
line_number: number;
2025-03-01 02:30:39 +08:00
modified?: boolean; //only toggle to true if we want to hide previous lines
}[];
2025-02-11 01:42:02 +08:00
};