Giter Club home page Giter Club logo

chatgpt.nvim's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chatgpt.nvim's Issues

difficulty with closing `ChatGPTEditWithInstructions` window.

Seems like there is some difficulty with closing ChatGPTEditWithInstructions window.

instead of closing floating windows, hitting mapped keys triggers the normal mode on the prompt.

For now use :q to exit this windows (just for this window. For the other windows there is no issue)

Here are my mappings :

keymaps = {
    close = { "jk", "kj", "<Esc>" },
    yank_last = "<C-y>",
    scroll_up = "<C-u>",
    scroll_down = "<C-d>",
    toggle_settings = "<C-o>",
    new_session = "<C-n>",
    cycle_windows = "<Tab>",
  },

Ability to override highlight groups

A colorscheme author here.

Searching through the code base, I can see that there are some highlight groups that are applied during setup, namely ChatGPTQuestion and ChatGPTTotalTokens.

I'd like to support the plugin out of the box in my colorscheme but with the current implementation, ChatGPT overwrites any highlight groups I set.

Is it possible to check if ChatGPTQuestion and ChatGPTTotalTokens highlight groups already exist before setting them? I think vim.api.nvim_get_hl_by_name() would do the trick.

Impruve INSTALL GUIDE to users don't use LUA & PACKER (init.vim)

First of all, Thank You for this Plug.
I want to use but I don't use vim with init.lua and Packer.

I try to add all the dependencies with my gestor of the package:
Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.0' }
Plug 'muniftanjim/nui.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'jackmort/chatgpt.nvim'

and when I use it in normal mode and type :chatgpt, I get the next error.

Error executing Lua callback: ...local/share/nvim/plugged/nui.nvim/lua/nui/popup/init.lua:33: attempt to index local 'options' (a nil value)
stack traceback:
...local/share/nvim/plugged/nui.nvim/lua/nui/popup/init.lua:33: in function 'merge_default_options'
...local/share/nvim/plugged/nui.nvim/lua/nui/popup/init.lua:79: in function 'init'
...ocal/share/nvim/plugged/nui.nvim/lua/nui/object/init.lua:132: in function 'Popup'
...l/share/nvim/plugged/chatgpt.nvim/lua/chatgpt/module.lua:53: in function 'open_chat'
...l/share/nvim/plugged/chatgpt.nvim/lua/chatgpt/module.lua:201: in function 'openChat'
...a/.local/share/nvim/plugged/chatgpt.nvim/lua/chatgpt.lua:24: in function 'openChat'
...local/share/nvim/plugged/chatgpt.nvim/plugin/chatgpt.lua:2: in function
<...local/share/nvim/plugged/chatgpt.nvim/plugin/chatgpt.lua:1>

Thank you for your efforts again, I'll wait for your help because I want to use your plugin.
I know at some moment, I have to pass to lua and packer!

Error starting the plugin

I get the following error when running :ChatGPT,

Error executing Lua callback: ...m/site/pack/packer/start/nui. nvim/lua/nui/popup/init.lua:33: attempt to index local 'option s' (a nil value) stack traceback: ...m/site/pack/packer/start/nui.nvim/lua/nui/popup/ini t.lua:33: in function 'merge_default_options' ...m/site/pack/packer/start/nui.nvim/lua/nui/popup/ini t.lua:79: in function 'init' .../site/pack/packer/start/nui.nvim/lua/nui/object/ini t.lua:132: in function 'Popup' ...te/pack/packer/start/ChatGPT.nvim/lua/chatgpt/modul e.lua:28: in function 'open_chat' ...te/pack/packer/start/ChatGPT.nvim/lua/chatgpt/modul e.lua:159: in function 'openChat' ...nvim/site/pack/packer/start/ChatGPT.nvim/lua/chatgp t.lua:16: in function 'openChat' ...m/site/pack/packer/start/ChatGPT.nvim/plugin/chatgp t.lua:2: in function <...m/site/pack/packer/start/ChatGPT.nvim /plugin/chatgpt.lua:1>

flows.inline edit file does not exist

Hi in the latest commit there seems to be a line added in lua/chatgpt/module.lua

local InlineEdit = require("chatgpt.flows.inline_edit")

However no such file structure exists, which is causing the installation and functionality to break.

`attempt to index local 'options' (a nil value)`

