Files
calendar/packages/features/calAIPhone/initializeRegistry.ts
T
02c86d0268 feat: cal ai self serve architecture #1 (#22919)
* feat: cal ai self serve architecture

* chore: add package

* chore: update evnet controller

* refactor: improvements

* chore: rename

* chore: type error and naming

* chore: just set it to nul

* chore: just set it to nul

* chore: some more improvements

* chore: packate version

* fix: API v2

* chore: change name of files

* chore: add select

* chore: add missing teamId

* chore: save progress

* refactor: split into multiple services

* refactor: make schema provider agonistic

* chore: improvements

* chore:

* chore: remove duplicate files

* chore: semicolon

* chore: formatting

* refactor: logging and error handling

* chore: rename variable

* refactor: use trpc error

* chore: replace with HttpError

* chore: remove from option

* We need the enum and not just the type

---------

Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
2025-08-08 15:57:13 +00:00

45 lines
1.4 KiB
TypeScript

import { AIPhoneServiceRegistry } from "./AIPhoneServiceRegistry";
import { AIPhoneServiceProviderType } from "./interfaces/AIPhoneService.interface";
import { RetellAIPhoneServiceProviderFactory } from "./providers/retellAI";
/**
* Initialize the AI Phone Service Registry
* This function should be called during application startup
*/
export function initializeAIPhoneServiceRegistry(): void {
// Use Retell AI as the default provider
const defaultProvider = AIPhoneServiceProviderType.RETELL_AI;
// Build providers configuration - only Retell AI for now
const providers = [
{
type: AIPhoneServiceProviderType.RETELL_AI,
factory: new RetellAIPhoneServiceProviderFactory(),
},
];
// Initialize the registry
AIPhoneServiceRegistry.initialize({
defaultProvider,
providers,
});
// Log initialization details in development
if (process.env.NODE_ENV !== "production") {
console.log("AI Phone Service Registry initialized:", {
defaultProvider: AIPhoneServiceRegistry.getDefaultProvider(),
availableProviders: AIPhoneServiceRegistry.getAvailableProviders(),
});
}
}
/**
* Check if the registry needs initialization and initialize if needed
* This is useful for ensuring the registry is ready before use
*/
export function ensureAIPhoneServiceRegistryInitialized(): void {
if (!AIPhoneServiceRegistry.isInitialized()) {
initializeAIPhoneServiceRegistry();
}
}