leona / helix-gpt

Code assistant language server for Helix with support for Copilot/OpenAI/Codeium/Ollama
MIT License
285 stars 19 forks source link

Fetch failed with status 404 body {"message": "Not Found"... #24

Open luccahuguet opened 4 months ago

luccahuguet commented 4 months ago

helix-editor version helix 23.10 (83f09ecb)

helix-gpt version 0.27

Describe the bug I can view the code actions successfully but when I pick one, I get the following error (I manually copied helix's diagnostic):

Fetch failed with status 404 body {"message": "Not Found", "documentation_url": "https://docs.github.com/rest"} {url: "/copilot_internal/v2/token"

helix-gpt logs Helix GPT output logs. Pass --logFile /app/helix-gpt.log to save them.

helix logs

2024-02-15T20:27:59.618 helix_lsp::transport [INFO] pylsp <- {"jsonrpc":"2.0","id":1,"result":[]}
2024-02-15T20:27:59.618 helix_lsp::transport [INFO] pylsp <- []
2024-02-15T20:27:59.624 helix_lsp::transport [INFO] gpt <- {"jsonrpc":"2.0","id":1,"result":[{"title":"Resolve diagnostics","kind":"quickfix","diagnostics":[],"command":{"title":"Resolve diagnostics","command":"resolveDiagnostics","arguments":[{"range":{"end":{"character":5,"line":18},"start":{"character":4,"line":18}},"query":"Resolve the diagnostics for this code.","diagnostics":[]}]}},{"title":"Generate documentation","kind":"quickfix","diagnostics":[],"command":{"title":"Generate documentation","command":"generateDocs","arguments":[{"range":{"end":{"character":5,"line":18},"start":{"character":4,"line":18}},"query":"Add documentation to this code.","diagnostics":[]}]}},{"title":"Improve code","kind":"quickfix","diagnostics":[],"command":{"title":"Improve code","command":"improveCode","arguments":[{"range":{"end":{"character":5,"line":18},"start":{"character":4,"line":18}},"query":"Improve this code.","diagnostics":[]}]}},{"title":"Refactor code from a comment","kind":"quickfix","diagnostics":[],"command":{"title":"Refactor code from a comment","command":"refactorFromComment","arguments":[{"range":{"end":{"character":5,"line":18},"start":{"character":4,"line":18}},"query":"Refactor this code based on the comment.","diagnostics":[]}]}},{"title":"Write a unit test","kind":"quickfix","diagnostics":[],"command":{"title":"Write a unit test","command":"writeTest","arguments":[{"range":{"end":{"character":5,"line":18},"start":{"character":4,"line":18}},"query":"Write a unit test for this code. Do not include any imports.","diagnostics":[]}]}}]}
2024-02-15T20:27:59.625 helix_lsp::transport [INFO] gpt <- [{"command":{"arguments":[{"diagnostics":[],"query":"Resolve the diagnostics for this code.","range":{"end":{"character":5,"line":18},"start":{"character":4,"line":18}}}],"command":"resolveDiagnostics","title":"Resolve diagnostics"},"diagnostics":[],"kind":"quickfix","title":"Resolve diagnostics"},{"command":{"arguments":[{"diagnostics":[],"query":"Add documentation to this code.","range":{"end":{"character":5,"line":18},"start":{"character":4,"line":18}}}],"command":"generateDocs","title":"Generate documentation"},"diagnostics":[],"kind":"quickfix","title":"Generate documentation"},{"command":{"arguments":[{"diagnostics":[],"query":"Improve this code.","range":{"end":{"character":5,"line":18},"start":{"character":4,"line":18}}}],"command":"improveCode","title":"Improve code"},"diagnostics":[],"kind":"quickfix","title":"Improve code"},{"command":{"arguments":[{"diagnostics":[],"query":"Refactor this code based on the comment.","range":{"end":{"character":5,"line":18},"start":{"character":4,"line":18}}}],"command":"refactorFromComment","title":"Refactor code from a comment"},"diagnostics":[],"kind":"quickfix","title":"Refactor code from a comment"},{"command":{"arguments":[{"diagnostics":[],"query":"Write a unit test for this code. Do not include any imports.","range":{"end":{"character":5,"line":18},"start":{"character":4,"line":18}}}],"command":"writeTest","title":"Write a unit test"},"diagnostics":[],"kind":"quickfix","title":"Write a unit test"}]
2024-02-15T20:28:00.089 helix_lsp::transport [INFO] gpt -> {"jsonrpc":"2.0","method":"workspace/executeCommand","params":{"arguments":[{"diagnostics":[],"query":"Resolve the diagnostics for this code.","range":{"end":{"character":5,"line":18},"start":{"character":4,"line":18}}}],"command":"resolveDiagnostics"},"id":2}
2024-02-15T20:28:00.099 helix_lsp::transport [INFO] gpt <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/lucca/api2/app.py","diagnostics":[{"message":"Executing resolveDiagnostics...","range":{"end":{"character":5,"line":18},"start":{"character":4,"line":18}},"severity":3,"source":"helix-gpt"}]}}
2024-02-15T20:28:00.396 helix_lsp::transport [INFO] gpt <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/lucca/api2/app.py","diagnostics":[{"message":"Fetch failed with status 404 body {\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest\"} url: /copilot_internal/v2/token","severity":1,"range":{"end":{"character":5,"line":18},"start":{"character":4,"line":18}},"source":"helix-gpt"}]}}
luccahuguet commented 4 months ago

