一句话让augment为我花了78次llm请求

问题是:
这是vscode copilot插件的代码,我抓包注意到插件发送llm请求的url是https://api.individual.githubcopilot.com/chat/completions但是我在这个源码了并没有搜索到它,api.individual.githubcopilot.com也没搜索到,我的目的是找到他然后把ur替换成http://127.0.0.1:6060/v1/chat/completions

对比了augment和cursor发现augment是真能跑啊,跑了十几分钟总过78个 :rofl:看得我心疼

cursor那边总共花了8次请求

结果上虽然不愿意承认但是cursor的更实用,cursor直接给了两个解决方法,一个是修改json配置一个是修改某个变量成硬编码

augment那边直接把js混淆逻辑捋清楚了:

根据我发现的代码,可以查看extension.js文件中的域名服务实现。我将提取相关部分:
var xEt="github-enterprise.uri",aI=class extends Ae{constructor(t,o){super();this._configurationService=t;this._tokenStore=o;this._onDidChangeDomains=this._register(new nt);this.onDidChangeDomains=this._onDidChangeDomains.event;this._telemetryBaseUrl="https://copilot-telemetry.githubusercontent.com";this._originTrackerUrl="https://origin-tracker.githubusercontent.com";this._register(this._configurationService.onDidChangeConfiguration(n=>this._onDidConfigChangeHandler(n))),this._dotcomAPIUrl=this._getDotComAPIUrl(),this._proxyBaseUrl=this._getProxyUrl(this._tokenStore.copilotToken),this._capiBaseUrl=this._getCAPIUrl(this._tokenStore.copilotToken),this._processCopilotToken(this._tokenStore.copilotToken),this._register(this._tokenStore.onDidStoreUpdate(()=>this._processCopilotToken(this._tokenStore.copilotToken)))}
该域名服务通过aI类实现,管理GitHub Copilot服务的多个URL配置。核心功能是处理GitHub企业版URI配置:

以下是GitHub.com API URL的获取逻辑:
_getDotComAPIUrl(){let t=this._configurationService.getNonExtensionConfig(xEt),o=this._configurationService.getConfig(oe.Shared.AuthProvider)==="github-enterprise";if(t&&o){let n=Ce.parse(t);return${n.scheme}://api.${n.authority}}return"https://api.github.com"}
该服务还处理其他URL配置:
_getCAPIUrl(t){let o=this._configurationService.getConfig(oe.Shared.DebugOverrideCAPIUrl);return o.endsWith("/")&&(o=o.slice(0,-1)),t?o==="https://api.githubcopilot.com"?t.endpoints.api:o:"https://api.githubcopilot.com"}

_getProxyUrl(t){let o=this._configurationService.getConfig(oe.Shared.DebugOverrideProxyUrl);return o?(o=o.replace(///,""),o):t?t.endpoints.proxy:aI.DEFAULT_PROXY_BASE_URL}
提供的端点URL包括:
get proxyBaseURL(){return this._proxyBaseUrl}
get capiBaseURL(){return this._capiBaseUrl}
get capiChatURL(){return`{this._capiBaseUrl}/chat/completions} get capiEmbeddingsURL(){return{this._capiBaseUrl}/embeddings`}
get capiModelsURL(){return`{this._capiBaseUrl}/models} get chunksURL(){return{this.dotComAPIURL}/chunks`}
get embeddingsCodeSearchURL(){return`{this.dotComAPIURL}/embeddings/code/search} get telemetryURL(){return{this._telemetryBaseUrl}/telemetry`}
get remoteAgentsURL(){return`{this._capiBaseUrl}/agents} get listSkillsURL(){return{this._capiBaseUrl}/skills`}
get searchSkillURL(){return`{this._capiBaseUrl}/search} get contentExclusionURL(){return{this._dotcomAPIUrl}/copilot_internal/content_exclusion`}
get tokenURL(){return this._dotcomAPIUrl+"/copilot_internal/v2/token"}
get dotComAPIURL(){return this._dotcomAPIUrl}
get originTrackerURL(){return this._originTrackerUrl}
当配置发生变化时,域名服务会触发更新:
_onDidConfigChangeHandler(t){if(t.affectsConfiguration(`{Sm}.advanced`)||t.affectsConfiguration(xEt)){let o=this._getDotComAPIUrl(),n=this._getCAPIUrl(this._tokenStore.copilotToken),s=this._getProxyUrl(this._tokenStore.copilotToken),A=this._dotcomAPIUrl!==o,a=this._capiBaseUrl!==n,c=this._proxyBaseUrl!==s;this._dotcomAPIUrl=o,this._capiBaseUrl=n,this._proxyBaseUrl=s,this._onDidChangeDomains.fire({capiUrlChanged:a,proxyUrlChanged:c,telemeryUrlChanged:!1,dotcomUrlChanged:A})}}
Copilot令牌处理逻辑:
_processCopilotToken(t){let o=this._capiBaseUrl,n=this._telemetryBaseUrl,s=this._proxyBaseUrl;t?(this._proxyBaseUrl=this._getProxyUrl(t),this._capiBaseUrl=this._getCAPIUrl(t),this._telemetryBaseUrl=t.endpoints.telemetry,t.endpoints["origin-tracker"]&&(this._originTrackerUrl=t.endpoints["origin-tracker"])):(this._capiBaseUrl="https://api.githubcopilot.com",this._telemetryBaseUrl="https://copilot-telemetry.githubusercontent.com"),(o!==this._capiBaseUrl||n!==this._telemetryBaseUrl||s!==this._proxyBaseUrl)&&this._onDidChangeDomains.fire({capiUrlChanged:o!==this._capiBaseUrl,telemeryUrlChanged:n!==this._telemetryBaseUrl,proxyUrlChanged:s!==this._proxyBaseUrl,dotcomUrlChanged:!1})}
默认URL配置:
static{this.DEFAULT_PROXY_BASE_URL="https://copilot-proxy.githubusercontent.com"}
static{this.CAPI_MODEL_LAB_URL="https://api-model-lab.githubcopilot.com"}

augment90%以上的调用在grep查本地代码,相比下cursor的codebase确实高效

1 Like

github copliot直接修改vscode的json配置就行了
不需要修改插件的
参考

试过改 ```
overrideCAPIUrl

没用,然后我用这个项目的话自己的sonnet应用代码编辑会卡住不知道怎么回事

“debug.overrideCAPIUrl”:
“debug.overrideProxyUrl”:
“debug.chatOverrideProxyUrl”:
“debug.overrideFastRewriteEngine”: “v1/engines/copilot-centralus-h100”,
“debug.overrideFastRewriteUrl”:
都要改

这个是啥意思?codebase是什么意思呀

这个又是啥意思 不懂0.0

此话题已在最后回复的 30 天后被自动关闭。不再允许新回复。