Giter Site home page Giter Site logo

mattvr / shellgpt Goto Github PK

View Code? Open in Web Editor NEW
217.0 217.0 11.0 156 KB

Upgrade your terminal with GPT-4. Ask questions, automate commands, pipe I/O, etc. Made with Deno.

License: MIT License

TypeScript 100.00%
chatgpt cli deno gpt-3 gpt-4 terminal

shellgpt's Issues

API key not detected using Fish shell

Could the key be provided in the config as an alternative? Also, should the check only occur when making a request? As it stands, if the key isn't found, all commands produce an error, including the 'help' and configuration commands.

Can't have line breaks in pasted input

First, I love ShellGPT. I use it a ton. Thank you!

Second, I wish there were a way in the REPL to paste in content, or type in content, which has line breaks. Is there a way to have line breaks in input in the REPL? Perhaps a different key combo (Ctrl+Enter?) could be used to submit a request?

I think it would require replacing prompt with stdin/stdout handling. I've never done much with CLI apps in Deno but if I'm feeling adventurous and have the time I might give it a try myself.

Feature request: Able to log the answers of the gpt commands

One thing that I've been missing with this, is that once I get an answer from the gpt command, and I accidentally close the terminal, I lose the answer to my question. Even if I run the same question again, it might be different from the previous good one.

Would it be possible to add the answer to the history as well? Now gpt --history just lists all the previous questions. The gpt --dump only shows the last answer, but if I'd want to show a specific answer from the history, is that possible? If not, would it be possible to implement, something like gpt --dump <history_entry> -> gpt --dump 2023-09-15_11-37-14?

Now that I look at the history, the entries are in descending order, i.e. the latest entry is on top, which makes me scroll all the way back up in the terminal. This should probably be in ascending order, so the latest question is visible at the bottom of the list.

Thoughts on these?

Higher level refactoring w/ many files

I'm realizing w/ gpt refactoring can happen at a whole new level now? I guess we call it semantic refactoring? The only problem is token limits?

Are there things we could do via an lsp client (language server protocol) which would help w/ token limitations? While allowing larger scale refactoring? ie lsp-mode in emacs might be a good starting point?

Would it make sense to enable discussions on this repo? For dumb questions like this? ;)

Given gpt cannot yet handle unified diffs, perhaps simple search/replace strings could suffice in the meantime? For automated editing/patching of existing codebases?

openai/evals#537

Again, this project rocks !!! Love it!

Error 'gpt-4' does not exist - MacOS

When I set up the program and export my openAI key via the install instructions, I get the following message when trying to use the program:

Failed to parse message TypeError: Failed to parse message:
"{
    "error": {
        "message": "The model: `gpt-4` does not exist",
        "type": "invalid_request_error",
        "param": null,
        "code": "model_not_found"
    }
}
"

