Files
goodbuddy/src/shared/deepseek-harness-compatibility.ts
T
mesalogo 7c6f15d3c0 fix: allow HTTP for configurable service endpoints
DeepSeek Harness and Weixin binding configuration rejected non-loopback HTTP endpoints even when users explicitly selected those internal services. Configurable endpoints now accept valid HTTP and HTTPS URLs without host-location restrictions, while retaining the required protocol and API-key checks.

Release note: 模型连接、DeepSeek Harness 与微信绑定现在可直接使用局域网或公网 HTTP/HTTPS 服务地址,不再强制公网 HTTPS 或本机回环地址。
2026-08-30 16:49:47 +08:00

30 lines
640 B
TypeScript

type DeepSeekHarnessModelProfile = {
baseUrl: string
protocol: string
authentication: string
}
export function isDeepSeekHarnessCompatibleBaseUrl(
value: string
): boolean {
try {
const url = new URL(value)
return (
Boolean(url.hostname) &&
(url.protocol === 'http:' || url.protocol === 'https:')
)
} catch {
return false
}
}
export function isDeepSeekHarnessModelProfile(
profile: DeepSeekHarnessModelProfile
): boolean {
return (
profile.protocol === 'openai-chat-completions' &&
profile.authentication === 'api-key' &&
isDeepSeekHarnessCompatibleBaseUrl(profile.baseUrl)
)
}