共计 486 个字符,预计需要花费 2 分钟才能阅读完成。
用 Rust
写了一个免费使用 ChatGPT 的命令行工具
代码在 https://github.com/shenjinti/fgpt 🙏 star
提供了 mac 和 linux 的二进制包. 可以到 github 上自行下载
不得不说,Rust
写 cli 工具还是真的好用,不管是 readline
或者 tokio
和reqwest
都大大减少代码量
功能:
- 完全命令行操作,支持各种管道
- 支持交互模式,能重置会话
- 内置支持代理配置,也可以用全局的
https_proxy
变量 - 支持 OpenAI 的
OpenAPI
模式,无限使用
看看简单用法
fgpt "How to get a domain's MX record on linux shell?"
# Output plain code -c/--code
fgpt -c "Write python code to reverse a string"
# With pipe
git diff | fgpt "Write a git commit bief with follow diff"
# With stdin
fgpt "Convert the follow csv data to json, without any description" < contacts.csv
正文完