ChatGPT.nvim icon indicating copy to clipboard operation
ChatGPT.nvim copied to clipboard

ChatGPTCompleteCode does not work at all (ChatGPT does)

Open chrisovergaauw opened this issue 1 year ago • 5 comments

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:

  • // TODO: implement will appear on line 9
  • the closing curly brace of the message dissapears
  • I can no longer undo and get the following error: E21: Cannot make changes, 'modifiable' is off

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 avatar Nov 25 '23 19:11 chrisovergaauw

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 avatar Nov 25 '23 19:11 chrisovergaauw

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 avatar Nov 26 '23 09:11 chrisovergaauw

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.

chrisovergaauw avatar Nov 26 '23 09:11 chrisovergaauw

For me :ChatGPTCompleteCode only generates

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

sawamotokai avatar Feb 14 '24 23:02 sawamotokai

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

gain620 avatar Mar 03 '24 09:03 gain620