MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / resolveModelDownloadProxyUrl

Function resolveModelDownloadProxyUrl

apps/desktop/main/network/proxy.ts:292–310  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

290}
291
292export async function resolveModelDownloadProxyUrl(): Promise<string | undefined> {
293 const config = loadProxyConfig()
294
295 if (config.mode === 'manual' && config.url) {
296 const validation = validateProxyUrl(config.url)
297 if (validation.valid) return config.url
298 }
299
300 if (config.mode !== 'system') return undefined
301
302 try {
303 await waitForPendingProxyApply()
304 const resolvedProxy = await session.defaultSession.resolveProxy('https://huggingface.co/')
305 return proxyUrlFromElectronResolvedProxy(resolvedProxy)
306 } catch (error) {
307 console.warn('[Proxy] Failed to resolve system proxy for model downloads:', error)
308 return undefined
309 }
310}
311
312/**
313 * 初始化代理模块

Callers

nothing calls this directly

Calls 5

loadProxyConfigFunction · 0.85
validateProxyUrlFunction · 0.85
waitForPendingProxyApplyFunction · 0.85
warnMethod · 0.65

Tested by

no test coverage detected