share-copilot/readme/codeTipsProxy.md
luyoyu dcef8e11c3
update readme/codeTipsProxy.md.
Signed-off-by: luyoyu <8829470+chuangxxt@user.noreply.gitee.com>
2023-09-20 17:52:47 +00:00

75 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 代码提示代理说明
**-以windows为例**
## **vscode**
#### 1.修改文件:**
`%userprofile%\.vscode\extensions\github.copilot-xxxx\dist\extension.js`
```js
//extension.js头部添加环境变量 127.0.0.1改为你自己的接口
process.env.completionsUrl="http://127.0.0.1";
process.env.telemetryUrl="http://127.0.0.1/telemetry";
```
**1.1.搜索extension.js全文搜索替换两个接口替换为上方定义的环境变量注意引号一起搜索替换
你也可以不定义环境变量直接搜索后替换成自己的url**
```js
"https://copilot-proxy.githubusercontent.com"
替换为process.env.completionsUrl
这个是代码提示接口
"https://copilot-telemetry.githubusercontent.com/telemetry"
替换为 process.env.completionsUrl
这个应该是copilot把你代码上传拿去深度学习的,直接改成null好像也不影响使用
```
**1.2.也可以使用[脚本](https://gitee.com/chuangxxt/share-copilot/releases/download/v1.0.4/vscode%E4%B8%80%E9%94%AE%E9%85%8D%E7%BD%AE%E8%84%9A%E6%9C%AC.bat)一键修改需要将extension.js原来增加的内容删掉再配置脚本一键修改**
将127.0.0.1改为自己的Api url
GITHUB_TOKEN改为代理服务器中间件验证内容
```bash
@echo off
setlocal
:: ghu代理
set "GITHUB_TOKEN=123456"
set "GITHUB_API_URL=http://127.0.0.1"
:: 代码提示代理
set "completionsUrl=http://127.0.0.1"
set "telemetryUrl=http://127.0.0.1/telemetry"
set "CODESPACES=true"
set "GITHUB_SERVER_URL=https://github.com"
...略...
```
#### 2.测试
全部接口代理后是走一个ip了虽然不知道有没有意义
如果你是贩子,甚至可以搞点有意思的东西
![输入图片说明](ceshi.gif)
## **jetbrains**
代理服务器是支持的,插件我不会改,等个有缘人
我修改了插件里面js文件里面的接口改为自己的然后重新构建成exe
打包后有问题,可以运行,代理联网等都正常
但是代码提示无法在ide里面显示
目前找不到原因不懂node.js
![](https://foruda.gitee.com/images/1695118855841319485/b2c3c89e_8829470.png)