GithubHelp home page GithubHelp logo

Comments (10)

evilpan avatar evilpan commented on May 18, 2024

Seems that this is caused by rich text, you may try copy and paste as plaintext to see if it solves the problem.

from gptcli.

evilpan avatar evilpan commented on May 18, 2024

I've update the code to add .save command to save conversation to file, by copying the content in the json file you may get the original results. I am also planing to add options to save/load conversation file as text file (markdown), and it would be more friendly for human reading.

from gptcli.

roperi avatar roperi commented on May 18, 2024

Seems that this is caused by rich text, you may try copy and paste as plaintext to see if it solves the problem.

I just tried it and looks fine but still has tons of blank spaces surrounding the code.

Also, paste it as plaintext is not available for some editors. I had to open it in Writer Document in Libre Office to be able to paste it as Unformatted Text (and blank spaces are still everywhere).

The idea of saving it is great though! Thanks, @evilpan . You are not so evil after all ;)

from gptcli.

roperi avatar roperi commented on May 18, 2024

I just git pulled but i don't get how to use .save.

This is what I do:

~/workspace/gptcli$ ./gptcli.py 
Loading config from /home/user/workspace/gptcli/config.json
Response in prompt: True
Stream mode: True
Input: 

I don't see the gptclip> as shown in README . Then in the input prompt I type .save and get back:

I'm sorry, I cannot perform file operations such as saving a file. However, I can still help you with any questions or information you need.

from gptcli.

roperi avatar roperi commented on May 18, 2024

Also tried this:

./gptcli.py .save
usage: gptcli.py [-h] [-c CONFIG]
gptcli.py: error: unrecognized arguments: .save

from gptcli.

evilpan avatar evilpan commented on May 18, 2024

Seems you are not using the latest code, are you sure the git pull command returns successfully?

from gptcli.

roperi avatar roperi commented on May 18, 2024

@evilpan

Sorry, i thought I was git pulling but didn't notice I was getting an error back, so I wasn't really pulling anything.

Anyway, I fixed the error and git pulled your latest commits but now it fails with FileNotFoundError: [Errno 2] No such file or directory /home/user/gptcli/config.json. I see the default config file is config.json in code, but in the repo you have it named as demo_config.json. So it fails when starting it up. So i had to start it with ./gptcli.py -c demo_config.json (which i didn't want to as i wanted to run on defaults without any arg flag).

Now, since i deleted the OpenAi key from the config (so it can it read from the environment) it fails with :

OpenAIError: You didn't provide an API key...

from gptcli.

roperi avatar roperi commented on May 18, 2024

Anyway! I can save the chat!

[
  {
    "role": "user",
    "content": "write a python script that prints 'hello, world!' and the time."
  },
  {
    "role": "assistant",
    "content": "Here's a Python script that prints 'Hello, World!' and the current time:\n\n```python\nimport datetime\n\ncurrent_time = datetime.datetime.now().strftime(\"%Y-%m-%d %H:%M:%S\")\nprint(\"Hello, World!\")\nprint(\"Current Time:\", current_time)\n```\n\nJust copy and paste the code above into a Python file, save it, and run the file to see the output."
  }
]

Now it's a matter of just parsing the json file. I'm gonna ask it to write a python script to parse it and get the python script from it.

Oh wait. :/

from gptcli.

evilpan avatar evilpan commented on May 18, 2024

Hi! Now we can save/load from both JSON and Markdown file, using the following command:

.save [-m {json, md}] file
.load [-m {json, md}] file

And we use the md (markdown) format by default now.

See: 0777a45

from gptcli.

roperi avatar roperi commented on May 18, 2024

Hi! Now we can save/load from both JSON and Markdown file, using the following command:

.save [-m {json, md}] file
.load [-m {json, md}] file

And we use the md (markdown) format by default now.

See: 0777a45

Ah, amazing! Now the tool is super useful. Thanks so much!

from gptcli.

Related Issues (20)

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.