nvbn / thefuck

Magnificent app which corrects your previous console command.
MIT License
83.76k stars 3.41k forks source link

Add ChatGPT as a rule, disabled by default. #1363

Open XieGuochao opened 1 year ago

XieGuochao commented 1 year ago

This patch enhances thefuck by querying ChatGPT optionally. The user sets an environment variable THEFUCK_OPENAI_TOKEN from OpenAI to enable it.

Three new arguments are added:

  1. -c or --chatgpt: the number of suggestions from ChatGPT. If it is 0, ChatGPT is disabled.
  2. -t or --chatgpt-token: the maximum tokens for a ChatGPT query. By default, it is 100.
  3. -m or --chatgpt-model: the ChatGPT model used. By default, it is gpt-3.5-turbo.
pannous commented 1 year ago

Fantastic PR

police merch (please merge!)

why not use OPENAI_TOKEN directly / as fallback?

pannous commented 1 year ago

100 token default limits seems pretty low though?

pannous commented 1 year ago

--chatgpt-token should be --chatgpt-max-tokens for clarity

--chatgpt-model can probably be removed since a new model will likely result in a new API

XieGuochao commented 1 year ago

Fantastic PR

police merch (please merge!)

why not use OPENAI_TOKEN directly / as fallback?

I was worrying users accidentally enabled it while one was using other OpenAI services. I am totally fine using OPENAI_TOKEN directly / as fallback.

100 token default limits seems pretty low though?

Great point! I am not a ChatGPT expert and can you suggest a better limit?

--chatgpt-token should be --chatgpt-max-tokens for clarity

Agree!

--chatgpt-model can probably be removed since a new model will likely result in a new API

I don't know if there would be GPT-4.0 or something similar with the same API but more data...

xingjian-zhang commented 1 year ago

This looks so promising to me. Like the idea. 🚀

thibaultmol commented 1 year ago

Status of this PR?