TheR1D / shell_gpt

A command-line productivity tool powered by AI large language models like GPT-4, will help you accomplish your tasks faster and more efficiently.
MIT License
9.28k stars 724 forks source link

Bug report? and param --version request #251

Closed sur1v closed 1 year ago

sur1v commented 1 year ago

I've been using it lately and is very cool, thanks for sharing it.

I have implemented locally using my own build docker image, from latest version (0.9.1), directly from source. This is my .profile:

alias sgpt="docker run --rm --env OPENAI_API_KEY --volume gpt-cache:/tmp/shell_gpt shellgpt"
export OPENAI_API_KEY="changeme"

It seems to work properly:

$ sgpt "tell me rainbow colors as if you were under daltonism"
Sure, as someone with daltonism, I see the colors of the rainbow differently than someone without it. The colors I see are red, greenish-yellow, green, blue, purple, and pinkish-orange.

However when I pipe an action like a diff for a commit message, it fails:

$ git diff
diff --git a/Dockerfile b/Dockerfile
index 8ba8544..efdd667 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,13 +1,25 @@
-FROM python:3-alpine
+FROM python:3.9-slim
...
$ git diff | sgpt "Generate git commit message, for my changes"
Sure, what are the changes you made?

I guess is not piping the diff into the container? How can we fix this?

Also, would be great to have a --version param to be sure what version I'm using. Thanks again!

TheR1D commented 1 year ago

Although I'm not aware of a straightforward method to pipe data into a container, it's still possible to use arguments. Here's an example:

sgpt "Generate a git commit message for my changes: $(git diff)"