TypeError: Cannot read properties of undefined (reading '0')
    at Object.next (https://deno.land/x/[email protected]/lib/ai.ts:179:31)
    at async https://deno.land/x/[email protected]/mod.ts:311:30`

I see the other closed issue and used the install line from there via deno, but issue persists.
Using MacOS and installed deno via brew

Error when installing

$ deno install -frA -n gpt https://deno.land/x/shellgpt/mod.ts
Would you like to run the above command to complete ShellGPT installation?
(y)es [default]
(n)o
leave blank to use default

y

error: Uncaught (in promise) NotFound: program not found
const command = Deno.run({
^
at opRun (ext:runtime/40_process.js:50:14)
at Object.run (ext:runtime/40_process.js:136:15)
at install (https://deno.land/x/[email protected]/lib/update.ts:146:24)
at https://deno.land/x/[email protected]/install.ts:61:22
at eventLoopTick (ext:core/01_core.js:183:11)

Keep getting an error even when changing the model to gpt-3.5-turbo

Even after changing the model to gpt-3.5-turbo using gpt --config. I am using MacOS 13.3.1

I keep getting this error:

Failed to parse message TypeError: Failed to parse message:
"{
    "error": {
        "message": "The model: `gpt-4` does not exist",
        "type": "invalid_request_error",
        "param": null,
        "code": "model_not_found"
    }
}
"

After updating to latest 0.3.8, gpt command doesn't return any response

I upgraded ShellGPT to the latest version just now, and now when running gpt "<anything here>" I just get an empty response. gpt "tell me a joke" just, nothing. I also uninstalled and re-installed, as well as made sure deno is at latest version. Any guidelines to perhaps get some logs to debug the issue?

Request: be able to paste long pieces of text in repl mode

I wanted to paste 394 lines of text, mostly code and then a prompt at the end (like the snippet below)

But when I tried pasting the text, gpt cut it off pretty early, then got stuck in a loop of getting pieces of the text and then giving a really long answer, then it even stopped responding to CTRL+C (^C), so I had to kill the process, but then the text kept pasting and executing in bash, so I had to kill the terminal ๐Ÿ˜…๐Ÿคฃ (You can see the whole thing at 20:17 here: https://www.loom.com/share/cab4f33752b44e5f8b77d30a0299d69e?t=1217)

Anyway, it would be cool to be able to paste large prompts ๐Ÿ™๐Ÿผ

I understand that maybe I could store the whole thing in a file and pipe it in without the repl option, but then I would lose the history/context, which is helpful in my coding interactions with chatgpt

# 300+ lines of code

The above is a python3 and ncurses application. And it needs tests. Write a test for the Add/Edit resume feature.
Provide python3 code, a description of the test, the path of the file where to save the test, instructions on how to run it.
No yapping please

System already had the same command?

Sorry for asking.
I'm using Mac and seem it already have the same "gpt" command in the system:

 gpt โ€“ GUID partition table maintenance utility

Is that possible to allow users can rename the default command name?

Install script, `--repl` issues on Windows

Deno.run has been deprecated and replaced with Deno.command. See https://deno.land/[email protected]?s=Deno.Command

I did try fixing it in a fork, but when I checked the current code out it would give me this error message even before I changed any code:

(No message passed)

{
  "error": {
    "message": "[] is too short - 'messages'",
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}

Failed to parse message TypeError: Cannot read properties of undefined (reading '0')
    at Object.next (file:///C:/Users/paul/Downloads/shellgpt/ShellGPT/lib/ai.ts:150:31)
    at eventLoopTick (ext:core/01_core.js:183:11)
    at async file:///C:/Users/paul/Downloads/shellgpt/ShellGPT/mod.ts:537:34

gpt --config keeps prompting to update to newer version, even after updating

I did a fresh install of gpt following the directions from the README:

brew install deo
deno run -rA https://deno.land/x/shellgpt/install.ts

This message is kind of strange, not sure what the warning means

Warning Implicitly using latest version (0.3.6) for https://deno.land/x/shellgpt/install.ts
ShellGPT 0.3.5 installer

Newer version of ShellGPT is available: 0.3.5 -> 0.3.6

Please run the following command instead to update:
deno run -A https://deno.land/x/shellgpt/install.ts

Type 'skip' to continue with the installation of an outdated version.

Not clear what the right answer to the question at the end is, but it only installs if I type skip. Also the suggested command to update is the same as the one that I ran

After skipping, it installed

Skipping update...

What command should be used to invoke gpt?
(default: gpt, leave blank to use default)
> gpt

Would you like ShellGPT to check for updates?
Options:
(y)es - ask before installing [default]
(a)uto-update - install updates automatically without asking
(never) - never install or ask
leave blank to use default
> y

$ deno install -frA -n gpt https://deno.land/x/shellgpt/mod.ts
Would you like to run the above command to complete ShellGPT installation?
(y)es [default]
(n)o
leave blank to use default
> y

And now there was another warning about using the latest version

Warning Implicitly using latest version (0.3.6) for https://deno.land/x/shellgpt/mod.ts
โœ… Successfully installed gpt
/Users/nico/.deno/bin/gpt
โ„น๏ธ  Add /Users/nico/.deno/bin to PATH
    export PATH="/Users/nico/.deno/bin:$PATH"


Configure and update via:
$ gpt --config

But when running the command (gpt --config), it would always give this same output:

gpt --config
Newer version of ShellGPT is available: 0.3.5 -> 0.3.6

$ deno install -frA -n gpt https://deno.land/x/[email protected]/mod.ts
Would you like to install the latest version of ShellGPT?
(Y)es / (n)o / (never) / (a)lways]: y
โœ… Successfully installed gpt
/Users/nico/.deno/bin/gpt

# command for zsh-completions
autoload -U compinit && compinit

> Successfully updated! Please re-run `gpt --config`

ShellGPT seems to work, but I'm not sure which version I'm running or if the updates will work

gpt --repl
(No message passed)



> hello there
Hello! How can I assist you today?

>

Made a video where I go through the process, it's at 4:25 aprox here: https://www.loom.com/share/7f415a53cb404cb0a059a9a065addce8

Add local model

Please add an option to API into local OpenAI compatible API server (llama.cpp.python[server] for example)

Handle insufficient_quota error

If your OPENAI_API_KEY exceeds the quota, you'll only get an empty response from gpt.
The actual response from openai:

{
    "error": {
        "message": "You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.",
        "type": "insufficient_quota",
        "param": null,
        "code": "insufficient_quota"
    }
}

This error should be handled, and a message should be shown to the user that their quota has been exceeded. lib/ai.ts:258 is where the result is decoded into this message.

Request: way to pass an image

Amazing tool!

It would be great to be able to use this like chatgpt, but from the console, using a chat-style interface that maintains context

Also, would love a way to pass images. I regularly take screenshots and then paste them into chatgpt to prompt it for something related to the image

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.