fix(provider): config error

This commit is contained in:
suyao 2025-07-07 04:33:37 +08:00
parent 448b5b5c9e
commit 4b0d8d7e65
No known key found for this signature in database
2 changed files with 18 additions and 2 deletions

View File

@ -130,6 +130,9 @@ export class ProviderConfigBuilder<T extends ProviderId = ProviderId> {
}
if (options.location) {
googleConfig.location = options.location
if (options.location === 'global') {
googleConfig.baseURL = 'https://aiplatform.googleapis.com'
}
}
}
return this

View File

@ -47,7 +47,11 @@ function providerToAiSdkConfig(provider: Provider): {
actualProvider = createVertexProvider(provider)
}
if (actualProvider.type === 'openai' || actualProvider.type === 'anthropic') {
if (
actualProvider.type === 'openai' ||
actualProvider.type === 'anthropic' ||
actualProvider.type === 'openai-response'
) {
actualProvider.apiHost = formatApiHost(actualProvider.apiHost)
}
@ -62,7 +66,16 @@ function providerToAiSdkConfig(provider: Provider): {
: undefined
if (AiCore.isSupported(aiSdkProviderId) && aiSdkProviderId !== 'openai-compatible') {
const options = ProviderConfigFactory.fromProvider(aiSdkProviderId, actualProvider, openaiResponseOptions)
const options = ProviderConfigFactory.fromProvider(
aiSdkProviderId,
{
baseURL: actualProvider.apiHost,
apiKey: actualProvider.apiKey,
headers: actualProvider.extra_headers
},
openaiResponseOptions
)
return {
providerId: aiSdkProviderId as ProviderId,
options