fix: update provider identification logic in aiCore

- Refactored the provider identification in `index_new.ts` to use `actualProvider.type` instead of `actualProvider.id` for better clarity and accuracy in determining OpenAI response modes.
- Removed redundant type checks in `factory.ts` to streamline the provider ID retrieval process.
This commit is contained in:
suyao 2025-07-17 03:21:52 +08:00
parent 42bfa281a7
commit 8863e10df1
No known key found for this signature in database
2 changed files with 3 additions and 6 deletions

View File

@ -67,13 +67,13 @@ function providerToAiSdkConfig(actualProvider: Provider): {
const aiSdkProviderId = getAiSdkProviderId(actualProvider)
// console.log('aiSdkProviderId', aiSdkProviderId)
// 如果provider是openai则使用strict模式并且默认responses api
const actualProviderId = actualProvider.id
const actualProviderType = actualProvider.type
const openaiResponseOptions =
actualProviderId === 'openai'
actualProviderType === 'openai-response'
? {
mode: 'response'
}
: aiSdkProviderId === 'openai'
: actualProviderType === 'openai'
? {
mode: 'chat'
}

View File

@ -26,9 +26,6 @@ export function getAiSdkProviderId(provider: Provider): ProviderId | 'openai-com
if (AiCore.isSupported(provider.id)) {
return provider.id as ProviderId
}
if (AiCore.isSupported(provider.type)) {
return provider.type as ProviderId
}
return provider.id as ProviderId
}