fix: address web seam review findings

This commit is contained in:
Tianyi Cui
2026-07-01 17:08:53 +08:00
parent 29ce2df315
commit cf71c0b215
9 changed files with 64 additions and 14 deletions

View File

@@ -147,6 +147,7 @@ export class DeepSeekSearchProvider implements WebSearchProvider {
status(): WebProviderStatus {
if (this.options.apiKey.length === 0) return { available: false, reason: 'missing-credential' }
if (!URL.canParse(this.options.baseURL)) return { available: false, reason: 'misconfigured' }
if (!isPositiveInteger(this.options.maxTokens) || !isPositiveInteger(this.options.maxUses)) return { available: false, reason: 'misconfigured' }
return { available: true }
}
@@ -215,3 +216,8 @@ export class DeepSeekSearchProvider implements WebSearchProvider {
function isAbortError(error: unknown): boolean {
return error instanceof DOMException && error.name === 'AbortError'
}
/** True for DeepSeek request limits that can be sent to the Messages API. */
function isPositiveInteger(value: number): boolean {
return Number.isInteger(value) && value > 0
}