🐛 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:
MyPrototypeWhat
2025-11-05 17:29:45 +08:00
parent 8af1b91905
commit 4eb1787dec
3 changed files with 11 additions and 4 deletions

View File

@@ -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.

View File

@@ -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)

View File

@@ -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: {