Hi! I noticed there were some recent updated on the nui.nvim package that might've broken ChatGPT.nvim. Might it be the reason I'm getting the following error?

Error executing Lua callback: ...m/site/pack/packer/start/nui.nvim/lua/nui/popup/init.lua:33: attempt to index local 'options' (a nil value)
stack traceback:
        ...m/site/pack/packer/start/nui.nvim/lua/nui/popup/init.lua:33: in function 'merge_default_options'
        ...m/site/pack/packer/start/nui.nvim/lua/nui/popup/init.lua:79: in function 'init'
        .../site/pack/packer/start/nui.nvim/lua/nui/object/init.lua:132: in function 'Popup'
        ...te/pack/packer/start/ChatGPT.nvim/lua/chatgpt/module.lua:26: in function 'open_chat'
        ...te/pack/packer/start/ChatGPT.nvim/lua/chatgpt/module.lua:104: in function 'openChat'
        ...nvim/site/pack/packer/start/ChatGPT.nvim/lua/chatgpt.lua:16: in function 'openChat'
        ...m/site/pack/packer/start/ChatGPT.nvim/plugin/chatgpt.lua:2: in function <...m/site/pack/packer/start/ChatGPT.nvim/plugin/chatgpt.lua:1>

Attempt to index field `usage` (a nil value)

I ran :ChatGPT and entered some query then this error occurred:

Error executing vim.schedule lua callback: ....local/share/nvim/lazy/ChatGPT.nvim/lua/chatgpt/chat.lua:97: attempt to index field 'usage' (a nil value)                                                                                 
stack traceback:                                                                                                                                                                                                                        
        ....local/share/nvim/lazy/ChatGPT.nvim/lua/chatgpt/chat.lua:97: in function 'get_total_tokens'                                                                                                                                  
        ...ocal/share/nvim/lazy/ChatGPT.nvim/lua/chatgpt/module.lua:75: in function 'cb'                                                                                                                                                
        .../.local/share/nvim/lazy/ChatGPT.nvim/lua/chatgpt/api.lua:57: in function ''                                                                                                                                                  
        vim/_editor.lua: in function <vim/_editor.lua:0>  

Might be a problem with my API key but if that's the case I think the error handling could be improved. Related: #10

Error when using response as input with `C-i`

After entering :ChatGPTEditWithInstructions and making my first request, I want to use the reponse as input and use C-i, but it gives me the following error:

E5108: Error executing lua: ...ack/packer/start/ChatGPT.nvim/lua/chatgpt/code_edits.lua:184: Expected Lua number                                                                                                                                                                                                  
stack traceback:
        [C]: in function 'nvim_set_current_win'
        ...ack/packer/start/ChatGPT.nvim/lua/chatgpt/code_edits.lua:184: in function <...ack/packer/start/ChatGPT.nvim/lua/chatgpt/code_edits.lua:179>

Any idea what's wrong?

EDIT: here is my config, in case it helps.

cannot load the module, stack trace

Hi, thanks for the plugin, I cannot the plugin to load, I get the following error:

loop or previous error loading module 'chatgpt'
stack traceback:
	[C]: at 0x561fde6360f0

Using neovim v0.8.1 and packer

queries should automatically factor in the current filetype

Take this example, which takes place while my current file is a lua file. The first query gives me an answer, which is not valid syntax in lua. I to have explicitly add "in lua" to get the correct answer. Given that the current file is a lua file, I assume it would be smarter if the plugin automatically adds "in {current filetype}" to any query (or offer this as an option).

This would reduce the number of wrong answers, and also reduce the number of queries one has to send when remembering that the filetype is missing (= less tokens)

image

Add command to open a fresh new chat

I discovered I miss this option when I started the chat with an "Hola", and chatGPT was answering me always in Spanish, even when all the next questions were in English.

Read and Write Config on Windows OS

Hey! Awesome plugin there!

I got this error running ChatGPT command on Windows after configuring ChatGPT.nvim according to the README.md :

