feat: add HTTP/HTTPS/SOCKS5 proxy supportFeat/proxy support 添加HTTP/HTTPS/SOCKS5代理支持#162
Open
kiangz wants to merge 3 commits into
Open
feat: add HTTP/HTTPS/SOCKS5 proxy supportFeat/proxy support 添加HTTP/HTTPS/SOCKS5代理支持#162kiangz wants to merge 3 commits into
kiangz wants to merge 3 commits into
Conversation
- Add src/common/proxy.ts: resolve proxy from env vars (HTTP_PROXY, HTTPS_PROXY, SOCKS_PROXY, NO_PROXY) and settings.json env field - Integrate undici ProxyAgent into OpenAI client (openai-client.ts) - Route telemetry and web-search requests through proxyFetch - Support DEEPCODE_HTTPS_PROXY prefixed env vars - NO_PROXY matching: exact host, subdomain wildcard, and * bypass - Priority: user settings < project settings < system env vars - Update configuration docs (zh + en) with proxy section
- 28 test cases covering resolveProxyUrl, getProxyDispatcher, proxyFetch - System env: HTTPS_PROXY, HTTP_PROXY, SOCKS_PROXY, SOCKS5_PROXY - DEEPCODE_ prefixed vars, lowercase fallback - settings.json: user-level and project-level env config - Priority: user < project < system - NO_PROXY: exact match, wildcard *, subdomain (.example.com) - Dispatcher caching verification - proxyFetch fallback to global fetch and dispatcher injection
9a1bc9c to
c170d78
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add comprehensive proxy support for all network requests (OpenAI API, telemetry, web search).
Changes
New
src/common/proxy.ts: Proxy resolution module with support for:HTTPS_PROXY,HTTP_PROXY,SOCKS_PROXY,SOCKS5_PROXYenvironment variablesNO_PROXYbypass with wildcard (*), exact match, and subdomain wildcard (.example.com)DEEPCODE_prefixed environment variables~/.deepcode/settings.jsonenvfieldProxyAgenton every requestsrc/common/openai-client.ts: IntegrateProxyAgentinto OpenAI clientsrc/common/telemetry.ts: Route telemetry throughproxyFetchsrc/tools/web-search-handler.ts: Route web search throughproxyFetchdocs/configuration.md/docs/configuration_en.md: Add proxy configuration docs (zh + en)src/tests/proxy.test.ts: 28 unit tests covering all proxy scenariosCompatibility
$env:HTTPS_PROXY = "http://..."export HTTPS_PROXY=http://...{"env": {"HTTPS_PROXY": "http://..."}}摘要
为所有网络请求添加全面的代理支持(OpenAI API、遥测、网络搜索)。
更改
src/common/proxy.ts:代理解析模块,支持:HTTPS_PROXY、HTTP_PROXY、SOCKS_PROXY和SOCKS5_PROXY环境变量src/common/openai-client.ts:将ProxyAgent集成到openai客户端中src/common/ttelemetry.ts:通过proxyFetch路由遥测src/tools/web-search-handler.ts:通过proxyFetch路由web搜索docs/configuration.md/docs/configuration _en.md:添加代理配置文档(中文+英文)src/tests/proxy.test.ts:28个单元测试,涵盖所有代理场景兼容性
$env:HTTPS_PROXY = "http://..."export HTTPS_PROXY=http://...{"env": {"HTTPS_PROXY": "http://..."}}