JudiniLabs / code-gpt-docs

Docusaurus page
https://code-gpt-docs.vercel.app
MIT License
569 stars 59 forks source link

CodeGPT options appears blank in VSCode in devcontainers in WSL2 #234

Open arundeep78 opened 7 months ago

arundeep78 commented 7 months ago

I am usin CodeGPT Plus in VSCode inside WSL2. It works when the code is in WSL, but it does not work when I use a devcontainer inside WSL. Seems similar to #223 .

inside DevContainer image

Inside WSL

image

Extension version is 3.1.7 in both cases . It seems it fails to start the port 5112 for CodeGPT inside devcontainer.

VScode details Version: 1.86.2 (user setup) Commit: 903b1e9d8990623e3d7da1df3d33db3e42d80eda Date: 2024-02-13T19:40:56.878Z Electron: 27.2.3 ElectronBuildId: 26908389 Chromium: 118.0.5993.159 Node.js: 18.17.1 V8: 11.8.172.18-electron.0 OS: Windows_NT x64 10.0.22631

PilarHidalgo commented 7 months ago

Hello!, @arundeep78 , did you try update the version of CodeGPT 3.1.7 and of VSCode (higher to 1.85)?

arundeep78 commented 7 months ago

Hello!, @arundeep78 , did you try update the version of CodeGPT 3.1.7 and of VSCode (higher to 1.85)?

VScode is running at 1.86.2 and it says there is no further update available. CodeGOPT 3.1.7 seems to be the latest as well. Did I get your message wrong?

arundeep78 commented 7 months ago

it seems an update was released to the extension. The version is now 3.2.0. There is some change as I see a loading text. But it is stuck forever.

image

djacquensf9 commented 6 months ago

Same issue here on a remote connection to an ARM server via SSH. Version : 1.87.2 (user setup) Validation : 863d2581ecda6849923a2118d93a088b0745d9d6 Date : 2024-03-08T15:20:17.278Z Electron : 27.3.2 ElectronBuildId : 26836302 Chromium : 118.0.5993.159 Node.js : 18.17.1 V8 : 11.8.172.18-electron.0 Système d’exploitation : Windows_NT x64 10.0.22631 CodeGPT: v3.2.4

I am ready to do some test if necessary ;)

YesnielX commented 5 months ago

Same problem, any solution?

Versión: 1.88.1 Validation: e170252f762678dec6ca2cc69aba1570769a5d39 Date: 2024-04-10T17:34:12.840Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 SO: Linux x64 6.8.6-200.fc39.x86_64 (Fedora 39)

andraz commented 5 months ago

Same issue, stuck at Loading in a Dev Container:

Version: 1.88.1 (user setup) Commit: e170252f762678dec6ca2cc69aba1570769a5d39 Date: 2024-04-10T17:41:02.734Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Windows_NT x64 10.0.22631

When running in local on canary it works fine, but gets stuck the same in loading forever when booted in Dev Container:

Version: 1.89.0-insider (system setup) Commit: cc3429872df5e655abd12c233a9defbd15b0987d Date: 2024-04-25T05:50:13.910Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Windows_NT x64 10.0.22631

eirikfk commented 4 months ago

The problem seems to be caused by CodeGPT plugin trying to reach http://localhost:54112/auth/callback?code=XXX at start-up (mentioned here https://github.com/davila7/code-gpt-docs/issues/237), however without explicitly defining port forwarding in the devcontainer setup, it cannot be reached.

Adding port forwarding in the docker-compose file resolved the issue for me, i.e:

`ports:

iJackUA commented 4 months ago

@eirikfk 's advice fixes the situation one step forward for me, but not completely after adding ports explicitly to docker-compose.yml for container - extension's tab passes the spinner and shows "chat ui" I can change settings and select provider/model but when I trigger any operation like "Explain this code..." - UI shows error (I do not have any other instances of VSCode opened)

image

console shows strange request (looks like port 54113 is added in a wrong place for some reason)

POST http://localhost:54112/54113/api/ollama 400 (Bad Request)

also despite showing other successful request to 54112

image

it constantly logs 54112 port open error (like trying to launch more than one instance)

console.ts:137 [Extension Host] Error: No open ports found in between 54112 and 54112
    at /root/.vscode-server/extensions/danielsanmedium.dscodegpt-3.2.11/dist/extension.js:475:3792
eirikfk commented 4 months ago

54112 is just for auth, if you run with the default ollama setup, chat requests should be to 11434.

If your ollama instance is running on your local computer and not within the devcontainer, that might explain the issue. Connecting to localhost from within a Docker container requires you to use docker.host.internal instead of localhost, as shown below.

Screenshot 2024-05-09 at 16 23 05

Ideally the ollama url should be a settings-parameter in CodeGPT, but those requests dont seem to be prioritised: https://github.com/davila7/code-gpt-docs/issues/208, https://github.com/davila7/code-gpt-docs/issues/199

Work arounds could e.g. be setting up a proxy, installing ollama within the devcontainer, or switching to a different extension

djacquensf9 commented 4 months ago

Today's upgrade (v3.3.25) fix it for me Thanks @davila7 and the team !! :)

janmande commented 3 months ago

Version: 1.90.1 (user setup) Commit: 611f9bfce64f25108829dd295f54a6894e87339d Date: 2024-06-11T21:01:24.262Z Electron: 29.4.0 ElectronBuildId: 9593362 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Windows_NT x64 10.0.22631

Adding port 54112 to docker-compose gets me a step ahead when attempting to connect to my custom model in Azure. It works in WSL but in dev container it shows me this:

image

I only have one instance of VS Code open. My devcontainer has exposed the port 54112. My user, Remote and Workspace settings for the extension are also the same.

mayankkapoor commented 1 month ago

I had a similar problem in my devcontainer running on docker on Mac. I solved it by adding the "appPort": ["54112:54112"] line to my devcontainer.json. My devcontainer.json file:

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
    "name": "Python 3",
    // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
    "image": "mcr.microsoft.com/devcontainers/python:1-3.12-bookworm",

    // Features to add to the dev container. More info: https://containers.dev/features.
    // "features": {},

    // Use 'forwardPorts' to make a list of ports inside the container available locally.
    // "forwardPorts": [],
    "appPort": ["54112:54112"]

    // Use 'postCreateCommand' to run commands after the container is created.
    "postCreateCommand": "pip3 install --user -r requirements.txt",

    // Configure tool-specific properties.
    // "customizations": {},

    // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
    // "remoteUser": "root"

    // Load environment variables from .env
    "runArgs": [
        "--env-file",
        ".env"
    ],
    "customizations": {
        "vscode": {
            "extensions": [
                "DanielSanMedium.dscodegpt"
            ]
        }
    }
}

However, even after the connection gets established, I'm still unable to sign into CodeGPT using VSCode. I click on Sign in, it opens a browser, connect to vscode account, however nothing happens. Any advice is appreciated.