Giter Club home page Giter Club logo

Comments (19)

AlexGreason avatar AlexGreason commented on April 20, 2024 6

Seconding this. I do wonder if it might be possible to pull some hostsfile trickery with the existing intellij plugin to redirect requests to the local inference server instead.

from fauxpilot.

moyix avatar moyix commented on April 20, 2024 5

You may want to dig into the code of the Copilot IntelliJ plugin to see if they have a similar debug setting to debug.overrideProxyUrl and debug.overrideEngine in the VSCode plugin? But yes, would also be great to have our own customizable IntelliJ plugin for FauxPilot as well :)

from fauxpilot.

wanyukang avatar wanyukang commented on April 20, 2024 3

One more thing, when checking whether the versions of IDEA and Github Copilot are affected, I updated Github Copilot to the latest version 1.4.4.3955. Then I read the code of agent.js and found that debug.overrideProxyUrl already supports setting in environment variables. πŸ˜ƒ (Search setOverridesFromEnvironment() to view the definition of the function)

Currently, there are only 3 supported parameters ["DebugOverrideEngine", "DebugOverrideProxyUrl", "DebugOverrideCapiUrl"]. For example, if you want to set debug.overrideProxyUrl, just set AGENT_DEBUG_OVERRIDE_PROXY_URL in the environment variable.

Combined with the solution proposed by @vibin to use agent.js to run the plug-in, theoretically, we can specify in JetBrains all the advanced parameter settings configurable in VSCode.

from fauxpilot.

heurainbow avatar heurainbow commented on April 20, 2024 1

anyone worked on Intellij plugin successfully?

from fauxpilot.

wanyukang avatar wanyukang commented on April 20, 2024 1

hi @vibin , I'm glad to see the solution you proposed.

I tried it locally. After I performed the second step (renaming the binary agent file in the /bin directory) and before performing the third step, I tried to start the IDE to verify the Copilot plug-in. When executing the agent.js file, I found that the status of the Copilot plug-in was abnormal, showing "not signed in to github". This seems inconsistent with what is stated in your scenario.

Step 2 is required, since the IntelliJ plugin uses agent.js only when it cannot find the binaries.

I am currently using IDEA version 21.3.3 and the GitHub Copilot plug-in version 1.2.9.2684. I am not sure whether this is related to the IDE and plug-in version. Can I ask you whether this solution can still be used? It would be great if you could tell me your IDE version and plug-in version.​

I figured it out, it was a problem with the local nodeJS version.

Since I am maintaining an old nodeJS project, my local default node version is node8, so when I manually run node agent.js, an error will also be reported. When I switch to node16, node agent.js starts normally. So when I switch the system's default nodeJS version to 16, and then start IDEA, I can run the plugin using agent.js as expected.

from fauxpilot.

nashid avatar nashid commented on April 20, 2024

@moyix are you aware of any opensource implementation that we could use to build the Intellij plugin for fauxpilot?

from fauxpilot.

nashid avatar nashid commented on April 20, 2024

@Xelef2000 I know you have suggested for vscode plugin https://github.com/hieunc229/copilot-clone.

Are you aware of anything equivalent for Intellij plugin?

from fauxpilot.

thakkarparth007 avatar thakkarparth007 commented on April 20, 2024

I took a quick look at the plugin code -- the code does seem to look for debug.overrideProxyUrl and debug.overrideEngine variables in "advanced" configuration, just like vscode. Now, I am not an intellij user so I don't know how to get to such advanced/custom configuration UI, but based on these references, I'm assuming there exists one. If that's not the case, please reopen this.

Side note: Both intellij and neo-vim copilot plugins have a thin wrapper that effectively calls common JS code (the same as used by VSCode extension).


When/if you do find the place to set these variables, here are the typical values for them if you're using Fauxpilot with default settings:

debug.overrideProxyUrl should be set to http://localhost:5000
debug.overrideEngine should be set to codegen

from fauxpilot.

wanyukang avatar wanyukang commented on April 20, 2024

Has anyone found the overrideProxyUrl configuration on Intellij ?

from fauxpilot.

xjtu-blacksmith avatar xjtu-blacksmith commented on April 20, 2024

The advanced options appear in the Jetbrains' copilot plugin source code do not seem to work anywhere. Maybe it is just a residue from code project migration. Jetbrains IDE use something like XML for software settings, and Copilot plugin does not seem to offer interfaces for changing debug options in such config files.

from fauxpilot.

xjtu-blacksmith avatar xjtu-blacksmith commented on April 20, 2024

I took a quick look at the plugin code -- the code does seem to look for debug.overrideProxyUrl and debug.overrideEngine variables in "advanced" configuration, just like vscode. Now, I am not an intellij user so I don't know how to get to such advanced/custom configuration UI, but based on these references, I'm assuming there exists one. If that's not the case, please reopen this.

Side note: Both intellij and neo-vim copilot plugins have a thin wrapper that effectively calls common JS code (the same as used by VSCode extension).

When/if you do find the place to set these variables, here are the typical values for them if you're using Fauxpilot with default settings:

debug.overrideProxyUrl should be set to http://localhost:5000 debug.overrideEngine should be set to codegen

I've tried to replace agent.js in intellij copilot plugin according to #72, to replace all proxy address to local ones, but when I restart IDE I could still see from network probe that the plugin is connecting to GitHub copilot proxy server. I do not know how these program works, but it seems that intellj use compiled and packed executables, so these server address are hard-coded into the plugin and could not be replaced.

from fauxpilot.

vibin avatar vibin commented on April 20, 2024

While the IntelliJ plugin does use the same agent.js to fetch completions from /engines/copilot-codex, it doesn't support debug.overrideProxyUrl.

