mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-28 05:11:24 +08:00
chore: bump @cherrystudio/ai-core version to 1.0.0-alpha.5
- Updated version in package.json to 1.0.0-alpha.5. - Enhanced provider configuration validation in createProvider function for improved error handling.
This commit is contained in:
parent
69e87ce21a
commit
ef6be4a6f9
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cherrystudio/ai-core",
|
||||
"version": "1.0.0-alpha.4",
|
||||
"version": "1.0.0-alpha.5",
|
||||
"description": "Cherry Studio AI Core - Unified AI Provider Interface Based on Vercel AI SDK",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.mjs",
|
||||
|
||||
@ -24,13 +24,15 @@ export class ProviderCreationError extends Error {
|
||||
export async function createProvider(config: ProviderConfig, options: any): Promise<any> {
|
||||
try {
|
||||
// 验证配置
|
||||
if (!config.creator && !(config.import && config.creatorFunctionName)) {
|
||||
if (!validateProviderConfig(config)) {
|
||||
throw new ProviderCreationError(
|
||||
'Invalid provider configuration: must provide either creator function or import configuration',
|
||||
config.id
|
||||
)
|
||||
}
|
||||
|
||||
config.validateOptions?.(options)
|
||||
|
||||
// 方式一:直接使用 creator 函数
|
||||
if (config.creator) {
|
||||
return config.creator(options)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user