Error executing Lua callback: ...\pack\packer\start\ChatGPT.nvim/lua/chatgpt/settings.lua:45: attempt to concatenate a nil value
stack traceback:
        ...\pack\packer\start\ChatGPT.nvim/lua/chatgpt/settings.lua:45: in function 'read_config'
        ...\pack\packer\start\ChatGPT.nvim/lua/chatgpt/settings.lua:69: in function 'get_settings_panel'
        ...te\pack\packer\start\ChatGPT.nvim/lua/chatgpt/module.lua:88: in function 'open_chat'
        ...te\pack\packer\start\ChatGPT.nvim/lua/chatgpt/module.lua:208: in function 'openChat'
        ...data\site\pack\packer\start\ChatGPT.nvim/lua/chatgpt.lua:24: in function 'openChat'
        ...a\site\pack\packer\start\ChatGPT.nvim\plugin\chatgpt.lua:2: in function <...a\site\pack\packer\start\ChatGPT.nvim\plugin\chatgpt.lua:1>

The error occurs precisely on this line :

local file = io.open(os.getenv("HOME") .. "/" .. ".chatgpt-" .. M.type .. "-params.json", "rb")

I did some researches and according to StackOverflow HOME is for Linux and on Windows this env variable has different name: USERPROFILE


You can just update the code with this snippet (or optimized version) to fix that issue for Windows users :

local function get_os_name()
  local os = vim.loop.os_uname()
  local os_name = os.sysname
  return os_name
end

local function get_user_profile_key()
  local os_name = get_os_name()

  local user_profile_key = nil
  if os_name == "Windows_NT" or os_name == "Windows" then
    user_profile_key = "USERPROFILE"
  elseif os_name == "Darwin" then
    user_profile_key = "HOME"
  else
    user_profile_key = "HOME"
  end
  return user_profile_key
end

M.read_config = function()
  local file = io.open(os.getenv(get_user_profile_key()) .. "/" .. ".chatgpt-" .. M.type .. "-params.json", "rb")
 -- ... 
end

M.write_config = function(config)
  local file, err = io.open(os.getenv(get_user_profile_key()) .. "/" .. ".chatgpt-" .. M.type .. "-params.json", "w")
-- ...
end

This is what I did and everything works fine now!

Awesome plugin ๐Ÿ’ฏ once again

[idea] Add a window for changing ChatGPT parameters

Hi! First let me thank you for your excellent work on this plugin! :)

Would it be possible to add a window for easier change of the OpenAI parameters?

        openai_params = {
            model = "text-davinci-003",
            frequency_penalty = 0,
            presence_penalty = 0,
            max_tokens = 300,
            temperature = 1,
            top_p = 1,
            n = 1,
        },

Thanks!

attempt to call field 'on_loading' (a nil value)

Hi, thanks for this plugin and for working quickly to bug bash! Trying to help with another bug report.

It looks like Chat:new expects the third argument, on_loading:

function Chat:new(bufnr, winid, on_loading)

But it's never passed:

chat = Chat:new(chat_window.bufnr, chat_window.winid)

So the self.on_loading is nil:

self.on_loading = on_loading

Creating a bug here:

self.on_loading()

This is output when I :chatGPT, type a question and hit enter:

Error executing vim.schedule lua callback: ...site/pack/packer/start/ChatGPT.nvim/lua/chatgpt/chat.lua:164: attempt to call field 'on_loading' (a nil value)                                                 
stack traceback:
        ...site/pack/packer/start/ChatGPT.nvim/lua/chatgpt/chat.lua:164: in function 'stopSpinner'
        ...site/pack/packer/start/ChatGPT.nvim/lua/chatgpt/chat.lua:124: in function 'renderLastMessage'
        ...site/pack/packer/start/ChatGPT.nvim/lua/chatgpt/chat.lua:83: in function 'add'
        ...site/pack/packer/start/ChatGPT.nvim/lua/chatgpt/chat.lua:87: in function 'addQuestion'
        ...te/pack/packer/start/ChatGPT.nvim/lua/chatgpt/module.lua:45: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

Token price & chatGpt model

Hello, i I have 2 questions,

I was wondering if it is possible to hide/toggle the tokens/price? I can't seem to find the configuration option to do this.

It's causing some issues when typing a long query, then the text goes behind it.
image
The same happens for a long chat gpt answers, then the answer is printed below the token label and unreadable.
image

And the other question is more informational. The plugin is called ChatGPT, but I get very different answers while using this plugin compared to using the web based version. Any idea of why that could be?

Thanks for your time!

module 'chatgpt.flows.inline_edit' not found

