carlrobertoh / CodeGPT

The leading open-source AI copilot for JetBrains. Connect to any model in any environment, and customize your coding experience in any way you like.
https://codegpt.ee
Apache License 2.0
1.06k stars 222 forks source link

Edit Code action returns `NULL` #737

Closed davidgilbertson closed 2 weeks ago

davidgilbertson commented 2 weeks ago

What happened?

I select a function, and perform the "Edit code" option and type "Make this code better".

It just puts NULL where the code was.

image

If I use the chat instead it works, using the same model, so I know it's picking up my API key correctly. image

I believe my settings are correct: image

All the OpenAI > GPT-* models do the same thing, insert NULL where the code was. The o1-preview model raises an error, which I think was reported elsewhere.

If I change the model to GPT-4o-mini - FREE it works (although it puts the changed code BEHIND the popup, so now I need to grab the mouse to move it to see if I want to accept it or not). image

Relevant log output or stack trace

2024-10-16 10:32:04,311 [ 839614]   INFO - STDERR - [OkHttp https://api.openai.com/...] INFO ee.carlrobert.llm.completion.CompletionEventSourceListener - Request opened.
2024-10-16 10:32:04,312 [ 839615]   INFO - STDERR - [OkHttp https://api.openai.com/...] INFO ee.carlrobert.llm.completion.CompletionEventSourceListener - Request closed.
2024-10-16 10:32:07,876 [ 843179]   INFO - #c.i.w.i.i.j.s.JpsGlobalModelSynchronizerImpl - Saving global entities com.intellij.platform.workspace.jps.entities.SdkEntity to files
2024-10-16 10:32:07,877 [ 843180]   INFO - #c.i.w.i.i.j.s.JpsGlobalModelSynchronizerImpl - Saving global entities com.intellij.platform.workspace.jps.entities.LibraryEntity to files

Steps to reproduce

Not sure, I just just installed the extension, tried it, and it gave this error. I tried it in another project and got the same error. Note that the Request closed is firing about 1 ms after the Request opened, is that a clue?

CodeGPT version

2.11.6-241.1

Operating System

Windows

davidgilbertson commented 2 weeks ago

I just tested with llama3.2 running locally via Ollama and that works, although it puts a full markdown codeblock in my code, with the backticks. image

And it works with Claude too: image

So the issue is somewhere at the intersection of

carlrobertoh commented 2 weeks ago

Thank you for reporting! I will have a look at it soon.

davidgilbertson commented 1 week ago

You work fast, nice!