0xacx / chatGPT-shell-cli

Simple shell script to use OpenAI's ChatGPT and DALL-E from the terminal. No Python or JS required.
https://gptshell.cc
MIT License
1.07k stars 152 forks source link

ChatGPT-shell-cli output doesn't register new lines #5

Closed pfr-dev closed 1 year ago

pfr-dev commented 1 year ago

For example, If I input the following into ChatGPT web

write a poem:

Beneath the starry sky so bright, I stand alone in the quiet night. The moon above shines down on me, And in its light, my thoughts run free.

The gentle breeze that stirs the trees, Whispers secrets to the leaves. The crickets' song a symphony, That fills the air with melody.

The world around is hushed and still, As if in awe of nature's thrill. The beauty here is plain to see, And in this moment, I am free.

So let my heart and spirit soar, On wings of wonder evermore. For in this peaceful, quiet place, I find my soul has found its grace.

The same in ChatGPT-shell-cli:

Enter a prompt: write a poem

chatgpt about a treeA tree so tall and greenIt stands so proud and tallIt's leaves so green and freshA sight to behold for allIt's branches reach so highTo the sky, so grand and blueThe trunk so strong and sturdyA sight so old and trueIt's roots so deep and hiddenThe secret to its strengthIt stands through wind and weatherSo tall and vast and lengthA tree so strong and gracefulIt's beauty so sublimeIt stands like a symbolof hope throughout all time

Is it possible for new lines to be used? and what about code blocks?

0xacx commented 1 year ago

Yes, it is possible and done already. You are probably running an older version of the script. If you install the latest version, you will see the response formatting is kept the same as it arrives from openAI's API. You can also include " quotation marks now in the prompt.

0xacx commented 1 year ago

I am closing this issue as it's been addressed already. If you have any questions lmk.

pfr-dev commented 1 year ago

Thank you! works perfectly now.

Also, just an FYI, image previews work on Lnux using the Kitty terminal the following:

   if [[ "$TERM" == "xterm-kitty" ]]; then
     curl -sS $image_url -o temp_image.png
       kitty +kitten icat temp_image.png

Maybe you could bake this in to the script as well?