I couldn't dig further, but I believe this line introduced a bug โ€” and maybe you're working on that because this commit is not even 30min old : )

local InlineEdit = require("chatgpt.flows.inline_edit")

When I open Neovim with the current version of the plugin fb47b4c I get:

packer.nvim: Error running config for ChatGPT.nvim: ...te/pack/packer/start/ChatGPT.nvim/lua/chatgpt/module.lua:14: module 'chatgpt.flows.inline_edit' not found:
	no field package.preload['chatgpt.flows.inline_edit']
	no file './chatgpt/flows/inline_edit.lua'
	no file '/opt/homebrew/share/luajit-2.1.0-beta3/chatgpt/flows/inline_edit.lua'
	no file '/usr/local/share/lua/5.1/chatgpt/flows/inline_edit.lua'
	no file '/usr/local/share/lua/5.1/chatgpt/flows/inline_edit/init.lua'
	no file '/opt/homebrew/share/lua/5.1/chatgpt/flows/inline_edit.lua'
	no file '/opt/homebrew/share/lua/5.1/chatgpt/flows/inline_edit/init.lua'
	no file '/Users/cuducos/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/chatgpt/flows/inline_edit.lua'
	no file '/Users/cuducos/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/chatgpt/flows/inline_edit/init.lua'
	no file '/Users/cuducos/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/chatgpt/flows/inline_edit.lua'
	no file '/Users/cuducos/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/chatgpt/flows/inline_edit/init.lua'
	no file './chatgpt/flows/inline_edit.so'
	no file '/usr/local/lib/lua/5.1/chatgpt/flows/inline_edit.so'
	no file '/opt/homebrew/lib/lua/5.1/chatgpt/flows/inline_edit.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'
	no file '/Users/cuducos/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/chatgpt/flows/inline_edit.so'
	no file './chatgpt.so'
	no file '/usr/local/lib/lua/5.1/chatgpt.so'
	no file '/opt/homebrew/lib/lua/5.1/chatgpt.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'
	no file '/Users/cuducos/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/chatgpt.so'

prompts.lua:1: module 'telescope.pickers' not found

Getting the following on default config.

packer.nvim: Error running config for ChatGPT.nvim: ...e/pack/packer/start/ChatGPT.nvim/lua/chatgpt/prompts.lua:1: module 'telescope.pickers' not found:            
^Ino field package.preload['telescope.pickers']                                                                                                                     
^Ino file './telescope/pickers.lua'                                                                                                                                 
^Ino file '/usr/share/luajit-2.1.0-beta3/telescope/pickers.lua'                                                                                                     
^Ino file '/usr/local/share/lua/5.1/telescope/pickers.lua'                                                                                                          
^Ino file '/usr/local/share/lua/5.1/telescope/pickers/init.lua'                                                                                                     
^Ino file '/usr/share/lua/5.1/telescope/pickers.lua'                                                                                                                
^Ino file '/usr/share/lua/5.1/telescope/pickers/init.lua'                                                                                                           
^Ino file '/home/paka/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/telescope/pickers.lua'                                                                 
^Ino file '/home/paka/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/telescope/pickers/init.lua'                                                            
^Ino file '/home/paka/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/telescope/pickers.lua'                                                        
^Ino file '/home/paka/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/telescope/pickers/init.lua'                                                   
^Ino file './telescope/pickers.so'                                                                                                                                  
^Ino file '/usr/local/lib/lua/5.1/telescope/pickers.so'                                                                                                             
^Ino file '/usr/lib/lua/5.1/telescope/pickers.so'                                                                                                                   
^Ino file '/usr/local/lib/lua/5.1/loadall.so'                                                                                                                       
^Ino file '/home/paka/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/telescope/pickers.so'                                                                    
^Ino file './telescope.so'                                                                                                                                          
^Ino file '/usr/local/lib/lua/5.1/telescope.so'                                                                                                                     
^Ino file '/usr/lib/lua/5.1/telescope.so'                                                                                                                           
^Ino file '/usr/local/lib/lua/5.1/loadall.so' 

Error at `:qa` after running `:ChatGPTEditWithInstructions`

If I run :ChatGPTEditWithInstructions in current session and then quit nvim by :qa, then error happens:

image

However I can't find the buffer 8
image

Here is my configuration

