jan/web/types/chatMessage.d.ts
Louis 96dba2690d feat: class-based plugin manager
chore: add facades

refactor: core module export

refactor: inference plugin - deprecate function registering (#537)

* refactor: revamp inference plugin as class - deprecate function registering

* refactor: monitoring plugin - deprecate service registering (#538)

refactor: revamp inference plugin as class - deprecate function registering

chore: update import

refactor: plugin revamp - model management

chore: update build steps and remove experimental plugins

refactor: remove pluggable electron

chore: add sorting for conversations

chore: build plugins for testing

chore: consistent plugin directory name

chore: docs

chore: fix CI

chore: update conversation prefix
2023-11-06 13:46:01 +07:00

63 lines
1.1 KiB
TypeScript

enum MessageType {
Text = 'Text',
Image = 'Image',
ImageWithText = 'ImageWithText',
Error = 'Error',
}
enum MessageSenderType {
Ai = 'assistant',
User = 'user',
}
enum MessageStatus {
Ready = 'ready',
Pending = 'pending',
}
interface ChatMessage {
id: string
conversationId: string
messageType: MessageType
messageSenderType: MessageSenderType
senderUid: string
senderName: string
senderAvatarUrl: string
text: string | undefined
imageUrls?: string[] | undefined
createdAt: number
status: MessageStatus
}
interface RawMessage {
_id?: string
conversationId?: string
user?: string
avatar?: string
message?: string
createdAt?: string
updatedAt?: string
}
interface Conversation {
_id: string
modelId?: string
name?: string
image?: string
message?: string
lastMessage?: string
summary?: string
createdAt?: string
updatedAt?: string
botId?: string
}
/**
* Store the state of conversation like fetching, waiting for response, etc.
*/
type ConversationState = {
hasMore: boolean
waitingForResponse: boolean
error?: Error
}