jackMort / ChatGPT.nvim

ChatGPT Neovim Plugin: Effortless Natural Language Generation with OpenAI's ChatGPT API
Apache License 2.0
3.57k stars 307 forks source link

ChatGPTCompleteCode does not work at all (ChatGPT does) #327

Open chrisovergaauw opened 7 months ago

chrisovergaauw commented 7 months ago

Hi,

I have just configured this plugin with the api_key_cmd like so: api_key_cmd = "op read op://somePath --no-newline",

When I set my cursor on line 9 in the following buffer and issue ChatGPTCompleteCode It kind of bugs out neovim. What happens is:

The code completion feature is completely unusable like this. Any help would be greatly appreciated because what I have seen from the Dreams of Code video seems amazing.

regards, Chris

package main

import (
    "flag"
    "fmt"
)

func sortStringsByLength(arr []string) {
// this is line 9, in my actual test the comment is not here but the line is empty
}

func main() {
    var nFlag = flag.Int("n", 1234, "help message for flag n")
    flag.Parse()
    fmt.Printf("nflag: %d", *nFlag)
}
chrisovergaauw commented 7 months ago

When I open a new buffer with just the function in it, I get more sensible results:

func sortStringsByLength(arr []string) {
    sort.Slice(arr, func(i, j int) bool {
        return len(arr[i]) < len(arr[j])
    })
}
chrisovergaauw commented 7 months ago

some additional findings: That one line it generates seems to be a buffer. When I :q after :ChatGPTCompleteCode has completed only that line dissappears.

chrisovergaauw commented 7 months ago

similar functionality works wonderfully btw. I can select the lines 7 -9 from the example and do :ChatGPTEditWithInstructions ask implement this and I get a solid response which I can accept.

sawamotokai commented 5 months ago

For me :ChatGPTCompleteCode only generates


    // API ERROR: The model `text-davinci-003` has been deprecated, learn more here: https://platform.openai.com/docs/deprecations
gain620 commented 4 months ago

For me :ChatGPTCompleteCode only generates

    // API ERROR: The model `text-davinci-003` has been deprecated, learn more here: https://platform.openai.com/docs/deprecations

same here