return {
  -- Coding with ChatGPT
  "jackMort/ChatGPT.nvim",
  dependencies = {
    "MunifTanjim/nui.nvim",
    "nvim-lua/plenary.nvim",
    "nvim-telescope/telescope.nvim"
  },
  keys = {
    { "<leader>t", "<cmd>ChatGPT<cr>", desc = "ChatGPT" },
    { "<leader><C-t>", "<cmd>ChatGPTActAs<cr>", desc = "ChatGPT with awesome prompt" },
    { "<leader>T", "<cmd>ChatGPTEditWithInstructions<cr>", mode = { "x", "n" }, desc = "ChatGPT with code" },
  },
  opts = {
    keymaps = {
      scroll_up = "<C-b>",
      scroll_down = "<C-f>",
    }
  }
}

Is this a bug? how to resolve this? Thanks!

PS: BTW, it seems keymaps close can't work in :ChatGPTEditWithInstructions. <Esc> can't close prompt.

Terrible performance while inside neovide..

I recently installed this plugin and noticed that it suffered from performance issues while used inside Neovide. Any ideas to why that is?

Steps to replicate:

  1. Launch neovide.
  2. Launch ChatGPT.
  3. Write random text and hit enter for generated answer.
  4. Hide -> show Neovide.

You will most likely experience some form of input lag in step 3 and a massively degraded performance in step 4.

