From 9c98596a66a65b9b1f5843de25387ca9ca3058f8 Mon Sep 17 00:00:00 2001 From: mubashir1osmani Date: Thu, 16 Oct 2025 20:11:35 -0400 Subject: [PATCH] fix: npm build errors --- .../src/components/callback_info_helpers.tsx | 39 ++++++++++++++++--- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/ui/litellm-dashboard/src/components/callback_info_helpers.tsx b/ui/litellm-dashboard/src/components/callback_info_helpers.tsx index d11f6a58368..22f7989a13a 100644 --- a/ui/litellm-dashboard/src/components/callback_info_helpers.tsx +++ b/ui/litellm-dashboard/src/components/callback_info_helpers.tsx @@ -1,15 +1,14 @@ -const asset_logos_folder = '/ui/assets/logos/'; - interface CallbackConfig { - id: string; // Internal callback name (e.g., "arize", "custom_callback_api") - displayName: string; // User-facing name (e.g., "Arize", "Custom Callback API") - logo: string; // Logo path + id: string; + displayName: string; + logo: string; supports_key_team_logging: boolean; dynamic_params: Record; description: string; } -// Single source of truth for ALL callback configurations +const asset_logos_folder = '/ui/assets/logos/'; + export const CALLBACK_CONFIGS: CallbackConfig[] = [ { id: "arize", @@ -140,6 +139,34 @@ export const CALLBACK_CONFIGS: CallbackConfig[] = [ } ]; +// Create callbackInfo object mapping display names to config objects +export const callbackInfo: Record = CALLBACK_CONFIGS.reduce((acc, config) => { + acc[config.displayName] = config; + return acc; +}, {} as Record); + +// Create callback_map mapping display names to internal IDs +export const callback_map: Record = CALLBACK_CONFIGS.reduce((acc, config) => { + acc[config.displayName] = config.id; + return acc; +}, {} as Record); + +// create reverse_callback_map to map internal IDs to display names +export const reverse_callback_map: Record = CALLBACK_CONFIGS.reduce((acc, config) => { + acc[config.id] = config.displayName; + return acc; +}, {} as Record); + +// Function to map display names to internal names +export const mapDisplayToInternalNames = (displayNames: string[]): string[] => { + return displayNames.map(name => callback_map[name] || name); +}; + +// Function to map internal names to display names +export const mapInternalToDisplayNames = (internalNames: string[]): string[] => { + return internalNames.map(name => reverse_callback_map[name] || name); +}; + // Utility functions for easy access export const getCallbackById = (id: string): CallbackConfig | undefined => { return CALLBACK_CONFIGS.find(callback => callback.id === id);