mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-28 05:11:24 +08:00
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:
parent
42bfa281a7
commit
8863e10df1
@ -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'
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user