- AI fetches events on-demand via callbacks for better efficiency - Add conflict detection with warning display when proposing overlapping events - Improve event search and display in chat interface - Load full chat history for display while limiting AI context
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import {
|
|
ChatMessage,
|
|
Conversation,
|
|
CreateMessageDTO,
|
|
CreateEventDTO,
|
|
GetMessagesOptions,
|
|
UpdateMessageDTO,
|
|
ConflictingEvent,
|
|
} from "@calchat/shared";
|
|
|
|
export interface ChatRepository {
|
|
// Conversations
|
|
getConversationsByUser(userId: string): Promise<Conversation[]>;
|
|
getConversationById(conversationId: string): Promise<Conversation | null>;
|
|
createConversation(userId: string): Promise<Conversation>;
|
|
|
|
// Messages (cursor-based pagination)
|
|
getMessages(
|
|
conversationId: string,
|
|
options?: GetMessagesOptions,
|
|
): Promise<ChatMessage[]>;
|
|
|
|
createMessage(
|
|
conversationId: string,
|
|
message: CreateMessageDTO,
|
|
): Promise<ChatMessage>;
|
|
|
|
updateMessage(
|
|
messageId: string,
|
|
updates: UpdateMessageDTO,
|
|
): Promise<ChatMessage | null>;
|
|
|
|
updateProposalResponse(
|
|
messageId: string,
|
|
proposalId: string,
|
|
respondedAction: "confirm" | "reject",
|
|
): Promise<ChatMessage | null>;
|
|
|
|
updateProposalEvent(
|
|
messageId: string,
|
|
proposalId: string,
|
|
event: CreateEventDTO,
|
|
conflictingEvents?: ConflictingEvent[],
|
|
): Promise<ChatMessage | null>;
|
|
|
|
getMessageById(messageId: string): Promise<ChatMessage | null>;
|
|
}
|