Installation steps:

       {
        "jackMort/ChatGPT.nvim",
        event = "UIEnter",
        opts = {
            chat_window = {
                border = { text = { top = "ChatGPT-3" } },
            },
        },

Ctrl-y overwrites what it yanked

Pressing ctrl+y in ChatGPTEditWithInstructions overwrites what it yanked and immediately closes the window.
Is this the intended function?
It's great if you are trying to get a refactor or something, but I feel like it would be a lot more useful to just leave it in your yank buffer to do what you want with; I intended to get a unit test written for a simple function and it is in this way impossible to do, considering I can't copy and paste into the normal ChatGPT command, either :(

Transparent background black shadow hlgroup?

Hi,

I was trying out your plugin but stumbled upon this (highlight?) issue. The background appears black. It looks as if it's a shadow.. I might be wrong though. I'm not familiar with styling/hlgroup manipulation.

image

Would you have any idea what might be causing this and how I could fix it? I'm using the catpuccin colorscheme.

Thank you for your time.

Doesn't show "cost" and hints about "<C-y> to apply..." anymore when using `ChatGPTEditWithInstructions`

Did I just imagine that worked also when using ChatGPTEditWithInstructions?

In the video from the Readme it's there. Here is a Screenshot with Settings open
image

This is my setup (just copied from Readme)

require('chatgpt').setup({
    welcome_message = WELCOME_MESSAGE, -- set to "" if you don't like the fancy godot robot
    loading_text = "loading",
    question_sign = "๏€‡", -- you can use emoji if you want e.g. ๐Ÿ™‚
    answer_sign = "๏ฎง", -- ๐Ÿค–
    max_line_length = 120,
    yank_register = "+",
    chat_layout = {
      relative = "editor",
      position = "50%",
      size = {
        height = "80%",
        width = "80%",
      },
    },
    settings_window = {
      border = {
        style = "rounded",
        text = {
          top = " Settings ",
        },
      },
    },
    chat_window = {
      filetype = "chatgpt",
      border = {
        highlight = "FloatBorder",
        style = "rounded",
        text = {
          top = " ChatGPT ",
        },
      },
    },
    chat_input = {
      prompt = " ๏†’ ",
      border = {
        highlight = "FloatBorder",
        style = "rounded",
        text = {
          top_align = "center",
          top = " Prompt ",
        },
      },
    },
    openai_params = {
      model = "text-davinci-003",
      frequency_penalty = 0,
      presence_penalty = 0,
      max_tokens = 300,
      temperature = 0,
      top_p = 1,
      n = 1,
    },
    openai_edit_params = {
      model = "code-davinci-edit-001",
      temperature = 0,
      top_p = 1,
      n = 1,
    },
    keymaps = {
      close = { "<C-c>", "<Esc>" },
      yank_last = "<C-y>",
      scroll_up = "<C-u>",
      scroll_down = "<C-d>",
      toggle_settings = "<C-o>",
      new_session = "<C-n>",
      cycle_windows = "<Tab>",
    },
  })

Modularizing query functionality to create 'coding helpers'

Hi Jack

I love your work! The code that encapsulates the completion query types are very good, quite clean and readable. The package is very playful and functional, really showing what can be done with the openAI api.

My use case is less interactive. I would like to use ChatGPT to help with day to day coding tasks, asking the API to 'document this diff', or 'create a test for this function'. I propose extend your ChatGPT.nvim package to create vim text actions for specific ChatGPT prompts.

To do this, I need to modularise your query functionality. You have started this task with the completions, especially the custom_code_action, but I would like to be able to specify all the OpenAI parameters. E.g. substitute/append the text, the actual prompt,

Also, I would like to specify the prompts and query parameters, defining a specific text action in an external file, sourced at runtime, like is done with snippets. This way, everyone can create their personal coding-helpers, without having to edit the plugin.

What do you think? I would be very happy if you wanted to lead this work, but I am also happy to take it on. Your code is very sensible.

Also, what is the license for the project?

Thanks, Dennis

I'm an idiot - try not to get your OpenAI key revoked by posting config to a public repository like github

Not complaining as this is all my fault but I decided to start using chezmoi to make moving to a new machine easier.
Had the super smart idea of storing my neovim config on a public github repository.
Not sure how OpenAI knew as I can't see any charges or use on my account but it took them about a day to find out I'd been dumb enough to do this.

Anyway, I'll give OpenAI the floor and hope anyone reading this has a good laugh at just how stupid I am. (and yes my repository is now private as it should have been because I'm not some fancy coder who has followers that need to copy my config.)

Hi there,
Your OpenAI API key was determined to have been leaked, which has triggered a key rotation and this friendly notification email.
This may be because you committed your API key to an online service such as GitHub, or your key may have been compromised in another way.
Don't worry, you still have API access! Head over to the API Keys page to view your updated API key.
If your API key was stored in any locations - for instance, in code you are running - it will need to be updated before you can run this code again.
Finally, we ask that you please review our best practices for API key safety.
Best,
The OpenAI team

error to run ChatGPT

I have this error, I do not know why it comes out, and it is not solved or uninstalled and reinstalled.

Error executing Lua callback: ...er/start/ChatGPT.nvim/lua/chatgpt/flows/chat/session.lua:132: field 'day' missing in date table                                 
stack traceback:
        [C]: in function 'parse_date_time'
        ...er/start/ChatGPT.nvim/lua/chatgpt/flows/chat/session.lua:132: in function 'list_sessions'
        ...r/start/ChatGPT.nvim/lua/chatgpt/flows/chat/sessions.lua:95: in function 'get_panel'
        ...te/pack/packer/start/ChatGPT.nvim/lua/chatgpt/module.lua:90: in function 'open_chat'
        ...te/pack/packer/start/ChatGPT.nvim/lua/chatgpt/module.lua:209: in function 'openChat'
        ...nvim/site/pack/packer/start/ChatGPT.nvim/lua/chatgpt.lua:25: in function 'openChat'
        ...m/site/pack/packer/start/ChatGPT.nvim/plugin/chatgpt.lua:2: in function <...m/site/pack/packer/start/ChatGPT.nvim/plugin/chatgpt.lua:1>

and if I uninstall it, I get this:

packer.nvim: Error running config for ChatGPT.nvim: [string "..."]:0: module 'chatgpt' not found:
^Ino field package.preload['chatgpt']
^Ino file './chatgpt.lua'
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/share/luajit-2.1.0-beta3/chatgpt.lua'
^Ino file '/usr/local/share/lua/5.1/chatgpt.lua'
^Ino file '/usr/local/share/lua/5.1/chatgpt/init.lua'
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/chatgpt.lua'
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/chatgpt/init.lua'
^Ino file '/home/metallica/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/chatgpt.lua'
^Ino file '/home/metallica/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/chatgpt/init.lua'
^Ino file '/home/metallica/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/chatgpt.lua'
^Ino file '/home/metallica/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/chatgpt/init.lua'
^Ino file './chatgpt.so'
^Ino file '/usr/local/lib/lua/5.1/chatgpt.so'
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.1/chatgpt.so'
^Ino file '/usr/local/lib/lua/5.1/loadall.so'

Tab cycle over windows gives error under certain conditions

<Tab> cycle over windows gives error in ChatGPTEditWithInstructions mode when the option window is NOT open.

This is the error:

E5108: Error executing lua: ...ack/packer/start/ChatGPT.nvim/lua/chatgpt/code_edits.lua:186: Expected Lua number
stack traceback:
        [C]: in function 'nvim_set_current_win'
        ...ack/packer/start/ChatGPT.nvim/lua/chatgpt/code_edits.lua:186: in function <...ack/packer/start/ChatGPT.nvim/lua/chatgpt/code_edits.lua:
181>

Are the responses generated for these requests?

Screen Shot 2023-02-08 at 16 42 02
The error reads that:

// API ERROR: Your access was terminated due to violation of our policies, please check your email for more information. If you believe this is in error
โ”‚ and would like to appeal, please contact [email protected].

But I wonder if the price indicates that the response had been generated but was just not displayed?

This information would be essential to this issue: I am in China and the VPN I use cannot hide/change my IP location.

Error happened after asking for a while

Hey mate, in loveeeee with the plugin. So helpful! I think I'm hitting some limit, getting this error. Any thoughts?
// API ERROR: 14 is greater than the maximum of 1 - 'top_p'

"line value out of range" error shortly after running the plugin

Happens every time I type something into the prompt too...

Error executing Lua callback: ...ite/pack/chatgpt/start/ChatGPT.nvim/lua/chatgpt/chat.lua:202: line value outside range
stack traceback:
        [C]: in function 'nvim_buf_set_extmark'
        ...ite/pack/chatgpt/start/ChatGPT.nvim/lua/chatgpt/chat.lua:202: in function 'renderLastMessage'
        ...ite/pack/chatgpt/start/ChatGPT.nvim/lua/chatgpt/chat.lua:132: in function '_add'
        ...ite/pack/chatgpt/start/ChatGPT.nvim/lua/chatgpt/chat.lua:43: in function 'welcome'
        ...e/pack/chatgpt/start/ChatGPT.nvim/lua/chatgpt/module.lua:202: in function 'openChat'
        ...vim/site/pack/chatgpt/start/ChatGPT.nvim/lua/chatgpt.lua:24: in function 'openChat'
        .../site/pack/chatgpt/start/ChatGPT.nvim/plugin/chatgpt.lua:2: in function <.../site/pack/chatgpt/start/ChatGPT.nvim/plugin/chatgpt.lua:1>

Bottom lines are missing when the ChatGPT window is full

It seems on my setup that the last lines in the ChatGPT window is missing when the window is full. As a result, you can't se the whole answer when the window is filled and you can't see your question either if you don't type some more so the texts moves "up into the window". I've tried to remove all my other plugins and commented out pretty much my whole init file and the issue remains.

Link to image of the issue

[Bug]: attempt to index field 'choices' (a nil value)

If I open chatgpt and type anything, I get the following error:

Error executing vim.schedule lua callback: .../site/pack/packer/start/chatgpt.nvim/lua/chatgpt/api.lua:42: attempt to index field 'choices' (a nil value)
stack traceback:
        .../site/pack/packer/start/chatgpt.nvim/lua/chatgpt/api.lua:42: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

My config is:

  chatgpt.setup({
    welcome_message = "",
    chat_input = {
    prompt = " ๏€‚  ",
    }
  })

[Enhancement] Customisable keybindings

Would be great to be able to customise how we close the chatgpt window. It's natural for myself to hit <esc> in normal mode to close the window instead of <c-c> which I have mapped to close a buffer.

Functional Question: Is there who uses this great plugin with "Curie" model?

Hi, I'm thinking about this theme.
If we want to use this plugin, should we set params like this?

{
  welcome_message = WELCOME_MESSAGE, -- set to "" if you don't like the fancy godot robot
  loading_text = "loading",
  question_sign = "๏€‡", -- you can use emoji if you want e.g. ๐Ÿ™‚
  answer_sign = "๏ฎง", -- ๐Ÿค–
  max_line_length = 120,
  yank_register = "+",
  chat_layout = {
    relative = "editor",
    position = "50%",
    size = {
      height = "80%",
      width = "80%",
    },
  },
  settings_window = {
    border = {
      style = "rounded",
      text = {
        top = " Settings ",
      },
    },
  },
  chat_window = {
    filetype = "chatgpt",
    border = {
      highlight = "FloatBorder",
      style = "rounded",
      text = {
        top = " ChatGPT ",
      },
    },
  },
  chat_input = {
    prompt = " ๏†’ ",
    border = {
      highlight = "FloatBorder",
      style = "rounded",
      text = {
        top_align = "center",
        top = " Prompt ",
      },
    },
  },
  openai_params = {
    model = "curie",
    frequency_penalty = 0,
    presence_penalty = 0,
    max_tokens = 300,
    temperature = 0,
    top_p = 1,
    n = 1,
  },
  openai_edit_params = {
    model = "curie",
    temperature = 0,
    top_p = 1,
    n = 1,
  },
  keymaps = {
    close = { "<C-c>", "<Esc>" },
    yank_last = "<C-y>",
    scroll_up = "<C-u>",
    scroll_down = "<C-d>",
    toggle_settings = "<C-o>",
    new_session = "<C-n>",
    cycle_windows = "<Tab>",
  },
}

If anyone already tried, please reply me.

FR: Custom location of file with OpenAI API Key

Basically the same issue I also reported for ai.vim: Some of us have their dotfiles public, so that putting the API key into files like .zshenv is not ideal.

The workaround right now is to set it via vim.env outside of the dotfiles repo, and symlink that file into the nvim config, which is unnecessarily many hoops to jump through just to get it set up.

`?` keymap help

Discussed in #43

Originally posted by RhydianJenkins December 29, 2022
Hi.

Thanks so much for this plugin. I use it daily :)

