Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: axios set proxy https agent, timeout tip #10853

Merged
merged 5 commits into from
Apr 6, 2023

Conversation

xyuanbuilds
Copy link
Member

  1. 使用命令行代理时会配置 http_proxy 环境变量,axios需额外传递 httpsAgent 否则无法获取请求结果https://github.com/axios/axios/issues/2072#issuecomment-567473812
  2. 超时提示使用代理服务器,而非直接请求openai
    eg

@vercel
Copy link

vercel bot commented Mar 26, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
umi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 4, 2023 3:01am

@codecov
Copy link

codecov bot commented Mar 26, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.09 ⚠️

Comparison is base (972b155) 29.35% compared to head (38d6826) 29.27%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10853      +/-   ##
==========================================
- Coverage   29.35%   29.27%   -0.09%     
==========================================
  Files         472      478       +6     
  Lines       14276    14316      +40     
  Branches     3360     3367       +7     
==========================================
  Hits         4191     4191              
- Misses       9368     9404      +36     
- Partials      717      721       +4     
Impacted Files Coverage Δ
copilot/src/chatgpt.ts 0.00% <0.00%> (ø)
copilot/src/cli.ts 0.00% <0.00%> (ø)
copilot/src/prompts/build.ts 0.00% <0.00%> (ø)
copilot/src/prompts/commands.ts 0.00% <0.00%> (ø)
copilot/src/prompts/config.ts 0.00% <0.00%> (ø)
copilot/src/prompts/dev.ts 0.00% <0.00%> (ø)
copilot/src/prompts/generate.ts 0.00% <0.00%> (ø)
copilot/src/prompts/index.ts 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@xyuanbuilds xyuanbuilds linked an issue Mar 26, 2023 that may be closed by this pull request
3 tasks
@xyuanbuilds xyuanbuilds removed a link to an issue Mar 26, 2023
3 tasks
@xyuanbuilds xyuanbuilds mentioned this pull request Mar 26, 2023
3 tasks
copilot/package.json Outdated Show resolved Hide resolved
copilot/package.json Outdated Show resolved Hide resolved
copilot/src/chatgpt.ts Outdated Show resolved Hide resolved
@@ -177,7 +177,8 @@ Object.keys(exported).forEach(function (key) {
code.includes('"node:') &&
opts.pkgName && // skip local file bundle like babel/bundle.js
opts.pkgName !== 'stylelint-declaration-block-no-ignored-properties' &&
opts.pkgName !== 'vite'
opts.pkgName !== 'vite' &&
opts.pkgName !== 'https-proxy-agent'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以加到上面 replace node: 前缀的逻辑里。

Copy link
Member Author

@xyuanbuilds xyuanbuilds Mar 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace之后还是会报错,文件中也没有node:的引入,具体原因不明,不太懂是不是因为 /// <reference types="node" />

@sorrycc
Copy link
Member

sorrycc commented Mar 28, 2023

image

确定需要吗?axios 会自动识别 https_proxy 和 http_proxy 代理的吧。 https://github.com/axios/axios

@xyuanbuilds
Copy link
Member Author

image 确定需要吗?axios 会自动识别 https_proxy 和 http_proxy 代理的吧。 https://github.com/axios/axios

没有自动识别呢,不传递httpsAgent请求不可用

@sorrycc
Copy link
Member

sorrycc commented Apr 4, 2023

冲突了,merge 下 master,记得升 pnpm 到 8 。

@xyuanbuilds
Copy link
Member Author

冲突了,merge 下 master,记得升 pnpm 到 8 。

已合并,修改了符合 pnpm 8 的lock

@sorrycc sorrycc merged commit aa16d22 into umijs:master Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants