refactor: improve AI event handling and conflict display in chat
- 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
This commit is contained in:
@@ -1,14 +1,21 @@
|
||||
import {
|
||||
CalendarEvent,
|
||||
ChatMessage,
|
||||
ProposedEventChange,
|
||||
ExpandedEvent,
|
||||
CalendarEvent,
|
||||
} from "@calchat/shared";
|
||||
|
||||
export interface AIContext {
|
||||
userId: string;
|
||||
conversationHistory: ChatMessage[];
|
||||
existingEvents: CalendarEvent[];
|
||||
currentDate: Date;
|
||||
// Callback to load events from a specific date range
|
||||
// Returns ExpandedEvent[] with occurrenceStart/occurrenceEnd for recurring events
|
||||
fetchEventsInRange: (startDate: Date, endDate: Date) => Promise<ExpandedEvent[]>;
|
||||
// Callback to search events by title
|
||||
searchEvents: (query: string) => Promise<CalendarEvent[]>;
|
||||
// Callback to fetch a single event by ID
|
||||
fetchEventById: (eventId: string) => Promise<CalendarEvent | null>;
|
||||
}
|
||||
|
||||
export interface AIResponse {
|
||||
|
||||
Reference in New Issue
Block a user