mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-28 05:11:24 +08:00
fix: conditionally enable reasoning middleware for OpenAI and Azure providers
- Added a check to enable the 'thinking-tag-extraction' middleware only if reasoning is enabled in the configuration for OpenAI and Azure providers. - Commented out the provider type check in `getAiSdkProviderId` to prevent issues with retrieving provider options.
This commit is contained in:
parent
786bc8dca9
commit
61e3309cd2
@ -146,11 +146,13 @@ function addProviderSpecificMiddlewares(builder: AiSdkMiddlewareBuilder, config:
|
||||
break
|
||||
case 'openai':
|
||||
case 'azure-openai': {
|
||||
const tagName = config.model?.id.includes('gemini') ? tagNameArray[1] : tagNameArray[0]
|
||||
builder.add({
|
||||
name: 'thinking-tag-extraction',
|
||||
middleware: extractReasoningMiddleware({ tagName })
|
||||
})
|
||||
if (config.enableReasoning) {
|
||||
const tagName = config.model?.id.includes('gemini') ? tagNameArray[1] : tagNameArray[0]
|
||||
builder.add({
|
||||
name: 'thinking-tag-extraction',
|
||||
middleware: extractReasoningMiddleware({ tagName })
|
||||
})
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'gemini':
|
||||
|
||||
@ -26,9 +26,10 @@ 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
|
||||
}
|
||||
// 先注释掉,会影响获取providerOptions
|
||||
// if (AiCore.isSupported(provider.type)) {
|
||||
// return provider.type as ProviderId
|
||||
// }
|
||||
|
||||
return provider.id as ProviderId
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user