|
|
|
@ -15,16 +15,16 @@ class OpenAiClient |
|
|
|
$defaultPlatform = config('openai.default'); |
|
|
|
$platform = config('openai.platforms.' . $defaultPlatform, []); |
|
|
|
if (empty($platform)) { |
|
|
|
throw new ApiException("默认的AI平台: {$defaultPlatform} 未配置", '', '', []); |
|
|
|
throw new ApiException("默认的AI平台: {$defaultPlatform} 未配置"); |
|
|
|
} |
|
|
|
if (empty($platform['base_url'])) { |
|
|
|
throw new ApiException("默认的AI平台: {$defaultPlatform} 未配置base_url", '', '', []); |
|
|
|
throw new ApiException("默认的AI平台: {$defaultPlatform} 未配置base_url"); |
|
|
|
} |
|
|
|
if (empty($platform['api_key'])) { |
|
|
|
throw new ApiException("默认的AI平台: {$defaultPlatform} 未配置api_key", '', '', []); |
|
|
|
throw new ApiException("默认的AI平台: {$defaultPlatform} 未配置api_key"); |
|
|
|
} |
|
|
|
if (empty($platform['model'])) { |
|
|
|
throw new ApiException("默认的AI平台: {$defaultPlatform} 未配置model", '', '', []); |
|
|
|
throw new ApiException("默认的AI平台: {$defaultPlatform} 未配置model"); |
|
|
|
} |
|
|
|
return $platform; |
|
|
|
} |
|
|
|
|