I've noticed that we've recently been blessed with several new features (such as sessions and api request params), and have since also been given several new keybinds to remember.

Could we get something like nerdtree (example below) where the user could press ? to see a quick summary/cheat sheet of all the possible buttons? It's getting hard to track!

image

image

Thanks

custom question_sign does't work

use({
"jackMort/ChatGPT.nvim",
config = function()
require("chatgpt").setup({
question_sign = "๐Ÿ™‚",
})
end,
requires = {
"MunifTanjim/nui.nvim",
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
},
})
here is the config that I using for this plugin, and the sign does't work, I also try to put anything there didn't override the default one, it's not big deal tbh ๐Ÿง‘โ€๐Ÿ’ป

Feature request: `?` keymap help

Hi.

Thanks so much for this plugin. I use it daily :)

I've noticed that we've recently been blessed with several new features (such as sessions and api request params), and have since also been given several new keybinds to remember.

Could we get something like nerdtree (example below) where the user could press ? to see a quick summary/cheat sheet of all the possible buttons? It's getting hard to track!

image

image

Thanks

popup background color/transparence

Hey, quick and probably easy question here. How can I change "popup" background for this plugin? Currently it's transparent window, which is not quite usable for me... Any help appreciated, thanks!
image

Vim:E6100: "state" is not a valid stdpath

