mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-20 23:22:05 +08:00
- Added provider API host formatting utilities to handle differences between Cherry Studio and AI SDK. - Introduced functions for formatting provider API hosts, including support for Azure OpenAI and Vertex AI. - Created a simple API key rotator for managing API key rotation. - Developed shared provider initialization and mapping utilities for resolving provider IDs. - Implemented AI SDK configuration utilities for converting Cherry Studio providers to AI SDK configurations. - Added support for various providers including OpenRouter, Google Vertex AI, and Amazon Bedrock. - Enhanced error handling and logging in the unified messages service for better debugging. - Introduced functions for streaming and generating unified messages using AI SDK.
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
/**
|
|
* Shared Provider Utilities
|
|
*
|
|
* This module exports utilities for working with AI providers
|
|
* that can be shared between main process and renderer process.
|
|
*/
|
|
|
|
// Type definitions
|
|
export type { MinimalProvider, ProviderType, SystemProviderId } from './types'
|
|
export { SystemProviderIds } from './types'
|
|
|
|
// Provider type detection
|
|
export {
|
|
isAIGatewayProvider,
|
|
isAnthropicProvider,
|
|
isAwsBedrockProvider,
|
|
isAzureOpenAIProvider,
|
|
isAzureResponsesEndpoint,
|
|
isCherryAIProvider,
|
|
isGeminiProvider,
|
|
isNewApiProvider,
|
|
isOpenAICompatibleProvider,
|
|
isOpenAIProvider,
|
|
isPerplexityProvider,
|
|
isVertexProvider
|
|
} from './detection'
|
|
|
|
// API host formatting
|
|
export type { ApiKeyRotator, ProviderFormatContext } from './format'
|
|
export {
|
|
defaultFormatAzureOpenAIApiHost,
|
|
formatProviderApiHost,
|
|
getBaseUrlForAiSdk,
|
|
simpleKeyRotator
|
|
} from './format'
|
|
|
|
// Provider ID mapping
|
|
export { getAiSdkProviderId, STATIC_PROVIDER_MAPPING, tryResolveProviderId } from './mapping'
|
|
|
|
// AI SDK configuration
|
|
export type { AiSdkConfig, AiSdkConfigContext } from './sdk-config'
|
|
export { providerToAiSdkConfig } from './sdk-config'
|
|
|
|
// Provider resolution
|
|
export { resolveActualProvider } from './resolve'
|
|
|
|
// Provider initialization
|
|
export { initializeSharedProviders, SHARED_PROVIDER_CONFIGS } from './initialization'
|