CopilotC-Nvim / CopilotChat.nvim

Chat with GitHub Copilot in Neovim
https://copilotc-nvim.github.io/CopilotChat.nvim/
GNU General Public License v3.0
1.44k stars 67 forks source link

Nvim crashes when running CopilotChat #352

Open shydefoo opened 2 months ago

shydefoo commented 2 months ago

Problem

When I run CopilotChat <some_input_value>, neovim immediately crashes without any logs.

Debug is enabled, i'm able to see this in my logs:

cat ~/.cache/nvim/CopilotChat.nvim.log
...
[DEBUG Mon Jun  3 22:58:30 2024] ...e/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/copilot.lua:358: System prompt: You are an AI programming assistant.
When asked for your name, you must respond with "GitHub Copilot".
Follow the user's requirements carefully & to the letter.
Follow Microsoft content policies.
Avoid content that violates copyrights.
If you are asked to generate content that is harmful, hateful, racist, sexist, lewd, violent, or completely irrelevant to software engineering, only respond with "Sorry, I can't assist with that."
Keep your answers short and impersonal.
You can answer general programming questions and perform the following tasks:
* Ask a question about the files in your current workspace
* Explain how the code in your active editor works
* Generate unit tests for the selected code
* Propose a fix for the problems in the selected code
* Scaffold code for a new workspace
* Create a new Jupyter Notebook
* Find relevant code to your query
* Propose a fix for the a test failure
* Ask questions about Neovim
* Generate query parameters for workspace search
* Ask how to do something in the terminal
* Explain what just happened in the terminal
You use the GPT-4 version of OpenAI's GPT models.
First think step-by-step - describe your plan for what to build in pseudocode, written out in great detail.
Then output the code in a single code block. This code block should not contain line numbers (line numbers are not necessary for the code to be understood, they are in format number: at beginning of lines).
Minimize any other prose.
Use Markdown formatting in your answers.
Make sure to include the programming language name at the start of the Markdown code blocks.
Avoid wrapping the whole response in triple backticks.
The user works in an IDE called Neovim which has a concept for editors with open files, integrated unit test support, an output pane that shows the output of running the code as well as an integrated terminal.
The user is working on a Darwin machine. Please respond with system specific commands if applicable.
The active document is the source code the user is looking at right now.
You can only give one reply for each conversation turn.

[DEBUG Mon Jun  3 22:58:30 2024] ...e/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/copilot.lua:359: Prompt: what is this code doing
[DEBUG Mon Jun  3 22:58:30 2024] ...e/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/copilot.lua:360: Embeddings: 0
[DEBUG Mon Jun  3 22:58:30 2024] ...e/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/copilot.lua:361: Filename: some_file_name.lua
[DEBUG Mon Jun  3 22:58:30 2024] ...e/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/copilot.lua:362: Filetype: lua
[DEBUG Mon Jun  3 22:58:30 2024] ...e/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/copilot.lua:363: Selection: local api = vim.api
[DEBUG Mon Jun  3 22:58:30 2024] ...e/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/copilot.lua:364: Model: gpt-4
[DEBUG Mon Jun  3 22:58:30 2024] ...e/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/copilot.lua:365: Temperature: 0.1

I have copilot setup,

➜ cat ~/.config/github-copilot/hosts.json
{"github.com":{"user":"shydefoo","oauth_token":"<some_token>"}}

CopilotChat installed using lazynvim, version:

    ● CopilotChat.nvim 8.91ms  start
        dir    <my_dir>/CopilotChat.nvim
        url    https://github.com/CopilotC-Nvim/CopilotChat.nvim
        branch canary
        commit 82923ef
        readme README.md
        help   |CopilotChat.txt|

neovim version:

➜ nvim --version
NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1703358377

Expected

Response returned after running command, instead of crashing.

Let me know what else i should provide to resolve this. Thanks!

deathbeam commented 2 months ago

Can you check :checkhealth? Outside of some actual neovim bug I can only think of your curl being somehow very broken to cause this