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-02-05 03:26: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 ;
2025-02-05 03:26:42 +08:00
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 =
| BusterChatMessageReasoning_thought
2025-02-11 01:42:02 +08:00
| BusterChatMessageReasoning_text
| BusterChatMessageReasoning_file ;
2025-02-08 13:24:18 +08:00
export type BusterChatMessageReasoning_thoughtPill = {
text : string ;
type : ThoughtFileType ;
id : string ;
} ;
2025-02-11 00:59:54 +08:00
export type BusterChatMessageReasoning_thoughtPillContainer = {
title : string ;
thought_pills : BusterChatMessageReasoning_thoughtPill [ ] ;
} ;
2025-02-12 01:22:46 +08:00
export type BusterChatMessageReasoning_status = 'loading' | 'completed' | 'failed' ;
2025-02-08 13:24:18 +08:00
export type BusterChatMessageReasoning_thought = {
id : string ;
type : 'thought' ;
thought_title : string ;
thought_secondary_title : string ;
2025-02-11 00:59:54 +08:00
thoughts? : BusterChatMessageReasoning_thoughtPillContainer [ ] ;
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' ;
message : string ;
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-02-12 01:22:46 +08:00
status? : BusterChatMessageReasoning_status ;
2025-02-11 07:43:38 +08:00
//when we are streaming, the whole file will always be streamed back, not chunks
2025-02-11 01:42:02 +08:00
file ? : {
text : string ;
line_number : number ;
modified? : boolean ; //defaults to true
2025-02-11 03:24:35 +08:00
} [ ] ; //will be defined if the file has been completed OR on a page refresh
2025-02-11 01:42:02 +08:00
} ;