Files
calchat/apps/server/src/services/interfaces/AIProvider.ts
Linus Waldowsky 868e1ba68d perf: preload events and CalDAV config to avoid empty screens
Add CaldavConfigStore and preloadAppData() to load events (current month)
and CalDAV config into stores before dismissing the auth loading spinner.
This prevents the brief empty flash when first navigating to Calendar or
Settings tabs. Also applies Prettier formatting across codebase.
2026-02-09 18:59:03 +01:00

32 lines
873 B
TypeScript

import {
ChatMessage,
ProposedEventChange,
ExpandedEvent,
CalendarEvent,
} from "@calchat/shared";
export interface AIContext {
userId: string;
conversationHistory: ChatMessage[];
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 {
content: string;
proposedChanges?: ProposedEventChange[];
}
export interface AIProvider {
processMessage(message: string, context: AIContext): Promise<AIResponse>;
}