gh copilot is given to me via student pack, provided by my university. could this be the issue?

luccahuguet commented 4 months ago

it works with the openAI key, but I still need to use copilot (specially since it says it's the recommended model in the readme)

luccahuguet commented 4 months ago

thank you for this project. it works very well.

Although I have yet to figure how to get the copilot one working.

leona commented 4 months ago

gh copilot is given to me via student pack, provided by my university. could this be the issue?

It's strange that a university encourages use of Copilot. Do your credentials work with the VSCode plugin do you know?

luccahuguet commented 4 months ago

It's strange that a university encourages use of Copilot.

It's called Github Student Developer Pack and it contains a lot of other things. I think some student's learning process will be enhanced with it while others will learn less, so a mixed bag

Do your credentials work with the VSCode plugin do you know?

Yes, I've been using copilot with all it's features, including copilot chat, and "fix with copilot" in vscode

My guess is that the api is closed for people that get copilot for free, so that they can't give it to others, maybe?

leona commented 4 months ago

It's strange that a university encourages use of Copilot.

It's called Github Student Developer Pack and it contains a lot of other things. I think some student's learning process will be enhanced with it while others will learn less, so a mixed bag

Do your credentials work with the VSCode plugin do you know?

Yes, I've been using copilot with all it's features, including copilot chat, and "fix with copilot" in vscode

My guess is that the api is closed for people that get copilot for free, so that they can't give it to others, maybe?

You said you can view the code actions successfully in the OP though. So are you getting the completions at first? The request that's failing is to do with refreshing the token so it might be that auth step which is done differently for your case.

luccahuguet commented 4 months ago

It's strange that a university encourages use of Copilot.

It's called Github Student Developer Pack and it contains a lot of other things. I think some student's learning process will be enhanced with it while others will learn less, so a mixed bag

Do your credentials work with the VSCode plugin do you know?

Yes, I've been using copilot with all it's features, including copilot chat, and "fix with copilot" in vscode My guess is that the api is closed for people that get copilot for free, so that they can't give it to others, maybe?

You said you can view the code actions successfully in the OP though. So are you getting the completions at first? The request that's failing is to do with refreshing the token so it might be that auth step which is done differently for your case.

I mean that I can see the code actions options (as in "improve code", "resolve diagnostics", etc) , but when I click any of them, I get the error described in OP.

and that error is the same whether it is a code action, or a completion on insert mode (like when you hit space bar)

nrdxp commented 4 months ago

I am getting a very similar error when trying to use the openai handler with perplexities pplx api, which is openai compatible, so I figured it would work. Problem is the log is kinda not as helpful as I would like. Nowhere in the log does it show the full endpoint url, so I have no idea if it is simply misconfigured, or truly broken. Is there a way to increase the log verbosity?