mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-03 02:59:07 +08:00
fix: Change unsupported provider error to return undefined (#10257)
Change unsupported provider error to return undefined Replace thrown error with empty object return and update function signature to allow undefined return type for unsupported providers
This commit is contained in:
parent
a8cd2e2eac
commit
5d8e706c0b
@ -44,7 +44,7 @@ function mapMaxResultToOpenAIContextSize(maxResults: number): OpenAISearchConfig
|
||||
export function buildProviderBuiltinWebSearchConfig(
|
||||
providerId: BaseProviderId,
|
||||
webSearchConfig: CherryWebSearchConfig
|
||||
): WebSearchPluginConfig {
|
||||
): WebSearchPluginConfig | undefined {
|
||||
switch (providerId) {
|
||||
case 'openai': {
|
||||
return {
|
||||
@ -99,7 +99,7 @@ export function buildProviderBuiltinWebSearchConfig(
|
||||
}
|
||||
}
|
||||
default: {
|
||||
throw new Error(`Unsupported provider: ${providerId}`)
|
||||
return {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user