🐛 fix: resolve cherryin provider lint errors and web search config
- Add fetch global variable declaration for ai-sdk-provider in oxlintrc - Fix endpoint_type mapping fallback logic in cherryin provider - Add error handling comment for better code readability
This commit is contained in:
@@ -53,6 +53,12 @@
|
||||
"node": true
|
||||
},
|
||||
"files": ["src/preload/**"]
|
||||
},
|
||||
{
|
||||
"files": ["packages/ai-sdk-provider/**"],
|
||||
"globals": {
|
||||
"fetch": "readonly"
|
||||
}
|
||||
}
|
||||
],
|
||||
// We don't use the React plugin here because its behavior differs slightly from that of ESLint's React plugin.
|
||||
|
||||
@@ -105,7 +105,9 @@ const createCustomFetch = (originalFetch?: any) => {
|
||||
delete body.tool_choice
|
||||
options.body = JSON.stringify(body)
|
||||
}
|
||||
} catch (error) {}
|
||||
} catch (error) {
|
||||
// ignore error
|
||||
}
|
||||
}
|
||||
|
||||
return originalFetch ? originalFetch(url, options) : fetch(url, options)
|
||||
|
||||
@@ -108,9 +108,8 @@ export function buildProviderBuiltinWebSearchConfig(
|
||||
}
|
||||
}
|
||||
case 'cherryin': {
|
||||
const _providerId = { 'openai-response': 'openai', openai: 'openai-chat' }[
|
||||
model?.endpoint_type ?? ''
|
||||
] as BaseProviderId
|
||||
const _providerId =
|
||||
{ 'openai-response': 'openai', openai: 'openai-chat' }[model?.endpoint_type ?? ''] ?? model?.endpoint_type
|
||||
return buildProviderBuiltinWebSearchConfig(_providerId, webSearchConfig, model)
|
||||
}
|
||||
default: {
|
||||
|
||||
Reference in New Issue
Block a user