Giter VIP home page Giter VIP logo

chatgpt-vim's Introduction

Typing SVG

chatgpt-vim's People

Contributors

0xstabby avatar jclsn avatar

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

Watchers

 avatar  avatar  avatar  avatar  avatar

chatgpt-vim's Issues

Suggestion

Could you add a command or feature to send the correct answer to chatgpt?
I am studying "figures of speech" and chatgpt gives me lots of wrong answers. Then I call the prompt and say: No. It is wrong (...), but the model does not learn it after asking the same question it gives me another wrong guessing answer...
:(

Special characters not being escaped on `system` call

When running the command gpt and on the input prompt the phrase has some special character, for instance ', it breaks the system call of the plugin.

For example:

image

This is caused by how the system call is made here https://github.com/0xStabby/chatgpt-vim/blob/master/plugin/chatgpt.vim#L10

So, we should escape the input string with shellescape, like this:

  let prompt = shellescape(input("Enter chatgpt prompt: "))

as described here: https://github.com/airblade/vim-system-escape/blob/master/README.md

And remove the single quote from system call:
Previous code:

    let output = system("echo '" . prompt . "' | openai complete - -t " . g:openaiToken)

New code:

    let output = system("echo " . prompt . " | openai complete - -t " . g:openaiToken)

So we can perform queries with special characters:

image

PS: Great plugin by the way! :)

Accessing OpenAI API fails

I configured openAI API and it works fine in bash but not using the app:

GptFile returns:

Traceback (most recent call last):
  File "/usr/local/bin/openai", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/openai_cli/cli.py", line 24, in complete
    result = client.generate_response(prompt, model)
  File "/usr/local/lib/python3.10/site-packages/openai_cli/client.py", line 36, in generate_response
    response.raise_for_status()
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.openai.com/v1/completions```

GptRun returns:

```Run with: Make a doctring for DESeq2
Make: *** No rule to make target `a'.  Stop.
Traceback (most recent call last):
  File "/usr/local/bin/openai", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/openai_cli/cli.py", line 24, in complete
    result = client.generate_response(prompt, model)
  File "/usr/local/lib/python3.10/site-packages/openai_cli/client.py", line 36, in generate_response
    response.raise_for_status()
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.openai.com/v1/completions```

change the command names

Could you change the command names to:
gpt
gptFile
gptRun

or
chatGPT
chatGPTfile
chatGPTrun
etc...

The reason is that, it is annoying to uppercase the first letter (g) all the time when using it in (n)vim :(

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.