Hi, first of all, this is the most exiting pluging I've ever seen, thank you for your work.

I get an error executing the command :ChatGPT

Error executing Lua callback: Vim:E6100: "state" is not a valid stdpath stack traceback: [C]: in function 'stdpath' .../plugged/ChatGPT.nvim/lua/chatgpt/flows/chat/session.lua:111: in function 'get_dir' .../plugged/ChatGPT.nvim/lua/chatgpt/flows/chat/session.lua:119: in function 'list_sessions' ...plugged/ChatGPT.nvim/lua/chatgpt/flows/chat/sessions.lua:95: in function 'get_panel' ....config/nvim/plugged/ChatGPT.nvim/lua/chatgpt/module.lua:89: in function 'open_chat' ....config/nvim/plugged/ChatGPT.nvim/lua/chatgpt/module.lua:208: in function 'openChat' .../jorge/.config/nvim/plugged/ChatGPT.nvim/lua/chatgpt.lua:24: in function 'openChat' ...rge/.config/nvim/plugged/ChatGPT.nvim/plugin/chatgpt.lua:2: in function <...rge/.config/nvim/plugged/ChatGPT.nvim/plugin/chatgpt.lua:1>

Same error occurs using :ChatGPTActAs once I select an option

ChatGPTEditWithInstructions and ChatGPTRunCustomCodeAction are working fine.

I installed ChatGPT.nvim using plug following issue #46 instructions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.