cherry-studio/packages/aiCore/src/index.ts
MyPrototypeWhat d10ba04047 refactor(aiCore): streamline type exports and enhance provider registration
Removed unused type exports from the aiCore module and consolidated type definitions for better clarity. Updated provider registration tests to reflect new configurations and improved error handling for non-existent providers. Enhanced the overall structure of the provider management system, ensuring better type safety and consistency across the codebase.
2025-08-28 15:28:44 +08:00

47 lines
1.6 KiB
TypeScript

/**
* Cherry Studio AI Core Package
* 基于 Vercel AI SDK 的统一 AI Provider 接口
*/
// 导入内部使用的类和函数
// ==================== 主要用户接口 ====================
export {
createExecutor,
createOpenAICompatibleExecutor,
generateImage,
generateObject,
generateText,
streamText
} from './core/runtime'
// ==================== 高级API ====================
export { globalModelResolver as modelResolver } from './core/models'
// ==================== 插件系统 ====================
export type { AiPlugin, AiRequestContext, HookResult, PluginManagerConfig } from './core/plugins'
export { createContext, definePlugin, PluginManager } from './core/plugins'
// export { createPromptToolUsePlugin, webSearchPlugin } from './core/plugins/built-in'
export { PluginEngine } from './core/runtime/pluginEngine'
// ==================== AI SDK 常用类型导出 ====================
// 直接导出 AI SDK 的常用类型,方便使用
export type { LanguageModelV2Middleware, LanguageModelV2StreamPart } from '@ai-sdk/provider'
export type { ToolCall } from '@ai-sdk/provider-utils'
export type { ReasoningPart } from '@ai-sdk/provider-utils'
// ==================== 选项 ====================
export {
createAnthropicOptions,
createGoogleOptions,
createOpenAIOptions,
type ExtractProviderOptions,
mergeProviderOptions,
type ProviderOptionsMap,
type TypedProviderOptions
} from './core/options'
// ==================== 包信息 ====================
export const AI_CORE_VERSION = '1.0.0'
export const AI_CORE_NAME = '@cherrystudio/ai-core'