Yes, you can override system proxy directly in IntelliJ itself, but Copilot throws errors related to self-signed certificates.

As a last resort, I modified the plugin source code and got it working.

Steps to follow:

  1. Go to the plugin's folder. In my case (Mac, Android Studio), it's at: ~/Library/Application Support/Google/AndroidStudioPreview2023.1/plugins/github-copilot-intellij
  2. Rename the binaries under copilot-agent/bin folder. Just add some suffix to all the file names
  3. Open copilot-agent/agent.js in a text editor and make following changes:
    a. Replace "https://copilot-proxy.githubusercontent.com" with your localhost url
    b. Replace "https://copilot-telemetry.githubusercontent.com/telemetry" with your localhost url

Step 2 is required, since the IntelliJ plugin uses agent.js only when it cannot find the binaries.

from fauxpilot.

bananasmoothii avatar bananasmoothii commented on April 20, 2024

Hello @vibin, did you manage to get it working on the current version of PyCharm? it's currently 1 AM here and I've been trying everything from using an old version of the plugin to reading the source code of the plugin, without success...

from fauxpilot.

vibin avatar vibin commented on April 20, 2024

@bananasmoothii the approach which I mentioned should work for all Jetbrains IDEs - I don't think Pycharm is any different.

I have tested in the following IDEs: IntelliJ Ultimate, IntelliJ Community, Android Studio, WebStorm

from fauxpilot.

bananasmoothii avatar bananasmoothii commented on April 20, 2024

When I wrote this, I was getting 404 errors but I then found out that it was because the sent prompt was too long, now I have issues where it sometimes takes 3 minutes to respond, although sometimes it takes less than a second. Then I have issues where the server apparently doesn't produce valid JSON, and when looking at the data I had a response with multiple data: ... and one data: [STOP] (it may not be "stop", I don't recall)
This is too unreliable, so instead I now just have a small python script using the openai api and I copy paste code around.

from fauxpilot.

wanyukang avatar wanyukang commented on April 20, 2024

hi @vibin , I'm glad to see the solution you proposed.

I tried it locally. After I performed the second step (renaming the binary agent file in the /bin directory) and before performing the third step, I tried to start the IDE to verify the Copilot plug-in. When executing the agent.js file, I found that the status of the Copilot plug-in was abnormal, showing "not signed in to github". This seems inconsistent with what is stated in your scenario.

Step 2 is required, since the IntelliJ plugin uses agent.js only when it cannot find the binaries.

I am currently using IDEA version 21.3.3 and the GitHub Copilot plug-in version 1.2.9.2684. I am not sure whether this is related to the IDE and plug-in version. Can I ask you whether this solution can still be used? It would be great if you could tell me your IDE version and plug-in version.
​

from fauxpilot.

vibin avatar vibin commented on April 20, 2024

hi @vibin , I'm glad to see the solution you proposed.

I tried it locally. After I performed the second step (renaming the binary agent file in the /bin directory) and before performing the third step, I tried to start the IDE to verify the Copilot plug-in. When executing the agent.js file, I found that the status of the Copilot plug-in was abnormal, showing "not signed in to github". This seems inconsistent with what is stated in your scenario.

Step 2 is required, since the IntelliJ plugin uses agent.js only when it cannot find the binaries.

I am currently using IDEA version 21.3.3 and the GitHub Copilot plug-in version 1.2.9.2684. I am not sure whether this is related to the IDE and plug-in version. Can I ask you whether this solution can still be used? It would be great if you could tell me your IDE version and plug-in version.​

@wanyukang Yes, we use this solution in our org. It's tested and working for ~200 developers (IntelliJ, Android Studio)

Have you tried signing into Github with the binary agent flow disabled?

Regarding versions, I think anything latest or near to latest should be fine. For example, try copilot-intellij/1.4.3.3913 and JetBrains-IU/232.10227.8. IntelliJ 21.3.3 is 2 years old, so that could be an issue...

from fauxpilot.

wanyukang avatar wanyukang commented on April 20, 2024

@vibin Thanks for your quick reply. I did try to log into GitHub after disabling the binary, but instead of showing the login window, the plugin threw an error saying "GitHub Copilot: Failed to initiate the GitHub login process. Please try again." I plan to try upgrading my version of IDEA and the version of the GitHub Copilot plugin to see if this is the problem.

from fauxpilot.

vibin avatar vibin commented on April 20, 2024

hi @vibin , I'm glad to see the solution you proposed.

I tried it locally. After I performed the second step (renaming the binary agent file in the /bin directory) and before performing the third step, I tried to start the IDE to verify the Copilot plug-in. When executing the agent.js file, I found that the status of the Copilot plug-in was abnormal, showing "not signed in to github". This seems inconsistent with what is stated in your scenario.

Step 2 is required, since the IntelliJ plugin uses agent.js only when it cannot find the binaries.

I am currently using IDEA version 21.3.3 and the GitHub Copilot plug-in version 1.2.9.2684. I am not sure whether this is related to the IDE and plug-in version. Can I ask you whether this solution can still be used? It would be great if you could tell me your IDE version and plug-in version.​

I figured it out, it was a problem with the local nodeJS version.

Since I am maintaining an old nodeJS project, my local default node version is node8, so when I manually run node agent.js, an error will also be reported. When I switch to node16, node agent.js starts normally. So when I switch the system's default nodeJS version to 16, and then start IDEA, I can run the plugin using agent.js as expected.

@wanyukang Good catch! Yes, most of our developers are on Node16 (we wrote a shell script which installs Node16 if it is not present on the system, before making changes to the plugin).

from fauxpilot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.